wip: skipass-duration based rentals filtering

This commit is contained in:
Björn Fromme
2025-09-10 14:26:18 +02:00
parent 5469c834a6
commit b6f991b291
8 changed files with 288 additions and 17 deletions
@@ -12,6 +12,7 @@ use App\Form\Service\Condition\FieldValueCondition;
use App\Form\Service\Condition\RentalSelectionCondition;
use App\Form\Service\Condition\RoomSelectionCondition;
use App\Form\Service\Condition\ServiceSubTypeCondition;
use App\Form\Service\Condition\SkiPassSelectionCondition;
/**
* Field state provider for the booking create workflow.
@@ -55,6 +56,7 @@ class CreateFieldStateProvider extends AbstractFieldStateProvider
protected function registerFieldStateConditions(): void
{
$rentalCondition = new RentalSelectionCondition();
$skiPassCondition = new SkiPassSelectionCondition();
// Hide body dimensions section unless rental services are selected
$this->fieldStateConditions['bodyDimensions'] = [
@@ -73,8 +75,12 @@ class CreateFieldStateProvider extends AbstractFieldStateProvider
'hidden' => CompositeCondition::not($dateOfBirthProvidedCondition),
];
// Show rentals only when both date of birth is provided AND skipass is selected
$this->fieldStateConditions['rentals'] = [
'hidden' => CompositeCondition::not($dateOfBirthProvidedCondition),
'hidden' => CompositeCondition::or(
CompositeCondition::not($dateOfBirthProvidedCondition),
CompositeCondition::not($skiPassCondition)
),
];
$this->fieldStateConditions['board'] = [