Tour bearbeiten: Kartenlayout mit bündigen Formularzeilen und Zimmerverwaltung

This commit is contained in:
torsten 2026-11-21 13:42:41 +01:00
parent b13b21f30f
commit 74f007fe72
5 changed files with 823 additions and 430 deletions

View file

@ -790,6 +790,16 @@ p {
margin-bottom: 3rem;
}
.tour-detail-card + .tour-detail-card {
margin-top: 1rem;
}
.tour-detail-card .tour-media-manager {
margin-top: 0;
padding-top: 0;
border-top: 0;
}
.tour-detail-card {
background: #f8fafc;
border: 1px solid #e2e8f0;
@ -1211,6 +1221,206 @@ p {
}
}
/* Tour bearbeiten: bündige Formularzeilen im Kartenlayout */
.tour-form {
display: block;
}
.tour-form-row {
display: grid;
grid-template-columns: 11rem minmax(0, 1fr);
align-items: center;
gap: .35rem 1rem;
padding: .55rem 0;
border-bottom: 1px dashed #e2e8f0;
}
.tour-form-row:last-of-type {
border-bottom: 0;
}
.tour-form-row.has-textarea {
align-items: start;
padding-top: .85rem;
}
.tour-form-row.has-textarea .tour-form-label {
padding-top: .45rem;
}
.tour-form-label {
margin: 0;
color: #64748b;
font-size: .74rem;
font-weight: 700;
letter-spacing: .06em;
text-transform: uppercase;
}
.tour-form-field {
min-width: 0;
}
.tour-form-field .form-control {
width: 100%;
border-color: #cbd5e1;
border-radius: 8px;
color: #0f172a;
background: #fff;
font-size: .95rem;
}
.tour-form-field .form-control:focus {
border-color: #4ea1ff;
box-shadow: 0 0 0 3px rgba(78, 161, 255, .25);
}
.tour-form-field textarea.form-control {
min-height: 12rem;
line-height: 1.55;
}
.tour-form-check {
display: flex;
align-items: flex-start;
gap: .5rem;
margin: 0;
color: #1e293b;
font-size: .92rem;
font-weight: 500;
cursor: pointer;
}
.tour-form-check input {
margin-top: .2rem;
width: 1.05rem;
height: 1.05rem;
flex: 0 0 auto;
}
.tour-form-error {
margin: .25rem 0 0;
color: #c13034;
font-size: .82rem;
font-weight: 600;
}
.tour-alert {
margin-bottom: 1rem;
padding: .75rem .9rem;
border-radius: 10px;
font-size: .92rem;
}
.tour-alert.is-success {
background: rgba(21, 128, 61, .12);
border: 1px solid rgba(21, 128, 61, .35);
color: #14532d;
}
.tour-alert.is-error {
background: rgba(229, 72, 77, .1);
border: 1px solid rgba(229, 72, 77, .35);
color: #8f1d21;
}
.tour-alert-list {
margin: .4rem 0 0;
padding-left: 1.1rem;
}
.tour-danger-zone {
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: space-between;
gap: .75rem;
margin-top: 1.5rem;
padding: .9rem 1rem;
border: 1px solid rgba(229, 72, 77, .35);
border-radius: 12px;
background: rgba(229, 72, 77, .06);
}
.tour-danger-title {
margin: 0;
color: #8f1d21;
font-weight: 700;
font-size: .95rem;
}
.tour-danger-hint {
margin: .15rem 0 0;
color: #64748b;
font-size: .82rem;
}
/* Zimmer- und Personenverwaltung in der Seitenspalte */
.tour-room-tools {
display: flex;
justify-content: flex-end;
gap: .35rem;
margin: -.1rem 0 .3rem;
}
.tour-icon-btn {
border: 0;
background: transparent;
color: rgba(255, 255, 255, .55);
cursor: pointer;
padding: 0 .2rem;
font-size: .8rem;
line-height: 1;
}
.tour-icon-btn:hover,
.tour-icon-btn:focus {
color: #e5484d;
}
.tour-person-assign {
border: 1px solid rgba(255, 255, 255, .35);
border-radius: 999px;
background: transparent;
color: #e6edf6;
cursor: pointer;
padding: .05rem .5rem;
font-size: .72rem;
line-height: 1.4;
}
.tour-person-assign:hover,
.tour-person-assign:focus {
background: rgba(78, 161, 255, .25);
border-color: #4ea1ff;
color: #fff;
}
.tour-side-actions form + form {
margin-top: .5rem;
}
@media (max-width: 767.98px) {
.tour-form-row {
grid-template-columns: 1fr;
gap: .15rem;
padding: .45rem 0;
}
.tour-form-field .form-control {
font-size: 16px;
}
.tour-danger-zone {
flex-direction: column;
align-items: stretch;
}
.tour-danger-zone .btn {
width: 100%;
}
}
/* Jahreskalender: Touren farblich markiert */
.tour-calendar-head {
display: flex;

View file

@ -491,6 +491,14 @@ class TourController
$tourGuide = User::find((int) $tour->tour_guide_id);
$tourImages = $this->tourImages((int) $tour->id);
$users = [];
foreach (Booking::forTour((int) $tour->id) as $booking) {
$user = User::find((int) $booking->user_id);
if ($user !== null) {
$users[] = $user;
}
}
$tourEnd = $tour->endDate();
if ($tourEnd !== null && $tourEnd < today()) {
@ -501,8 +509,11 @@ class TourController
view('tour.edit_old', [
'tour' => $tour,
'guides' => $guides,
'users' => $users,
'current' => $current,
'tourGuide' => $tourGuide,
'tourImages' => $tourImages,
'roomOptions' => TourRoom::forTour((int) $tour->id),
]);
return;
@ -515,11 +526,14 @@ class TourController
$tour->deadline = german_date($tour->deadline);
view('tour.edit', [
'tour' => $tour,
'rooms' => $rooms,
'guides' => $guides,
'tourGuide' => $tourGuide,
'tourImages' => $tourImages,
'tour' => $tour,
'rooms' => $rooms,
'guides' => $guides,
'users' => $users,
'current' => $current,
'tourGuide' => $tourGuide,
'tourImages' => $tourImages,
'roomOptions' => TourRoom::forTour((int) $tour->id),
]);
}

View file

@ -25,6 +25,12 @@ class View
ob_start();
require $layoutFile;
return (string) ob_get_clean();
$html = (string) ob_get_clean();
// Alte Eingaben und Validierungsfehler gelten nur für die direkt
// folgende Anzeige (Flash-Semantik) und werden danach verworfen.
unset($_SESSION['_old'], $_SESSION['_errors']);
return $html;
}
}

View file

