src/Form/BuildingReportingFormType.php line 13

  1. <?php
  2. namespace App\Form;
  3. use App\Entity\BuildingReportingHistory;
  4. use Symfony\Component\Form\AbstractType;
  5. use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
  6. use Symfony\Component\Form\Extension\Core\Type\NumberType;
  7. use Symfony\Component\Form\Extension\Core\Type\TextareaType;
  8. use Symfony\Component\Form\FormBuilderInterface;
  9. use Symfony\Component\OptionsResolver\OptionsResolver;
  10. class BuildingReportingFormType extends AbstractType
  11. {
  12.     public function buildForm(FormBuilderInterface $builder, array $options): void
  13.     {
  14.         $builder
  15.             ->add('type'ChoiceType::class, [
  16.                 'label' => 'Raison',
  17.                 'choices' => [
  18.                     'Photos' => 'Photos',
  19.                     'Description' => 'Description',
  20.                 ],
  21.                 'multiple' => false,
  22.                 'attr' => [
  23.                     'placeholder' => 'Raison',
  24.                     'class' => ' block w-full my-2 px-3 py-2 border border-gray-300 placeholder-gray-500 text-gray-900 rounded-t-md focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 focus:z-10 sm:text-sm'
  25.                 ],
  26.             ])
  27.             ->add('number',NumberType::class,[
  28.                 'label' => 'indiquez le numéro de la photo concernée par votre signalement',
  29.                 'required' => false,
  30.                 'attr' => [
  31.                     'placeholder' => 'Nombre',
  32.                     'class' => ' block w-full my-2 px-3 py-2 border border-gray-300 placeholder-gray-500 text-gray-900 rounded-t-md focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 focus:z-10 sm:text-sm'
  33.                 ],
  34.             ])
  35.             ->add('detail'TextareaType::class, [
  36.                 'label' => 'Description',
  37.                 'required' => false,
  38.                 'attr' => [
  39.                     'placeholder' => 'Description',
  40.                     'class' => ' block w-full my-2 px-3 py-2 border border-gray-300 placeholder-gray-500 text-gray-900 rounded-b-md focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 focus:z-10 sm:text-sm'
  41.                 ],
  42.             ])
  43.         ;
  44.     }
  45.     public function configureOptions(OptionsResolver $resolver): void
  46.     {
  47.         $resolver->setDefaults([
  48.             'data_class' => BuildingReportingHistory::class,
  49.         ]);
  50.     }
  51. }