From e5fa63b7e871a97de712a1724ced1c985f60b8be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Fromme?= Date: Wed, 5 Aug 2026 12:28:43 +0200 Subject: [PATCH] feat: dedicated logos per country for accommodation bookings --- .env | 4 +++ assets/images/logo_alpinevacation.svg | 33 +++++++++++++++++++ assets/images/logo_cllt.svg | 33 +++++++++++++++++++ migrations/Version20260805102251.php | 28 ++++++++++++++++ src/Entity/Groups/Accommodation.php | 17 ++++++++++ src/Enum/Groups/AccommodationCountry.php | 31 +++++++++++++++++ src/Form/Admin/Groups/AccommodationType.php | 7 ++++ templates/_partials/_header.html.twig | 6 +++- templates/admin/accommodation/_form.html.twig | 1 + .../accommodation/modal_create.html.twig | 1 + templates/layout.html.twig | 4 ++- templates/layout_booking.html.twig | 4 ++- translations/messages.de.yaml | 5 +++ 13 files changed, 171 insertions(+), 3 deletions(-) create mode 100644 assets/images/logo_alpinevacation.svg create mode 100644 assets/images/logo_cllt.svg create mode 100644 migrations/Version20260805102251.php create mode 100644 src/Enum/Groups/AccommodationCountry.php diff --git a/.env b/.env index 2805a26..798f8d9 100644 --- a/.env +++ b/.env @@ -54,6 +54,10 @@ APP_NEWSLETTER_CONFIRMATION_TTL_HOURS=1 # (override in .env.local/production secrets as usual). ACCOMMODATION_OFFER_LINK_SECRET=abf8ec28cc2162d9121d35d6f8cbf7c29728cdacce0303e22e1bac854501728a +ACCOMMODATION_TERMS_AT= +ACCOMMODATION_TERMS_CH= +ACCOMMODATION_TERMS_IT= + BPN_CONNECT_BASE_URL=https://bpn-connect.ep-reisen.app BPN_CONNECT_API_KEY= diff --git a/assets/images/logo_alpinevacation.svg b/assets/images/logo_alpinevacation.svg new file mode 100644 index 0000000..8d246bc --- /dev/null +++ b/assets/images/logo_alpinevacation.svg @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + ALPINEVACATION + + + + + + + + diff --git a/assets/images/logo_cllt.svg b/assets/images/logo_cllt.svg new file mode 100644 index 0000000..4af82bf --- /dev/null +++ b/assets/images/logo_cllt.svg @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + CLLT Touristik + + + + + + + + diff --git a/migrations/Version20260805102251.php b/migrations/Version20260805102251.php new file mode 100644 index 0000000..0d75bd1 --- /dev/null +++ b/migrations/Version20260805102251.php @@ -0,0 +1,28 @@ +addSql("ALTER TABLE accommodation ADD country VARCHAR(2) DEFAULT 'DE' NOT NULL"); + $this->addSql('ALTER TABLE accommodation ALTER country DROP DEFAULT'); + } + + public function down(Schema $schema): void + { + $this->addSql('ALTER TABLE accommodation DROP country'); + } +} diff --git a/src/Entity/Groups/Accommodation.php b/src/Entity/Groups/Accommodation.php index f94b7cd..ab855ce 100644 --- a/src/Entity/Groups/Accommodation.php +++ b/src/Entity/Groups/Accommodation.php @@ -6,6 +6,7 @@ use App\Entity\BlameableEntity; use App\Entity\BlameableEntityInterface; use App\Entity\TimestampableEntity; use App\Entity\TimestampableEntityInterface; +use App\Enum\Groups\AccommodationCountry; use App\Repository\Groups\AccommodationRepository; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; @@ -64,6 +65,10 @@ class Accommodation implements BlameableEntityInterface, TimestampableEntityInte #[Assert\Choice(choices: ['EUR', 'CHF'], message: 'invalid')] private ?string $currency = 'EUR'; + #[ORM\Column(length: 2, enumType: AccommodationCountry::class)] + #[Assert\NotNull(message: 'required')] + private ?AccommodationCountry $country = AccommodationCountry::Germany; + public function __construct() { $this->accommodationPrices = new ArrayCollection(); @@ -171,6 +176,18 @@ class Accommodation implements BlameableEntityInterface, TimestampableEntityInte return $this; } + public function getCountry(): ?AccommodationCountry + { + return $this->country; + } + + public function setCountry(AccommodationCountry $country): self + { + $this->country = $country; + + return $this; + } + /** * @return Collection */ diff --git a/src/Enum/Groups/AccommodationCountry.php b/src/Enum/Groups/AccommodationCountry.php new file mode 100644 index 0000000..2cd7a73 --- /dev/null +++ b/src/Enum/Groups/AccommodationCountry.php @@ -0,0 +1,31 @@ +value; + } + + /** + * Logo of the legal entity operating this country's accommodations, shown in the + * header of the public booking and offer pages. Null falls back to the logo of the + * request host — Germany has no dedicated entity. + */ + public function logo(): ?string + { + return match ($this) { + self::Austria => 'logo_cllt.svg', + self::Switzerland => 'logo_alpinevacation.svg', + self::Italy => 'logo_ep.svg', + self::Germany => null, + }; + } +} diff --git a/src/Form/Admin/Groups/AccommodationType.php b/src/Form/Admin/Groups/AccommodationType.php index 0767852..314f902 100644 --- a/src/Form/Admin/Groups/AccommodationType.php +++ b/src/Form/Admin/Groups/AccommodationType.php @@ -5,8 +5,10 @@ declare(strict_types=1); namespace App\Form\Admin\Groups; use App\Entity\Groups\Accommodation; +use App\Enum\Groups\AccommodationCountry; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; +use Symfony\Component\Form\Extension\Core\Type\EnumType; use Symfony\Component\Form\Extension\Core\Type\IntegerType; use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; @@ -38,6 +40,11 @@ class AccommodationType extends AbstractType 'CHF' => 'CHF', ], ]) + ->add('country', EnumType::class, [ + 'label' => 'Land', + 'class' => AccommodationCountry::class, + 'choice_label' => fn (AccommodationCountry $country): string => $country->label(), + ]) ; } diff --git a/templates/_partials/_header.html.twig b/templates/_partials/_header.html.twig index c177d20..6c1a697 100644 --- a/templates/_partials/_header.html.twig +++ b/templates/_partials/_header.html.twig @@ -1,6 +1,10 @@ {% if cmsData is not null and cmsData.name is not null %}
diff --git a/templates/admin/accommodation/modal_create.html.twig b/templates/admin/accommodation/modal_create.html.twig index dd92038..c91dab5 100644 --- a/templates/admin/accommodation/modal_create.html.twig +++ b/templates/admin/accommodation/modal_create.html.twig @@ -9,6 +9,7 @@
{{ form_row(form.name) }} {{ form_row(form.currency) }} + {{ form_row(form.country) }} {{ form_row(form.calendarCode) }} {{ form_row(form.cmsCode) }} {{ form_row(form.maxAdolescentAge) }} diff --git a/templates/layout.html.twig b/templates/layout.html.twig index c68f288..239e6cf 100644 --- a/templates/layout.html.twig +++ b/templates/layout.html.twig @@ -5,7 +5,9 @@
{% block header %} - {% include '_partials/_header.html.twig' %} + {% include '_partials/_header.html.twig' with { + accommodation: ctx is defined ? ctx.accommodation : null + } %} {% endblock %}
diff --git a/templates/layout_booking.html.twig b/templates/layout_booking.html.twig index 2f86329..70e563a 100644 --- a/templates/layout_booking.html.twig +++ b/templates/layout_booking.html.twig @@ -5,7 +5,9 @@
{% block header %} - {% include '_partials/_header.html.twig' %} + {% include '_partials/_header.html.twig' with { + accommodation: ctx is defined ? ctx.accommodation : null + } %} {% endblock %}
diff --git a/translations/messages.de.yaml b/translations/messages.de.yaml index 090fe23..edf9296 100644 --- a/translations/messages.de.yaml +++ b/translations/messages.de.yaml @@ -14,6 +14,11 @@ service: separator: ' und ' enum: + accommodation_country: + DE: Deutschland + AT: Österreich + CH: Schweiz + IT: Italien additional_service: flat: pauschal per_person: pro Person