feat: implement mutability cutoff for rentals
addresses #869cca42x
This commit is contained in:
@@ -22,6 +22,7 @@ use App\Form\Service\Condition\RentalSelectionCondition;
|
||||
use App\Form\Service\Condition\RoomSelectionCondition;
|
||||
use App\Form\Service\Condition\ServiceSubTypeCondition;
|
||||
use App\Form\Service\Condition\SkiPassSelectionCondition;
|
||||
use App\Form\Service\Condition\TravelStartCutoffReachedCondition;
|
||||
use App\Form\Service\Condition\TransportationServicesMutabilityCondition;
|
||||
|
||||
/**
|
||||
@@ -48,6 +49,10 @@ class EditFieldStateProvider extends AbstractFieldStateProvider
|
||||
$additionalServicesMutabilityCondition = new AdditionalServicesMutabilityCondition();
|
||||
$transportationServicesMutabilityCondition = new TransportationServicesMutabilityCondition();
|
||||
$pickupsMutabilityCondition = new PickupsMutabilityCondition();
|
||||
// Booking-level D-4 cutoff used in addition to BPN mutability flags.
|
||||
$serviceCutoffReachedCondition = new TravelStartCutoffReachedCondition(
|
||||
TravelStartCutoffReachedCondition::DEFAULT_DAYS_BEFORE_START
|
||||
);
|
||||
|
||||
// Personal data protection in edit mode:
|
||||
// 1. First participant in non-internal agency booking - always read-only (first participant = applicant)
|
||||
@@ -155,14 +160,18 @@ class EditFieldStateProvider extends AbstractFieldStateProvider
|
||||
'readonly' => $additionalServicesMutabilityCondition,
|
||||
];
|
||||
|
||||
// Rentals - shown only when skipass selected, readonly if services not mutable
|
||||
// Rentals - shown only when skipass selected.
|
||||
// Read-only when either BPN additional services are immutable OR the D-4 cutoff is reached.
|
||||
// For first participant: only check skipass, not DOB
|
||||
$this->fieldStateConditions['rentals'] = [
|
||||
'hidden' => CompositeCondition::or(
|
||||
$hideUntilDobCondition,
|
||||
CompositeCondition::not($skiPassCondition)
|
||||
),
|
||||
'readonly' => $additionalServicesMutabilityCondition,
|
||||
'readonly' => CompositeCondition::or(
|
||||
$additionalServicesMutabilityCondition,
|
||||
$serviceCutoffReachedCondition
|
||||
),
|
||||
];
|
||||
|
||||
// Rental insurance - shown only when rentals selected AND LVS services exist, readonly if services not mutable
|
||||
|
||||
Reference in New Issue
Block a user