feat: implement mutability cutoff for rentals
addresses #869cca42x
This commit is contained in:
1 parent
752e6752b4
commit
cb56a4fe46
9 files changed
+253
-8
No files matched your search
@@ -23,6 +23,7 @@ use App\Form\Service\Condition\RoomSelectionCondition;
|
||||
use App\Form\Service\Condition\ServiceSubTypeCondition;
|
||||
use App\Form\Service\Condition\SingleRoomTypeCondition;
|
||||
use App\Form\Service\Condition\SkiPassSelectionCondition;
|
||||
use App\Form\Service\Condition\TravelStartCutoffReachedCondition;
|
||||
use App\Service\ParticipantEligibilityService;
|
||||
|
||||
/**
|
||||
@@ -79,6 +80,10 @@ class CreateFieldStateProvider extends AbstractFieldStateProvider
|
||||
|
||||
$rentalCondition = new RentalSelectionCondition();
|
||||
$skiPassCondition = new SkiPassSelectionCondition();
|
||||
// Booking-level D-4 cutoff used to lock mutable service selections close to departure.
|
||||
$serviceCutoffReachedCondition = new TravelStartCutoffReachedCondition(
|
||||
TravelStartCutoffReachedCondition::DEFAULT_DAYS_BEFORE_START
|
||||
);
|
||||
|
||||
// First participant read-only condition
|
||||
// Render personal data fields as static text for first participant in non-internal agency bookings
|
||||
@@ -177,13 +182,15 @@ class CreateFieldStateProvider extends AbstractFieldStateProvider
|
||||
),
|
||||
];
|
||||
|
||||
// Show rentals only when both date of birth is provided AND skipass is selected AND participant is eligible
|
||||
// Show rentals only when both date of birth is provided AND skipass is selected AND participant is eligible.
|
||||
// From D-4 onward, keep rentals visible but make them read-only.
|
||||
$this->fieldStateConditions['rentals'] = [
|
||||
'hidden' => CompositeCondition::or(
|
||||
CompositeCondition::not($dateOfBirthProvidedCondition),
|
||||
CompositeCondition::not($skiPassCondition),
|
||||
$bookingEligibilityCondition
|
||||
),
|
||||
'readonly' => $serviceCutoffReachedCondition,
|
||||
];
|
||||
|
||||
$this->fieldStateConditions['board'] = [
|
||||
|
||||
Reference in new issue
Block a user