src/Backend/Modules/Editions/Domain/Registration/RegistrationType.php line 14

Open in your IDE?
  1. <?php
  2. namespace Backend\Modules\Editions\Domain\Registration;
  3. use Backend\Modules\Editions\Domain\AddressType;
  4. use Common\Form\CollectionType;
  5. use Symfony\Component\Form\AbstractType;
  6. use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
  7. use Symfony\Component\Form\Extension\Core\Type\EmailType;
  8. use Symfony\Component\Form\Extension\Core\Type\TextType;
  9. use Symfony\Component\Form\FormBuilderInterface;
  10. use Symfony\Component\OptionsResolver\OptionsResolver;
  11. class RegistrationType extends AbstractType
  12. {
  13.     public function buildForm(FormBuilderInterface $builder, array $options): void
  14.     {
  15.         $builder
  16.             ->add(
  17.                 'vatNumber',
  18.                 TextType::class,
  19.                 [
  20.                     'label' => 'lbl.Vat',
  21.                     'required' => false,
  22.                     'attr' => [
  23.                         'data-role' => 'vat-field',
  24.                     ],
  25.                 ]
  26.             )
  27.             ->add(
  28.                 'company',
  29.                 TextType::class,
  30.                 [
  31.                     'label' => 'lbl.Company',
  32.                     'attr' => [
  33.                         'data-role' => 'graydonCompany'
  34.                     ],
  35.                 ]
  36.             )
  37.             ->add(
  38.                 'legalForm',
  39.                 LegalFormType::class,
  40.                 [
  41.                     'label' => 'lbl.LegalForm',
  42.                     'attr' => [
  43.                         'data-role' => 'graydonLegalForm'
  44.                     ],
  45.                     'placeholder' => '',
  46.                     'required' => false,
  47.                 ]
  48.             )
  49.             ->add(
  50.                 'address',
  51.                 AddressType::class,
  52.                 [
  53.                     'label' => 'lbl.Address',
  54.                 ]
  55.             )
  56.             ->add(
  57.                 'membershipNumber',
  58.                 TextType::class,
  59.                 [
  60.                     'label' => 'lbl.MembershipNumber',
  61.                     'required' => false,
  62.                     'attr' => [
  63.                         'data-role' => 'membership-number-field',
  64.                         'data-is-valid' => 'false',
  65.                         'data-triggers-price-change' => true,
  66.                     ],
  67.                 ]
  68.             )
  69.             ->add(
  70.                 'phoneNumber',
  71.                 TextType::class,
  72.                 [
  73.                     'label' => 'lbl.PhoneNumber',
  74.                     'required' => false,
  75.                 ]
  76.             )
  77.             ->add(
  78.                 'email',
  79.                 EmailType::class,
  80.                 [
  81.                     'label' => 'lbl.Email',
  82.                 ]
  83.             )
  84.             ->add(
  85.                 'participants',
  86.                 CollectionType::class,
  87.                 [
  88.                     'label' => 'lbl.Participants',
  89.                     'entry_type' => ParticipantType::class,
  90.                     'allow_add' => true,
  91.                     'allow_delete' => true,
  92.                     'entry_options' => [
  93.                         'attr' => [
  94.                             'data-role' => 'participant-container',
  95.                         ],
  96.                     ],
  97.                     'add_button_options' => [
  98.                         'label' => 'lbl.Add',
  99.                         'attr' => [
  100.                             'data-triggers-price-change' => true,
  101.                         ],
  102.                     ],
  103.                     'delete_button_options' => [
  104.                         'label' => 'lbl.Add',
  105.                         'attr' => [
  106.                             'data-triggers-price-change' => true,
  107.                         ],
  108.                     ],
  109.                 ]
  110.             )
  111.             ->add(
  112.                 'iHaveAPromoCode',
  113.                 CheckboxType::class,
  114.                 [
  115.                     'label' => 'lbl.IHaveAPromoCode',
  116.                     'required' => false,
  117.                     'attr' => [
  118.                         'data-role' => 'promo-code-toggler',
  119.                     ],
  120.                     'mapped' => false,
  121.                 ]
  122.             )
  123.             ->add(
  124.                 'promoCode',
  125.                 TextType::class,
  126.                 [
  127.                     'label' => 'lbl.PromoCode',
  128.                     'required' => false,
  129.                     'attr' => [
  130.                         'data-role' => 'promo-code-field',
  131.                         'data-is-valid' => 'false',
  132.                         'data-discount' => 0,
  133.                         'data-triggers-price-change' => true,
  134.                     ]
  135.                 ]
  136.             )
  137.             ->add(
  138.                 'agreedToTermsAndConditions',
  139.                 CheckboxType::class,
  140.                 [
  141.                     'label' => 'lbl.IAgreeToTermsAndConditions',
  142.                 ]
  143.             )
  144.         ;
  145.     }
  146.     public function configureOptions(OptionsResolver $resolver): void
  147.     {
  148.         $resolver->setDefaults(
  149.             [
  150.                 'data_class' => RegistrationDataTransferObject::class,
  151.             ]
  152.         );
  153.     }
  154. }