feat: render 'new' badge in teasers and product detail header

This commit is contained in:
Björn Fromme
2024-02-06 12:19:13 +01:00
parent 10befd2c95
commit 0fb627094e
9 changed files with 39 additions and 3 deletions
@@ -135,6 +135,11 @@ class Date extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
*/
protected $available = 0;
/**
* @var bool
*/
protected $new = false;
/**
* @return int $bookingId
*/
@@ -469,4 +474,13 @@ class Date extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
$this->available = $available;
}
public function isNew()
{
return $this->new;
}
public function setNew(bool $new)
{
$this->new = $new;
}
}
@@ -70,7 +70,7 @@ class ProductRepository extends AbstractRepository
'date.board as board', 'date.board_bus_pro_id as boardUid',
'date.product_fact as productFact', 'date.hotel_fact as hotelFact', 'date.region_fact as regionFact',
'date.services_included as servicesIncluded',
'date.bus_available as busAvailable',
'date.bus_available as busAvailable', 'date.new as new',
'date.min_price as minPrice', 'date.nights as nights', 'date.available as available',
'date.pseudo_price as pseudoPrice', 'date.hide_booking_button as hideBookingButton',
'room.type as roomType'
@@ -132,7 +132,7 @@ class ProductRepository extends AbstractRepository
'skipass_included as skipassIncluded', 'bus_included as busIncluded',
'earlybird', 'new', 'daytrip', 'hide_booking_button as hideBookingButton',
'low_contingent as lowContingent', 'concept_code as conceptCode', 'concept_name as conceptName',
'board'
'board', 'new'
)
->from('tx_epproducts_domain_model_date', 'date')
->where('date_start >= NOW()')
@@ -155,6 +155,7 @@ class SearchResultService implements SingletonInterface
'dates' => [],
'nights' => [],
'rooms' => [],
'new' => $row['new'],
];
$total++;
}
@@ -25,7 +25,7 @@ return [
'types' => [
'1' => ['showitem' => 'hidden, bus_pro_id, hotel_bus_pro_id, code, daytrip, date_start, date_end, nights, board,
board_code, board_bus_pro_id, bus_included, bus_available, skipass_included, services_included,
services_general, pickups, discount, min_price, pseudo_price, available'],
services_general, pickups, discount, min_price, pseudo_price, available, new'],
],
'palettes' => [
'1' => ['showitem' => ''],
@@ -314,5 +314,13 @@ return [
'eval' => 'trim',
],
],
'new' => [
'exclude' => 0,
'label' => 'neu',
'config' => [
'type' => 'check',
'default' => 0,
],
],
]
];
@@ -49,6 +49,11 @@
{product.concept.name}
</div>
</f:if>
<f:if condition="{hotel.new}">
<div class="flex items-center text-white font-semibold leading-none uppercase h-6 md:h-8 px-2 bg-badge-gradient">
NEU!
</div>
</f:if>
</div>
<f:if condition="{referringUrl}">
<a href="{referringUrl}" class="button bg-button button--small mt-8">
@@ -55,6 +55,11 @@
<svg class="product-teaser__watchlist-icon" data-watchlist-toggle-target="icon" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4.318 6.318a4.5 4.5 0 000 6.364L12 20.364l7.682-7.682a4.5 4.5 0 00-6.364-6.364L12 7.636l-1.318-1.318a4.5 4.5 0 00-6.364 0z"></path></svg>
</button>
</div>
<f:if condition="{new}">
<div class="absolute top-12 left-2 text-white font-bold text-sm leading-none p-1 bg-badge-gradient">
NEU!
</div>
</f:if>
<f:if condition="{showHotelDetails} && {concept.code} == 'evt'">
<div class="absolute bottom-0 left-0 inset-x-0 flex justify-between text-white {f:if(condition: landscape, else: 'text-sm')} bg-concept-evt/70 px-2 py-1">
<span>{hotel.name}</span>
@@ -83,6 +83,7 @@
dateTo: item.maxDateEnd,
forceHotelUid: 1,
showHotelDetails: 1,
new: item.new,
referringPageUri: referringPageUri
}"/>
</f:for>
@@ -23,6 +23,7 @@
forceHotelUid: teaser.forceHotelUid,
dateFrom: dateFrom,
dateTo: dateTo,
new: teaser.new,
landscape: '{f:if(condition: \'{data.layout} == 2 || {data.layout} == 3\', then: 1, else: 0)}'
}"/>
</f:if>
@@ -51,6 +51,7 @@
forceHotelUid: teaser.forceHotelUid,
dateFrom: dateFrom,
dateTo: dateTo,
new: teaser.new,
index: iteration.index
}"/>
</f:for>