feat: hide parking from participants under 18
This commit is contained in:
@@ -8,6 +8,7 @@ use App\BusProNet\Utility\DirectionMapper;
|
||||
use App\Form\Model\BookingDto;
|
||||
use App\Form\Service\Abstract\AbstractFieldStateProvider;
|
||||
use App\Form\Service\Condition\AdditionalServicesMutabilityCondition;
|
||||
use App\Form\Service\Condition\AgeRangeCondition;
|
||||
use App\Form\Service\Condition\ApplicantCondition;
|
||||
use App\Form\Service\Condition\AuthenticatedUserPersonalDataCondition;
|
||||
use App\Form\Service\Condition\BookingModeCondition;
|
||||
@@ -188,10 +189,15 @@ class EditFieldStateProvider extends AbstractFieldStateProvider
|
||||
'readonly' => $pickupsMutabilityCondition,
|
||||
];
|
||||
|
||||
// Parking - shown only when outbound transportation is PKW, readonly if transportation not mutable
|
||||
// Parking - shown only when outbound transportation is PKW AND participant is 18+, readonly if transportation not mutable
|
||||
// Participants under 18 cannot drive in Germany, so parking is not relevant for them
|
||||
$minimumDrivingAgeCondition = new AgeRangeCondition(18);
|
||||
$this->fieldStateConditions['parking'] = [
|
||||
'hidden' => CompositeCondition::not(
|
||||
ServiceSubTypeCondition::equals('transportationOutbound', DirectionMapper::SUBTYPE_CAR_API)
|
||||
'hidden' => CompositeCondition::or(
|
||||
CompositeCondition::not(
|
||||
ServiceSubTypeCondition::equals('transportationOutbound', DirectionMapper::SUBTYPE_CAR_API)
|
||||
),
|
||||
CompositeCondition::not($minimumDrivingAgeCondition)
|
||||
),
|
||||
'readonly' => $transportationServicesMutabilityCondition,
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user