diff --git a/src/Form/DestinationType.php b/src/Form/DestinationType.php index ba48d53..0c153a6 100644 --- a/src/Form/DestinationType.php +++ b/src/Form/DestinationType.php @@ -5,6 +5,7 @@ namespace App\Form; use App\BusProNet\DataProvider\HotelDataProvider; use App\Model\DestinationDto; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\Extension\Core\Type\CollectionType; use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; @@ -37,6 +38,16 @@ class DestinationType extends AbstractType 'allow_add' => true, 'allow_delete' => true, ]) + ->add('country', ChoiceType::class, [ + 'label' => 'Land', + 'choices' => [ + 'Österreich' => 'a', + 'Schweiz' => 'ch', + 'Frankreich' => 'f', + 'Italien' => 'i', + 'Deutschland' => 'd', + ], + ]) ->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) { $form = $event->getForm(); $data = $event->getData(); diff --git a/src/Model/DestinationDto.php b/src/Model/DestinationDto.php index e579351..5c4af7a 100644 --- a/src/Model/DestinationDto.php +++ b/src/Model/DestinationDto.php @@ -10,6 +10,9 @@ class DestinationDto #[Assert\NotBlank(message: 'Bitte angeben')] private ?string $product = null; + #[Assert\Choice(choices: ['a', 'ch', 'd', 'f', 'i'], message: 'Ungültige Auswahl')] + private ?string $country = null; + #[Assert\NotNull(message: 'Bitte das Beginndatum angeben')] private ?\DateTimeImmutable $dateFrom = null; @@ -52,6 +55,18 @@ class DestinationDto return $this; } + public function getCountry(): ?string + { + return $this->country; + } + + public function setCountry(?string $country): static + { + $this->country = $country; + + return $this; + } + public function getDateFrom(): ?\DateTimeImmutable { return $this->dateFrom; diff --git a/templates/administrative/system/destination/_form.html.twig b/templates/administrative/system/destination/_form.html.twig index 6584289..886928c 100644 --- a/templates/administrative/system/destination/_form.html.twig +++ b/templates/administrative/system/destination/_form.html.twig @@ -12,24 +12,31 @@ {{ form_start(form) }}
- {{ form_row(form.product) }} - {{ form_row(form.dateFrom) }} - {{ form_row(form.dateTo) }} - {{ form_row(form.hotelBusProId) }} -
-

- Buszustiege -

-
- {% do form.pickups.setRendered %} - {%- for pickup in form.pickups -%}{{- _self.collectionRow(pickup) -}}{%- endfor -%} -
-
- +
+ {{ form_row(form.product) }} + {{ form_row(form.hotelBusProId) }} +
+
+ {{ form_row(form.dateFrom) }} + {{ form_row(form.dateTo) }} +
+
+ {{ form_row(form.country) }} +
+

+ Buszustiege +

+
+ {% do form.pickups.setRendered %} + {%- for pickup in form.pickups -%}{{- _self.collectionRow(pickup) -}}{%- endfor -%} +
+
+ +