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, - ] ]) ;