From ed8a8a2f8b79e02af8d0fe2bb1dac398dc385684 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Fromme?= Date: Thu, 8 Jan 2026 17:51:39 +0100 Subject: [PATCH] feat: streamlined display of hotel image, name and address --- src/Service/BookingSummaryDataService.php | 7 +++++-- src/Service/CmsDataService.php | 8 +++++--- templates/booking/create/authenticate.html.twig | 14 ++++++++++---- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/Service/BookingSummaryDataService.php b/src/Service/BookingSummaryDataService.php index b894867..627ebf2 100644 --- a/src/Service/BookingSummaryDataService.php +++ b/src/Service/BookingSummaryDataService.php @@ -4,6 +4,7 @@ declare(strict_types=1); namespace App\Service; +use App\BusProNet\DataProvider\CountryDataProvider; use App\BusProNet\Model\Hotel; use App\BusProNet\XmlLoader\HotelLoader; use App\Form\Model\BookingDto; @@ -24,6 +25,7 @@ class BookingSummaryDataService private readonly BookingPriceCalculatorService $priceCalculator, private readonly CmsDataService $cmsDataService, private readonly HotelLoader $hotelLoader, + private readonly CountryDataProvider $countryDataProvider, private readonly CacheInterface $cache, private readonly LoggerInterface $logger, ) { @@ -182,7 +184,7 @@ class BookingSummaryDataService } /** - * Formats a hotel's address from street and city. + * Formats a hotel's address from street, city and country. */ private function formatHotelAddress(?Hotel $hotel): ?string { @@ -190,7 +192,8 @@ class BookingSummaryDataService return null; } - $parts = array_filter([$hotel->street, $hotel->city]); + $countryName = $this->countryDataProvider->get($hotel->country)?->name; + $parts = array_filter([$hotel->street, $hotel->city, $countryName]); return [] === $parts ? null : implode("\n", $parts); } diff --git a/src/Service/CmsDataService.php b/src/Service/CmsDataService.php index 2fb3bbd..a9d453a 100644 --- a/src/Service/CmsDataService.php +++ b/src/Service/CmsDataService.php @@ -31,20 +31,22 @@ class CmsDataService } /** - * Fetches only the hotel images from the CMS using normalized codes. + * Fetches only the hotel images from the CMS. + * + * The product code is normalized for CMS lookup while the hotel code + * is passed as-is for better matching results. * * @return array|null The images array or null if unavailable */ public function getProductImages(string $productCode, ?string $hotelCode = null): ?array { $normalizedProduct = $this->normalizeCode($productCode); - $normalizedHotel = $this->normalizeCode($hotelCode); if (null === $normalizedProduct) { return null; } - $result = $this->getProductDetails($normalizedProduct, $normalizedHotel); + $result = $this->getProductDetails($normalizedProduct, $hotelCode); if (true === isset($result['success']) && false === $result['success']) { return null; diff --git a/templates/booking/create/authenticate.html.twig b/templates/booking/create/authenticate.html.twig index 66b87cf..a6db461 100644 --- a/templates/booking/create/authenticate.html.twig +++ b/templates/booking/create/authenticate.html.twig @@ -10,18 +10,24 @@
- {% if cmsData.hotel.images is defined %} + {% if cmsData.hotel.images.resized.l[0] is defined %} {{ cmsData.hotel.images.resized.l[0].alt }} {% endif %} -
-
+
+
{{ travel_title }}
-
+
{{ travel_date_from | date('d.m.Y') }} - {{ travel_date_to | date('d.m.Y') }}
+ {% if cmsData.hotel.name is defined and cmsData.hotel.name %} +
{{ cmsData.hotel.name }}
+ {% endif %} + {% if cmsData.hotel.address is defined and cmsData.hotel.address %} +
{{ cmsData.hotel.address | nl2br }}
+ {% endif %}