Zimmerliste: kompakte Kopfzeile, abgegrenzte Karten, Einzel- vor Doppelzimmer
This commit is contained in:
parent
74f007fe72
commit
2c72a2807d
3 changed files with 142 additions and 40 deletions
|
|
@ -1022,8 +1022,8 @@ p {
|
|||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: .5rem;
|
||||
padding: .35rem 0;
|
||||
border-bottom: 1px solid rgba(255, 255, 255, .08);
|
||||
padding: .22rem 0;
|
||||
border-bottom: 1px solid rgba(255, 255, 255, .07);
|
||||
font-size: .9rem;
|
||||
}
|
||||
|
||||
|
|
@ -1051,32 +1051,48 @@ p {
|
|||
}
|
||||
|
||||
.tour-room-group {
|
||||
margin-top: .75rem;
|
||||
padding-top: .6rem;
|
||||
border-top: 1px solid rgba(255, 255, 255, .1);
|
||||
margin-top: .55rem;
|
||||
padding: .55rem .7rem .6rem;
|
||||
border: 1px solid rgba(255, 255, 255, .14);
|
||||
border-radius: 10px;
|
||||
background: rgba(255, 255, 255, .05);
|
||||
}
|
||||
|
||||
.tour-room-group:first-of-type {
|
||||
margin-top: 0;
|
||||
padding-top: 0;
|
||||
border-top: 0;
|
||||
}
|
||||
|
||||
.tour-room-title {
|
||||
.tour-room-group.is-unassigned {
|
||||
border-style: dashed;
|
||||
background: rgba(78, 161, 255, .08);
|
||||
}
|
||||
|
||||
.tour-room-head {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: .5rem;
|
||||
margin: 0 0 .25rem;
|
||||
}
|
||||
|
||||
.tour-room-heading {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: .45rem;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.tour-room-name {
|
||||
color: #fff;
|
||||
font-size: .88rem;
|
||||
font-weight: 600;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.tour-room-meta {
|
||||
color: rgba(255, 255, 255, .65);
|
||||
font-size: .78rem;
|
||||
color: rgba(255, 255, 255, .6);
|
||||
font-size: .76rem;
|
||||
font-weight: 500;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* Bildergalerie der Detailansicht */
|
||||
|
|
@ -1358,9 +1374,9 @@ p {
|
|||
/* Zimmer- und Personenverwaltung in der Seitenspalte */
|
||||
.tour-room-tools {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: .35rem;
|
||||
margin: -.1rem 0 .3rem;
|
||||
align-items: center;
|
||||
margin: 0 0 0 auto;
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
|
||||
.tour-icon-btn {
|
||||
|
|
|
|||
|
|
@ -34,6 +34,22 @@ foreach (($rooms ?? []) as $row) {
|
|||
}
|
||||
}
|
||||
|
||||
// Einzelzimmer zuerst, danach Doppelzimmer; freie Zimmer je Sektion unten.
|
||||
uasort($roomMap, static function (array $a, array $b): int {
|
||||
if ($a['capacity'] !== $b['capacity']) {
|
||||
return $a['capacity'] <=> $b['capacity'];
|
||||
}
|
||||
|
||||
$aFree = $a['booked'] >= $a['capacity'];
|
||||
$bFree = $b['booked'] >= $b['capacity'];
|
||||
|
||||
if ($aFree !== $bFree) {
|
||||
return $aFree <=> $bFree;
|
||||
}
|
||||
|
||||
return 0;
|
||||
});
|
||||
|
||||
$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">
|
||||
|
|
@ -274,13 +290,13 @@ $freeRooms = array_filter($roomMap, static fn(array $room): bool => $room['booke
|
|||
|
||||
<?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-head">
|
||||
<div class="tour-room-heading">
|
||||
<span class="tour-room-name"><?= e($room['name']) ?></span>
|
||||
<span class="tour-room-meta"><?= $room['booked'] ?>/<?= $room['capacity'] ?></span>
|
||||
</div>
|
||||
|
||||
<div class="tour-room-tools">
|
||||
<form action="/tour/<?= e($tour->id) ?>/delete_room/<?= e($roomId) ?>" method="POST"
|
||||
<form class="tour-room-tools" 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"
|
||||
|
|
@ -313,8 +329,13 @@ $freeRooms = array_filter($roomMap, static fn(array $room): bool => $room['booke
|
|||
<?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>
|
||||
<div class="tour-room-group is-unassigned">
|
||||
<div class="tour-room-head">
|
||||
<div class="tour-room-heading">
|
||||
<span class="tour-room-name">Ohne Zimmer</span>
|
||||
<span class="tour-room-meta"><?= count($unassigned) ?></span>
|
||||
</div>
|
||||
</div>
|
||||
<ul class="tour-person-list">
|
||||
<?php foreach ($unassigned as $participant): ?>
|
||||
<li class="tour-person">
|
||||
|
|
|
|||
|
|
@ -34,32 +34,66 @@ $isPast = false;
|
|||
</h2>
|
||||
|
||||
<?php
|
||||
// Buchungen nach Zimmer gruppieren (Quelle: TourRoom::fetchRooms)
|
||||
$roomsByName = [];
|
||||
// Zimmer aus der Zimmerliste aufbauen (auch freie), Buchungen zuordnen.
|
||||
$roomsById = [];
|
||||
|
||||
foreach (($roomOptions ?? []) as $room) {
|
||||
$roomsById[(string) $room['id']] = [
|
||||
'name' => (string) $room['name'],
|
||||
'capacity' => (int) $room['capacity'],
|
||||
'people' => [],
|
||||
];
|
||||
}
|
||||
|
||||
$unassigned = [];
|
||||
|
||||
foreach (($rooms ?? []) as $row) {
|
||||
$name = (string) $row->room_name;
|
||||
|
||||
if (!isset($roomsByName[$name])) {
|
||||
$roomsByName[$name] = ['capacity' => (int) $row->capacity, 'people' => []];
|
||||
if (empty($row->user_name)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!empty($row->user_name)) {
|
||||
$roomsByName[$name]['people'][] = $row;
|
||||
$key = (string) ($row->room_id ?? '');
|
||||
|
||||
if (isset($roomsById[$key])) {
|
||||
$roomsById[$key]['people'][] = $row;
|
||||
} else {
|
||||
$unassigned[] = $row;
|
||||
}
|
||||
}
|
||||
|
||||
// Einzelzimmer zuerst, danach Doppelzimmer; freie Zimmer je Sektion unten.
|
||||
uasort($roomsById, static function (array $a, array $b): int {
|
||||
if ($a['capacity'] !== $b['capacity']) {
|
||||
return $a['capacity'] <=> $b['capacity'];
|
||||
}
|
||||
|
||||
$aFree = count($a['people']) >= $a['capacity'];
|
||||
$bFree = count($b['people']) >= $b['capacity'];
|
||||
|
||||
if ($aFree !== $bFree) {
|
||||
return $aFree <=> $bFree;
|
||||
}
|
||||
|
||||
return 0;
|
||||
});
|
||||
?>
|
||||
|
||||
<?php if (empty($users)): ?>
|
||||
<?php if ($roomsById === [] && $unassigned === []): ?>
|
||||
<p class="tour-side-empty">Noch keine Anmeldungen.</p>
|
||||
<?php else: ?>
|
||||
<?php foreach ($roomsByName as $roomName => $roomGroup): ?>
|
||||
<div class="tour-room-group">
|
||||
<p class="tour-room-title">
|
||||
<?= e($roomName) ?>
|
||||
<span class="tour-room-meta"><?= count($roomGroup['people']) ?>/<?= $roomGroup['capacity'] ?></span>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php foreach ($roomsById as $roomGroup): ?>
|
||||
<div class="tour-room-group">
|
||||
<div class="tour-room-head">
|
||||
<div class="tour-room-heading">
|
||||
<span class="tour-room-name"><?= e($roomGroup['name']) ?></span>
|
||||
<span class="tour-room-meta"><?= count($roomGroup['people']) ?>/<?= $roomGroup['capacity'] ?></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ($roomGroup['people'] === []): ?>
|
||||
<p class="tour-side-empty">frei</p>
|
||||
<?php else: ?>
|
||||
<ul class="tour-person-list">
|
||||
<?php foreach ($roomGroup['people'] as $participant): ?>
|
||||
<li class="tour-person">
|
||||
|
|
@ -79,8 +113,39 @@ $isPast = false;
|
|||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
|
||||
<?php if ($unassigned !== []): ?>
|
||||
<div class="tour-room-group is-unassigned">
|
||||
<div class="tour-room-head">
|
||||
<div class="tour-room-heading">
|
||||
<span class="tour-room-name">Ohne Zimmer</span>
|
||||
<span class="tour-room-meta"><?= count($unassigned) ?></span>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
|
||||
<ul class="tour-person-list">
|
||||
<?php foreach ($unassigned as $participant): ?>
|
||||
<li class="tour-person">
|
||||
<span class="tour-person-name">
|
||||
<i class="fas fa-biking" aria-hidden="true"></i>
|
||||
<?= e($participant->user_name) ?>
|
||||
</span>
|
||||
<?php if ($canManage && !empty($participant->user_id)): ?>
|
||||
<form action="/tour/<?= e($tour->id) ?>/cancelBookingAdmin/<?= e($participant->user_id) ?>" method="POST">
|
||||
<?= csrf_field() ?>
|
||||
<button type="submit" class="tour-person-remove" title="Anmeldung entfernen"
|
||||
aria-label="Anmeldung von <?= e($participant->user_name) ?> entfernen">
|
||||
<i class="fas fa-times" aria-hidden="true"></i>
|
||||
</button>
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</section>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue