Show skip dates table for single dates
This commit is contained in:
@@ -121,6 +121,43 @@ class AjaxTableController extends ActionController
|
||||
$filterSettings['dateFrom'] = $dateFrom;
|
||||
$filterSettings['dateTo'] = $dateTo;
|
||||
|
||||
$dates = $this->dateService->getDatesTable([
|
||||
'product' => $product,
|
||||
'hotel' => $hotel,
|
||||
'filterSettings' => $filterSettings,
|
||||
]);
|
||||
|
||||
if ($reseller = $this->resellerDataService->getResellerForCurrentDomain()) {
|
||||
$paCode = $reseller['paCode'];
|
||||
}
|
||||
|
||||
if (1 === count($dates)) {
|
||||
$date = reset($dates);
|
||||
$this->forward(
|
||||
'pricetable',
|
||||
null,
|
||||
'ep_products',
|
||||
[
|
||||
'product' => $product,
|
||||
'hotel' => $hotel,
|
||||
'date' => $date['dateUid'],
|
||||
'paCode' => $paCode,
|
||||
'singleDate' => true,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
$nonBookableDateUids = GeneralUtility::trimExplode(',', $product->getNonBookableDates(), true);
|
||||
|
||||
$datesTable = $this->dateService->preprocessDatesTable([
|
||||
'dateTableData' => $dates,
|
||||
'template' => $this->settings['bpnBookingUrlTemplateCode'],
|
||||
'paCode' => $paCode,
|
||||
'isDayTrip' => $product->isDaytrip(),
|
||||
'showBookingButton' => false === $product->getHideBookingButton(),
|
||||
'nonBookableDateUids' => $nonBookableDateUids,
|
||||
]);
|
||||
|
||||
$altProductLink = null;
|
||||
$altLabel = null;
|
||||
if ($product->getAltProduct()) {
|
||||
@@ -136,16 +173,7 @@ class AjaxTableController extends ActionController
|
||||
$altLabel = $product->getAltLabel();
|
||||
}
|
||||
}
|
||||
if ($reseller = $this->resellerDataService->getResellerForCurrentDomain()) {
|
||||
$paCode = $reseller['paCode'];
|
||||
}
|
||||
$datesTable = $this->dateService->getDatesTable([
|
||||
'product' => $product,
|
||||
'hotel' => $hotel,
|
||||
'filterSettings' => $filterSettings,
|
||||
'template' => $this->settings['bpnBookingUrlTemplateCode'],
|
||||
'paCode' => $paCode,
|
||||
]);
|
||||
|
||||
$hasSurchargeOrDiscount = $this->dateService->checkSurcharcheOrDiscount($datesTable);
|
||||
$noInfoConceptUids = GeneralUtility::trimExplode(',', $this->settings['noInfoConceptUids']);
|
||||
$isProductWithNoInfoConcept = ($product->getConcept() !== null) && \in_array($product->getConcept()->getUid(),
|
||||
@@ -169,8 +197,8 @@ class AjaxTableController extends ActionController
|
||||
* @param Product $product
|
||||
* @param Hotel $hotel
|
||||
* @param Date $date
|
||||
* @param string $paCode
|
||||
*
|
||||
* @param null $paCode
|
||||
* @param bool $singleDate
|
||||
* @return string
|
||||
* @throws \Doctrine\DBAL\DBALException
|
||||
*/
|
||||
@@ -179,7 +207,8 @@ class AjaxTableController extends ActionController
|
||||
Product $product,
|
||||
Hotel $hotel,
|
||||
Date $date,
|
||||
$paCode = null
|
||||
$paCode = null,
|
||||
bool $singleDate = false
|
||||
) {
|
||||
$forcedConceptUids = GeneralUtility::trimExplode(',', $this->settings['forcedConceptUids'], true);
|
||||
$filterSettings = $this->filterService->getNormalizedFilterSettings([], $forcedConceptUids);
|
||||
@@ -216,6 +245,7 @@ class AjaxTableController extends ActionController
|
||||
'hasSurcharge' => $hasSurchargeOrDiscount['surcharge'],
|
||||
'hasDiscount' => $hasSurchargeOrDiscount['discount'],
|
||||
'isProductWithNoInfoConcept' => $isProductWithNoInfoConcept,
|
||||
'isSingleDate' => $singleDate,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -147,29 +147,16 @@ class DateService implements SingletonInterface
|
||||
$product = $resolvedOptions['product'];
|
||||
$hotel = $resolvedOptions['hotel'];
|
||||
$filterSettings = $resolvedOptions['filterSettings'];
|
||||
$template = $resolvedOptions['template'];
|
||||
$paCode = $resolvedOptions['paCode'];
|
||||
|
||||
if ($filterSettings === null) {
|
||||
$filterSettings = $this->filterService->getNormalizedFilterSettings();
|
||||
}
|
||||
|
||||
$nonBookableDateUids = GeneralUtility::trimExplode(',', $product->getNonBookableDates(), true);
|
||||
|
||||
$dateTableData = $this->productRepository->getAvailableDates(
|
||||
return $this->productRepository->getAvailableDates(
|
||||
$product,
|
||||
$hotel,
|
||||
$filterSettings
|
||||
);
|
||||
|
||||
return $this->preprocessDatesTable([
|
||||
'dateTableData' => $dateTableData,
|
||||
'template' => $template,
|
||||
'paCode' => $paCode,
|
||||
'isDayTrip' => $product->isDaytrip(),
|
||||
'showBookingButton' => false === $product->getHideBookingButton(),
|
||||
'nonBookableDateUids' => $nonBookableDateUids,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -177,9 +164,8 @@ class DateService implements SingletonInterface
|
||||
*/
|
||||
protected function configureDatesTableOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefined(['filterSettings', 'paCode']);
|
||||
$resolver->setDefined(['filterSettings']);
|
||||
$resolver->setRequired(['product', 'hotel']);
|
||||
$resolver->setDefault('template', 'base');
|
||||
$resolver->setAllowedTypes('product', Product::class);
|
||||
$resolver->setAllowedTypes('hotel', Hotel::class);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user