feat: authenticated booking

This commit is contained in:
Björn Fromme
2025-10-24 17:07:08 +02:00
parent 647a25a78f
commit b63804df88
13 changed files with 866 additions and 50 deletions
+59 -5
View File
@@ -7,6 +7,7 @@ namespace App\Form\Service;
use App\BusProNet\Utility\DirectionMapper;
use App\Form\Service\Abstract\AbstractFieldStateProvider;
use App\Form\Service\Condition\ApplicantCondition;
use App\Form\Service\Condition\AuthenticatedUserPersonalDataCondition;
use App\Form\Service\Condition\BookingEligibilityCondition;
use App\Form\Service\Condition\BulkInsuranceBookingCondition;
use App\Form\Service\Condition\CompositeCondition;
@@ -73,6 +74,64 @@ class CreateFieldStateProvider extends AbstractFieldStateProvider
$rentalCondition = new RentalSelectionCondition();
$skiPassCondition = new SkiPassSelectionCondition();
// Authenticated user personal data protection
// Hide personal data fields for participants linked to BPN accounts (prevents duplicate records)
$authenticatedUserCondition = new AuthenticatedUserPersonalDataCondition();
$this->fieldStateConditions['firstName'] = [
'hidden' => $authenticatedUserCondition,
];
$this->fieldStateConditions['lastName'] = [
'hidden' => $authenticatedUserCondition,
];
$this->fieldStateConditions['gender'] = [
'hidden' => $authenticatedUserCondition,
];
$this->fieldStateConditions['nationality'] = [
'hidden' => $authenticatedUserCondition,
];
$this->fieldStateConditions['dateOfBirth'] = [
'hidden' => $authenticatedUserCondition,
];
$this->fieldStateConditions['email'] = [
'hidden' => $authenticatedUserCondition,
];
// Mobile field: hidden for authenticated users, required for guest applicants
$this->fieldStateConditions['mobile'] = [
'hidden' => $authenticatedUserCondition,
'required' => new ApplicantCondition(),
];
// Address subfields - must be hidden to prevent creating duplicate BPN records
$this->fieldStateConditions['address.street'] = [
'hidden' => $authenticatedUserCondition,
];
$this->fieldStateConditions['address.postCode'] = [
'hidden' => $authenticatedUserCondition,
];
$this->fieldStateConditions['address.city'] = [
'hidden' => $authenticatedUserCondition,
];
$this->fieldStateConditions['address.country'] = [
'hidden' => $authenticatedUserCondition,
];
$this->fieldStateConditions['address.district'] = [
'hidden' => $authenticatedUserCondition,
];
// Note: Body dimensions (height, weight, shoeSize) are NOT hidden for authenticated users
// These are preferences/measurements that can be updated without creating duplicate records
// Hide body dimensions section unless rental services are selected
$this->fieldStateConditions['bodyDimensions'] = [
'hidden' => CompositeCondition::not($rentalCondition),
@@ -195,11 +254,6 @@ class CreateFieldStateProvider extends AbstractFieldStateProvider
'hidden' => FieldValueCondition::equals('parking', false),
];
// Make mobile field required for applicant (participant index 0)
$this->fieldStateConditions['mobile'] = [
'required' => new ApplicantCondition(),
];
// Make address field required for applicant (participant index 0)
$this->fieldStateConditions['address'] = [
'required' => new ApplicantCondition(),