From b71e655db27debcc713201b2f373bdf8634a3abf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Fromme?= Date: Thu, 30 Jan 2025 10:44:24 +0100 Subject: [PATCH] feat: respect participants' mutability status in booking data --- src/Form/Model/ParticipantData.php | 2 ++ src/Form/ParticipantType.php | 13 +------------ 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/src/Form/Model/ParticipantData.php b/src/Form/Model/ParticipantData.php index 613aab2..0676ef4 100644 --- a/src/Form/Model/ParticipantData.php +++ b/src/Form/Model/ParticipantData.php @@ -14,6 +14,7 @@ class ParticipantData public ?int $addressId = null; public ?int $personId = null; public ?string $status = null; + public bool $mutable = false; #[Assert\NotBlank(message: 'Bitte angeben')] public ?string $firstName = null; @@ -97,6 +98,7 @@ class ParticipantData $instance->addressId = $personalData->addressId; $instance->personId = $personalData->personId; + $instance->mutable = $personalData->mutable; $instance->firstName = $personalData->firstName; $instance->lastName = $personalData->name; $instance->gender = $personalData->gender; diff --git a/src/Form/ParticipantType.php b/src/Form/ParticipantType.php index 0fbd248..84b77f9 100644 --- a/src/Form/ParticipantType.php +++ b/src/Form/ParticipantType.php @@ -28,9 +28,7 @@ class ParticipantType extends AbstractType $form = $event->getForm(); -// $personalDataMutable = $options['personal_data_mutable'] -// && $participantData->personId !== $options['applicant_id']; - $personalDataMutable = $options['personal_data_mutable']; + $personalDataMutable = $options['personal_data_mutable'] && $participantData->mutable; $form ->add('firstName', TextType::class, [ @@ -92,23 +90,14 @@ class ParticipantType extends AbstractType ->add('height', IntegerType::class, [ 'label' => 'Körpergröße [cm]', 'required' => false, - 'attr' => [ - 'readonly' => false === $personalDataMutable, - ] ]) ->add('shoeSize', IntegerType::class, [ 'label' => 'Schuhgröße', 'required' => false, - 'attr' => [ - 'readonly' => false === $personalDataMutable, - ] ]) ->add('weight', IntegerType::class, [ 'label' => 'Gewicht [kg]', 'required' => false, - 'attr' => [ - 'readonly' => false === $personalDataMutable, - ] ]) ;