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