src/Form/SolicitudNoSocioType.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\Form;
  3. use App\Entity\Provider;
  4. use App\Entity\SolicitudPublica;
  5. use Symfony\Bridge\Doctrine\Form\Type\EntityType;
  6. use Symfony\Component\Form\AbstractType;
  7. use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
  8. use Symfony\Component\Form\Extension\Core\Type\DateType;
  9. use Symfony\Component\Form\Extension\Core\Type\EmailType;
  10. use Symfony\Component\Form\Extension\Core\Type\IntegerType;
  11. use Symfony\Component\Form\Extension\Core\Type\TelType;
  12. use Symfony\Component\Form\Extension\Core\Type\TimeType;
  13. use Symfony\Component\Form\FormBuilderInterface;
  14. use Symfony\Component\OptionsResolver\OptionsResolver;
  15. class SolicitudNoSocioType extends AbstractType
  16. {
  17. public function buildForm(FormBuilderInterface $builder, array $options): void
  18. {
  19. $t1 = new \DateTime();
  20. $t1->setTime(9,0);
  21. $t2 = new \DateTime();
  22. $t2->setTime(20,0);
  23. $builder
  24. ->add('nombre', null, [
  25. 'attr' => [
  26. 'placeholder' => 'Nombre',
  27. 'class' => 'uk-input'
  28. ]
  29. ])
  30. ->add('apellido', null, [
  31. 'attr' => [
  32. 'placeholder' => 'Apellido',
  33. 'class' => 'uk-input'
  34. ]
  35. ])
  36. ->add('telefono', TelType::class, [
  37. 'attr' => [
  38. 'placeholder' => 'Teléfono',
  39. 'class' => 'uk-input'
  40. ]
  41. ])
  42. ->add('email', EmailType::class, [
  43. 'attr' => [
  44. 'placeholder' => 'Email',
  45. 'class' => 'uk-input'
  46. ]
  47. ])
  48. // ->add('destino')
  49. // ->add('cadena')
  50. ->add('fechaEntrada', DateType::class, [
  51. 'widget' => 'single_text',
  52. 'attr' => [
  53. 'class' => 'uk-input'
  54. ]
  55. ])
  56. ->add('fechaSalida', DateType::class, [
  57. 'widget' => 'single_text',
  58. 'attr' => [
  59. 'class' => 'uk-input'
  60. ]
  61. ])
  62. ->add('adultos', IntegerType::class, [
  63. 'attr' => [
  64. 'class' => 'uk-input',
  65. 'value' => 1,
  66. 'min' => 1
  67. ]
  68. ])
  69. ->add('menores', IntegerType::class, [
  70. 'attr' => [
  71. 'class' => 'uk-input',
  72. 'value' => 0,
  73. 'min' => 0
  74. ]
  75. ])
  76. ->add('horaDeContactoDesde', TimeType::class,[
  77. 'attr' => [
  78. 'class' => 'uk-input',
  79. ],
  80. 'widget' => 'single_text',
  81. 'html5' => true,
  82. 'help' => 'A partir de esta hora',
  83. 'data' => $t1
  84. ])
  85. ->add('horaDeContactoHasta', TimeType::class,[
  86. 'attr' => [
  87. 'class' => 'uk-input',
  88. ],
  89. 'widget' => 'single_text',
  90. 'html5' => true,
  91. 'help' => 'Hasta esta hora',
  92. 'data' => $t2
  93. ])
  94. ->add('entiendo', CheckboxType::class, [
  95. 'label' => 'Entiendo que esto es sólo una solicitud, y en ninguna manera constituye o garantiza Reservación en este Hotel.'
  96. ])
  97. ->add('autorizacion')
  98. ->add('proveedor', EntityType::class, [
  99. 'class' => Provider::class,
  100. 'data' => $options['proveedor'],
  101. 'disabled' => true,
  102. 'attr' => [
  103. 'class' => 'uk-input',
  104. ],
  105. ])
  106. ;
  107. }
  108. public function configureOptions(OptionsResolver $resolver): void
  109. {
  110. $resolver->setDefaults([
  111. 'data_class' => SolicitudPublica::class,
  112. 'proveedor' => null,
  113. ]);
  114. }
  115. }