This commit is contained in:
Björn Fromme
2025-02-27 19:21:12 +01:00
parent f5d3619c4a
commit ac498f9040
15 changed files with 311 additions and 185 deletions
+1 -8
View File
@@ -24,20 +24,13 @@ class ParticipantData
public ?string $title = null;
public ?string $gender = null;
public ?string $nationality = null;
#[Assert\Range(notInRangeMessage: 'Bitte einen Wert im Bereich {{ min }}-{{ max }}cm angeben', min: 150, max: 210)]
public ?string $height = null;
#[Assert\Range(notInRangeMessage: 'Bitte einen Wert im Bereich {{ min }}-{{ max }} angeben', min: 37, max: 49)]
public ?string $shoeSize = null;
#[Assert\Range(notInRangeMessage: 'Bitte einen Wert im Bereich {{ min }}-{{ max }}kg angeben', min: 40, max: 130)]
public ?string $weight = null;
#[Assert\NotNull(message: 'Bitte angeben')]
public ?\DateTimeImmutable $dateOfBirth = null;
#[Assert\NotBlank(message: 'Bitte angeben')]
#[Assert\Email(message: 'Bitte eine gültige E-Mail Adresse angeben', mode: 'strict')]
public ?string $email = null;
@@ -112,4 +105,4 @@ class ParticipantData
return $instance;
}
}
}
+43 -7
View File
@@ -10,7 +10,6 @@ use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\BirthdayType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvent;
@@ -77,6 +76,7 @@ class ParticipantType extends AbstractType
])
->add('email', EmailType::class, [
'label' => 'E-Mail',
'required' => false,
'attr' => [
'readonly' => false === $personalDataMutable,
]
@@ -87,17 +87,43 @@ class ParticipantType extends AbstractType
'readonly' => false === $personalDataMutable,
]
])
->add('height', IntegerType::class, [
'label' => 'Körpergröße [cm]',
->add('height', ChoiceType::class, [
'label' => 'Körpergröße',
'required' => false,
'expanded' => false,
'multiple' => false,
'placeholder' => 'Keine Angabe',
'choices' => [
'bis 148cm' => '-148',
'149 - 157cm' => '149-157',
'158 - 166cm' => '158-166',
'167 - 178cm' => '167-178',
'179 - 194cm' => '179-197',
'195cm oder mehr' => '195cm+',
],
])
->add('shoeSize', IntegerType::class, [
->add('shoeSize', ChoiceType::class, [
'label' => 'Schuhgröße',
'required' => false,
'expanded' => false,
'multiple' => false,
'placeholder' => 'Keine Angabe',
'choices' => array_combine(range(36, 48), range(36, 48)),
])
->add('weight', IntegerType::class, [
'label' => 'Gewicht [kg]',
->add('weight', ChoiceType::class, [
'label' => 'Gewicht',
'required' => false,
'expanded' => false,
'multiple' => false,
'placeholder' => 'Keine Angabe',
'choices' => [
'42 - 48kg' => '42-48',
'49 - 57kg' => '49-57',
'58 - 66kg' => '58-66',
'67 - 78kg' => '67-78',
'79 - 94kg' => '79-94',
'95kg oder mehr' => '95k+',
],
])
;
@@ -130,11 +156,21 @@ class ParticipantType extends AbstractType
if (true === $service->mandatory) {
$attributes['checked'] = true;
$attributes['disabled'] = true;
$attributes['class'] = 'text-pink';
$attributes['tooltip'] = 'Diese Leistung ist nicht abwählbar';
}
// disable selection of services only available in booking data
if (Service::SOURCE_BOOKING === $service->source) {
$attributes['disabled'] = true;
$attributes['class'] = 'text-pink';
}
// disable selection of services that are unavailable according to their status
if (Service::STATUS_BLOCKED === $service->status) {
$attributes['checked'] = false;
$attributes['disabled'] = true;
$attributes['tooltip'] = 'Diese Leistung ist derzeit leider nicht buchbar';
}
return $attributes;
@@ -297,4 +333,4 @@ class ParticipantType extends AbstractType
'anti_xss' => true,
]);
}
}
}
+1 -26
View File
@@ -16,31 +16,6 @@ class PersonalDataType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('gender', ChoiceType::class, [
'label' => 'Gender',
'choices' => [
'männlich' => 'M',
'weiblich' => 'W',
'divers' => 'D',
],
])
->add('firstName', TextType::class, [
'label' => 'Name',
])
->add('name', TextType::class, [
'label' => 'Nachname',
])
->add('dateOfBirth', BirthdayType::class, [
'label' => 'Geburtsdatum',
'html5' => true,
'widget' => 'single_text',
'input' => 'datetime_immutable',
])
->add('nationality', CountryType::class, [
'label' => 'Nationalität',
'property' => 'nationality',
'preferred_choices' => ['D', 'A', 'CH'],
])
->add('street', TextType::class, [
'label' => 'Straße',
'property_path' => 'address.street',
@@ -78,4 +53,4 @@ class PersonalDataType extends AbstractType
'anti_xss' => true,
]);
}
}
}