Hide non-bookable dates in dates table
This commit is contained in:
@@ -153,7 +153,7 @@ class AjaxTableController extends ActionController
|
|||||||
|
|
||||||
$nonBookableDateUids = GeneralUtility::trimExplode(',', $product->getNonBookableDates(), true);
|
$nonBookableDateUids = GeneralUtility::trimExplode(',', $product->getNonBookableDates(), true);
|
||||||
|
|
||||||
$datesTable = $this->dateService->preprocessDatesTable([
|
$allDates = $this->dateService->preprocessDatesTable([
|
||||||
'dateTableData' => $dates,
|
'dateTableData' => $dates,
|
||||||
'template' => $this->settings['bpnBookingUrlTemplateCode'],
|
'template' => $this->settings['bpnBookingUrlTemplateCode'],
|
||||||
'paCode' => $paCode,
|
'paCode' => $paCode,
|
||||||
@@ -162,6 +162,10 @@ class AjaxTableController extends ActionController
|
|||||||
'nonBookableDateUids' => $nonBookableDateUids,
|
'nonBookableDateUids' => $nonBookableDateUids,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
$bookableDates = array_filter($allDates, function (array $date) {
|
||||||
|
return $date['available'] > 0;
|
||||||
|
});
|
||||||
|
|
||||||
$altProductLink = null;
|
$altProductLink = null;
|
||||||
$altLabel = null;
|
$altLabel = null;
|
||||||
if ($product->getAltProduct()) {
|
if ($product->getAltProduct()) {
|
||||||
@@ -178,15 +182,16 @@ class AjaxTableController extends ActionController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$hasSurchargeOrDiscount = $this->dateService->checkSurcharcheOrDiscount($datesTable);
|
$hasSurchargeOrDiscount = $this->dateService->checkSurcharcheOrDiscount($allDates);
|
||||||
$noInfoConceptUids = GeneralUtility::trimExplode(',', $this->settings['noInfoConceptUids']);
|
$noInfoConceptUids = GeneralUtility::trimExplode(',', $this->settings['noInfoConceptUids']);
|
||||||
$isProductWithNoInfoConcept = ($product->getConcept() !== null) && \in_array($product->getConcept()->getUid(),
|
$isProductWithNoInfoConcept = ($product->getConcept() !== null) && \in_array($product->getConcept()->getUid(),
|
||||||
$noInfoConceptUids, false);
|
$noInfoConceptUids, false);
|
||||||
|
|
||||||
$this->view->assignMultiple([
|
$this->view->assignMultiple([
|
||||||
'dates' => $datesTable,
|
'allDates' => $allDates,
|
||||||
|
'bookableDates' => $bookableDates,
|
||||||
'bookable' => $product->getBookable(),
|
'bookable' => $product->getBookable(),
|
||||||
'unavailable' => count($datesTable) === 0,
|
'unavailable' => count($allDates) === 0,
|
||||||
'product' => $product,
|
'product' => $product,
|
||||||
'hotel' => $hotel,
|
'hotel' => $hotel,
|
||||||
'altProductLink' => $altProductLink,
|
'altProductLink' => $altProductLink,
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
</f:if>
|
</f:if>
|
||||||
</f:else>
|
</f:else>
|
||||||
</f:if>
|
</f:if>
|
||||||
<f:if condition="{dates}">
|
<f:if condition="{bookableDates}">
|
||||||
<div class="headline--3 mb-2">
|
<div class="headline--3 mb-2">
|
||||||
Buchungsoptionen {hotel.name}
|
Buchungsoptionen {hotel.name}
|
||||||
</div>
|
</div>
|
||||||
@@ -42,8 +42,8 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<f:for each="{dates}" as="row" iteration="iteration">
|
<f:for each="{bookableDates}" as="row" iteration="iteration">
|
||||||
<tr class="odd:bg-zinc-50 hover:bg-zinc-100 odd:hover:bg-zinc-100{f:if(condition: '{iteration.cycle} > 5', then: ' hidden')}"
|
<tr class="odd:bg-zinc-50 hover:bg-zinc-100 odd:hover:bg-zinc-100{f:if(condition: '{bookableDates -> f:count()} > 5 && {iteration.cycle} > 5', then: ' hidden')}"
|
||||||
data-pricetable-target="row">
|
data-pricetable-target="row">
|
||||||
<td class="border-r border-zinc-200 px-2 py-1 md:p-2">
|
<td class="border-r border-zinc-200 px-2 py-1 md:p-2">
|
||||||
<f:if condition="{bookable} && {row.available} && {row.showBookingButton}">
|
<f:if condition="{bookable} && {row.available} && {row.showBookingButton}">
|
||||||
@@ -184,7 +184,7 @@
|
|||||||
</button>
|
</button>
|
||||||
</li>
|
</li>
|
||||||
</f:if>
|
</f:if>
|
||||||
<f:if condition="{dates -> f:count()} > 5">
|
<f:if condition="{bookableDates -> f:count()} > 5">
|
||||||
<li class="py-2">
|
<li class="py-2">
|
||||||
<button type="button"
|
<button type="button"
|
||||||
class="flex items-center space-x-1 focus:outline-none text-ep-primary-light ser:text-ser-primary"
|
class="flex items-center space-x-1 focus:outline-none text-ep-primary-light ser:text-ser-primary"
|
||||||
|
|||||||
Reference in New Issue
Block a user