From e001bb8f8b84b439a34b24ba253fbe0e6bd0d0ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Fromme?= Date: Wed, 21 Dec 2022 16:50:08 +0100 Subject: [PATCH] Hide non-bookable dates in dates table --- .../Classes/Controller/AjaxTableController.php | 13 +++++++++---- .../Private/Templates/AjaxTable/Datestable.html | 8 ++++---- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/public/typo3conf/ext/ep_products/Classes/Controller/AjaxTableController.php b/public/typo3conf/ext/ep_products/Classes/Controller/AjaxTableController.php index a794d9ae..71429d34 100644 --- a/public/typo3conf/ext/ep_products/Classes/Controller/AjaxTableController.php +++ b/public/typo3conf/ext/ep_products/Classes/Controller/AjaxTableController.php @@ -153,7 +153,7 @@ class AjaxTableController extends ActionController $nonBookableDateUids = GeneralUtility::trimExplode(',', $product->getNonBookableDates(), true); - $datesTable = $this->dateService->preprocessDatesTable([ + $allDates = $this->dateService->preprocessDatesTable([ 'dateTableData' => $dates, 'template' => $this->settings['bpnBookingUrlTemplateCode'], 'paCode' => $paCode, @@ -162,6 +162,10 @@ class AjaxTableController extends ActionController 'nonBookableDateUids' => $nonBookableDateUids, ]); + $bookableDates = array_filter($allDates, function (array $date) { + return $date['available'] > 0; + }); + $altProductLink = null; $altLabel = null; 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']); $isProductWithNoInfoConcept = ($product->getConcept() !== null) && \in_array($product->getConcept()->getUid(), $noInfoConceptUids, false); $this->view->assignMultiple([ - 'dates' => $datesTable, + 'allDates' => $allDates, + 'bookableDates' => $bookableDates, 'bookable' => $product->getBookable(), - 'unavailable' => count($datesTable) === 0, + 'unavailable' => count($allDates) === 0, 'product' => $product, 'hotel' => $hotel, 'altProductLink' => $altProductLink, diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Templates/AjaxTable/Datestable.html b/public/typo3conf/ext/ep_theme/Resources/Private/Templates/AjaxTable/Datestable.html index 3826f430..00fe3b03 100644 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Templates/AjaxTable/Datestable.html +++ b/public/typo3conf/ext/ep_theme/Resources/Private/Templates/AjaxTable/Datestable.html @@ -19,7 +19,7 @@ - +
Buchungsoptionen {hotel.name}
@@ -42,8 +42,8 @@ - - + @@ -184,7 +184,7 @@ - +