feat: highlight prices with undersubscription

closes #86998znag
This commit is contained in:
Björn Fromme
2025-06-02 11:49:25 +02:00
parent d8351534be
commit 498b70409e
3 changed files with 10 additions and 4 deletions
@@ -358,7 +358,8 @@ class ProductRepository extends AbstractRepository
'date.bus_pro_id as dateBusProId', 'date.hotel_bus_pro_id as hotelBusProId',
'date.date_end as dateEnd', 'date.hotel as hotelUid', 'date.hotel_name as hotelName',
'date.hotel_header_title as hotelTitle', 'date.hotel_category as hotelCategory',
'room.pax as roomPax', 'room.price as roomPrice', 'room.available as available',
'room.name as roomName', 'room.pax as roomPax', 'room.price as roomPrice',
'room.available as available',
'hotel.detail_page as hotelDetailPageUid', 'hotel.short_name as hotelShortName',
'hotel.show_as_teaser as hotelShowAsTeaser'
)
@@ -384,6 +384,8 @@ class DateService implements SingletonInterface
}
$entry =& $priceTable[$categoryUid][$hotelUid]['rooms'];
$isUndersubscription = 1 === preg_match('/mit \d{1,2} Personen/', $row['roomName']);
// Add new entry or replace possible existing entry that is not
// bookable with current record in case of matching category
// and pax
@@ -391,7 +393,7 @@ class DateService implements SingletonInterface
$entry[$roomPax] = [
'price' => $row['roomPrice'],
'available' => $row['available'] && $row['roomPrice'],
'undersubscription' => $isUndersubscription,
] ;
} else {
$lastEntry = $entry[$roomPax];
@@ -399,6 +401,7 @@ class DateService implements SingletonInterface
$entry[$roomPax] = [
'price' => $row['roomPrice'],
'available' => $row['available'] && $row['roomPrice'],
'undersubscription' => $isUndersubscription,
];
}
}
@@ -20,7 +20,7 @@
<f:section name="Table">
<div class="w-full max-w-full overflow-x-scroll md:overflow-x-auto">
<table class="min-w-full border border-zinc-200 border-collapse mb-8">
<table class="min-w-full border border-zinc-200 border-collapse mb-2">
<f:for each="{categories}" as="category" key="categoryKey">
<f:if condition="{v:variable.get(name: 'pricetable.{categoryKey}', useRawKeys: 1) -> f:count()} > 0">
<tr class="text-white {ep:themeClasses(classes: '{sbw: \'bg-sbw-primary\', snz: \'bg-snz-primary\', uch: \'bg-uch-primary\'}', key: themekey)}">
@@ -60,8 +60,9 @@
<f:then>
<f:link.typolink
parameter="{row.hotelUri}"
class="{ep:themeClasses(classes: '{sbw: \'text-sbw-primary\', snz: \'text-snz-primary\', uch: \'text-uch-primary\'}', key: settings.themekey)}">
class="whitespace-nowrap {ep:themeClasses(classes: '{sbw: \'text-sbw-primary\', snz: \'text-snz-primary\', uch: \'text-uch-primary\'}', key: settings.themekey)}">
{row.rooms.{type}.price}
{f:if(condition: '{row.rooms.{type}.undersubscription}', then: '*')}
</f:link.typolink>
</f:then>
<f:else>
@@ -79,6 +80,7 @@
</f:if>
</f:for>
</table>
<p class="text-sm mb-8">* Preis kommt durch eine Unterbelegung zustande.</p>
</div>
</f:section>