diff --git a/admin.html b/admin.html new file mode 100644 index 0000000..037a823 --- /dev/null +++ b/admin.html @@ -0,0 +1,63 @@ + + + + + Admin Dashboard + + + +
+

Admin Dashboard

+ Logout +
Tickets werden geladen...
+
+ + + \ No newline at end of file diff --git a/admin.php b/admin.php new file mode 100644 index 0000000..26739fd --- /dev/null +++ b/admin.php @@ -0,0 +1,130 @@ + + + + + + Admin Dashboard + + + +
+
+

Admin Dashboard

+ +
+ + Logout + +
+ +
+

Tickets Übersicht

+
    +
    + + +
    +

    Wähle ein Ticket aus der Liste links aus.

    +
    +
    +
    + + + + \ No newline at end of file diff --git a/backend/delete_ticket.php b/backend/delete_ticket.php new file mode 100644 index 0000000..6b679bf --- /dev/null +++ b/backend/delete_ticket.php @@ -0,0 +1,32 @@ +false,"message"=>"Nicht eingeloggt"]); + exit; +} + +$input = json_decode(file_get_contents("php://input"), true); +$index = $input['index'] ?? null; + +if($index === null){ + echo json_encode(["success"=>false,"message"=>"Kein Index angegeben"]); + exit; +} + +$ticketsPath = __DIR__ . '/tickets.json'; +$tickets = []; + +if(file_exists($ticketsPath)){ + $tickets = json_decode(file_get_contents($ticketsPath), true); +} + +if(!isset($tickets[$index])){ + echo json_encode(["success"=>false,"message"=>"Ticket existiert nicht"]); + exit; +} + +// Ticket löschen +array_splice($tickets, $index, 1); +file_put_contents($ticketsPath, json_encode($tickets, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE), LOCK_EX); + +echo json_encode(["success"=>true]); \ No newline at end of file diff --git a/backend/login.php b/backend/login.php new file mode 100644 index 0000000..af28275 --- /dev/null +++ b/backend/login.php @@ -0,0 +1,32 @@ + \ No newline at end of file diff --git a/backend/save_ticket.php b/backend/save_ticket.php new file mode 100644 index 0000000..9bf8b1a --- /dev/null +++ b/backend/save_ticket.php @@ -0,0 +1,40 @@ + $title, + 'description' => $description, + 'category' => $category, + 'room' => $room, + 'name' => $name, + 'status' => 'To-Do', + 'date' => $date +]; + +$ticketsPath = __DIR__ . '/tickets.json'; +$tickets = []; + +if (file_exists($ticketsPath)) { + $json = file_get_contents($ticketsPath); + $tickets = json_decode($json, true); + if (!is_array($tickets)) $tickets = []; +} + +$tickets[] = $newTicket; + +file_put_contents($ticketsPath, json_encode($tickets, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE), LOCK_EX); + +// Redirect zurück ins Dashboard oder zur Hauptseite +header('Location: ../index.html?success=1'); +exit; \ No newline at end of file diff --git a/backend/tickets.json b/backend/tickets.json new file mode 100644 index 0000000..0637a08 --- /dev/null +++ b/backend/tickets.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/backend/update_ticket.php b/backend/update_ticket.php new file mode 100644 index 0000000..578dfc7 --- /dev/null +++ b/backend/update_ticket.php @@ -0,0 +1,33 @@ +false,"message"=>"Nicht eingeloggt"]); + exit; +} + +$input = json_decode(file_get_contents("php://input"), true); +$index = $input['index'] ?? null; +$ticket = $input['ticket'] ?? null; + +if($index === null || $ticket === null){ + echo json_encode(["success"=>false,"message"=>"Keine Daten"]); + exit; +} + +$ticketsPath = __DIR__ . '/tickets.json'; +$tickets = []; + +if(file_exists($ticketsPath)){ + $tickets = json_decode(file_get_contents($ticketsPath), true); +} + +if(!isset($tickets[$index])){ + echo json_encode(["success"=>false,"message"=>"Ticket existiert nicht"]); + exit; +} + +// Ticket aktualisieren +$tickets[$index] = $ticket; +file_put_contents($ticketsPath, json_encode($tickets, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE), LOCK_EX); + +echo json_encode(["success"=>true]); \ No newline at end of file diff --git a/backend/users.json b/backend/users.json new file mode 100644 index 0000000..f4178a1 --- /dev/null +++ b/backend/users.json @@ -0,0 +1,9 @@ +[ + { "username": "rtbrgr", + "password": "tNafets_9i" + }, + { + "username": "admin", + "password": "1234" + } +] \ No newline at end of file diff --git a/css/style.css b/css/style.css new file mode 100644 index 0000000..f37d08d --- /dev/null +++ b/css/style.css @@ -0,0 +1,168 @@ +/* Grundstyles */ +body { + font-family: Arial, sans-serif; + background: #f0f2f5; + padding: 2rem; + margin: 0; +} + +.container { + max-width: 900px; + margin: auto; + background: #fff; + padding: 2rem; + border-radius: 1rem; + box-shadow: 0 0 15px rgba(0,0,0,0.1); +} + +.header-with-image { + display: flex; + justify-content: space-between; + align-items: center; + margin-bottom: 20px; +} + +.header-with-image img { + height: 60px; +} + +/* Formular Styles */ +input, textarea, select, button { + width: 100%; + margin-top: 1rem; + padding: 0.75rem; + font-size: 1rem; + border-radius: 0.5rem; + border: 1px solid #ccc; + box-sizing: border-box; +} + +button { + background-color: #2b79c2; + color: white; + border: none; + cursor: pointer; +} + +button:hover { + background-color: #1d5fa0; +} + +/* Login Button (Index-Seite) */ +.login-btn { + display: inline-block; + padding: 12px 400px; + background: #2b79c2; + color: white; + border-radius: 10px; + text-decoration: none; + font-weight: bold; + font-size: 1rem; + cursor: pointer; + border: none; + transition: all 0.2s ease-in-out; +} + +.login-btn:hover { + background: #1d5fa0; + transform: scale(1.05); + box-shadow: 0 4px 12px rgba(0,0,0,0.2); +} + +/* Logout Button */ +.logout-btn { + display: inline-block; + padding: 10px 20px; + background: #ff4d4d; + color: white; + border-radius: 10px; + text-decoration: none; + font-weight: bold; + transition: 0.2s ease-in-out; + margin-bottom: 20px; +} + +.logout-btn:hover { + background: #e60000; + transform: scale(1.05); +} + +/* Tickets */ +.ticket { + border: 1px solid #ccc; + padding: 1rem; + margin-bottom: 1rem; + border-radius: 10px; + background: #fff; + box-shadow: 0 0 10px rgba(0,0,0,0.1); +} + +.ticket h3 { + margin-top: 0; + color: #2b79c2; +} + +.ticket p { + margin: 0.3rem 0; +} + +/* Status Labels */ +.status { + display: inline-block; + padding: 4px 10px; + border-radius: 8px; + font-size: 0.8rem; + font-weight: bold; + margin-top: 8px; +} + +/* Logout Button */ +.logout-btn { + display: inline-block; + padding: 10px 20px; + background: #ff4d4d; + color: white; + border-radius: 10px; + text-decoration: none; + font-weight: bold; + transition: 0.2s ease-in-out; + margin-bottom: 20px; +} + +.logout-btn:hover { + background: #e60000; + transform: scale(1.05); +} + +/* Tickets */ +.ticket { + border: 1px solid #ccc; + padding: 1rem; + margin-bottom: 1rem; + border-radius: 10px; + background: #fff; + box-shadow: 0 0 10px rgba(0,0,0,0.1); +} + +.ticket h3 { + margin-top: 0; + color: #2b79c2; +} + +.ticket p { + margin: 0.3rem 0; +} + +/* Status Labels */ +.status { + display: inline-block; + padding: 4px 10px; + border-radius: 8px; + font-size: 0.8rem; + font-weight: bold; + margin-top: 8px; +} + +.status.To-Do { background: #ffcccc; color: #a00; } +.status.InProgress { background: #fff3cd; color: #856404; } +.status.Done { background: #d4edda; color: #155724; } diff --git a/dashboard.php b/dashboard.php new file mode 100644 index 0000000..c552379 --- /dev/null +++ b/dashboard.php @@ -0,0 +1,141 @@ + + + + + + +Admin Dashboard + + + + + + + +
    + +
    +

    Admin Dashboard

    +

    Angemeldet als:

    + Logout +
    +
    + + + + + \ No newline at end of file diff --git a/img/csg.png b/img/csg.png new file mode 100644 index 0000000..6a8e356 Binary files /dev/null and b/img/csg.png differ diff --git a/img/dsc.png b/img/dsc.png new file mode 100644 index 0000000..f7e6fe3 Binary files /dev/null and b/img/dsc.png differ diff --git a/index.html b/index.html new file mode 100644 index 0000000..47dedfe --- /dev/null +++ b/index.html @@ -0,0 +1,46 @@ + + + + + + Schul-IT Ticketsystem + + + +
    +
    +

    CSG IT Ticket System

    + +
    + +
    + + + + + + + + + + + + + + + + + + +
    +
    + + \ No newline at end of file diff --git a/js/login.js b/js/login.js new file mode 100644 index 0000000..cc0b390 --- /dev/null +++ b/js/login.js @@ -0,0 +1,21 @@ +document.getElementById("loginForm").addEventListener("submit", async function (e) { + e.preventDefault(); + const username = document.getElementById("username").value; + const password = document.getElementById("password").value; + + const formData = new FormData(); + formData.append("username", username); + formData.append("password", password); + + const response = await fetch("backend/login.php", { + method: "POST", + body: formData + }); + + const result = await response.json(); + if (result.success) { + window.location.href = "admin.php"; + } else { + document.getElementById("errorMsg").innerText = "Login fehlgeschlagen!"; + } +}); \ No newline at end of file diff --git a/login.html b/login.html new file mode 100644 index 0000000..b90dd64 --- /dev/null +++ b/login.html @@ -0,0 +1,26 @@ + + + + + + Login + + + +
    +
    +

    Admin Login

    + +
    +
    + + + + + +
    +

    +
    + + + \ No newline at end of file