<?php
namespace App\Form\Abo;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\DateType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Routing\RouterInterface;
use Symfony\Component\Validator\Constraints\Email;
use Symfony\Component\Validator\Constraints\Length;
use Symfony\Component\Validator\Constraints\NotBlank;
class AdressMutationType extends AbstractType
{
public function __construct(private readonly RouterInterface $router)
{
}
#[\Override]
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('datumAb', DateType::class,
[
'label' => 'Ab',
'required' => true,
'widget' => 'single_text',
'constraints' => [
new NotBlank(),
],
'html5' => false,
'format' => 'dd.MM.yyyy',
]
)
;
$builder
->add('vorname', TextType::class,
[
'required' => true,
'attr' => ['maxlength' => 100],
'constraints' => [
new NotBlank(),
new Length(['max' => 100]),
],
]
)
->add('nachname', TextType::class,
[
'required' => true,
'label' => 'Name',
'attr' => ['maxlength' => 100],
'constraints' => [
new NotBlank(),
new Length(['max' => 100]),
],
]
)
->add('firma', TextType::class,
[
'required' => false,
'attr' => ['maxlength' => 100],
'constraints' => [
new Length(['max' => 100]),
],
]
)
->add('strasse', TextType::class,
[
'required' => true,
'attr' => ['maxlength' => 100],
'constraints' => [
new NotBlank(),
new Length(['max' => 100]),
],
'label' => 'Strasse/Nr.',
]
)
->add('plz', TextType::class,
[
'label' => 'PLZ',
'required' => true,
'attr' => ['maxlength' => 100],
'constraints' => [
new NotBlank(),
new Length(['max' => 100]),
],
]
)
->add('ort', TextType::class,
[
'required' => true,
'attr' => ['maxlength' => 100],
'constraints' => [
new NotBlank(),
new Length(['max' => 100]),
],
]
)
->add('land', TextType::class,
[
'required' => true,
'attr' => ['maxlength' => 100],
'constraints' => [
new NotBlank(),
new Length(['max' => 100]),
],
]
)
->add('telefon', TextType::class,
[
'required' => true,
'attr' => ['maxlength' => 100],
'constraints' => [
new NotBlank(),
new Length(['max' => 100]),
],
]
)
->add('email', EmailType::class,
[
'required' => true,
'label' => 'E-Mail',
'attr' => ['maxlength' => 100],
'constraints' => [
new NotBlank(),
new Email(),
new Length(['max' => 100]),
],
]
)
->add('mitteilung', TextareaType::class,
[
'required' => false,
'attr' => ['maxlength' => 5000],
'constraints' => [
new Length(['max' => 5000]),
],
]
)
->add('altVorname', TextType::class,
[
'required' => true,
'label' => 'Vorname',
'attr' => ['maxlength' => 100],
'constraints' => [
new NotBlank(),
new Length(['max' => 100]),
],
]
)
->add('altNachname', TextType::class,
[
'required' => true,
'label' => 'Name',
'attr' => ['maxlength' => 100],
'constraints' => [
new NotBlank(),
new Length(['max' => 100]),
],
]
)
->add('altFirma', TextType::class,
[
'required' => false,
'label' => 'Firma',
'attr' => ['maxlength' => 100],
'constraints' => [
new Length(['max' => 100]),
],
]
)
->add('altStrasse', TextType::class,
[
'required' => true,
'label' => 'Strasse/Nr.',
'attr' => ['maxlength' => 100],
'constraints' => [
new NotBlank(),
new Length(['max' => 100]),
],
]
)
->add('altPlz', TextType::class,
[
'required' => true,
'label' => 'PLZ',
'attr' => ['maxlength' => 100],
'constraints' => [
new NotBlank(),
new Length(['max' => 100]),
],
]
)
->add('altOrt', TextType::class,
[
'required' => true,
'label' => 'Ort',
'attr' => ['maxlength' => 100],
'constraints' => [
new NotBlank(),
new Length(['max' => 100]),
],
]
)
->add('altLand', TextType::class,
[
'required' => true,
'label' => 'Land',
'attr' => ['maxlength' => 100],
'constraints' => [
new NotBlank(),
new Length(['max' => 100]),
],
]
)
->add('altTelefon', TextType::class,
[
'required' => true,
'label' => 'Telefon',
'attr' => ['maxlength' => 100],
'constraints' => [
new NotBlank(),
new Length(['max' => 100]),
],
]
)
->add('altEmail', EmailType::class,
[
'required' => true,
'label' => 'E-Mail',
'attr' => ['maxlength' => 100],
'constraints' => [
new NotBlank(),
new Length(['max' => 100]),
],
]
)
->add('datenschutz', CheckboxType::class,
[
'mapped' => false,
'required' => true,
'label' => 'Ich habe die <a href="'.$this->router->generate('fe.page_datenschutz').'" target="_blank">Datenschutzrichtlinien</a> gelesen und bin damit einverstanden.',
'label_html' => true,
'constraints' => [
new NotBlank(),
],
]
)
;
}
}