feat: make room selection fields read-only for single room type

This commit is contained in:
Björn Fromme
2026-03-16 11:59:10 +01:00
parent e3081e56f8
commit 66ccebb02b
@@ -84,7 +84,7 @@ class ParticipantFieldOptionsProvider extends AbstractFieldOptionsProvider
// Room assignment field provider (only available for create workflow)
$this->fieldOptionProviders['assignedRoomId'] = fn (BookingDtoInterface $bookingDto, int $participantIndex, array $options = []) => [
'label' => 'Zimmer',
'placeholder' => 'Bitte wählen',
'placeholder' => 'Nicht zugeordnet',
// Use factory to create context-aware choice loader that:
// - Shows only available rooms for this participant
// - Excludes rooms already assigned to other participants
@@ -96,6 +96,9 @@ class ParticipantFieldOptionsProvider extends AbstractFieldOptionsProvider
$participantIndex
)
: null,
// Make field read-only when only one room type is selected
// Room is auto-assigned, no user choice needed
'disabled' => $bookingDto instanceof BookingCreateDto && 1 === count($bookingDto->getSelectedRooms()),
];
// Courses field provider - provides age-appropriate courses from travel data