nur offene Treffen anzeigen

This commit is contained in:
Borgal
2025-08-22 15:50:49 +02:00
parent e2e931b74e
commit d934d3c76f

View File

@@ -159,7 +159,8 @@ while ($row = mysqli_fetch_assoc($result)) {
}
$meetings = [];
$result = mysqli_query($conn, "SELECT m.id, m.meeting_date, m.created_at, m.reason, c.name AS color_name, c.hex_code FROM meetings m JOIN colors c ON m.color_id = c.id WHERE m.meeting_date >= CURDATE() ORDER BY m.meeting_date");
// Aktualisierte Abfrage: Zeigt nur Meetings an, die nicht abgeschlossen sind (is_completed = 0)
$result = mysqli_query($conn, "SELECT m.id, m.meeting_date, m.created_at, m.reason, c.name AS color_name, c.hex_code FROM meetings m JOIN colors c ON m.color_id = c.id WHERE m.is_completed = 0 ORDER BY m.meeting_date");
while ($row = mysqli_fetch_assoc($result)) {
$meetings[] = $row;
}
@@ -239,46 +240,35 @@ require_once '../inc/header.php';
<div class="card shadow">
<div class="card-header bg-secondary bg-opacity-50 text-secondary">
<h4 class="mb-0">Übersicht der Termine</h4>
<h4 class="mb-0">Übersicht der nächsten Termine</h4>
</div>
<div class="card-body">
<?php if (empty($meetings)): ?>
<p class="text-muted text-center">Es sind noch keine Termine vorhanden.</p>
<?php else: ?>
<div class="table-responsive">
<table class="table table-striped table-hover">
<thead>
<tr>
<th>Datum & Uhrzeit</th>
<th>Farbe</th>
<th>Aktionen</th>
</tr>
</thead>
<tbody>
<?php foreach ($meetings as $meeting): ?>
<tr>
<td><?= date('d.m.Y H:i', strtotime($meeting['meeting_date'])); ?></td>
<td>
<div class="d-flex align-items-center">
<div class="color-preview rounded me-2" style="background-color: <?= htmlspecialchars($meeting['hex_code']); ?>;"></div>
<div>
<span><?= htmlspecialchars($meeting['color_name']); ?></span>
<div class="small text-muted mt-1">Grund: <?= htmlspecialchars($meeting['reason']); ?></div>
</div>
</div>
</td>
<td>
<a href="planning.php?action=edit&id=<?= htmlspecialchars($meeting['id']); ?>" class="text-dark me-1 text-decoration-none" data-bs-toggle="tooltip" data-bs-placement="top" title="Bearbeiten">
<span class="material-icons">mode_edit_outline</span>
</a>
<a href="planning.php?action=delete&id=<?= htmlspecialchars($meeting['id']); ?>" class="text-danger text-decoration-none" onclick="return confirm('Sind Sie sicher, dass Sie diesen Termin löschen möchten?');" data-bs-toggle="tooltip" data-bs-placement="top" title="Löschen">
<span class="material-icons">delete_outline</span>
</a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<div class="list-group list-group-flush">
<?php foreach ($meetings as $meeting): ?>
<div class="list-group-item">
<div class="d-flex justify-content-between align-items-center">
<div>
<p class="mb-1 fw-bold"><?= date('d.m.y H:i', strtotime($meeting['meeting_date'])); ?></p>
<div class="d-flex align-items-center">
<div class="color-preview rounded me-2" style="background-color: <?= htmlspecialchars($meeting['hex_code']); ?>; width: 20px; height: 20px;"></div>
<p class="mb-1"><?= htmlspecialchars($meeting['color_name']); ?></p>
</div>
</div>
<div>
<a href="planning.php?action=edit&id=<?= htmlspecialchars($meeting['id']); ?>" class="text-dark me-1 text-decoration-none" data-bs-toggle="tooltip" data-bs-placement="top" title="Bearbeiten">
<span class="material-icons">mode_edit_outline</span>
</a>
<a href="planning.php?action=delete&id=<?= htmlspecialchars($meeting['id']); ?>" class="text-danger text-decoration-none" onclick="return confirm('Sind Sie sicher, dass Sie diesen Termin löschen möchten?');" data-bs-toggle="tooltip" data-bs-placement="top" title="Löschen">
<span class="material-icons">delete_outline</span>
</a>
</div>
</div>
<p class="small text-muted mb-0 mt-2">Grund: <?= htmlspecialchars($meeting['reason']); ?></p>
</div>
<?php endforeach; ?>
</div>
<?php endif; ?>
</div>