fix: avoid selection trap for mandatory services with age constraints
This commit is contained in:
@@ -191,11 +191,18 @@ class ParticipantFieldOptionsProvider extends AbstractFieldOptionsProvider
|
||||
|
||||
$attributes = [];
|
||||
|
||||
// Make readonly and checked for mandatory services (pre-selection handled by service layer)
|
||||
// Make mandatory services readonly only when actually selected by participant.
|
||||
// Unselected mandatory services remain interactive so the user can select them
|
||||
// after age changes (e.g. agency skeleton bookings where DOB is corrected).
|
||||
if (true === $service->mandatory) {
|
||||
$attributes['checked'] = true;
|
||||
$attributes['readonly'] = true;
|
||||
$attributes['data-tooltip'] = 'Diese Leistung ist nicht abwählbar';
|
||||
$participant = $bookingDto->getParticipant($participantIndex);
|
||||
$isSelected = null !== $participant
|
||||
&& $this->hasServiceById($participant->additionalServices, $service->id);
|
||||
|
||||
if (true === $isSelected) {
|
||||
$attributes['readonly'] = true;
|
||||
$attributes['data-tooltip'] = 'Diese Leistung ist nicht abwählbar';
|
||||
}
|
||||
}
|
||||
|
||||
// Add service description as data attribute for frontend use
|
||||
|
||||
Reference in New Issue
Block a user