Schichtenplan-Funktion
parent
46e5f29a0f
commit
1741131f7b
|
@ -0,0 +1,48 @@
|
|||
package com.cafe.schichtenPlan;
|
||||
|
||||
import jakarta.servlet.ServletException;
|
||||
import java.sql.*;
|
||||
import jakarta.servlet.annotation.WebServlet;
|
||||
import jakarta.servlet.http.HttpServlet;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
|
||||
@WebServlet("/AustragenSchichtServlet")
|
||||
public class AustragenSchichtServlet extends HttpServlet {
|
||||
private static final String DB_URL = "jdbc:sqlite:C:/Users/asus/personal.db";
|
||||
|
||||
@Override
|
||||
protected void doPost(HttpServletRequest request, HttpServletResponse response)
|
||||
throws IOException {
|
||||
String schichtId = request.getParameter("schicht");
|
||||
String position = request.getParameter("position");
|
||||
|
||||
// Überprüfe die Position
|
||||
if (position == null || (!position.equals("1") && !position.equals("2"))) {
|
||||
response.sendError(HttpServletResponse.SC_BAD_REQUEST, "Ungültige Position.");
|
||||
return;
|
||||
}
|
||||
|
||||
String query = position.equals("1")
|
||||
? "UPDATE Schichten SET mitarbeiter1 = NULL WHERE id = ?"
|
||||
: "UPDATE Schichten SET mitarbeiter2 = NULL WHERE id = ?";
|
||||
|
||||
try (Connection conn = DriverManager.getConnection(DB_URL);
|
||||
PreparedStatement updateStmt = conn.prepareStatement(query)) {
|
||||
|
||||
updateStmt.setInt(1, Integer.parseInt(schichtId));
|
||||
int rowsAffected = updateStmt.executeUpdate();
|
||||
|
||||
if (rowsAffected > 0) {
|
||||
System.out.println("Mitarbeiter erfolgreich ausgetragen aus Position: " + position);
|
||||
} else {
|
||||
System.out.println("Keine Änderungen vorgenommen. Position war bereits leer.");
|
||||
response.sendError(HttpServletResponse.SC_BAD_REQUEST, "Die ausgewählte Position ist bereits leer.");
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Datenbankfehler: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
package com.cafe.schichtenPlan;
|
||||
|
||||
import jakarta.servlet.ServletException;
|
||||
import java.sql.*;
|
||||
import jakarta.servlet.annotation.WebServlet;
|
||||
import jakarta.servlet.http.HttpServlet;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
|
||||
@WebServlet("/EintragenSchichtServlet")
|
||||
public class EintragenSchichtServlet extends HttpServlet {
|
||||
private static final String DB_URL = "jdbc:sqlite:C:/Users/asus/personal.db";
|
||||
|
||||
@Override
|
||||
protected void doPost(HttpServletRequest request, HttpServletResponse response)
|
||||
throws IOException {
|
||||
String schichtId = request.getParameter("schicht"); // Automatisch übergeben
|
||||
String username = request.getParameter("username"); // Nur der Name des Mitarbeiters
|
||||
|
||||
// Überprüfe, ob die Eingaben gültig sind
|
||||
if (schichtId == null || username == null || schichtId.isEmpty() || username.isEmpty()) {
|
||||
response.sendError(HttpServletResponse.SC_BAD_REQUEST, "Ungültige Eingabe.");
|
||||
return;
|
||||
}
|
||||
|
||||
try (Connection conn = DriverManager.getConnection(DB_URL)) {
|
||||
|
||||
|
||||
// Überprüfe, ob die Schicht bereits voll ist
|
||||
String query = "SELECT mitarbeiter1, mitarbeiter2 FROM Schichten WHERE id = ?";
|
||||
try (PreparedStatement stmt = conn.prepareStatement(query)) {
|
||||
stmt.setInt(1, Integer.parseInt(schichtId));
|
||||
ResultSet rs = stmt.executeQuery();
|
||||
|
||||
if (rs.next()) {
|
||||
String mitarbeiter1 = rs.getString("mitarbeiter1");
|
||||
String mitarbeiter2 = rs.getString("mitarbeiter2");
|
||||
|
||||
if (mitarbeiter1 == null) {
|
||||
query = "UPDATE Schichten SET mitarbeiter1 = ? WHERE id = ?";
|
||||
} else if (mitarbeiter2 == null) {
|
||||
query = "UPDATE Schichten SET mitarbeiter2 = ? WHERE id = ?";
|
||||
} else {
|
||||
response.sendError(HttpServletResponse.SC_BAD_REQUEST, "Schicht ist bereits voll.");
|
||||
return;
|
||||
}
|
||||
|
||||
try (PreparedStatement updateStmt = conn.prepareStatement(query)) {
|
||||
updateStmt.setString(1, username); // Nur der Name wird eingefügt
|
||||
updateStmt.setInt(2, Integer.parseInt(schichtId));
|
||||
updateStmt.executeUpdate();
|
||||
System.out.println("Mitarbeiter erfolgreich eingetragen: " + username);
|
||||
}
|
||||
} else {
|
||||
response.sendError(HttpServletResponse.SC_BAD_REQUEST, "Schicht-ID nicht gefunden.");
|
||||
}
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Datenbankfehler: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
package com.cafe.schichtenPlan;
|
||||
|
||||
import jakarta.servlet.ServletException;
|
||||
import jakarta.servlet.annotation.WebServlet;
|
||||
import jakarta.servlet.http.HttpServlet;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.sql.*;
|
||||
|
||||
@WebServlet("/SchichtenDatenServlet")
|
||||
public class SchichtenDatenServlet extends HttpServlet {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final String DB_URL = "jdbc:sqlite:C:/Users/asus/personal.db";
|
||||
|
||||
@Override
|
||||
protected void doGet(HttpServletRequest request, HttpServletResponse response)
|
||||
throws IOException {
|
||||
response.setContentType("text/plain;charset=UTF-8");
|
||||
|
||||
try (PrintWriter out = response.getWriter()) {
|
||||
try {
|
||||
Class.forName("org.sqlite.JDBC");
|
||||
} catch (ClassNotFoundException ex) {
|
||||
ex.printStackTrace();
|
||||
out.println("<p>Error: SQLite JDBC Driver not found.</p>");
|
||||
return;
|
||||
}
|
||||
|
||||
String query = "SELECT * FROM Schichten ORDER BY id";
|
||||
|
||||
try (Connection conn = DriverManager.getConnection(DB_URL);
|
||||
PreparedStatement stmt = conn.prepareStatement(query)) {
|
||||
|
||||
ResultSet rs = stmt.executeQuery();
|
||||
|
||||
StringBuilder csvOutput = new StringBuilder();
|
||||
|
||||
// Spaltenüberschriften hinzufügen (optional)
|
||||
csvOutput.append("id,datum,tag,zeitraum,mitarbeiter1,mitarbeiter2\n");
|
||||
|
||||
while (rs.next()) {
|
||||
csvOutput.append(rs.getInt("id")).append(",")
|
||||
.append(rs.getString("datum")).append(",")
|
||||
.append(rs.getString("tag")).append(",")
|
||||
.append(rs.getString("zeitraum")).append(",")
|
||||
.append(rs.getString("mitarbeiter1") != null ? rs.getString("mitarbeiter1") : "").append(",")
|
||||
.append(rs.getString("mitarbeiter2") != null ? rs.getString("mitarbeiter2") : "").append("\n");
|
||||
}
|
||||
|
||||
response.getWriter().print(csvOutput.toString());
|
||||
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -46,4 +46,28 @@
|
|||
<servlet-mapping>
|
||||
<servlet-name>snacksServlet</servlet-name>
|
||||
<url-pattern>/snacksServlet</url-pattern>
|
||||
</servlet-mapping>
|
||||
<servlet>
|
||||
<servlet-name>AustragenSchichtServlet</servlet-name>
|
||||
<servlet-class>com.cafe.schichtenPlan</servlet-class>
|
||||
</servlet>
|
||||
<servlet-mapping>
|
||||
<servlet-name>AustragenSchichtServlet</servlet-name>
|
||||
<url-pattern>/AustragenSchichtServlet</url-pattern>
|
||||
</servlet-mapping>
|
||||
<servlet>
|
||||
<servlet-name>EintragenSchichtServlet</servlet-name>
|
||||
<servlet-class>com.cafe.schichtenPlan</servlet-class>
|
||||
</servlet>
|
||||
<servlet-mapping>
|
||||
<servlet-name>EintragenSchichtServlet</servlet-name>
|
||||
<url-pattern>/EintragenSchichtServlet</url-pattern>
|
||||
</servlet-mapping>
|
||||
<servlet>
|
||||
<servlet-name>SchichtenDatenServlet</servlet-name>
|
||||
<servlet-class>com.cafe.schichtenPlan</servlet-class>
|
||||
</servlet>
|
||||
<servlet-mapping>
|
||||
<servlet-name>SchichtenDatenServlet</servlet-name>
|
||||
<url-pattern>/SchichtenDatenServlet</url-pattern>
|
||||
</servlet-mapping></web-app>
|
|
@ -55,9 +55,8 @@
|
|||
Hier kannst du alles verwalten, was dein Lokal so besonders macht.<br>
|
||||
In der vertrauten und professionellen Umgebung<br>
|
||||
hast du die Kontrolle über alle Abläufe.<br>
|
||||
<strong>Organisiere Veranstaltungen,<br>pflege Speise- und Getränkekarten,<br>
|
||||
und behalte den Überblick über deine Buchungen<br>
|
||||
und die Performance deines Cafés.</strong><br>
|
||||
<strong>Pflege die Speise- und Getränkekarte, verwalte deine Mitarbeiter<br>
|
||||
und behalte den Überblick über die Schichtpläne.</strong><br>
|
||||
Falls du Unterstützung brauchst, steht dir unser Support-Team jederzeit zur Verfügung.<br>
|
||||
Wir freuen uns, dich auf dem Weg zum Erfolg begleiten zu dürfen.<br>
|
||||
<em>Dein EJSS Palast Admin-Team</em>
|
||||
|
|
|
@ -0,0 +1,154 @@
|
|||
let currentSchichtId = null; // Variable zum Speichern der aktuellen Schicht-ID
|
||||
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
loadSchichten();
|
||||
});
|
||||
|
||||
// Lädt die Schichtdaten und zeigt sie in der Tabelle an
|
||||
function loadSchichten() {
|
||||
fetch("/Projekt_SE2/SchichtenDatenServlet")
|
||||
.then(response => response.text())
|
||||
.then(csv => {
|
||||
const rows = csv.trim().split("\n").slice(1); // Zeilen außer der Kopfzeile
|
||||
const tbody = document.querySelector("#schichtenTabelle tbody");
|
||||
tbody.innerHTML = "";
|
||||
|
||||
rows.forEach(row => {
|
||||
const columns = row.split(",");
|
||||
const tr = document.createElement("tr");
|
||||
tr.innerHTML = `
|
||||
<td>${columns[1]}</td> <!-- datum -->
|
||||
<td>${columns[2]}</td> <!-- tag -->
|
||||
<td>${columns[3]}</td> <!-- zeitraum -->
|
||||
<td>${columns[4] || "Frei"}</td> <!-- mitarbeiter1 -->
|
||||
<td>${columns[5] || "Frei"}</td> <!-- mitarbeiter2 -->
|
||||
<td>
|
||||
<button onclick="showEintragenPopup(${columns[0]})">Eintragen</button> <!-- Schicht-ID -->
|
||||
<button onclick="austragenSchicht(${columns[0]})">Austragen</button>
|
||||
</td>
|
||||
`;
|
||||
tbody.appendChild(tr);
|
||||
});
|
||||
})
|
||||
.catch(error => showPopup("Fehler beim Laden der Schichten: " + error.message));
|
||||
}
|
||||
|
||||
// Zeigt das Popup-Fenster zur Namenseingabe an
|
||||
function showEintragenPopup(schichtId) {
|
||||
currentSchichtId = schichtId; // Speichere die Schicht-ID
|
||||
const popupOverlay = document.getElementById("popupOverlay");
|
||||
const popupMessage = document.getElementById("popupMessage");
|
||||
const popupInputSection = document.getElementById("popupInputSection");
|
||||
const popupCloseButton = document.getElementById("popupCloseButton");
|
||||
|
||||
popupMessage.textContent = "Bitte gib deinen Namen ein:";
|
||||
popupInputSection.style.display = "block"; // Zeige das Eingabefeld
|
||||
popupCloseButton.style.display = "none"; // Verberge die Schließen-Schaltfläche
|
||||
popupOverlay.style.display = "flex";
|
||||
}
|
||||
|
||||
// Bestätigt die Eintragung und sendet die Daten an den Server
|
||||
function confirmEintragen() {
|
||||
const username = document.getElementById("popupInput").value;
|
||||
|
||||
if (username) {
|
||||
fetch(`/Projekt_SE2/EintragenSchichtServlet`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/x-www-form-urlencoded"
|
||||
},
|
||||
body: `schicht=${currentSchichtId}&username=${encodeURIComponent(username)}`
|
||||
})
|
||||
.then(response => {
|
||||
if (!response.ok) {
|
||||
return response.text().then(text => { throw new Error(text); });
|
||||
}
|
||||
showPopup("Erfolgreich eingetragen!"); // Zeige Erfolgsmeldung
|
||||
loadSchichten(); // Tabelle neu laden
|
||||
})
|
||||
.catch(error => {
|
||||
if (error.message.includes("Schicht ist bereits voll")) {
|
||||
showPopup("Diese Schicht ist bereits voll. Wählen Sie eine andere Schicht!");
|
||||
} else {
|
||||
showPopup("Fehler beim Eintragen: " + error.message);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
showPopup("Bitte gib einen gültigen Namen ein."); // Warnung bei leerem Namen
|
||||
}
|
||||
}
|
||||
|
||||
// Mitarbeiter aus einer Schicht austragen
|
||||
let selectedSchichtId = null;
|
||||
|
||||
function austragenSchicht(schichtId) {
|
||||
selectedSchichtId = schichtId; // Speichere die Schicht-ID
|
||||
const positionPopupOverlay = document.getElementById("positionPopupOverlay");
|
||||
positionPopupOverlay.style.display = "flex"; // Zeige das Popup an
|
||||
}
|
||||
|
||||
// Wird aufgerufen, wenn der Benutzer die Position bestätigt
|
||||
function submitAustragen() {
|
||||
const form = document.getElementById("positionForm");
|
||||
const formData = new FormData(form);
|
||||
const mitarbeiterPosition = formData.get("position"); // Hole die ausgewählte Position
|
||||
|
||||
fetch(`/Projekt_SE2/AustragenSchichtServlet`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/x-www-form-urlencoded"
|
||||
},
|
||||
body: `schicht=${selectedSchichtId}&position=${mitarbeiterPosition}` // Schicht-ID und Position übergeben
|
||||
})
|
||||
.then(response => {
|
||||
if (!response.ok) {
|
||||
return response.text().then(text => { throw new Error(text); });
|
||||
}
|
||||
showPopup("Erfolgreich ausgetragen!");
|
||||
loadSchichten(); // Tabelle neu laden
|
||||
})
|
||||
.catch(error => showPopup("Fehler beim Austragen: " + error.message))
|
||||
.finally(() => closePositionPopup()); // Schließe das Popup in jedem Fall
|
||||
}
|
||||
|
||||
// Schließt das Austragen-Popup
|
||||
function closePositionPopup() {
|
||||
const positionPopupOverlay = document.getElementById("positionPopupOverlay");
|
||||
positionPopupOverlay.style.display = "none";
|
||||
selectedSchichtId = null; // Zurücksetzen der Schicht-ID
|
||||
}
|
||||
function closeEintragenPopup() {
|
||||
const positionPopupOverlay = document.getElementById("popupOverlay");
|
||||
const popupInput = document.getElementById("popupInput");
|
||||
|
||||
// Popup ausblenden
|
||||
positionPopupOverlay.style.display = "none";
|
||||
|
||||
// Eingabefeld leeren
|
||||
if (popupInput) {
|
||||
popupInput.value = "";
|
||||
}
|
||||
|
||||
// Zurücksetzen der Schicht-ID
|
||||
selectedSchichtId = null;
|
||||
}
|
||||
|
||||
// Zeigt das Popup-Fenster an
|
||||
function showPopup(message) {
|
||||
const popupOverlay = document.getElementById("popupOverlay");
|
||||
const popupMessage = document.getElementById("popupMessage");
|
||||
const popupInputSection = document.getElementById("popupInputSection");
|
||||
const popupCloseButton = document.getElementById("popupCloseButton");
|
||||
|
||||
popupMessage.textContent = message;
|
||||
popupInputSection.style.display = "none"; // Verberge das Eingabefeld
|
||||
popupCloseButton.style.display = "inline-block"; // Zeige die Schließen-Schaltfläche
|
||||
popupOverlay.style.display = "flex";
|
||||
}
|
||||
|
||||
// Schließt das Popup-Fenster
|
||||
function closePopup() {
|
||||
const popupOverlay = document.getElementById("popupOverlay");
|
||||
document.getElementById("popupInput").value = ""; // Eingabefeld zurücksetzen
|
||||
popupOverlay.style.display = "none";
|
||||
}
|
|
@ -49,16 +49,67 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Popup-Fenster Schichten -->
|
||||
<div id="popupOverlay">
|
||||
<div id="popupContent">
|
||||
<h3 id="popupMessage">Nachricht</h3>
|
||||
<div id="popupInputSection" style="display: none;">
|
||||
<label for="popupInput">Dein Name:</label>
|
||||
<input type="text" id="popupInput" placeholder="Name eingeben" /><br><br>
|
||||
<button id="popupConfirmButton" onclick="confirmEintragen()">Eintragen</button>
|
||||
<button type="button" onclick="closeEintragenPopup()">Abbrechen</button>
|
||||
</div>
|
||||
<button id="popupCloseButton" onclick="closePopup()">OK</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Popup-Fenster für Austragen -->
|
||||
<div id="positionPopupOverlay">
|
||||
<div id="positionPopupContent">
|
||||
<h3>Wähle den Mitarbeiter zum Austragen</h3>
|
||||
<form id="positionForm">
|
||||
<label>
|
||||
<input type="radio" name="position" value="1" checked> Mitarbeiter 1
|
||||
</label><br>
|
||||
<label>
|
||||
<input type="radio" name="position" value="2"> Mitarbeiter 2
|
||||
</label><br><br>
|
||||
<button type="button" onclick="submitAustragen()">Bestätigen</button>
|
||||
<button type="button" onclick="closePositionPopup()">Abbrechen</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="willkommenstext">
|
||||
<p>
|
||||
<span class="einleitung">Willkommen zum Schichtenplan<br>vom EJSS Palast</span><br>
|
||||
<strong>Hier kannst du alle Schichten von deinen Mitarbeiter einsehen.</strong><br>
|
||||
<strong>Hier kannst du alle Schichten von deinen Mitarbeiter einsehen,<br>
|
||||
Mitarbeiter in die Schichten eintragen oder bei Bedarf austragen.</strong><br>
|
||||
Falls du Unterstützung brauchst, steht dir unser Support-Team jederzeit zur Verfügung.<br>
|
||||
Wir freuen uns, dich auf dem Weg zum Erfolg begleiten zu dürfen.<br>
|
||||
<strong>Achtung: Der erste Eintrag entspricht Mitarbeiter 1 und der zweite Eintrag Mitarbeiter 2.</strong><br>
|
||||
<em>Dein EJSS Palast Admin-Team</em>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<h2>Schichtenübersicht</h2>
|
||||
<table id="schichtenTabelle">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Datum</th>
|
||||
<th>Tag</th>
|
||||
<th>Zeitraum</th>
|
||||
<th>Mitarbeiter 1 (12:00 - 17:00)</th>
|
||||
<th>Mitarbeiter 2 (17:00 - Ende)</th>
|
||||
<th>Aktionen</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<!-- Dynamische Inhalte -->
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</main>
|
||||
<a href="#Anfang"><h4>Zurück zum Anfang</h4></a>
|
||||
<footer>
|
||||
|
@ -75,6 +126,7 @@
|
|||
</div>
|
||||
</footer>
|
||||
|
||||
<script src="/Projekt_SE2/chefFunktionen/schichtenChefScript.js"></script>
|
||||
<script src="/Projekt_SE2/chefFunktionen/chefScript.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -29,8 +29,7 @@
|
|||
<ul>
|
||||
<li><a href="/Projekt_SE2/mitarbeiter.jsp" class="aktiv"><i class="fa-solid fa-house"></i> Startseite</a></li>
|
||||
<li><a href="/Projekt_SE2/mitarbeiterFunktionen/schichtenPlanMitarbeiter.jsp"><i class="fa-solid fa-calendar-days"></i> Schichtenplan</a></li>
|
||||
<li><a href="/Projekt_SE2/mitarbeiterFunktionen/datenMitarbeiter.jsp"><i class="fa-solid fa-user"></i> Persönliche Daten</a></li>
|
||||
<li><a href="#" onclick="openLogoutPopup()"><i class="fa-solid fa-right-to-bracket"></i> Abmelden</a></li>
|
||||
<li><a href="#" onclick="openLogoutPopup()"><i class="fa-solid fa-right-to-bracket"></i> Abmelden</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
|
@ -49,8 +48,7 @@
|
|||
</div>
|
||||
<div class="willkommenstext">
|
||||
<p> <span class="einleitung">Willkommen im Mitarbeiterbereich<br>vom EJSS Palast</span><br>
|
||||
Du bist eingeloggt als: ... <br>
|
||||
<strong>Plane deine Schichten,<br>und behalte den Überblick über deine persönliche Daten</strong><br>
|
||||
<strong>Plane deine Schichten,<br>und behalte den Überblick über deine Arbeitszeiten</strong><br>
|
||||
Deine Arbeit macht den Unterschied und trägt dazu bei, unseren Gästen unvergessliche Momente zu bereiten.<br>
|
||||
Solltest du Unterstützung benötigen, steht dir unser Team jederzeit zur Seite.<br>
|
||||
<em>Vielen Dank für deinen Einsatz!<br>
|
||||
|
|
|
@ -1,77 +0,0 @@
|
|||
<%@ page language="java" contentType="text/html; charset=UTF-8"
|
||||
pageEncoding="UTF-8"%>
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>EJSS Palast - Pers. Daten</title>
|
||||
<link rel="icon" href="/Projekt_SE2/Bilder/EJS_Palast_logo.jpg" type="image/x-icon" />
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.1/css/all.min.css"/>
|
||||
<link rel="stylesheet" href="/Projekt_SE2/styles.css" />
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com">
|
||||
<link href="https://fonts.googleapis.com/css2?family=Playwrite+GB+S:ital,wght@0,100..400;1,100..400&display=swap"
|
||||
rel="stylesheet">
|
||||
<link
|
||||
href="https://fonts.googleapis.com/css2?family=Gowun+Dodum&family=Playwrite+GB+S:ital,wght@0,100..400;1,100..400&display=swap"
|
||||
rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
<header id="Anfang">
|
||||
<img src="/Projekt_SE2/Bilder/EJS_Palast_logo.jpg" alt="EJS Logo" class="logoOben">
|
||||
<h1>EJSS Palast - Mitarbeiter</h1>
|
||||
</header>
|
||||
<nav>
|
||||
<span class="menu-icon" onclick="toggleMenu()">☰ Menu</span>
|
||||
<div class="navigation">
|
||||
<ul>
|
||||
<li><a href="/Projekt_SE2/mitarbeiter.jsp"><i class="fa-solid fa-house"></i> Startseite</a></li>
|
||||
<li><a href="/Projekt_SE2/mitarbeiterFunktionen/schichtenPlanMitarbeiter.jsp"><i class="fa-solid fa-calendar-days"></i> Schichtenplan</a></li>
|
||||
<li><a href="/Projekt_SE2/mitarbeiterFunktionen/datenMitarbeiter.jsp" class="aktiv"><i class="fa-solid fa-user"></i> Persönliche Daten</a></li>
|
||||
<li><a href="#" onclick="openLogoutPopup()"><i class="fa-solid fa-right-to-bracket"></i> Abmelden</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
<main>
|
||||
|
||||
<!-- Popup-HTML -->
|
||||
<div id="logoutPopup" class="popup">
|
||||
<div class="popup-content">
|
||||
<h3>Abmelden</h3>
|
||||
<p>Möchten Sie sich wirklich abmelden?</p><br>
|
||||
<div class="popup-actions">
|
||||
<button onclick="confirmLogout()">Ja</button><br><hr>
|
||||
<button onclick="closeLogoutPopup()">Nein</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="willkommenstext">
|
||||
<p> <span class="einleitung">Willkommen zum Persönlichem-Bereich<br>vom EJSS Palast</span><br>
|
||||
Du bist eingeloggt als: ....<br>
|
||||
<strong>Hier kannst du deine persönliche Daten einsehen und verwalten.</strong><br>
|
||||
<em>Vielen Dank für deinen Einsatz!<br>
|
||||
Dein EJSS Palast Team</em>
|
||||
</p>
|
||||
</div>
|
||||
</main>
|
||||
<a href="#Anfang"><h4>Zurück zum Anfang</h4></a>
|
||||
<footer>
|
||||
<img src="/Projekt_SE2/Bilder/EJS_Palast_logo.jpg" alt="EJS Logo" class="logo">
|
||||
<p>
|
||||
<small>Anschrift:<br>
|
||||
Musterstrasse 10<br>
|
||||
68163 Mannheim</small>
|
||||
</p>
|
||||
<div class="socials">
|
||||
<a href="https://www.facebook.com" target="_blank"><i class="fa-brands fa-facebook"></i></a>
|
||||
<a href="https://www.instagram.com" target="_blank"><i class="fa-brands fa-instagram"></i></a>
|
||||
<a href="tel:004962012345678" class="call-icon"><i class="fa-solid fa-phone"></i></a>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<script src="/Projekt_SE2/mitarbeiterFunktionen/mitarbeiterScript.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
// Öffnet das Logout-Popup
|
||||
function openLogoutPopup() {
|
||||
const popup = document.getElementById("logoutPopup");
|
||||
|
@ -17,4 +18,4 @@ function closeLogoutPopup() {
|
|||
// Bestätigt die Abmeldung und leitet zur Startseite weiter
|
||||
function confirmLogout() {
|
||||
window.location.href = "/Projekt_SE2/startseite.jsp"; // Weiterleitung zur Startseite
|
||||
}
|
||||
}
|
|
@ -0,0 +1,114 @@
|
|||
let currentSchichtId = null; // Variable zum Speichern der aktuellen Schicht-ID
|
||||
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
loadSchichten();
|
||||
});
|
||||
|
||||
// Lädt die Schichtdaten und zeigt sie in der Tabelle an
|
||||
function loadSchichten() {
|
||||
fetch("/Projekt_SE2/SchichtenDatenServlet")
|
||||
.then(response => response.text())
|
||||
.then(csv => {
|
||||
const rows = csv.trim().split("\n").slice(1); // Zeilen außer der Kopfzeile
|
||||
const tbody = document.querySelector("#schichtenTabelle tbody");
|
||||
tbody.innerHTML = "";
|
||||
|
||||
rows.forEach(row => {
|
||||
const columns = row.split(",");
|
||||
const tr = document.createElement("tr");
|
||||
tr.innerHTML = `
|
||||
<td>${columns[1]}</td> <!-- datum -->
|
||||
<td>${columns[2]}</td> <!-- tag -->
|
||||
<td>${columns[3]}</td> <!-- zeitraum -->
|
||||
<td>${columns[4] || "Frei"}</td> <!-- mitarbeiter1 -->
|
||||
<td>${columns[5] || "Frei"}</td> <!-- mitarbeiter2 -->
|
||||
<td>
|
||||
<button onclick="showEintragenPopup(${columns[0]})">Eintragen</button> <!-- Schicht-ID -->
|
||||
</td>
|
||||
`;
|
||||
tbody.appendChild(tr);
|
||||
});
|
||||
})
|
||||
.catch(error => showPopup("Fehler beim Laden der Schichten: " + error.message));
|
||||
}
|
||||
|
||||
// Zeigt das Popup-Fenster zur Namenseingabe an
|
||||
function showEintragenPopup(schichtId) {
|
||||
currentSchichtId = schichtId; // Speichere die Schicht-ID
|
||||
const popupOverlay = document.getElementById("popupOverlay");
|
||||
const popupMessage = document.getElementById("popupMessage");
|
||||
const popupInputSection = document.getElementById("popupInputSection");
|
||||
const popupCloseButton = document.getElementById("popupCloseButton");
|
||||
|
||||
popupMessage.textContent = "Bitte gib deinen Namen ein:";
|
||||
popupInputSection.style.display = "block"; // Zeige das Eingabefeld
|
||||
popupCloseButton.style.display = "none"; // Verberge die Schließen-Schaltfläche
|
||||
popupOverlay.style.display = "flex";
|
||||
}
|
||||
|
||||
// Bestätigt die Eintragung und sendet die Daten an den Server
|
||||
function confirmEintragen() {
|
||||
const username = document.getElementById("popupInput").value;
|
||||
|
||||
if (username) {
|
||||
fetch(`/Projekt_SE2/EintragenSchichtServlet`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/x-www-form-urlencoded"
|
||||
},
|
||||
body: `schicht=${currentSchichtId}&username=${encodeURIComponent(username)}`
|
||||
})
|
||||
.then(response => {
|
||||
if (!response.ok) {
|
||||
return response.text().then(text => { throw new Error(text); });
|
||||
}
|
||||
showPopup("Erfolgreich eingetragen!"); // Zeige Erfolgsmeldung
|
||||
loadSchichten(); // Tabelle neu laden
|
||||
})
|
||||
.catch(error => {
|
||||
if (error.message.includes("Schicht ist bereits voll")) {
|
||||
showPopup("Diese Schicht ist bereits voll. Wählen Sie eine andere Schicht!");
|
||||
} else {
|
||||
showPopup("Fehler beim Eintragen: " + error.message);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
showPopup("Bitte gib einen gültigen Namen ein."); // Warnung bei leerem Namen
|
||||
}
|
||||
}
|
||||
|
||||
function closeEintragenPopup() {
|
||||
const positionPopupOverlay = document.getElementById("popupOverlay");
|
||||
const popupInput = document.getElementById("popupInput");
|
||||
|
||||
// Popup ausblenden
|
||||
positionPopupOverlay.style.display = "none";
|
||||
|
||||
// Eingabefeld leeren
|
||||
if (popupInput) {
|
||||
popupInput.value = "";
|
||||
}
|
||||
|
||||
// Zurücksetzen der Schicht-ID
|
||||
selectedSchichtId = null;
|
||||
}
|
||||
|
||||
// Zeigt das Popup-Fenster an
|
||||
function showPopup(message) {
|
||||
const popupOverlay = document.getElementById("popupOverlay");
|
||||
const popupMessage = document.getElementById("popupMessage");
|
||||
const popupInputSection = document.getElementById("popupInputSection");
|
||||
const popupCloseButton = document.getElementById("popupCloseButton");
|
||||
|
||||
popupMessage.textContent = message;
|
||||
popupInputSection.style.display = "none"; // Verberge das Eingabefeld
|
||||
popupCloseButton.style.display = "inline-block"; // Zeige die Schließen-Schaltfläche
|
||||
popupOverlay.style.display = "flex";
|
||||
}
|
||||
|
||||
// Schließt das Popup-Fenster
|
||||
function closePopup() {
|
||||
const popupOverlay = document.getElementById("popupOverlay");
|
||||
document.getElementById("popupInput").value = ""; // Eingabefeld zurücksetzen
|
||||
popupOverlay.style.display = "none";
|
||||
}
|
|
@ -29,14 +29,13 @@
|
|||
<ul>
|
||||
<li><a href="/Projekt_SE2/mitarbeiter.jsp"><i class="fa-solid fa-house"></i> Startseite</a></li>
|
||||
<li><a href="/Projekt_SE2/mitarbeiterFunktionen/schichtenPlanMitarbeiter.jsp" class="aktiv"><i class="fa-solid fa-calendar-days"></i> Schichtenplan</a></li>
|
||||
<li><a href="/Projekt_SE2/mitarbeiterFunktionen/datenMitarbeiter.jsp"><i class="fa-solid fa-user"></i> Persönliche Daten</a></li>
|
||||
<li><a href="#" onclick="openLogoutPopup()"><i class="fa-solid fa-right-to-bracket"></i> Abmelden</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
<main>
|
||||
|
||||
<!-- Popup-HTML -->
|
||||
<!-- Popup Ausloggen -->
|
||||
<div id="logoutPopup" class="popup">
|
||||
<div class="popup-content">
|
||||
<h3>Abmelden</h3>
|
||||
|
@ -47,18 +46,50 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Popup-Fenster Schichten -->
|
||||
<div id="popupOverlay">
|
||||
<div id="popupContent">
|
||||
<h3 id="popupMessage">Nachricht</h3>
|
||||
<div id="popupInputSection" style="display: none;">
|
||||
<label for="popupInput">Dein Name:</label>
|
||||
<input type="text" id="popupInput" placeholder="Name eingeben" /><br><br>
|
||||
<button id="popupConfirmButton" onclick="confirmEintragen()">Eintragen</button>
|
||||
<button type="button" onclick="closeEintragenPopup()">Abbrechen</button>
|
||||
</div>
|
||||
<button id="popupCloseButton" onclick="closePopup()">OK</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="willkommenstext">
|
||||
<p> <span class="einleitung">Willkommen zur Schichtplanung<br>vom EJSS Palast</span><br>
|
||||
Du bist eingeloggt als: ....<br>
|
||||
<strong>Hier kannst du deine Schichten einsehen und auswählen,<br>
|
||||
um deinen Beitrag zu unserem Team zu planen.</strong><br>
|
||||
<strong>Bitte beachte, dass du dich nicht selbst aus einer Schicht austragen kannst.<br>
|
||||
Falls du dich abmelden möchtest,<br>kontaktiere bitte den Chef oder die zuständige Person.</strong><br>
|
||||
<strong>Achtung: Der erste Eintrag entspricht Mitarbeiter 1 und der zweite Eintrag Mitarbeiter 2.</strong><br>
|
||||
<em>Vielen Dank für deinen Einsatz!<br>
|
||||
Dein EJSS Palast Team</em>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<h2>Schichtenübersicht</h2>
|
||||
<table id="schichtenTabelle">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Datum</th>
|
||||
<th>Tag</th>
|
||||
<th>Zeitraum</th>
|
||||
<th>Mitarbeiter 1 (12:00 - 17:00)</th>
|
||||
<th>Mitarbeiter 2 (17:00 - Ende)</th>
|
||||
<th>Aktionen</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<!-- Dynamische Inhalte -->
|
||||
</tbody>
|
||||
</table>
|
||||
</main>
|
||||
<a href="#Anfang"><h4>Zurück zum Anfang</h4></a>
|
||||
<footer>
|
||||
|
@ -75,6 +106,7 @@
|
|||
</div>
|
||||
</footer>
|
||||
|
||||
<script src="/Projekt_SE2/mitarbeiterFunktionen/schichtenMAscript.js"></script>
|
||||
<script src="/Projekt_SE2/mitarbeiterFunktionen/mitarbeiterScript.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -111,7 +111,7 @@
|
|||
<td>12:00 - 22:00</td>
|
||||
<td>12:00 - 23:00</td>
|
||||
<td>12:00 - 23:00</td>
|
||||
<td>13:00 - 22:00</td>
|
||||
<td>12:00 - 22:00</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
@ -933,3 +933,126 @@ footer .call-icon:hover {
|
|||
}
|
||||
}
|
||||
|
||||
/* Tabelle stylen */
|
||||
#schichtenTabelle {
|
||||
width: 90%;
|
||||
margin: 20px auto;
|
||||
border-collapse: collapse;
|
||||
font-family: Arial, sans-serif;
|
||||
}
|
||||
|
||||
#schichtenTabelle th, #schichtenTabelle td {
|
||||
border: 1px solid #ddd;
|
||||
padding: 12px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#schichtenTabelle th {
|
||||
background-color: #623c3d;
|
||||
color: white;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#schichtenTabelle tr:nth-child(even) {
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
|
||||
#schichtenTabelle tr:hover {
|
||||
background-color: #f1f1f1;
|
||||
}
|
||||
|
||||
button {
|
||||
padding: 8px 12px;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
background-color: #ddd;
|
||||
}
|
||||
|
||||
/* Popup-Styling */
|
||||
#popupOverlay {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
display: none;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
#popupContent {
|
||||
background: white;
|
||||
padding: 20px;
|
||||
border-radius: 10px;
|
||||
width: 50%;
|
||||
max-width: 400px;
|
||||
text-align: center;
|
||||
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
#popupContent h3 {
|
||||
margin-bottom: 20px;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
#popupContent button {
|
||||
background-color: #623c3d;
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 10px 20px;
|
||||
border-radius: 5px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#popupContent button:hover {
|
||||
background-color: #6c2f3d;
|
||||
}
|
||||
|
||||
#positionPopupOverlay {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
display: none;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
#positionPopupContent {
|
||||
background: white;
|
||||
padding: 20px;
|
||||
border-radius: 10px;
|
||||
width: 50%;
|
||||
max-width: 400px;
|
||||
text-align: center;
|
||||
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
#positionPopupContent h3 {
|
||||
margin-bottom: 20px;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
#positionPopupContent button {
|
||||
background-color: #623c3d;
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 10px 20px;
|
||||
border-radius: 5px;
|
||||
cursor: pointer;
|
||||
margin: 5px;
|
||||
}
|
||||
|
||||
#positionPopupContent button:hover {
|
||||
background-color: #6c2f3d;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue