fix: use currency value provided by api response for the calendar

This commit is contained in:
2026-08-17 08:40:41 +02:00
parent 5396ab941b
commit 9fc490fabf
@@ -111,6 +111,7 @@ class AjaxCalendarController extends ActionController
'pricePerNight' => $item['pricePerNight'] ?? null, 'pricePerNight' => $item['pricePerNight'] ?? null,
'defaultPricePerNight' => $item['defaultPricePerNight'] ?? null, 'defaultPricePerNight' => $item['defaultPricePerNight'] ?? null,
'type' => $item['type'] ?? null, 'type' => $item['type'] ?? null,
'currency' => $item['currency'] ?? null,
'includedPax' => $item['includedPax'] ?? null, 'includedPax' => $item['includedPax'] ?? null,
'minNights' => (int)($item['minNights'] ?? 0), 'minNights' => (int)($item['minNights'] ?? 0),
]; ];
@@ -253,11 +254,12 @@ class AjaxCalendarController extends ActionController
private function buildPriceTooltip(array $item): string private function buildPriceTooltip(array $item): string
{ {
$price = $item['pricePerNight'] ?? null; $price = $item['pricePerNight'] ?? null;
$currency = $this->getCurrencySymbol($item['currency'] ?? null);
if ($price !== null) { if ($price !== null) {
$priceStr = (($item['type'] ?? null) === 'discount') $priceStr = (($item['type'] ?? null) === 'discount')
? $price . ' € (Angebot)' ? $price . ' ' . $currency
: 'ab ' . $price . ' '; : 'ab ' . $price . ' ' . $currency;
} else { } else {
$priceStr = 'Anfrage'; $priceStr = 'Anfrage';
} }
@@ -269,6 +271,15 @@ class AjaxCalendarController extends ActionController
: $priceStr; : $priceStr;
} }
private function getCurrencySymbol(?string $currency): string
{
if (null === $currency || '' === $currency) {
return '€';
}
return 'EUR' === $currency ? '€' : $currency;
}
/** /**
* @return array<int, array<string, mixed>> * @return array<int, array<string, mixed>>
*/ */