feat: hide parking from participants under 18

This commit is contained in:
Björn Fromme
2025-12-10 14:37:06 +01:00
parent 346dee23e4
commit 7665385cbf
4 changed files with 300 additions and 19 deletions
+9 -3
View File
@@ -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,
];