feat: streamlined display of hotel image, name and address
This commit is contained in:
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Service;
|
namespace App\Service;
|
||||||
|
|
||||||
|
use App\BusProNet\DataProvider\CountryDataProvider;
|
||||||
use App\BusProNet\Model\Hotel;
|
use App\BusProNet\Model\Hotel;
|
||||||
use App\BusProNet\XmlLoader\HotelLoader;
|
use App\BusProNet\XmlLoader\HotelLoader;
|
||||||
use App\Form\Model\BookingDto;
|
use App\Form\Model\BookingDto;
|
||||||
@@ -24,6 +25,7 @@ class BookingSummaryDataService
|
|||||||
private readonly BookingPriceCalculatorService $priceCalculator,
|
private readonly BookingPriceCalculatorService $priceCalculator,
|
||||||
private readonly CmsDataService $cmsDataService,
|
private readonly CmsDataService $cmsDataService,
|
||||||
private readonly HotelLoader $hotelLoader,
|
private readonly HotelLoader $hotelLoader,
|
||||||
|
private readonly CountryDataProvider $countryDataProvider,
|
||||||
private readonly CacheInterface $cache,
|
private readonly CacheInterface $cache,
|
||||||
private readonly LoggerInterface $logger,
|
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
|
private function formatHotelAddress(?Hotel $hotel): ?string
|
||||||
{
|
{
|
||||||
@@ -190,7 +192,8 @@ class BookingSummaryDataService
|
|||||||
return null;
|
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);
|
return [] === $parts ? null : implode("\n", $parts);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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<string, mixed>|null The images array or null if unavailable
|
* @return array<string, mixed>|null The images array or null if unavailable
|
||||||
*/
|
*/
|
||||||
public function getProductImages(string $productCode, ?string $hotelCode = null): ?array
|
public function getProductImages(string $productCode, ?string $hotelCode = null): ?array
|
||||||
{
|
{
|
||||||
$normalizedProduct = $this->normalizeCode($productCode);
|
$normalizedProduct = $this->normalizeCode($productCode);
|
||||||
$normalizedHotel = $this->normalizeCode($hotelCode);
|
|
||||||
|
|
||||||
if (null === $normalizedProduct) {
|
if (null === $normalizedProduct) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->getProductDetails($normalizedProduct, $normalizedHotel);
|
$result = $this->getProductDetails($normalizedProduct, $hotelCode);
|
||||||
|
|
||||||
if (true === isset($result['success']) && false === $result['success']) {
|
if (true === isset($result['success']) && false === $result['success']) {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -10,18 +10,24 @@
|
|||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
<div class="lg:flex lg:space-x-8 pb-8 mb-8 border-b border-primary-bg/40">
|
<div class="lg:flex lg:space-x-8 pb-8 mb-8 border-b border-primary-bg/40">
|
||||||
{% if cmsData.hotel.images is defined %}
|
{% if cmsData.hotel.images.resized.l[0] is defined %}
|
||||||
<img src="{{ cmsData.hotel.images.resized.l[0].url }}"
|
<img src="{{ cmsData.hotel.images.resized.l[0].url }}"
|
||||||
alt="{{ cmsData.hotel.images.resized.l[0].alt }}"
|
alt="{{ cmsData.hotel.images.resized.l[0].alt }}"
|
||||||
class="block w-full max-w-64 h-auto mb-4">
|
class="block w-full max-w-64 h-auto mb-4">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div class="text-white uppercase max-w-96">
|
<div class="text-white max-w-96">
|
||||||
<div class="text-xl lg:text-2xl font-semibold">
|
<div class="text-xl lg:text-2xl font-semibold uppercase">
|
||||||
{{ travel_title }}
|
{{ travel_title }}
|
||||||
</div>
|
</div>
|
||||||
<div class="text-lg font-semibold">
|
<div class="text-lg font-semibold uppercase">
|
||||||
{{ travel_date_from | date('d.m.Y') }} - {{ travel_date_to | date('d.m.Y') }}
|
{{ travel_date_from | date('d.m.Y') }} - {{ travel_date_to | date('d.m.Y') }}
|
||||||
</div>
|
</div>
|
||||||
|
{% if cmsData.hotel.name is defined and cmsData.hotel.name %}
|
||||||
|
<div class="mt-4 font-semibold">{{ cmsData.hotel.name }}</div>
|
||||||
|
{% endif %}
|
||||||
|
{% if cmsData.hotel.address is defined and cmsData.hotel.address %}
|
||||||
|
<div>{{ cmsData.hotel.address | nl2br }}</div>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="space-y-8 max-w-screen-sm">
|
<div class="space-y-8 max-w-screen-sm">
|
||||||
|
|||||||
Reference in New Issue
Block a user