src/Form/Einsendung/TodesanzeigeType.php line 22

Open in your IDE?
  1. <?php
  2. namespace App\Form\Einsendung;
  3. use App\Entity\Einsendung\Todesanzeige;
  4. use App\Entity\Vs\Vs;
  5. use Symfony\Component\Form\AbstractType;
  6. use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
  7. use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
  8. use Symfony\Component\Form\Extension\Core\Type\DateType;
  9. use Symfony\Component\Form\Extension\Core\Type\HiddenType;
  10. use Symfony\Component\Form\Extension\Core\Type\TextareaType;
  11. use Symfony\Component\Form\Extension\Core\Type\TextType;
  12. use Symfony\Component\Form\FormBuilderInterface;
  13. use Symfony\Component\OptionsResolver\OptionsResolver;
  14. use Symfony\Component\Routing\RouterInterface;
  15. use Symfony\Component\Validator\Constraints\Length;
  16. use Symfony\Component\Validator\Constraints\NotBlank;
  17. use Symfony\Component\Asset\Packages;
  18. class TodesanzeigeType extends AbstractType
  19. {
  20. public function __construct(
  21. private readonly RouterInterface $router,
  22. private readonly Packages $assetsManager)
  23. {
  24. }
  25. #[\Override]
  26. public function buildForm(FormBuilderInterface $builder, array $options): void
  27. {
  28. $builder
  29. ->add('vVorname', null, [
  30. 'label' => 'Vorname',
  31. 'attr' => ['placeholder' => 'der verstorbenen Person'],
  32. 'required' => true,
  33. 'constraints' => [
  34. new NotBlank(),
  35. new Length(['max' => 100]),
  36. ],
  37. ])
  38. ->add('vNachname', null, [
  39. 'label' => 'Name',
  40. 'attr' => ['placeholder' => 'der verstorbenen Person'],
  41. 'required' => true,
  42. 'constraints' => [
  43. new NotBlank(),
  44. new Length(['max' => 100]),
  45. ],
  46. ])
  47. ->add('geburtsdatum', DateType::class, [
  48. 'widget' => 'single_text',
  49. 'format' => 'dd.MM.yyyy',
  50. 'attr' => ['placeholder' => 'TT.MM.JJJJ', 'class' => 'jqDateTimePickerDate'],
  51. 'html5' => false,
  52. 'constraints' => [
  53. new NotBlank(),
  54. ],
  55. ])
  56. ->add('todesdatum', DateType::class, [
  57. 'widget' => 'single_text',
  58. 'format' => 'dd.MM.yyyy',
  59. 'attr' => ['placeholder' => 'TT.MM.JJJJ', 'class' => 'jqDateTimePickerDate'],
  60. 'html5' => false,
  61. 'constraints' => [
  62. new NotBlank(),
  63. ],
  64. ])
  65. ->add('spruch', null, [
  66. 'label' => 'Spruch<br/><a href="'.$this->assetsManager->getUrl('assets/pdf/Sprueche_Onlineformular_TA.pdf').'" target="_blank">Auswahl</a>',
  67. 'label_html' => true,
  68. 'constraints' => [
  69. new Length(['max' => 1000]),
  70. ],
  71. ])
  72. ->add('text', TextType::class,
  73. [
  74. 'label' => 'Einleitung<br/><a href="'.$this->assetsManager->getUrl('assets/pdf/Einleitung_Onlineformular_TA.pdf').'" target="_blank">Auswahl</a>',
  75. 'label_html' => true,
  76. 'required' => false,
  77. 'attr' => ['placeholder' => 'In Liebe und Dankbarkeit nehmen wir Abschied von'],
  78. 'constraints' => [
  79. new Length(['max' => 6000]),
  80. ],
  81. ]
  82. )
  83. ->add('hauptteil', TextareaType::class,
  84. [
  85. 'label' => 'Hauptteil',
  86. 'required' => false,
  87. 'constraints' => [
  88. new Length(['max' => 6000]),
  89. ],
  90. ]
  91. )
  92. ->add('angehoerige', TextareaType::class,
  93. [
  94. 'label' => 'Angehörige<br/><a href="'.$this->assetsManager->getUrl('assets/pdf/Angehoerige_Onlineformular_TA.pdf').'" target="_blank">Auswahl</a>',
  95. 'label_html' => true,
  96. 'required' => false,
  97. 'attr' => ['maxlength' => 6000],
  98. 'constraints' => [
  99. new Length(['max' => 6000]),
  100. ],
  101. ]
  102. )
  103. ->add('urne', TextType::class,
  104. [
  105. 'label' => 'Urne',
  106. 'required' => false,
  107. 'attr' => ['placeholder' => 'Die Urne befindet sich ab Dienstag, 2. Juni 2002, in der Totenkappelle Altdorf'],
  108. 'constraints' => [
  109. new Length(['max' => 6000]),
  110. ],
  111. ]
  112. )
  113. ->add('sterbegebet', null, [
  114. 'label' => 'Sterbegebet',
  115. 'required' => false,
  116. 'attr' => ['placeholder' => 'Datum / Ort / Zeit'],
  117. 'constraints' => [
  118. new Length(['max' => 100]),
  119. ],
  120. ])
  121. ->add('dreissigster', null, [
  122. 'label' => 'Dreissigster',
  123. 'required' => false,
  124. 'attr' => ['placeholder' => 'Datum / Ort / Zeit'],
  125. 'constraints' => [
  126. new Length(['max' => 100]),
  127. ],
  128. ])
  129. ->add('abschiedsgottesdienst', null, [
  130. 'label' => 'Abschiedsgottes-dienst',
  131. 'attr' => ['placeholder' => 'Datum / Ort / Zeit'],
  132. 'required' => false,
  133. 'constraints' => [
  134. new Length(['max' => 100]),
  135. ],
  136. ])
  137. ->add('urnenbeisetzung', null, [
  138. 'label' => 'Urnenbeisetzung',
  139. 'attr' => ['placeholder' => 'Datum / Ort / Zeit'],
  140. 'required' => false,
  141. 'constraints' => [
  142. new Length(['max' => 100]),
  143. ],
  144. ])
  145. ->add('institution', null, [
  146. 'label' => 'Institution/ Spende',
  147. 'attr' => ['placeholder' => 'IBAN und Name der Organisation'],
  148. 'required' => false,
  149. 'constraints' => [
  150. new Length(['max' => 10000]),
  151. ],
  152. ])
  153. ->add('leidzirkular', ChoiceType::class, [
  154. 'label' => 'Gilt als Leidzirkular',
  155. 'choices' => [
  156. 'Ja' => 'Ja',
  157. 'Nein' => 'Nein',
  158. ],
  159. 'expanded' => true,
  160. 'multiple' => false,
  161. 'required' => true,
  162. 'row_attr' => ['class' => 'form-row-leidzirkular'],
  163. ])
  164. ->add('traueradresse', null, [
  165. 'constraints' => [
  166. new Length(['max' => 1000]),
  167. ],
  168. ])
  169. ->add('bemerkungen', TextareaType::class,
  170. [
  171. 'label' => 'Bemerkungen',
  172. 'required' => false,
  173. 'attr' => ['maxlength' => 6000],
  174. 'constraints' => [
  175. new Length(['max' => 6000]),
  176. ],
  177. ]
  178. )
  179. // Kontakt
  180. ->add('vorname', TextType::class,
  181. [
  182. 'required' => true,
  183. 'attr' => ['maxlength' => 100],
  184. 'constraints' => [
  185. new Length(['max' => 100]),
  186. new NotBlank(),
  187. ],
  188. ]
  189. )
  190. ->add('nachname', TextType::class,
  191. [
  192. 'required' => true,
  193. 'label' => 'Name',
  194. 'attr' => ['maxlength' => 100],
  195. 'constraints' => [
  196. new Length(['max' => 100]),
  197. new NotBlank(),
  198. ],
  199. ]
  200. )
  201. ->add('strasse', TextType::class,
  202. [
  203. 'required' => true,
  204. 'attr' => ['maxlength' => 100],
  205. 'constraints' => [
  206. new Length(['max' => 100]),
  207. new NotBlank(),
  208. ],
  209. 'label' => 'Strasse/Nr.'
  210. ]
  211. )
  212. ->add('plz', TextType::class,
  213. [
  214. 'label' => 'PLZ',
  215. 'required' => true,
  216. 'attr' => ['maxlength' => 100],
  217. 'constraints' => [
  218. new Length(['max' => 100]),
  219. new NotBlank(),
  220. ],
  221. ]
  222. )
  223. ->add('ort', TextType::class,
  224. [
  225. 'required' => true,
  226. 'attr' => ['maxlength' => 100],
  227. 'constraints' => [
  228. new Length(['max' => 100]),
  229. new NotBlank(),
  230. ],
  231. ]
  232. )
  233. ->add('telefon', TextType::class,
  234. [
  235. 'required' => true,
  236. 'attr' => ['maxlength' => 100],
  237. 'constraints' => [
  238. new Length(['max' => 100]),
  239. new NotBlank(),
  240. ],
  241. ]
  242. )
  243. ->add('email', TextType::class,
  244. [
  245. 'label' => 'E-Mail',
  246. 'required' => true,
  247. 'attr' => ['maxlength' => 100],
  248. 'constraints' => [
  249. new Length(['max' => 100]),
  250. new NotBlank(),
  251. ],
  252. ]
  253. )
  254. // Image
  255. ->add('imageFilepath', HiddenType::class, ['label' => 'Foto', 'required' => false, 'mapped' => true, 'help' => 'der verstorbenen Person (max. 5 MB)'])
  256. ->add('imageAlt', TextType::class, ['label' => 'Foto Alt', 'required' => false, 'mapped' => false, 'attr' => ['placeholder' => 'Bildbeschreibung (alt-Tag)']])
  257. ->add('imageCaption', TextType::class, ['label' => 'Foto Caption', 'mapped' => false, 'help' => 'Foto wird automatisch auf '.Vs::MAX_WIDTH_VSIMAGE.'px Breite runtergerechnet falls grösser.', 'required' => false, 'attr' => ['placeholder' => 'Fotolegende (figcaption-Tag)']])
  258. ->add('fotoposition', ChoiceType::class, [
  259. 'label' => 'Fotoposition',
  260. 'choices' => [
  261. 'Foto links' => 'Foto links',
  262. 'Foto rechts' => 'Foto rechts',
  263. 'kein Foto' => 'kein Foto'
  264. ],
  265. 'expanded' => true,
  266. 'multiple' => false,
  267. 'required' => true,
  268. 'row_attr' => ['class' => 'form-row-fotoposition'],
  269. ])
  270. ->add('hintergrund', TextType::class,
  271. [
  272. 'label' => 'Hintergrund<br/><a href="'.$this->assetsManager->getUrl('assets/pdf/Hintergrund_Onlineformular_TA.pdf').'" target="_blank">Auswahl</a>',
  273. 'label_html' => true,
  274. 'required' => false,
  275. 'mapped' => true,
  276. 'constraints' => [
  277. new Length(['max' => 1000]),
  278. ],
  279. ]
  280. )
  281. ->add('imageFilepath2', HiddenType::class, ['label' => false, 'required' => false, 'mapped' => true, 'help' => 'Wünschen Sie ein eigenes, individuelles Hintergrundbild? (max. 5 MB)'])
  282. ->add('imageAlt2', TextType::class, ['label' => 'Bild Alt', 'required' => false, 'mapped' => false, 'attr' => ['placeholder' => 'Bildbeschreibung (alt-Tag)']])
  283. ->add('imageCaption2', TextType::class, ['label' => 'Bild Caption', 'mapped' => false, 'help' => 'Bild wird automatisch auf '.Vs::MAX_WIDTH_VSIMAGE.'px Breite runtergerechnet falls grösser.', 'required' => false, 'attr' => ['placeholder' => 'Bildlegende (figcaption-Tag)']])
  284. ->add('signet', null, [
  285. 'label' => 'Signet<br/><a href="'.$this->assetsManager->getUrl('assets/pdf/Signete_Onlineformular_TA.pdf').'" target="_blank">Auswahl</a>',
  286. 'label_html' => true,
  287. 'constraints' => [
  288. new Length(['max' => 1000]),
  289. ],
  290. ])
  291. ->add('schriftart', null, [
  292. 'label' => 'Schriftart<br/><a href="'.$this->assetsManager->getUrl('assets/pdf/Schriftarten_Onlineformular_TA.pdf').'" target="_blank">Auswahl</a>',
  293. 'label_html' => true,
  294. 'constraints' => [
  295. new Length(['max' => 1000]),
  296. ],
  297. ])
  298. ->add('zeitungstitel', ChoiceType::class, [
  299. 'label' => 'Zeitungstitel',
  300. 'choices' => [
  301. 'Urner Wochenblatt' => 'Urner Wochenblatt',
  302. ],
  303. 'expanded' => true,
  304. 'multiple' => false,
  305. 'required' => true,
  306. 'row_attr' => ['class' => 'form-row-zeitungstitel'],
  307. ])
  308. ->add('erscheinungsdatum', DateType::class, [
  309. 'label' => 'Erscheinungs-<br>datum',
  310. 'label_html' => true,
  311. 'widget' => 'single_text',
  312. 'format' => 'dd.MM.yyyy',
  313. 'attr' => ['placeholder' => 'TT.MM.JJJJ', 'class' => 'jqDateTimePickerDate'],
  314. 'html5' => false,
  315. 'constraints' => [
  316. new NotBlank(),
  317. ],
  318. ])
  319. ->add('urnenbild', ChoiceType::class, [
  320. 'label' => 'Urnenbild<br/><a href="'.$this->assetsManager->getUrl('assets/pdf/UB_Onlineformular_TA.pdf').'" target="_blank">Muster</a>',
  321. 'label_html' => true,
  322. 'choices' => [
  323. 'Urnenbild 13 x 18 cm laminiert im Silberrahmen' => 'Urnenbild 13 x 18 cm laminiert im Silberrahmen',
  324. 'Ich benötige kein Urnenbild' => 'Ich benötige kein Urnenbild',
  325. ],
  326. 'expanded' => true,
  327. 'multiple' => false,
  328. 'required' => true,
  329. 'row_attr' => ['class' => 'form-row-urnenbild'],
  330. ])
  331. ->add('leidzirkulare', null, [
  332. 'label' => 'Leidzirkulare<br/><a href="'.$this->assetsManager->getUrl('assets/pdf/Leidzirkulare_Onlineformular_TA.pdf').'" target="_blank">Muster</a>',
  333. 'label_html' => true,
  334. 'attr' => ['placeholder' => 'Stückzahl'],
  335. 'constraints' => [
  336. new Length(['max' => 1000]),
  337. ],
  338. ])
  339. ->add('couverts', null, [
  340. 'label' => 'Couverts zu Leidzirkular<br/><a href="'.$this->assetsManager->getUrl('assets/pdf/Couverts_Onlineformular_TA.pdf').'" target="_blank">Auswahl</a>',
  341. 'label_html' => true,
  342. 'attr' => ['placeholder' => 'Bezeichnung der Couverts'],
  343. 'constraints' => [
  344. new Length(['max' => 1000]),
  345. ],
  346. ])
  347. ->add('datenschutz', CheckboxType::class,
  348. [
  349. 'mapped' => false,
  350. 'required' => true,
  351. 'label' => 'Ich habe die <a href="'.$this->router->generate('fe.page_datenschutz').'" target="_blank">Datenschutzrichtlinien</a> gelesen und bin damit einverstanden.',
  352. 'label_html' => true,
  353. 'constraints' => [
  354. new NotBlank(),
  355. ],
  356. ]
  357. )
  358. ;
  359. }
  360. #[\Override]
  361. public function configureOptions(OptionsResolver $resolver): void
  362. {
  363. $resolver->setDefaults([
  364. 'data_class' => Todesanzeige::class,
  365. 'attr' => [
  366. 'novalidate' => 'novalidate',
  367. 'autocomplete' => 'off'
  368. ],
  369. ]);
  370. }
  371. }