wip: improved booking summary
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user