src/Flexy/FrontBundle/Form/RegistrationVendorFormType.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 RegistrationVendorFormType 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('ICE')
  40.         ->add('imageIceFile'VichFileType::class, [
  41.             'required' => true,
  42.             'allow_delete' => true,
  43.             'delete_label' => '...',
  44.             'download_uri' => '...',
  45.             'download_label' => '...',
  46.             'asset_helper' => true,
  47.         ])
  48.         ->add('RC')
  49.         ->add('imageRCFile'VichFileType::class, [
  50.             'required' => true,
  51.             'allow_delete' => true,
  52.             'delete_label' => '...',
  53.             'download_uri' => '...',
  54.             'download_label' => '...',
  55.             'asset_helper' => true,
  56.         ])
  57.         ->add('IdentifiantFiscale')
  58.         ->add('imageIFFile'VichFileType::class, [
  59.             'required' => true,
  60.             'allow_delete' => true,
  61.             'delete_label' => '...',
  62.             'download_uri' => '...',
  63.             'download_label' => '...',
  64.             'asset_helper' => true,
  65.         ])
  66.         ->add('imageCVFile'VichFileType::class, [
  67.             'required' => true,
  68.             'allow_delete' => true,
  69.             'delete_label' => '...',
  70.             'download_uri' => '...',
  71.             'download_label' => '...',
  72.             'asset_helper' => true,
  73.         ])
  74.         ->add('simulateUsername',null,["label"=>"identifiant"])
  75.         //->add('simulatePassword')
  76.         ->add('simulatePassword'PasswordType::class, [
  77.             // instead of being set onto the object directly,
  78.             // this is read and encoded in the controller
  79.             "label"=>"Mot de passe",
  80.             'mapped' => false,
  81.             'attr' => ['autocomplete' => 'new-password'],
  82.             'constraints' => [
  83.                 new NotBlank([
  84.                     'message' => 'Please enter a password',
  85.                 ]),
  86.                 new Length([
  87.                     'min' => 6,
  88.                     'minMessage' => 'Your password should be at least {{ limit }} characters',
  89.                     // max length allowed by Symfony for security reasons
  90.                     'max' => 4096,
  91.                 ]),
  92.             ],
  93.         ])
  94.         ->add('agreeTerms'CheckboxType::class, [
  95.             "label"=>'Accepter les conditions gĂ©nerales',
  96.             'mapped' => false,
  97.             'constraints' => [
  98.                 new IsTrue([
  99.                     'message' => 'You should agree to our terms.',
  100.                 ]),
  101.             ],
  102.         ])
  103.         
  104.         /*
  105.             ->add('username')
  106.             ->add('agreeTerms', CheckboxType::class, [
  107.                 'mapped' => false,
  108.                 'constraints' => [
  109.                     new IsTrue([
  110.                         'message' => 'You should agree to our terms.',
  111.                     ]),
  112.                 ],
  113.             ])
  114.             ->add('plainPassword', PasswordType::class, [
  115.                 // instead of being set onto the object directly,
  116.                 // this is read and encoded in the controller
  117.                 'mapped' => false,
  118.                 'attr' => ['autocomplete' => 'new-password'],
  119.                 'constraints' => [
  120.                     new NotBlank([
  121.                         'message' => 'Please enter a password',
  122.                     ]),
  123.                     new Length([
  124.                         'min' => 6,
  125.                         'minMessage' => 'Your password should be at least {{ limit }} characters',
  126.                         // max length allowed by Symfony for security reasons
  127.                         'max' => 4096,
  128.                     ]),
  129.                 ],
  130.             ])
  131.             */
  132.         ;
  133.     }
  134.     public function configureOptions(OptionsResolver $resolver): void
  135.     {
  136.         $resolver->setDefaults([
  137.             'data_class' => Vendor::class,
  138.         ]);
  139.     }
  140. }