Merge branch 'dev' into live
This commit is contained in:
commit
206d56b10c
2 files changed
+133
No files matched your search
@@ -19,6 +19,7 @@ $serviceGroups = array (
|
||||
1 => 'vergabe',
|
||||
2 => 'links',
|
||||
3 => 'einkaufsliste',
|
||||
4 => 'termine',
|
||||
),
|
||||
),
|
||||
'Ausbildung' =>
|
||||
@@ -199,6 +200,12 @@ $services = array (
|
||||
'active' => true,
|
||||
'adminOnly' => false,
|
||||
),
|
||||
'termine' =>
|
||||
array (
|
||||
'name' => 'Termine',
|
||||
'active' => true,
|
||||
'adminOnly' => false,
|
||||
),
|
||||
);
|
||||
|
||||
$linkGroups = array (
|
||||
|
||||
@@ -0,0 +1,126 @@
|
||||
<?php
|
||||
include_once(__DIR__ . '/../controller/DatabaseController.php');
|
||||
include_once(__DIR__ . '/../controller/DataController.php');
|
||||
|
||||
$msg = "";
|
||||
$username = $_SESSION['username'] ?? 'Gast'; // Holt den eingeloggten User[cite: 5]
|
||||
|
||||
// 1. Termin löschen (Aktion)
|
||||
if (isset($_GET['action']) && $_GET['action'] === 'delete' && isset($_GET['id'])) {
|
||||
$deleteId = (int)$_GET['id'];
|
||||
DatabaseDelete("Termine", "ID = ?", $deleteId);
|
||||
$msg = "Termin erfolgreich gelöscht!";
|
||||
}
|
||||
|
||||
// 2. Termin hinzufügen (Aktion)
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['add_termin'])) {
|
||||
$datum = $_POST['datum'] ?? '';
|
||||
$zeit = $_POST['zeit'] ?? '';
|
||||
$name = $_POST['name'] ?? '';
|
||||
$notiz = $_POST['notiz'] ?? '';
|
||||
|
||||
if (!empty($datum) && !empty($zeit) && !empty($name)) {
|
||||
DatabaseInsert(
|
||||
"Termine",
|
||||
"DATUM, ZEIT, NAME, NOTIZ, ERSTELLT_VON",
|
||||
$datum,
|
||||
$zeit,
|
||||
$name,
|
||||
$notiz,
|
||||
$username
|
||||
);
|
||||
$msg = "Termin erfolgreich eingetragen!";
|
||||
} else {
|
||||
$msg = "Bitte alle Pflichtfelder ausfüllen.";
|
||||
}
|
||||
}
|
||||
|
||||
// 3. Alle anstehenden Termine laden (Sortiert nach Datum und Zeit)
|
||||
$termine = DatabaseShow("Termine", "*", "1=1 ORDER BY DATUM ASC, ZEIT ASC");
|
||||
?>
|
||||
|
||||
<!-- Status-Meldung anzeigen, falls vorhanden -->
|
||||
<?php if (!empty($msg)): ?>
|
||||
<div class="status-msg"><?= htmlspecialchars($msg) ?></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="form-container">
|
||||
<h3>📅 Neuen Termin vergeben</h3>
|
||||
|
||||
<form method="POST" class="vergabe-form">
|
||||
<div class="vergabe-grid">
|
||||
|
||||
<div class="form-group">
|
||||
<label for="datum">Datum *</label>
|
||||
<input type="date" id="datum" name="datum" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="zeit">Uhrzeit *</label>
|
||||
<input type="time" id="zeit" name="zeit" required style="width:100%; padding:10px; border-radius:5px; border:1px solid var(--input-border); background:var(--input-bg); color:var(--input-text);">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="name">Name / Zweck *</label>
|
||||
<input type="text" id="name" name="name" placeholder="z.B. Kundentermin" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="notiz">Notiz (Optional)</label>
|
||||
<input type="text" id="notiz" name="notiz" placeholder="Details zum Termin...">
|
||||
</div>
|
||||
|
||||
<button type="submit" name="add_termin" class="btn-submit-vergabe">Speichern</button>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- Termine Übersicht -->
|
||||
<div class="form-container">
|
||||
<h3>📋 Aktuelle Terminbelegungen</h3>
|
||||
|
||||
<div class="table-container">
|
||||
<table class="db-table mobile-responsive-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Datum</th>
|
||||
<th>Uhrzeit</th>
|
||||
<th>Termin / Name</th>
|
||||
<th>Notiz</th>
|
||||
<th>Eingetragen von</th>
|
||||
<th>Aktion</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if (empty($termine)): ?>
|
||||
<tr>
|
||||
<td colspan="6" style="text-align: center; padding: 20px;">Keine Termine eingetragen.</td>
|
||||
</td>
|
||||
<?php else: ?>
|
||||
<?php foreach ($termine as $termin): ?>
|
||||
<?php
|
||||
// Formatiere das Datum lesbar (DD.MM.YYYY)
|
||||
$dateFormatted = date('d.m.Y', strtotime($termin['DATUM']));
|
||||
// Formatiere die Zeit lesbar (HH:MM)
|
||||
$timeFormatted = date('H:i', strtotime($termin['ZEIT']));
|
||||
?>
|
||||
<tr>
|
||||
<td data-label="Datum:"><?= htmlspecialchars($dateFormatted) ?></td>
|
||||
<td data-label="Uhrzeit:"><?= htmlspecialchars($timeFormatted) ?></td>
|
||||
<td data-label="Termin / Name:"><strong><?= htmlspecialchars($termin['NAME']) ?></strong></td>
|
||||
<td data-label="Notiz:"><?= htmlspecialchars($termin['NOTIZ'] ?: '-') ?></td>
|
||||
<td data-label="Von:"><span class="badge"><?= htmlspecialchars($termin['ERSTELLT_VON']) ?></span></td>
|
||||
<td data-label="Aktion:">
|
||||
<a href="?service=vergabe&action=delete&id=<?= $termin['ID'] ?>"
|
||||
onclick="return confirm('Möchtest du diesen Termin wirklich löschen?');">
|
||||
<button class="btn-delete">Löschen</button>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
Reference in new issue
Block a user