wip: improved booking summary

This commit is contained in:
Björn Fromme
2025-07-24 12:44:38 +02:00
parent 787e76c21c
commit 2b122a7cc4
11 changed files with 168 additions and 90 deletions
+47
View File
@@ -137,4 +137,51 @@ class BookingService
'participantCount' => $participantCount,
];
}
/**
* Groups available rooms by selection type ('by_pax' or 'by_room').
*
* @param array<int, Room> $rooms Rooms indexed by room ID
* @return array{by_pax: array<int, Room>, by_room: array<int, Room>}
*/
public function groupRoomsBySelectionType(array $rooms): array
{
$groups = [
'by_pax' => [],
'by_room' => [],
];
foreach ($rooms as $room) {
if (stripos($room->label, 'bett') !== false) {
$groups['by_pax'][$room->id] = $room;
} else {
$groups['by_room'][$room->id] = $room;
}
}
return $groups;
}
/**
* Groups roomSelections by selection type ('by_pax' or 'by_room'), using Room::getSelectionType().
*
* @param array $roomSelections Array of selected RoomSelectionDto
* @param array<int, Room> $roomsById Rooms indexed by room ID
* @return array{by_pax: array, by_room: array}
*/
public function groupRoomSelectionsByType(array $roomSelections, array $roomsById): array
{
$groups = [
'by_pax' => [],
'by_room' => [],
];
foreach ($roomSelections as $roomSelection) {
$room = $roomsById[$roomSelection->roomId] ?? null;
if ($room) {
$type = $room->getSelectionType();
$groups[$type][] = $roomSelection;
}
}
return $groups;
}
}