@ -1,78 +1,96 @@
<?php
$current = auth_check() ? user() : null;
$flashStatus = flash_pull('status');
$flashError = flash_pull('error');
$validationErrors = errors();
unset($_SESSION['_errors']);
$canChangeGuide = $current !== null && $current->isAdmin();
$galleryLightbox = 'tour-bilder-' . $tour->id;
/** @var \App\Models\Tour $tour */
$flashStatus = flash_pull('status');
$flashError = flash_pull('error');
$validationErrors = errors();
unset($_SESSION['_errors']);
// Räume gruppieren, Reihenfolge wie aus der Abfrage
$groups = [];
foreach ($rooms as $room) {
$roomId = (int) ($room->room_id ?? 0);
$key = $roomId > 0 ? (string) $roomId : 'ungebucht';
if (!isset($groups[$key])) {
$groups[$key] = [
'name' => $room->room_name,
'id' => $room->room_id,
'free_slots' => $room->free_slots,
'users' => [],
];
}
$groups[$key]['users'][] = $room;
$canChangeGuide = $current !== null && $current->isAdmin();
$galleryLightbox = 'tour-bilder-' . $tour->id;
// Zimmer inkl. freier Plätze und zugewiesener Personen aufbereiten.
$roomMap = [];
foreach (($roomOptions ?? []) as $room) {
$roomMap[(string) $room['id']] = [
'name' => (string) $room['name'],
'capacity' => (int) $room['capacity'],
'booked' => (int) $room['booked'],
'users' => [],
];
}
$unassigned = [];
foreach (($rooms ?? []) as $row) {
if (empty($row->user_name)) {
continue;
}
?>
$key = (string) ($row->room_id ?? '');
if (isset($roomMap[$key])) {
$roomMap[$key]['users'][] = $row;
} else {
$unassigned[] = $row;
}
}
$freeRooms = array_filter($roomMap, static fn(array $room): bool => $room['booked'] < $room['capacity']);
?>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vanillajs-datepicker@1.1.2/dist/css/datepicker-bs4.min.css">
<script src="https://cdn.jsdelivr.net/npm/vanillajs-datepicker@1.1.2/dist/js/datepicker.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vanillajs-datepicker@1.1.2/dist/js/locales/de.js"></script>
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card mt-4">
<div class="card-header"><?= e($tour->name) ?></div>
<div class="container tour-detail">
<div class="row">
<div class="col-12 col-lg-8">
<article class="tour-detail-card">
<header class="tour-detail-head">
<div class="tour-detail-heading">
<h1 class="tour-detail-title">Tour bearbeiten</h1>
<p class="tour-detail-sub"><?= e($tour->name) ?> &middot; <?= e($tour->start) ?></p>
</div>
<a class="tour-status is-past" href="/tour/<?= e($tour->id) ?>">Zur Tour</a>
</header>
<div class="card-body">
<?php if ($flashStatus !== null): ?>
<div class="alert alert-success" role="alert"><?= e($flashStatus) ?></div>
<?php endif; ?>
<?php if ($flashStatus !== null): ?>
<div class="tour-alert is-success" role="status"><?= e($flashStatus) ?></div>
<?php endif; ?>
<?php if ($flashError !== null): ?>
<div class="alert alert-danger" role="alert"><?= e($flashError) ?></div>
<?php endif; ?>
<?php if ($flashError !== null): ?>
<div class="tour-alert is-error" role="alert"><?= e($flashError) ?></div>
<?php endif; ?>
<?php if ($validationErrors !== []): ?>
<div class="alert alert-danger" role="alert">
<strong>Bitte die Eingaben prüfen:</strong>
<ul class="mb-0 mt-1">
<?php foreach ($validationErrors as $messages): ?>
<?php foreach ($messages as $message): ?>
<li><?= e($message) ?></li>
<?php endforeach; ?>
<?php if ($validationErrors !== []): ?>
<div class="tour-alert is-error" role="alert">
<strong>Bitte die Eingaben prüfen:</strong>
<ul class="tour-alert-list">
<?php foreach ($validationErrors as $messages): ?>
<?php foreach ($messages as $message): ?>
<li><?= e($message) ?></li>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
<form style="background-color: #fff;" class="text-dark" method="post"
action="/tour/<?= e($tour->id) ?>" enctype="multipart/form-data">
<?= csrf_field() ?>
<input type="hidden" name="_method" value="PUT">
<input type="hidden" name="tour_id" value="<?= e($tour->id) ?>">
<form class="tour-form" method="post" action="/tour/<?= e($tour->id) ?>" enctype="multipart/form-data">
<?= csrf_field() ?>
<input type="hidden" name="_method" value="PUT">
<input type="hidden" name="tour_id" value="<?= e($tour->id) ?>">
<div class="form-group" style="display:flex;">
<label class="ml-2 mt-3 col-form-label col-form-label-sm" style="width:180px; text-align:left;font-size:18px;" for="name">Name:</label>
<input class="mt-3 mr-2 form-control input-sm" type="text" id="name" name="name"
<div class="tour-form-row">
<label class="tour-form-label" for="name">Name</label>
<div class="tour-form-field">
<input class="form-control" type="text" id="name" name="name"
value="<?= e(old('name') ?? $tour->name) ?>" required>
</div>
</div>
<div class="form-group" style="display:flex;">
<label class="ml-2 mt-3" style="width:180px; text-align:left;font-size:18px;" for="tour_guide_id">Tour Guide:</label>
<div class="tour-form-row">
<label class="tour-form-label" for="tour_guide_id">Tour Guide</label>
<div class="tour-form-field">
<?php if ($canChangeGuide): ?>
<select class="mt-3 mr-2 form-control input-sm" id="tour_guide_id" name="tour_guide_id" required>
<select class="form-control" id="tour_guide_id" name="tour_guide_id" required>
<?php foreach ($guides as $guide): ?>
<option value="<?= e($guide->id) ?>"<?= (int) $guide->id === (int) $tour->tour_guide_id ? ' selected' : '' ?>>
<?= e($guide->name) ?><?= $guide->role === 'ADMIN' ? ' (Admin)' : ($guide->role === 'TOUR GUIDE' ? ' (Tour Guide)' : '') ?>
@ -80,296 +98,345 @@
<?php endforeach; ?>
</select>
<?php else: ?>
<input class="mt-3 mr-2 form-control input-sm" type="text" value="<?= e($tourGuide ? $tourGuide->name : '') ?>" readonly>
<input class="form-control" type="text" value="<?= e($tourGuide ? $tourGuide->name : '') ?>" readonly>
<input type="hidden" name="tour_guide_id" value="<?= e($tour->tour_guide_id) ?>">
<?php endif; ?>
</div>
</div>
<div class="form-group" style="display:flex;">
<label class="ml-2 mt-3" style="width:180px; text-align:left;font-size:18px;" for="start">Start:</label>
<input class="mt-3 mr-2 form-control input-sm" type="text" id="start" name="start"
value="<?= e($tour->start) ?>" required>
<div class="tour-form-row">
<label class="tour-form-label" for="start">Start</label>
<div class="tour-form-field">
<input class="form-control" type="text" id="start" name="start"
value="<?= e($tour->start) ?>" autocomplete="off" required>
</div>
</div>
<div class="form-group" style="display:flex;">
<label class="ml-2 mt-3" style="width:180px; text-align:left;font-size:18px;" for="end_date">Ende:</label>
<input class="mt-3 mr-2 form-control input-sm" type="text" id="end_date" name="end_date"
<div class="tour-form-row">
<label class="tour-form-label" for="end_date">Ende</label>
<div class="tour-form-field">
<input class="form-control" type="text" id="end_date" name="end_date"
value="<?= e(old('end_date') ?? $tour->end_date) ?>" autocomplete="off"
placeholder="optional, z. B. bei Mehrtages-Touren">
placeholder="optional – leer lassen bei eintägigen Touren">
<?php if (error('end_date')): ?>
<div class="invalid-feedback d-block"><?= e(error('end_date')) ?></div>
<p class="tour-form-error"><?= e(error('end_date')) ?></p>
<?php endif; ?>
</div>
</div>
<div class="form-group" style="display:flex;">
<label class="ml-2 mt-4" style="width:180px; text-align:left;font-size:18px;" for="deadline">Anmeldeschluss:</label>
<input class="mt-3 mr-2 form-control" type="text" id="deadline" style="font-size:16px;"
name="deadline" value="<?= e(old('deadline') ?? $tour->deadline) ?>" required>
<div class="tour-form-row">
<label class="tour-form-label" for="deadline">Anmeldeschluss</label>
<div class="tour-form-field">
<input class="form-control" type="text" id="deadline" name="deadline"
value="<?= e(old('deadline') ?? $tour->deadline) ?>" autocomplete="off" required>
</div>
</div>
<div class="form-group" style="display:flex;">
<label class="ml-2 mt-4" style="width:180px; text-align:left;font-size:18px;" for="max_participants">Max Teilnehmer:</label>
<input class="mt-3 mr-2 form-control" type="number" min="1" max="99" id="max_participants"
style="font-size:16px;" name="max_participants"
<div class="tour-form-row">
<label class="tour-form-label" for="max_participants">Max. Teilnehmer</label>
<div class="tour-form-field">
<input class="form-control" type="number" min="1" max="99" id="max_participants"
name="max_participants"
value="<?= e(old('max_participants') ?? $tour->max_participants) ?>" required>
</div>
</div>
<div class="form-group" style="display:flex;">
<label class="ml-2 mt-3" style="width:140px; text-align:left;font-size:18px;" for="is_cancelled">Storniert:</label>
<input class="mt-3 mr-2 form-control" type="checkbox" id="is_cancelled"
style="font-size:10px;width:20px;" name="is_cancelled"
<?= $tour->is_cancelled ? 'checked' : '' ?>>
<div class="tour-form-row">
<span class="tour-form-label">Status</span>
<div class="tour-form-field">
<label class="tour-form-check" for="is_cancelled">
<input type="checkbox" id="is_cancelled" name="is_cancelled" value="1"
<?= $tour->is_cancelled ? 'checked' : '' ?>>
<span>Tour ist abgesagt (Anmeldungen gesperrt)</span>
</label>
</div>
</div>
<div class="form-group">
<textarea class="col-12" name="beschreibung" rows="10" cols="50"><?= e($tour->beschreibung) ?></textarea>
<div class="tour-form-row has-textarea">
<label class="tour-form-label" for="beschreibung">Beschreibung</label>
<div class="tour-form-field">
<textarea class="form-control" id="beschreibung" name="beschreibung" rows="10"><?= e($tour->beschreibung) ?></textarea>
</div>
</div>
<a href="/tour/<?= e($tour->id) ?>">
<div type="submit" class="btn btn-success col-2 mb-2 float-right mr-2">Abbrechen</div>
</a>
<button type="submit" class="btn btn-danger col-2 mb-2 float-right mr-2">Speichern</button>
</form>
<div class="tour-actions">
<button type="submit" class="btn btn-success">
<i class="fas fa-save" aria-hidden="true"></i> Speichern
</button>
<a class="btn btn-outline-secondary" href="/tour/<?= e($tour->id) ?>">Abbrechen</a>
</div>
</form>
<?php if ($current && $current->isAdmin()): ?>
<form action="/tour/<?= e($tour->id) ?>" method="POST" style="clear: both;" class="mt-3 mb-4"
<?php if ($current && $current->isAdmin()): ?>
<div class="tour-danger-zone">
<div>
<p class="tour-danger-title">Tour löschen</p>
<p class="tour-danger-hint">Anmeldungen, Zimmer und Bilder werden ebenfalls entfernt.</p>
</div>
<form action="/tour/<?= e($tour->id) ?>" method="POST"
onsubmit="return confirm('Diese Tour wirklich endgültig löschen? Anmeldungen, Zimmer und Bilder werden ebenfalls entfernt.');">
<?= csrf_field() ?>
<input type="hidden" name="_method" value="DELETE">
<button type="submit" class="btn btn-outline-danger btn-sm">Tour löschen</button>
<button type="submit" class="btn btn-outline-danger btn-sm">Endgültig löschen</button>
</form>
<?php endif; ?>
<section class="tour-media-manager" aria-labelledby="tour-media-title">
<div class="tour-media-head">
<div>
<h4 id="tour-media-title">Tour-Bilder</h4>
<p class="tour-media-hint">Mehrere Bilder möglich. Das neueste Bild wird zuerst angezeigt.</p>
</div>
<span class="tour-media-count"><?= count($tourImages) === 1 ? '1 Bild' : count($tourImages) . ' Bilder' ?></span>
</div>
<?php if ($tourImages === []): ?>
<div class="tour-media-empty">Noch keine Bilder hinterlegt.</div>
<?php else: ?>
<div class="tour-media-grid gallery-grid">
<?php foreach ($tourImages as $i => $image): ?>
<figure class="gallery-item" style="--i:<?= $i % 20 ?>">
<a class="gallery-item-link"
href="<?= e($image['large']) ?>?v=<?= e($image['version']) ?>"
data-lightbox="<?= e($galleryLightbox) ?>"
data-title="<?= e($tour->name) ?> – Bild <?= $i + 1 ?>">
<img src="<?= e($image['large']) ?>?v=<?= e($image['version']) ?>"
alt="<?= e($tour->name) ?> – Bild <?= $i + 1 ?>"
loading="lazy" decoding="async">
<span class="gallery-overlay" aria-hidden="true">
<span class="gallery-zoom">
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24"
fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
stroke-linejoin="round">
<circle cx="11" cy="11" r="7"/><path d="m21 21-4.3-4.3"/>
<path d="M11 8v6"/><path d="M8 11h6"/>
</svg>
</span>
</span>
</a>
<form class="gallery-delete"
action="/tour/<?= e($tour->id) ?>/images/delete/<?= e($image['name']) ?>"
method="POST"
onsubmit="return confirm('Dieses Bild wirklich löschen?');">
<?= csrf_field() ?>
<button type="submit" title="Bild löschen" aria-label="Bild löschen">&times;</button>
</form>
</figure>
<?php endforeach; ?>
</div>
<?php endif; ?>
<form class="tour-media-upload" action="/tour/<?= e($tour->id) ?>/images"
method="POST" enctype="multipart/form-data">
<?= csrf_field() ?>
<label class="gallery-drop" id="tourImagesDrop" for="tourImagesInput">
<svg xmlns="http://www.w3.org/2000/svg" width="34" height="34" viewBox="0 0 24 24" fill="none"
stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/>
<path d="m17 8-5-5-5 5"/><path d="M12 3v12"/>
</svg>
<span class="gallery-drop-title">Bilder auswählen</span>
<span class="gallery-drop-hint">oder hierher ziehen</span>
<input class="gallery-file-input" type="file" id="tourImagesInput" name="bilder[]"
accept="image/jpeg,image/png,image/gif,image/webp" multiple>
</label>
<div class="gallery-preview" id="tourImagesPreview" aria-live="polite"></div>
<div class="gallery-upload-actions">
<button type="submit" class="btn btn-primary gallery-btn">Bilder hochladen</button>
</div>
</form>
<p class="tour-media-hint mt-3">
Bitte lade nur Bilder hoch, an denen du die erforderlichen Rechte hast und
abgebildete Personen mit der Veröffentlichung einverstanden sind.
</p>
</section>
<!-- Modal: Zimmer auswählen -->
<div id="myModal" class="modal">
<div class="modal-content">
<span class="close">&times;</span>
<h2>Bitte Zimmer auswählen</h2>
<div class="card-body">
<ul>
<?php $first = true; ?>
<?php foreach ($groups as $key => $group): ?>
<?php if ($key !== 'ungebucht' && $group['free_slots'] > 0): ?>
<?php if (!$first): ?><hr/><?php endif; ?>
<p style="list-style-type: none;">[<?= e($group['id']) ?>]
<span><?= e($group['name']) ?></span>
<b>
<form class="booking_form" action="/tour/<?= e($tour->id) ?>/join4user/<?= e($group['id']) ?>" method="POST" style="display:inline;">
<?= csrf_field() ?>
<input type="hidden" name="user_id" value="">
<button type="submit" style="border:none;background:none;padding:0;cursor:pointer;font-weight:bold;">==> Buchen</button>
</form>
</b>
</p>
<?php $first = false; ?>
<?php foreach ($group['users'] as $room): ?>
<?php if ($room->user_name): ?>
<li> <?= e($room->user_name) ?></li>
<?php endif; ?>
<?php endforeach; ?>
<?php endif; ?>
<?php endforeach; ?>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
<?php endif; ?>
</article>
<div class="col-md-3 mt-2">
<div class="card mt-4">
<div class="card-header"><h5>Teilnehmer</h5></div>
<article class="tour-detail-card">
<section class="tour-media-manager" aria-labelledby="tour-media-title">
<div class="tour-media-head">
<div>
<h2 class="tour-section-title" id="tour-media-title">Tour-Bilder</h2>
<p class="tour-media-hint">Mehrere Bilder möglich. Das neueste Bild wird zuerst angezeigt.</p>
</div>
<span class="tour-media-count"><?= count($tourImages) === 1 ? '1 Bild' : count($tourImages) . ' Bilder' ?></span>
</div>
<div class="card-body">
<?php foreach ($groups as $key => $group): ?>
<div style="border:solid;border-width:1px;">
<div><b><?= e($group['name']) ?>
<?php if ($key !== 'ungebucht'): ?>
<form action="/tour/<?= e($tour->id) ?>/delete_room/<?= e($group['id']) ?>" method="POST" style="display:inline;" class="ts_tooltip">
<?php if ($tourImages === []): ?>
<div class="tour-media-empty">Noch keine Bilder hinterlegt.</div>
<?php else: ?>
<div class="tour-media-grid gallery-grid">
<?php foreach ($tourImages as $i => $image): ?>
<figure class="gallery-item" style="--i:<?= $i % 20 ?>">
<a class="gallery-item-link"
href="<?= e($image['large']) ?>?v=<?= e($image['version']) ?>"
data-lightbox="<?= e($galleryLightbox) ?>"
data-title="<?= e($tour->name) ?> – Bild <?= $i + 1 ?>">
<img src="<?= e($image['large']) ?>?v=<?= e($image['version']) ?>"
alt="<?= e($tour->name) ?> – Bild <?= $i + 1 ?>"
loading="lazy" decoding="async">
<span class="gallery-overlay" aria-hidden="true">
<span class="gallery-zoom">
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24"
fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
stroke-linejoin="round">
<circle cx="11" cy="11" r="7"/><path d="m21 21-4.3-4.3"/>
<path d="M11 8v6"/><path d="M8 11h6"/>
</svg>
</span>
</span>
</a>
<form class="gallery-delete"
action="/tour/<?= e($tour->id) ?>/images/delete/<?= e($image['name']) ?>"
method="POST"
onsubmit="return confirm('Dieses Bild wirklich löschen?');">
<?= csrf_field() ?>
<button type="submit" class="text-primary" style="border:none;background:none;padding:0;cursor:pointer;">(X)</button>
<span class="ts_tooltiptext">Raum Löschen</span>
<button type="submit" title="Bild löschen" aria-label="Bild löschen">&times;</button>
</form>
<?php endif; ?>
</b></div>
<?php foreach ($group['users'] as $room): ?>
<?php if ($room->user_name): ?>
<div> &nbsp; <?= e($room->user_name) ?>
<?php if ($key === 'ungebucht'): ?>
<a href="#" data-user_id="<?= e($room->user_id) ?>" id="myBtn"
class="float-left ts_tooltip">
(+)
<span class="ts_tooltiptext">Zimmer zuweisen</span>
</a>
<?php else: ?>
<form action="/tour/<?= e($tour->id) ?>/join4user/0" method="POST" style="display:inline;" class="float-left ts_tooltip">
<?= csrf_field() ?>
<input type="hidden" name="user_id" value="<?= e($room->user_id) ?>">
<button type="submit" style="border:none;background:none;padding:0;cursor:pointer;">(-)</button>
<span class="ts_tooltiptext">Zimmer-Zuweisung löschen</span>
</form>
<?php endif; ?>
</div>
<?php endif; ?>
</figure>
<?php endforeach; ?>
</div>
<div style="height:2px;"></div>
<?php endforeach; ?>
<?php endif; ?>
<div class="card-header">
<p>
<form action="/tour/<?= e($tour->id) ?>/create_room/1" method="POST" style="display:inline;">
<?= csrf_field() ?>
<button type="submit" class="text-primary" style="border:none;background:none;padding:0;cursor:pointer;">+ Einzelzimmer erstellen</button>
</form>
</p>
<p>
<form action="/tour/<?= e($tour->id) ?>/create_room/2" method="POST" style="display:inline;">
<?= csrf_field() ?>
<button type="submit" class="text-primary" style="border:none;background:none;padding:0;cursor:pointer;">+ Doppelzimmer erstellen</button>
</form>
</p>
</div>
</div>
</div>
<form class="tour-media-upload" action="/tour/<?= e($tour->id) ?>/images"
method="POST" enctype="multipart/form-data">
<?= csrf_field() ?>
<label class="gallery-drop" id="tourImagesDrop" for="tourImagesInput">
<svg xmlns="http://www.w3.org/2000/svg" width="34" height="34" viewBox="0 0 24 24" fill="none"
stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/>
<path d="m17 8-5-5-5 5"/><path d="M12 3v12"/>
</svg>
<span class="gallery-drop-title">Bilder auswählen</span>
<span class="gallery-drop-hint">oder hierher ziehen</span>
<input class="gallery-file-input" type="file" id="tourImagesInput" name="bilder[]"
accept="image/jpeg,image/png,image/gif,image/webp" multiple>
</label>
<div class="gallery-preview" id="tourImagesPreview" aria-live="polite"></div>
<div class="gallery-upload-actions">
<button type="submit" class="btn btn-primary gallery-btn">Bilder hochladen</button>
</div>
</form>
<p class="tour-media-hint mt-3">
Bitte lade nur Bilder hoch, an denen du die erforderlichen Rechte hast und
abgebildete Personen mit der Veröffentlichung einverstanden sind.
</p>
</section>
</article>
</div>
<aside class="col-12 col-lg-4">
<section class="tour-side-card">
<h2 class="tour-side-title">
Teilnehmer
<span class="tour-side-count"><?= count(array_filter($roomMap, static fn(array $room): bool => $room['users'] !== [])) ?> Zimmer belegt</span>
</h2>
<?php if ($roomMap === [] && $unassigned === []): ?>
<p class="tour-side-empty">Noch keine Zimmer und keine Anmeldungen.</p>
<?php endif; ?>
<?php foreach ($roomMap as $roomId => $room): ?>
<div class="tour-room-group">
<p class="tour-room-title">
<?= e($room['name']) ?>
<span class="tour-room-meta"><?= $room['booked'] ?>/<?= $room['capacity'] ?></span>
</p>
<div class="tour-room-tools">
<form action="/tour/<?= e($tour->id) ?>/delete_room/<?= e($roomId) ?>" method="POST"
onsubmit="return confirm('Zimmer wirklich löschen?');">
<?= csrf_field() ?>
<button type="submit" class="tour-icon-btn" title="Zimmer löschen"
aria-label="Zimmer <?= e($room['name']) ?> löschen">
<i class="fas fa-trash-alt" aria-hidden="true"></i>
</button>
</form>
</div>
<?php if ($room['users'] === []): ?>
<p class="tour-side-empty">frei</p>
<?php else: ?>
<ul class="tour-person-list">
<?php foreach ($room['users'] as $participant): ?>
<li class="tour-person">
<span class="tour-person-name"><?= e($participant->user_name) ?></span>
<form action="/tour/<?= e($tour->id) ?>/join4user/0" method="POST">
<?= csrf_field() ?>
<input type="hidden" name="user_id" value="<?= e($participant->user_id) ?>">
<button type="submit" class="tour-person-remove" title="Zimmer-Zuweisung aufheben"
aria-label="Zimmer-Zuweisung von <?= e($participant->user_name) ?> aufheben">
<i class="fas fa-times" aria-hidden="true"></i>
</button>
</form>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</div>
<?php endforeach; ?>
<?php if ($unassigned !== []): ?>
<div class="tour-room-group">
<p class="tour-room-title">Ohne Zimmer <span class="tour-room-meta"><?= count($unassigned) ?></span></p>
<ul class="tour-person-list">
<?php foreach ($unassigned as $participant): ?>
<li class="tour-person">
<span class="tour-person-name"><?= e($participant->user_name) ?></span>
<?php if ($freeRooms !== []): ?>
<button type="button" class="tour-person-assign" data-user-id="<?= e($participant->user_id) ?>"
title="Zimmer zuweisen"
aria-label="Zimmer für <?= e($participant->user_name) ?> wählen">
<i class="fas fa-plus" aria-hidden="true"></i>
</button>
<?php endif; ?>
</li>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
<div class="tour-side-actions">
<form action="/tour/<?= e($tour->id) ?>/create_room/1" method="POST">
<?= csrf_field() ?>
<button type="submit" class="btn btn-outline-light btn-block btn-sm">+ Einzelzimmer</button>
</form>
<form action="/tour/<?= e($tour->id) ?>/create_room/2" method="POST">
<?= csrf_field() ?>
<button type="submit" class="btn btn-outline-light btn-block btn-sm">+ Doppelzimmer</button>
</form>
</div>
</section>
<section class="tour-side-card">
<h2 class="tour-side-title">Schnellzugriff</h2>
<div class="tour-side-actions">
<a class="btn btn-outline-light btn-block" href="/tour/<?= e($tour->id) ?>">
<i class="fas fa-eye" aria-hidden="true"></i> Tour ansehen
</a>
<a class="btn btn-outline-light btn-block" href="/tour">
<i class="fas fa-list" aria-hidden="true"></i> Zur Tourenliste
</a>
</div>
</section>
</aside>
</div>
</div>
<?php if ($freeRooms !== [] && $unassigned !== []): ?>
<div id="myModal" class="modal tour-modal">
<div class="modal-content tour-modal-content">
<span class="close" aria-label="Schließen">&times;</span>
<h2 class="tour-modal-title">Zimmer zuweisen</h2>
<p class="tour-modal-hint">Wähle das Zimmer für die Anmeldung.</p>
<div class="tour-modal-rooms">
<?php foreach ($freeRooms as $roomId => $room): ?>
<form class="booking_form tour-modal-room" action="/tour/<?= e($tour->id) ?>/join4user/<?= e($roomId) ?>" method="POST">
<?= csrf_field() ?>
<input type="hidden" name="user_id" value="">
<span class="tour-modal-room-name"><?= e($room['name']) ?></span>
<span class="tour-modal-room-meta"><?= $room['booked'] ?>/<?= $room['capacity'] ?> belegt</span>
<button type="submit" class="btn btn-success btn-sm">Zuweisen</button>
</form>
<?php endforeach; ?>
</div>
</div>
</div>
<?php endif; ?>
<script>
const elem = document.querySelector('input[name="start"]');
const datepicker_start = new Datepicker(elem, {
'autohide': true,
'format': 'dd.mm.yyyy',
'language': 'de',
'orientation': 'bottom'
});
(function () {
var pickerOptions = {
autohide: true,
format: 'dd.mm.yyyy',
language: 'de',
orientation: 'bottom'
};
const elemEnd = document.querySelector('input[name="end_date"]');
const datepicker_end = new Datepicker(elemEnd, {
'autohide': true,
'format': 'dd.mm.yyyy',
'language': 'de',
'orientation': 'bottom'
});
['start', 'end_date', 'deadline'].forEach(function (name) {
var element = document.querySelector('input[name="' + name + '"]');
const elem2 = document.querySelector('input[name="deadline"]');
const datepicker_deadline = new Datepicker(elem2, {
'autohide': true,
'format': 'dd.mm.yyyy',
'language': 'de',
'orientation': 'bottom'
});
var modal = document.getElementById("myModal");
var btns = document.querySelectorAll("#myBtn");
for (let i = 0; i < btns.length; ++i) {
btns[i].onclick = function (e) {
let user_id = this.dataset.user_id;
var forms = document.querySelectorAll(".booking_form");
for (var j = 0; j < forms.length; j++) {
forms[j].querySelector('input[name="user_id"]').value = user_id;
if (element && typeof Datepicker !== 'undefined') {
new Datepicker(element, pickerOptions);
}
});
e.preventDefault();
modal.style.display = "block";
var modal = document.getElementById('myModal');
if (!modal) {
return;
}
}
var span = document.getElementsByClassName("close")[0];
var forms = modal.querySelectorAll('.booking_form');
var closeBtn = modal.querySelector('.close');
span.onclick = function (e) {
e.preventDefault();
modal.style.display = "none";
}
document.querySelectorAll('.tour-person-assign').forEach(function (button) {
button.addEventListener('click', function () {
var userId = this.dataset.userId || '';
window.onclick = function (event) {
if (event.target == modal) {
modal.style.display = "none";
forms.forEach(function (form) {
var input = form.querySelector('input[name="user_id"]');
if (input) {
input.value = userId;
}
});
modal.style.display = 'block';
});
});
if (closeBtn) {
closeBtn.addEventListener('click', function (event) {
event.preventDefault();
modal.style.display = 'none';
});
}
}
</script>
<script>
modal.addEventListener('click', function (event) {
if (event.target === modal) {
modal.style.display = 'none';
}
});
})();
(function () {
var drop = document.getElementById('tourImagesDrop');
var input = document.getElementById('tourImagesInput');

View file

@ -1,56 +1,68 @@
<?php
$current = auth_check() ? user() : null;
$flashStatus = flash_pull('status');
$flashError = flash_pull('error');
$validationErrors = errors();
unset($_SESSION['_errors']);
$canChangeGuide = $current !== null && $current->isAdmin();
$galleryLightbox = 'tour-bilder-' . $tour->id;
/** @var \App\Models\Tour $tour */
$flashStatus = flash_pull('status');
$flashError = flash_pull('error');
$validationErrors = errors();
unset($_SESSION['_errors']);
$canChangeGuide = $current !== null && $current->isAdmin();
$galleryLightbox = 'tour-bilder-' . $tour->id;
?>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vanillajs-datepicker@1.1.2/dist/css/datepicker-bs4.min.css">
<script src="https://cdn.jsdelivr.net/npm/vanillajs-datepicker@1.1.2/dist/js/datepicker.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vanillajs-datepicker@1.1.2/dist/js/locales/de.js"></script>
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card mt-4">
<div class="card-header"><?= e($tour->name) ?></div>
<div class="container tour-detail">
<div class="row">
<div class="col-12 col-lg-8">
<article class="tour-detail-card">
<header class="tour-detail-head">
<div class="tour-detail-heading">
<h1 class="tour-detail-title">Vergangene Tour bearbeiten</h1>
<p class="tour-detail-sub"><?= e($tour->name) ?> &middot; <?= e($tour->start) ?></p>
</div>
<a class="tour-status is-past" href="/tour/<?= e($tour->id) ?>">Zur Tour</a>
</header>
<div class="card-body">
<?php if ($flashStatus !== null): ?>
<div class="alert alert-success" role="alert"><?= e($flashStatus) ?></div>
<?php endif; ?>
<?php if ($flashStatus !== null): ?>
<div class="tour-alert is-success" role="status"><?= e($flashStatus) ?></div>
<?php endif; ?>
<?php if ($flashError !== null): ?>
<div class="alert alert-danger" role="alert"><?= e($flashError) ?></div>
<?php endif; ?>
<?php if ($flashError !== null): ?>
<div class="tour-alert is-error" role="alert"><?= e($flashError) ?></div>
<?php endif; ?>
<?php if ($validationErrors !== []): ?>
<div class="alert alert-danger" role="alert">
<strong>Bitte die Eingaben prüfen:</strong>
<ul class="mb-0 mt-1">
<?php foreach ($validationErrors as $messages): ?>
<?php foreach ($messages as $message): ?>
<li><?= e($message) ?></li>
<?php endforeach; ?>
<?php if ($validationErrors !== []): ?>
<div class="tour-alert is-error" role="alert">
<strong>Bitte die Eingaben prüfen:</strong>
<ul class="tour-alert-list">
<?php foreach ($validationErrors as $messages): ?>
<?php foreach ($messages as $message): ?>
<li><?= e($message) ?></li>
<?php endforeach; ?>
</ul>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
<form class="tour-form" method="post" action="/tour/<?= e($tour->id) ?>">
<?= csrf_field() ?>
<input type="hidden" name="_method" value="PUT">
<input type="hidden" name="tour_id" value="<?= e($tour->id) ?>">
<div class="tour-form-row">
<label class="tour-form-label" for="name">Name</label>
<div class="tour-form-field">
<input class="form-control" type="text" id="name" name="name"
value="<?= e(old('name') ?? $tour->name) ?>" required>
</div>
<?php endif; ?>
<form style="background-color: #fff;" class="text-dark" method="post" action="/tour/<?= e($tour->id) ?>">
<?= csrf_field() ?>
<input type="hidden" name="_method" value="PUT">
<input type="hidden" name="tour_id" value="<?= e($tour->id) ?>">
<div class="form-group" style="display:flex;">
<label class="ml-2 mt-3 col-form-label col-form-label-sm" style="width:180px; text-align:left;font-size:18px;" for="name">Name:</label>
<input class="mt-3 mr-2 form-control input-sm" type="text" id="name" name="name" value="<?= e(old('name') ?? $tour->name) ?>" required>
</div>
<div class="form-group" style="display:flex;">
<label class="ml-2 mt-3" style="width:180px; text-align:left;font-size:18px;" for="tour_guide_id">Tour Guide:</label>
</div>
<div class="tour-form-row">
<label class="tour-form-label" for="tour_guide_id">Tour Guide</label>
<div class="tour-form-field">
<?php if ($canChangeGuide): ?>
<select class="mt-3 mr-2 form-control input-sm" id="tour_guide_id" name="tour_guide_id" required>
<select class="form-control" id="tour_guide_id" name="tour_guide_id" required>
<?php foreach ($guides as $guide): ?>
<option value="<?= e($guide->id) ?>"<?= (int) $guide->id === (int) $tour->tour_guide_id ? ' selected' : '' ?>>
<?= e($guide->name) ?><?= $guide->role === 'ADMIN' ? ' (Admin)' : ($guide->role === 'TOUR GUIDE' ? ' (Tour Guide)' : '') ?>
@ -58,110 +70,194 @@
<?php endforeach; ?>
</select>
<?php else: ?>
<input class="mt-3 mr-2 form-control input-sm" type="text" value="<?= e($tourGuide ? $tourGuide->name : '') ?>" readonly>
<input class="form-control" type="text" value="<?= e($tourGuide ? $tourGuide->name : '') ?>" readonly>
<input type="hidden" name="tour_guide_id" value="<?= e($tour->tour_guide_id) ?>">
<?php endif; ?>
</div>
</div>
<div class="form-group" style="display:flex;">
<label class="ml-2 mt-3" style="width:180px; text-align:left;font-size:18px;" for="start">Start:</label>
<input class="mt-3 mr-2 form-control input-sm" type="text" id="start" name="start" value="<?= e(old('start') ?? $tour->start) ?>" required>
<div class="tour-form-row">
<label class="tour-form-label" for="start">Start</label>
<div class="tour-form-field">
<input class="form-control" type="text" id="start" name="start"
value="<?= e(old('start') ?? $tour->start) ?>" autocomplete="off" required>
</div>
</div>
<div class="form-group">
<label class="ml-2 mt-3" style="width:140px; text-align:left;font-size:18px;" for="bericht">Bericht:</label>
<textarea class="col-12" name="bericht" rows="10" cols="50"><?= e($tour->bericht) ?></textarea>
<div class="tour-form-row">
<label class="tour-form-label" for="end_date">Ende</label>
<div class="tour-form-field">
<input class="form-control" type="text" id="end_date" name="end_date"
value="<?= e(old('end_date') ?? $tour->end_date) ?>" autocomplete="off"
placeholder="optional – leer lassen bei eintägigen Touren">
</div>
</div>
<a href="/tour/<?= e($tour->id) ?>"><div type="submit" class="btn btn-success col-2 mb-2 float-right mr-2">Abbrechen</div></a>
<button type="submit" class="btn btn-danger col-2 mb-2 float-right mr-2">Speichern</button>
</form>
<div class="tour-form-row has-textarea">
<label class="tour-form-label" for="bericht">Bericht</label>
<div class="tour-form-field">
<textarea class="form-control" id="bericht" name="bericht" rows="10"><?= e($tour->bericht) ?></textarea>
</div>
</div>
<?php if ($current && $current->isAdmin()): ?>
<form action="/tour/<?= e($tour->id) ?>" method="POST" style="clear: both;" class="mt-3 mb-4"
<div class="tour-actions">
<button type="submit" class="btn btn-success">
<i class="fas fa-save" aria-hidden="true"></i> Speichern
</button>
<a class="btn btn-outline-secondary" href="/tour/<?= e($tour->id) ?>">Abbrechen</a>
</div>
</form>
<?php if ($current && $current->isAdmin()): ?>
<div class="tour-danger-zone">
<div>
<p class="tour-danger-title">Tour löschen</p>
<p class="tour-danger-hint">Anmeldungen, Zimmer und Bilder werden ebenfalls entfernt.</p>
</div>
<form action="/tour/<?= e($tour->id) ?>" method="POST"
onsubmit="return confirm('Diese Tour wirklich endgültig löschen? Anmeldungen, Zimmer und Bilder werden ebenfalls entfernt.');">
<?= csrf_field() ?>
<input type="hidden" name="_method" value="DELETE">
<button type="submit" class="btn btn-outline-danger btn-sm">Tour löschen</button>
<button type="submit" class="btn btn-outline-danger btn-sm">Endgültig löschen</button>
</form>
</div>
<?php endif; ?>
</article>
<article class="tour-detail-card">
<section class="tour-media-manager" aria-labelledby="tour-media-title">
<div class="tour-media-head">
<div>
<h2 class="tour-section-title" id="tour-media-title">Tour-Bilder</h2>
<p class="tour-media-hint">Mehrere Bilder möglich. Das neueste Bild wird zuerst angezeigt.</p>
</div>
<span class="tour-media-count"><?= count($tourImages) === 1 ? '1 Bild' : count($tourImages) . ' Bilder' ?></span>
</div>
<?php if ($tourImages === []): ?>
<div class="tour-media-empty">Noch keine Bilder hinterlegt.</div>
<?php else: ?>
<div class="tour-media-grid gallery-grid">
<?php foreach ($tourImages as $i => $image): ?>
<figure class="gallery-item" style="--i:<?= $i % 20 ?>">
<a class="gallery-item-link"
href="<?= e($image['large']) ?>?v=<?= e($image['version']) ?>"
data-lightbox="<?= e($galleryLightbox) ?>"
data-title="<?= e($tour->name) ?> – Bild <?= $i + 1 ?>">
<img src="<?= e($image['large']) ?>?v=<?= e($image['version']) ?>"
alt="<?= e($tour->name) ?> – Bild <?= $i + 1 ?>"
loading="lazy" decoding="async">
<span class="gallery-overlay" aria-hidden="true">
<span class="gallery-zoom">
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24"
fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
stroke-linejoin="round">
<circle cx="11" cy="11" r="7"/><path d="m21 21-4.3-4.3"/>
<path d="M11 8v6"/><path d="M8 11h6"/>
</svg>
</span>
</span>
</a>
<form class="gallery-delete"
action="/tour/<?= e($tour->id) ?>/images/delete/<?= e($image['name']) ?>"
method="POST"
onsubmit="return confirm('Dieses Bild wirklich löschen?');">
<?= csrf_field() ?>
<button type="submit" title="Bild löschen" aria-label="Bild löschen">&times;</button>
</form>
</figure>
<?php endforeach; ?>
</div>
<?php endif; ?>
<section class="tour-media-manager" aria-labelledby="tour-media-title">
<div class="tour-media-head">
<div>
<h4 id="tour-media-title">Tour-Bilder</h4>
<p class="tour-media-hint">Mehrere Bilder möglich. Das neueste Bild wird zuerst angezeigt.</p>
</div>
<span class="tour-media-count"><?= count($tourImages) === 1 ? '1 Bild' : count($tourImages) . ' Bilder' ?></span>
<form class="tour-media-upload" action="/tour/<?= e($tour->id) ?>/images"
method="POST" enctype="multipart/form-data">
<?= csrf_field() ?>
<label class="gallery-drop" id="tourImagesDrop" for="tourImagesInput">
<svg xmlns="http://www.w3.org/2000/svg" width="34" height="34" viewBox="0 0 24 24" fill="none"
stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/>
<path d="m17 8-5-5-5 5"/><path d="M12 3v12"/>
</svg>
<span class="gallery-drop-title">Bilder auswählen</span>
<span class="gallery-drop-hint">oder hierher ziehen</span>
<input class="gallery-file-input" type="file" id="tourImagesInput" name="bilder[]"
accept="image/jpeg,image/png,image/gif,image/webp" multiple>
</label>
<div class="gallery-preview" id="tourImagesPreview" aria-live="polite"></div>
<div class="gallery-upload-actions">
<button type="submit" class="btn btn-primary gallery-btn">Bilder hochladen</button>
</div>
</form>
<?php if ($tourImages === []): ?>
<div class="tour-media-empty">Noch keine Bilder hinterlegt.</div>
<?php else: ?>
<div class="tour-media-grid gallery-grid">
<?php foreach ($tourImages as $i => $image): ?>
<figure class="gallery-item" style="--i:<?= $i % 20 ?>">
<a class="gallery-item-link"
href="<?= e($image['large']) ?>?v=<?= e($image['version']) ?>"
data-lightbox="<?= e($galleryLightbox) ?>"
data-title="<?= e($tour->name) ?> – Bild <?= $i + 1 ?>">
<img src="<?= e($image['large']) ?>?v=<?= e($image['version']) ?>"
alt="<?= e($tour->name) ?> – Bild <?= $i + 1 ?>"
loading="lazy" decoding="async">
<span class="gallery-overlay" aria-hidden="true">
<span class="gallery-zoom">
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24"
fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
stroke-linejoin="round">
<circle cx="11" cy="11" r="7"/><path d="m21 21-4.3-4.3"/>
<path d="M11 8v6"/><path d="M8 11h6"/>
</svg>
</span>
</span>
</a>
<form class="gallery-delete"
action="/tour/<?= e($tour->id) ?>/images/delete/<?= e($image['name']) ?>"
method="POST"
onsubmit="return confirm('Dieses Bild wirklich löschen?');">
<?= csrf_field() ?>
<button type="submit" title="Bild löschen" aria-label="Bild löschen">&times;</button>
</form>
</figure>
<?php endforeach; ?>
</div>
<?php endif; ?>
<form class="tour-media-upload" action="/tour/<?= e($tour->id) ?>/images"
method="POST" enctype="multipart/form-data">
<?= csrf_field() ?>
<label class="gallery-drop" id="tourImagesDrop" for="tourImagesInput">
<svg xmlns="http://www.w3.org/2000/svg" width="34" height="34" viewBox="0 0 24 24" fill="none"
stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/>
<path d="m17 8-5-5-5 5"/><path d="M12 3v12"/>
</svg>
<span class="gallery-drop-title">Bilder auswählen</span>
<span class="gallery-drop-hint">oder hierher ziehen</span>
<input class="gallery-file-input" type="file" id="tourImagesInput" name="bilder[]"
accept="image/jpeg,image/png,image/gif,image/webp" multiple>
</label>
<div class="gallery-preview" id="tourImagesPreview" aria-live="polite"></div>
<div class="gallery-upload-actions">
<button type="submit" class="btn btn-primary gallery-btn">Bilder hochladen</button>
</div>
</form>
</section>
</div>
</div>
<p class="tour-media-hint mt-3">
Bitte lade nur Bilder hoch, an denen du die erforderlichen Rechte hast und
abgebildete Personen mit der Veröffentlichung einverstanden sind.
</p>
</section>
</article>
</div>
<aside class="col-12 col-lg-4">
<section class="tour-side-card">
<h2 class="tour-side-title">
Teilnehmer
<span class="tour-side-count"><?= count($users ?? []) ?>/<?= (int) $tour->max_participants ?></span>
</h2>
<?php if (empty($users)): ?>
<p class="tour-side-empty">Niemand hat teilgenommen.</p>
<?php else: ?>
<ul class="tour-person-list">
<?php foreach ($users as $participant): ?>
<li class="tour-person">
<span class="tour-person-name">
<i class="fas fa-biking" aria-hidden="true"></i>
<?= e($participant->name) ?>
</span>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</section>
<section class="tour-side-card">
<h2 class="tour-side-title">Schnellzugriff</h2>
<div class="tour-side-actions">
<a class="btn btn-outline-light btn-block" href="/tour/<?= e($tour->id) ?>">
<i class="fas fa-eye" aria-hidden="true"></i> Tour ansehen
</a>
<a class="btn btn-outline-light btn-block" href="/tour">
<i class="fas fa-list" aria-hidden="true"></i> Zur Tourenliste
</a>
</div>
</section>
</aside>
</div>
</div>
<script>
(function () {
var pickerOptions = {
autohide: true,
format: 'dd.mm.yyyy',
language: 'de',
orientation: 'bottom'
};
['start', 'end_date'].forEach(function (name) {
var element = document.querySelector('input[name="' + name + '"]');
if (element && typeof Datepicker !== 'undefined') {
new Datepicker(element, pickerOptions);
}
});
})();
(function () {
var drop = document.getElementById('tourImagesDrop');
var input = document.getElementById('tourImagesInput');