src/Form/GroupTicket/TransportCompanyType.php line 19

Open in your IDE?
  1. <?php
  2. namespace App\Form\GroupTicket;
  3. use App\Entity\GroupTicket\PublicConnection;
  4. use App\Entity\GroupTicket\TransportCompany;
  5. use Doctrine\ORM\EntityRepository;
  6. use Symfony\Bridge\Doctrine\Form\Type\EntityType;
  7. use Symfony\Component\Form\AbstractType;
  8. use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
  9. use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
  10. use Symfony\Component\Form\Extension\Core\Type\DateType;
  11. use Symfony\Component\Form\Extension\Core\Type\EmailType;
  12. use Symfony\Component\Form\Extension\Core\Type\IntegerType;
  13. use Symfony\Component\Form\Extension\Core\Type\TextType;
  14. use Symfony\Component\Form\FormBuilderInterface;
  15. use Symfony\Component\OptionsResolver\OptionsResolver;
  16. class TransportCompanyType extends AbstractType
  17. {
  18. public function buildForm(FormBuilderInterface $builder, array $options): void
  19. {
  20. $builder
  21. ->add('name', TextType::class, [
  22. 'required' => true,
  23. 'label' => 'persona.label.name',
  24. 'empty_data' => '',
  25. 'attr' => [
  26. 'placeholder' => 'persona.label.name',
  27. 'autofocus' => true
  28. ],
  29. ])
  30. ->add('taxNumber', TextType::class, [
  31. 'required' => true,
  32. 'label' => 'transport_company.taxNumber',
  33. 'empty_data' => '',
  34. 'attr' => [
  35. 'placeholder' => 'transport_company.taxNumber',
  36. 'autofocus' => true
  37. ],
  38. ])
  39. ->add('abbrevation', TextType::class, [
  40. 'label' => 'transport_company.abbreviation',
  41. 'empty_data' => '',
  42. 'attr' => [
  43. 'placeholder' => 'transport_company.abbreviation',
  44. 'autofocus' => true
  45. ],
  46. ])
  47. ->add('tuNumber', TextType::class, [
  48. 'required' => true,
  49. 'label' => 'transport_company.tuNumber',
  50. 'empty_data' => '',
  51. 'attr' => [
  52. 'placeholder' => 'transport_company.tuNumber',
  53. 'autofocus' => true
  54. ],
  55. ])
  56. ->add('productTitle', TextType::class, [
  57. 'required' => true,
  58. 'label' => 'transport_company.productTitle',
  59. 'empty_data' => '',
  60. 'attr' => [
  61. 'placeholder' => 'transport_company.productTitle',
  62. 'autofocus' => true
  63. ],
  64. ])
  65. ->add('productLimitation', TextType::class, [
  66. 'required' => true,
  67. 'label' => 'transport_company.productLimitation',
  68. 'empty_data' => '',
  69. 'attr' => [
  70. 'placeholder' => 'transport_company.productLimitation',
  71. 'autofocus' => true
  72. ],
  73. ])
  74. ->add('productNumber', TextType::class, [
  75. 'required' => true,
  76. 'label' => 'transport_company.productNumber',
  77. 'empty_data' => '',
  78. 'attr' => [
  79. 'placeholder' => 'transport_company.productNumber',
  80. 'autofocus' => true
  81. ],
  82. ])
  83. ->add('email', EmailType::class, [
  84. 'required' => true,
  85. 'label' => 'persona.label.email',
  86. 'attr' => [
  87. 'placeholder' => 'persona.label.email'
  88. ],
  89. ])
  90. ->add('loginValidStart', DateType::class, [
  91. 'html5' => false,
  92. 'label' => 'login.validStart',
  93. 'widget' => 'single_text',
  94. 'required' => false,
  95. 'attr' => [
  96. 'class' => 'flatpickr-time',
  97. 'placeholder' => 'login.validStart'
  98. ]
  99. ])
  100. ->add('loginValidEnd', DateType::class, [
  101. 'html5' => false,
  102. 'label' => 'login.validEnd',
  103. 'widget' => 'single_text',
  104. 'required' => false,
  105. 'attr' => [
  106. 'class' => 'flatpickr-time',
  107. 'placeholder' => 'login.validEnd'
  108. ]
  109. ])
  110. ->add('allowedEditPriceList', CheckboxType::class, [
  111. 'label' => 'transport_company.allowedEditPriceList',
  112. 'required' => false,
  113. ])
  114. ->add('groupTicketClass', IntegerType::class, [
  115. 'required' => true,
  116. 'label' => 'transport_company.groupTicketClass',
  117. 'empty_data' => '',
  118. 'attr' => [
  119. 'placeholder' => 'transport_company.groupTicketClass',
  120. 'autofocus' => true
  121. ],
  122. ])
  123. ->add('groupTicketFqCode', TextType::class, [
  124. 'required' => false,
  125. 'label' => 'transport_company.groupTicketFqCode',
  126. 'empty_data' => '',
  127. 'attr' => [
  128. 'placeholder' => 'transport_company.groupTicketFqCode',
  129. 'autofocus' => true
  130. ],
  131. ])
  132. ->add('groupTicketSegment', TextType::class, [
  133. 'required' => true,
  134. 'label' => 'transport_company.groupTicketSegment',
  135. 'empty_data' => '',
  136. 'attr' => [
  137. 'placeholder' => 'transport_company.groupTicketSegment',
  138. 'autofocus' => true
  139. ],
  140. ])
  141. ->add('footerTemplate', ChoiceType::class, [
  142. 'required' => false,
  143. 'label' => 'public_connection.template',
  144. 'choices' => [
  145. 'Bitte wählen' => null,
  146. 'Regionalbus Lenzburg AG' => 'rbl.html.twig',
  147. ],
  148. 'attr' => [
  149. 'data-minimum-results-for-search' => 'Infinity',
  150. ]
  151. ])
  152. ->add('groupTicketMinSize', IntegerType::class, [
  153. 'required' => false,
  154. 'label' => 'transport_company.groupTicketMinSize',
  155. 'empty_data' => '',
  156. 'attr' => [
  157. 'placeholder' => 'transport_company.groupTicketMinSize',
  158. ],
  159. ])
  160. ;
  161. }
  162. public function configureOptions(OptionsResolver $resolver): void
  163. {
  164. $resolver->setDefaults([
  165. 'data_class' => TransportCompany::class,
  166. ]);
  167. }
  168. }