diff --git a/motorradig/public/css/custom.css b/motorradig/public/css/custom.css index e492716..f279c1b 100644 --- a/motorradig/public/css/custom.css +++ b/motorradig/public/css/custom.css @@ -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; diff --git a/motorradig/src/Controllers/TourController.php b/motorradig/src/Controllers/TourController.php index 4f3133b..a56abcf 100644 --- a/motorradig/src/Controllers/TourController.php +++ b/motorradig/src/Controllers/TourController.php @@ -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), ]); } diff --git a/motorradig/src/Core/View.php b/motorradig/src/Core/View.php index 2e440cd..92d06a5 100644 --- a/motorradig/src/Core/View.php +++ b/motorradig/src/Core/View.php @@ -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; } } diff --git a/motorradig/views/tour/edit.php b/motorradig/views/tour/edit.php index 145ee1c..f3fccba 100644 --- a/motorradig/views/tour/edit.php +++ b/motorradig/views/tour/edit.php @@ -1,78 +1,96 @@ 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']); +?> -
-
-
-
-
name) ?>
+
+
+
+
+
+
+

Tour bearbeiten

+

name) ?> · start) ?>

+
+ Zur Tour +
-
- - - + +
+ - - - + + + - - + -
- - - + + + + -
- - + +
+
+
-
- - +
+ +
-
+
-
- - +
+ +
+
+
-
- - + +
+ + placeholder="optional – leer lassen bei eintägigen Touren"> -
+

+
-
- - +
+ +
+
+
-
- - + +
+
+
-
- - is_cancelled ? 'checked' : '' ?>> +
+ Status +
+
+
-
- +
+ +
+
+
- -
Abbrechen
-
- - +
+ + Abbrechen +
+ - isAdmin()): ?> -
isAdmin()): ?> +
+
+

Tour löschen

+

Anmeldungen, Zimmer und Bilder werden ebenfalls entfernt.

+
+ - + - - -
-
-
-

Tour-Bilder

-

Mehrere Bilder möglich. Das neueste Bild wird zuerst angezeigt.

-
- -
- - -
Noch keine Bilder hinterlegt.
- - - - -
- - - - - - - -
- -

- Bitte lade nur Bilder hoch, an denen du die erforderlichen Rechte hast und - abgebildete Personen mit der Veröffentlichung einverstanden sind. -

-
- - - -
-
-
+ +
-
-
-
Teilnehmer
+
+
+
+
+

Tour-Bilder

+

Mehrere Bilder möglich. Das neueste Bild wird zuerst angezeigt.

+
+ +
-
- $group): ?> -
-
- -
+ +
Noch keine Bilder hinterlegt.
+ +
- - - user_name): ?> -
  user_name) ?> - - - (+) - Zimmer zuweisen - - -
- - - - Zimmer-Zuweisung löschen -
- -
- +
-
- + -
-

-

- - -
-

-

-

- - -
-

-
-
-
+
+ + + + + + + +
+ +

+ Bitte lade nur Bilder hoch, an denen du die erforderlichen Rechte hast und + abgebildete Personen mit der Veröffentlichung einverstanden sind. +

+
+
+ +
+ + + + - + -
-
-
-
-
name) ?>
+
+
+
+
+
+
+

Vergangene Tour bearbeiten

+

name) ?> · start) ?>

+
+ Zur Tour +
-
- - - + +
+ - - - + + + - - + + +
+ + + + +
+ +
+
- - - - - - - -
- - -
- -
- +
+
+ +
-
+
-
- - +
+ +
+
+
-
- - +
+ +
+
+
-
Abbrechen
- - +
+ +
+ +
+
- isAdmin()): ?> -
+ + Abbrechen +
+ + + isAdmin()): ?> +
+
+

Tour löschen

+

Anmeldungen, Zimmer und Bilder werden ebenfalls entfernt.

+
+
- +
+
+ +
+ +
+
+
+
+

Tour-Bilder

+

Mehrere Bilder möglich. Das neueste Bild wird zuerst angezeigt.

+
+ +
+ + +
Noch keine Bilder hinterlegt.
+ + -
-
-
-

Tour-Bilder

-

Mehrere Bilder möglich. Das neueste Bild wird zuerst angezeigt.

-
- +
+ + + + + + + +
- -
Noch keine Bilder hinterlegt.
- - - - -
- - - - - - - -
-
-
-
+

+ Bitte lade nur Bilder hoch, an denen du die erforderlichen Rechte hast und + abgebildete Personen mit der Veröffentlichung einverstanden sind. +

+ +
+ +