feat: remove room selection field entirely for single room type
addresses #869axcukn
This commit is contained in:
@@ -151,6 +151,30 @@ class BookingDto
|
||||
return null !== $this->booking && 'O' === $this->booking->status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the label of the single selected room type.
|
||||
*
|
||||
* Returns the room label when exactly one room type is selected (auto-assignment scenario).
|
||||
* Used by templates to display the room assignment when the dropdown is hidden.
|
||||
*
|
||||
* @return string|null The room label or null if not a single room type scenario
|
||||
*/
|
||||
public function getSingleRoomLabel(): ?string
|
||||
{
|
||||
$selectedRooms = $this->getSelectedRooms();
|
||||
|
||||
// Only return label when exactly one room type selected
|
||||
if (1 !== count($selectedRooms)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$roomSelection = reset($selectedRooms);
|
||||
$availableRooms = $this->travel->getAvailableRooms();
|
||||
$room = $availableRooms[$roomSelection->roomId] ?? null;
|
||||
|
||||
return $room?->label;
|
||||
}
|
||||
|
||||
#[Assert\Callback(callback: 'validateRoomSelection', groups: ['booking_create_step_1'])]
|
||||
public function validateRoomSelection(ExecutionContextInterface $context): void
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user