feat: auto-booking services

addresses #869cfcptv
This commit is contained in:
Björn Fromme
2026-03-16 20:24:58 +01:00
parent 6d9265de0f
commit c510cbf590
19 changed files with 1829 additions and 72 deletions
@@ -249,13 +249,26 @@ class ParticipantFieldOptionsProvider extends AbstractFieldOptionsProvider
$attributes = [];
// Make mandatory services readonly only when actually selected by participant.
if (true === $service->mandatory) {
$participant = $bookingDto->getParticipant($participantIndex);
$isSelected = null !== $participant
&& $this->hasServiceById($participant->board, $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
if (null !== $service->description && '' !== trim($service->description)) {
$attributes['data-description'] = $service->description;
}
// Make readonly if service is unavailable (intelligently handles edit mode)
if ($this->shouldMakeServiceReadonly($service, $bookingDto, $participantIndex, 'board')) {
// Make readonly if service is unavailable (only if not already mandatory)
if (false === $service->mandatory
&& $this->shouldMakeServiceReadonly($service, $bookingDto, $participantIndex, 'board')) {
$attributes['readonly'] = true;
$attributes['data-tooltip'] = 'ausgebucht';
}
@@ -361,13 +374,26 @@ class ParticipantFieldOptionsProvider extends AbstractFieldOptionsProvider
$attributes = [];
// Make mandatory services readonly only when actually selected by participant.
if (true === $service->mandatory) {
$participant = $bookingDto->getParticipant($participantIndex);
$isSelected = null !== $participant
&& $this->hasServiceById($participant->rentals, $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
if (null !== $service->description && '' !== trim($service->description)) {
$attributes['data-description'] = $service->description;
}
// Make readonly if service is unavailable (intelligently handles edit mode)
if ($this->shouldMakeServiceReadonly($service, $bookingDto, $participantIndex, 'rentals')) {
// Make readonly if service is unavailable (only if not already mandatory)
if (false === $service->mandatory
&& $this->shouldMakeServiceReadonly($service, $bookingDto, $participantIndex, 'rentals')) {
$attributes['readonly'] = true;
$attributes['data-tooltip'] = 'ausgebucht';
}