Format der Button überarbeitet

This commit is contained in:
Borgal
2025-10-25 00:07:18 +02:00
parent 4ab4576ec8
commit 80360c0dfd
4 changed files with 34 additions and 31 deletions

View File

@@ -37,10 +37,14 @@ function auto_decline_if_on_vacation($conn, $meeting_id, $user_id, $meeting_date
$existing = mysqli_fetch_assoc(mysqli_stmt_get_result($check_stmt));
mysqli_stmt_close($check_stmt);
if ($existing && $existing['rsvp_status'] === 'accepted') {
return 'accepted';
$current_status = $existing ? $existing['rsvp_status'] : null;
// Wenn explizit "accepted" oder "maybe" gewählt wurde → NICHT überschreiben!
if ($current_status === 'accepted' || $current_status === 'maybe') {
return $current_status;
}
// Nur wenn Status "declined" oder NULL → auf "declined" setzen
if ($existing) {
$upd = mysqli_prepare($conn, "UPDATE meeting_teilnehmer SET rsvp_status = 'declined', attended = 0 WHERE meeting_id = ? AND user_id = ?");
mysqli_stmt_bind_param($upd, "ii", $meeting_id, $user_id);
@@ -270,7 +274,7 @@ $german_weekdays = [
mysqli_stmt_execute($color_stmt);
$color_row = mysqli_fetch_assoc(mysqli_stmt_get_result($color_stmt));
?>
<div class="card mx-auto bg-light shadow" style="max-width: 500px;">
<div class="card mx-auto bg-light shadow mb-4" style="max-width: 500px;">
<div class="card-body text-center">
<div class="rounded-4 mb-3 mx-auto d-flex flex-column justify-content-center align-items-center color-box" style="background-image: linear-gradient(135deg, <?= htmlspecialchars($color_row['hex_code']) ?>, <?= darken_color($color_row['hex_code']) ?>);">
<p class="fs-5 fw-semibold m-0" style="color: <?= get_readable_text_color($color_row['hex_code']) ?>;"><?= htmlspecialchars($color_row['name']) ?></p>
@@ -306,7 +310,10 @@ $german_weekdays = [
</div>
</div>
<div class="d-flex justify-content-center pt-2 pb-3 meeting-actions"> <?php if ($user_attendance_status === 'accepted'): ?>
<!-- TODO: -->
<div class="d-flex justify-content-center pt-2 pb-3" style="max-width: 500px; margin-left: auto; margin-right: auto; flex-direction: column; align-items: center;" <!-- inline-css-ok -->
<?php if ($user_attendance_status === 'accepted'): ?>
<p class="text-success fw-bold mb-4">Du hast zugesagt!</p>
<div class="d-flex justify-content-center">
<a href="index.php?action=decline&meeting_id=<?= htmlspecialchars($meeting_id); ?>" class="btn btn-sm btn-outline-danger me-2">Absagen</a>
@@ -455,24 +462,28 @@ $german_weekdays = [
</div>
<div class="mt-2">
<?php if (!isset($user_votes[$p['id']])): ?>
<form method="POST" class="d-inline">
<input type="hidden" name="proposal_id" value="<?= $p['id'] ?>">
<button type="submit" name="vote_proposal" value="yes" class="btn btn-sm btn-success">✅ Ja</button>
<button type="submit" name="vote_proposal" value="no" class="btn btn-sm btn-danger">❌ Nein</button>
</form>
<?php else: ?>
<span class="badge bg-secondary">Bereits abgestimmt:
<?= $user_votes[$p['id']] === 'yes' ? '✅ Ja' : '❌ Nein' ?>
</span>
<?php endif; ?>
<div class="mt-2">
<?php if (!isset($user_votes[$p['id']])): ?>
<form method="POST" class="d-inline">
<input type="hidden" name="proposal_id" value="<?= $p['id'] ?>">
<button type="submit" name="vote_proposal" value="yes" class="btn btn-sm btn-success">✅ Ja</button>
<button type="submit" name="vote_proposal" value="no" class="btn btn-sm btn-danger">❌ Nein</button>
</form>
<?php else: ?>
<span class="badge bg-secondary">Bereits abgestimmt:
<?= $user_votes[$p['id']] === 'yes' ? '✅ Ja' : '❌ Nein' ?>
</span>
<?php endif; ?>
</div>
<?php if (isset($_SESSION['role']) && $_SESSION['role'] === 'admin'): ?>
<form method="POST" class="d-inline ms-2">
<input type="hidden" name="proposal_id" value="<?= $p['id'] ?>">
<button type="submit" name="accept_proposal" class="btn btn-sm btn-outline-success" onclick="return confirm('Vorschlag wirklich annehmen? Der Termin wird verschoben!')">Annehmen</button>
<button type="submit" name="reject_proposal" class="btn btn-sm btn-outline-danger" onclick="return confirm('Vorschlag wirklich ablehnen?')">Ablehnen</button>
</form>
<div class="mt-1">
<form method="POST" class="d-inline">
<input type="hidden" name="proposal_id" value="<?= $p['id'] ?>">
<button type="submit" name="accept_proposal" class="btn btn-sm btn-outline-success" onclick="return confirm('Vorschlag wirklich annehmen? Der Termin wird verschoben!')">Annehmen</button>
<button type="submit" name="reject_proposal" class="btn btn-sm btn-outline-danger" onclick="return confirm('Vorschlag wirklich ablehnen?')">Ablehnen</button>
</form>
</div>
<?php endif; ?>
</div>
</div>