src/Form/ComplaintXApprovalType.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Form;
  3. use Symfony\Component\Form\AbstractType;
  4. use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
  5. use Symfony\Component\Form\FormBuilderInterface;
  6. use App\Service\UserService;
  7. use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
  8. class ComplaintXApprovalType extends AbstractType
  9. {
  10.     protected $tokenStorage;
  11.     protected $userService;
  12.     public function __construct(TokenStorageInterface $tokenStorageUserService $userService)
  13.     {
  14.         $this->tokenStorage $tokenStorage;
  15.         $this->userService $userService;
  16.     }
  17.     /**
  18.      * {@inheritdoc}
  19.      */
  20.     public function buildForm(FormBuilderInterface $builder, array $options)
  21.     {
  22.         $user $this->tokenStorage->getToken()?->getUser();
  23.         $builder
  24.             ->add('youHasVictim'CheckboxType::class, [
  25.                 'label' => "Vous êtes la victime directe des faits",
  26.                 'label_attr' => ['style' => 'white-space: initial;''class' => 'checkbox-switch'],
  27.                 'attr' => ['class' => 'form-checkbox''style' => 'vertical-align: top;'],
  28.                 'required' => false
  29.             ])
  30.             ->add('yourChildrenHasVictim'CheckboxType::class, [
  31.                 'label' => "Vous êtes le représentant légal d'un enfant mineur qui est la victime des faits",
  32.                 'label_attr' => ['style' => 'white-space: initial;''class' => 'checkbox-switch'],
  33.                 'attr' => ['class' => 'form-checkbox''style' => 'vertical-align: top;'],
  34.                 'required' => false
  35.             ])
  36.             ->add('noWeaponsUsage'CheckboxType::class, [
  37.                 'label' => "Les faits ont été commis sans faire usage d'une arme et sans violences physique ou menaces",
  38.                 'label_attr' => ['style' => 'white-space: initial;''class' => 'checkbox-switch'],
  39.                 'attr' => ['class' => 'form-checkbox''style' => 'vertical-align: top;'],
  40.                 'required' => true
  41.             ])
  42.             ->add('noDocumentStolen'CheckboxType::class, [
  43.                 'label' => "Aucun document délivré par l'état ne vous a été volé (Passeport, carte d'identité, permis, carte grise, etc...)",
  44.                 'label_attr' => ['style' => 'white-space: initial;''class' => 'checkbox-switch'],
  45.                 'attr' => ['class' => 'form-checkbox''style' => 'vertical-align: top;'],
  46.                 'required' => true
  47.             ])
  48.             ->add('noTargetDescription'CheckboxType::class, [
  49.                 'label' => "Vous ne connaissez pas l'auteur des faits et vous n'avez vu personne commettre l'infraction",
  50.                 'label_attr' => ['style' => 'white-space: initial;''class' => 'checkbox-switch'],
  51.                 'attr' => ['class' => 'form-checkbox''style' => 'vertical-align: top;'],
  52.                 'required' => true
  53.             ]);
  54.         if (!$user) {
  55.             $builder->add('frenchPhone'CheckboxType::class, [
  56.                 'label' => "Vous disposez d'un téléphone mobile avec une ligne française commençant par 06 ou 07",
  57.                 'label_attr' => ['style' => 'white-space: initial;''class' => 'checkbox-switch'],
  58.                 'attr' => ['class' => 'form-checkbox''style' => 'vertical-align: top;'],
  59.                 'required' => true
  60.             ]);
  61.         }
  62.     }
  63. }