src/Flexy/FrontBundle/Form/RegistrationEntrepreneurFormType.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\Flexy\FrontBundle\Form;
  3. use App\Entity\User;
  4. use App\Flexy\ShopBundle\Entity\Vendor\Vendor;
  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 Vich\UploaderBundle\Form\Type\VichFileType;
  14. use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
  15. class RegistrationEntrepreneurFormType extends AbstractType
  16. {
  17.     public function buildForm(FormBuilderInterface $builder, array $options): void
  18.     {
  19.         $builder
  20.         ->add('name')
  21.         ->add('fullName')
  22.         ->add('tel')
  23.         ->add('email',null,["required"=> true])
  24.         ->add('address')
  25.         ->add('city'ChoiceType::class, [
  26.             'choices'  => [
  27.                 'Casablanca' => "Casablanca",
  28.                 'Rabat' => "Rabat",
  29.                 'Mohammedia' => "Mohammedia",
  30.                 'Temara' => "Temara",
  31.                 'Fes' => "Fes",
  32.                 'Agadir' => "Agadir",
  33.                 'Sale' => "Sale",
  34.                 'Marrakech' => "Marrakech",
  35.                 'Tanger' => "Tanger",                    
  36.             ],
  37.             "label"=>"Ville"
  38.         ])  
  39.         ->add('imageCVFile'VichFileType::class, [
  40.             'required' => true,
  41.             'allow_delete' => true,
  42.             'delete_label' => '...',
  43.             'download_uri' => '...',
  44.             'download_label' => '...',
  45.             'asset_helper' => true,
  46.         ])
  47.         ->add('imageCERTFile'VichFileType::class, [ 
  48.             'required' => true,
  49.             'allow_delete' => true,
  50.             'delete_label' => '...',
  51.             'download_uri' => '...',
  52.             'download_label' => '...',
  53.             'asset_helper' => true,
  54.         ])   
  55.         ->add('simulateUsername',null,["label"=>"identifiant"])
  56.         //->add('simulatePassword')
  57.         ->add('simulatePassword'PasswordType::class, [
  58.             // instead of being set onto the object directly,
  59.             // this is read and encoded in the controller
  60.             "label"=>"Mot de passe",
  61.             'mapped' => false,
  62.             'attr' => ['autocomplete' => 'new-password'],
  63.             'constraints' => [
  64.                 new NotBlank([
  65.                     'message' => 'Please enter a password',
  66.                 ]),
  67.                 new Length([
  68.                     'min' => 6,
  69.                     'minMessage' => 'Your password should be at least {{ limit }} characters',
  70.                     // max length allowed by Symfony for security reasons
  71.                     'max' => 4096,
  72.                 ]),
  73.             ],
  74.         ])
  75.         ->add('agreeTerms'CheckboxType::class, [
  76.             "label"=>'Accepter les conditions gĂ©nerales',
  77.             'mapped' => false,
  78.             'constraints' => [
  79.                 new IsTrue([
  80.                     'message' => 'You should agree to our terms.',
  81.                 ]),
  82.             ],
  83.         ])
  84.         
  85.         /*
  86.             ->add('username')
  87.             ->add('agreeTerms', CheckboxType::class, [
  88.                 'mapped' => false,
  89.                 'constraints' => [
  90.                     new IsTrue([
  91.                         'message' => 'You should agree to our terms.',
  92.                     ]),
  93.                 ],
  94.             ])
  95.             ->add('plainPassword', PasswordType::class, [
  96.                 // instead of being set onto the object directly,
  97.                 // this is read and encoded in the controller
  98.                 'mapped' => false,
  99.                 'attr' => ['autocomplete' => 'new-password'],
  100.                 'constraints' => [
  101.                     new NotBlank([
  102.                         'message' => 'Please enter a password',
  103.                     ]),
  104.                     new Length([
  105.                         'min' => 6,
  106.                         'minMessage' => 'Your password should be at least {{ limit }} characters',
  107.                         // max length allowed by Symfony for security reasons
  108.                         'max' => 4096,
  109.                     ]),
  110.                 ],
  111.             ])
  112.             */
  113.         ;
  114.     }
  115.     public function configureOptions(OptionsResolver $resolver): void
  116.     {
  117.         $resolver->setDefaults([
  118.             'data_class' => Vendor::class,
  119.         ]);
  120.     }
  121. }