fix: use currency value provided by api response for the calendar
This commit is contained in:
@@ -111,6 +111,7 @@ class AjaxCalendarController extends ActionController
|
||||
'pricePerNight' => $item['pricePerNight'] ?? null,
|
||||
'defaultPricePerNight' => $item['defaultPricePerNight'] ?? null,
|
||||
'type' => $item['type'] ?? null,
|
||||
'currency' => $item['currency'] ?? null,
|
||||
'includedPax' => $item['includedPax'] ?? null,
|
||||
'minNights' => (int)($item['minNights'] ?? 0),
|
||||
];
|
||||
@@ -253,11 +254,12 @@ class AjaxCalendarController extends ActionController
|
||||
private function buildPriceTooltip(array $item): string
|
||||
{
|
||||
$price = $item['pricePerNight'] ?? null;
|
||||
$currency = $this->getCurrencySymbol($item['currency'] ?? null);
|
||||
|
||||
if ($price !== null) {
|
||||
$priceStr = (($item['type'] ?? null) === 'discount')
|
||||
? $price . ' € (Angebot)'
|
||||
: 'ab ' . $price . ' €';
|
||||
? $price . ' ' . $currency
|
||||
: 'ab ' . $price . ' ' . $currency;
|
||||
} else {
|
||||
$priceStr = 'Anfrage';
|
||||
}
|
||||
@@ -269,6 +271,15 @@ class AjaxCalendarController extends ActionController
|
||||
: $priceStr;
|
||||
}
|
||||
|
||||
private function getCurrencySymbol(?string $currency): string
|
||||
{
|
||||
if (null === $currency || '' === $currency) {
|
||||
return '€';
|
||||
}
|
||||
|
||||
return 'EUR' === $currency ? '€' : $currency;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<int, array<string, mixed>>
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user