src/Flexy/FrontBundle/Themes/IlaveU/Form/RegistrationCustomerFormType.php line 20

  1. <?php
  2. namespace App\Flexy\FrontBundle\Themes\IlaveU\Form;
  3. use App\Entity\User;
  4. use App\Flexy\ShopBundle\Entity\Customer\Customer;
  5. use Symfony\Component\Form\AbstractType;
  6. use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
  7. use Symfony\Component\Form\Extension\Core\Type\PasswordType;
  8. use Symfony\Component\Form\FormBuilderInterface;
  9. use Symfony\Component\OptionsResolver\OptionsResolver;
  10. use Symfony\Component\Validator\Constraints\IsTrue;
  11. use Symfony\Component\Validator\Constraints\Length;
  12. use Symfony\Component\Validator\Constraints\NotBlank;
  13. use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
  14. use Symfony\Component\Form\Extension\Core\Type\DateType;
  15. use Symfony\Component\Form\Extension\Core\Type\EmailType;
  16. use Symfony\Component\Validator\Constraints\Email;
  17. class RegistrationCustomerFormType extends AbstractType
  18. {
  19.     public function buildForm(FormBuilderInterface $builder, array $options): void
  20.     {
  21.         $builder
  22.             //->add('description')
  23.             ->add('customerGroup',null,[ 
  24.                 "required"=>true,
  25.                 "label"=>"Vous etes un client ",
  26.                 'expanded' => true,
  27.                 'multiple' => false,
  28.                 "row_attr"=>["class"=>"col-md-12"]
  29.             ])
  30.             ->add('email',EmailType::class,
  31.             [
  32.                 "required"=> true,
  33.                 'constraints' => [new Email()]
  34.             ])
  35.             ->add('user'UserPasswordFormType::class, [
  36.                 
  37.                 
  38.             ])
  39.             //->add('createdAt')
  40.             ->add('firstName')
  41.             ->add('lastName')
  42.             ->add('address',null,["required"=> true])
  43.             ->add('phone')
  44.             ->add('companyName')  
  45.             ->add('dateOfBirth',DateType::class, ['required'=>false,
  46.             'widget' => 'single_text'])
  47.             ->add('gender'ChoiceType::class, [  
  48.             'choices'  => [     
  49.                    'Male'=> 'male',
  50.                    'Female'=> 'female',
  51.                         
  52.                ],]) 
  53.             ->add('addressIndication')
  54.             //->add('country')
  55.             ->add('postCode')
  56.             //->add('customerGroup')
  57.             
  58.             
  59.             ->add("canReceiveMails")
  60.             ->add("canReceiveSms")
  61.             ->add('agreeTerms'CheckboxType::class, [
  62.                 "label"=>'Accepter les conditions gĂ©nerales',
  63.                 'mapped' => false,
  64.                 'constraints' => [
  65.                     new IsTrue([
  66.                         'message' => 'You should agree to our terms.',
  67.                     ]),
  68.                 ],
  69.             ])
  70.             ->add('sponsorshipCode',null,["label"=>"Code Parrainage"])
  71.         ;
  72.     }
  73.     public function configureOptions(OptionsResolver $resolver): void
  74.     {
  75.         $resolver->setDefaults([
  76.             'data_class' => Customer::class,
  77.         ]);
  78.     }
  79. }