feat: auto-booking services
addresses #869cfcptv
This commit is contained in:
@@ -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';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user