diff --git a/public/typo3conf/ext/ep_products/Classes/Controller/AjaxSearchbarController.php b/public/typo3conf/ext/ep_products/Classes/Controller/AjaxSearchbarController.php index c4aee202..2527d4c9 100644 --- a/public/typo3conf/ext/ep_products/Classes/Controller/AjaxSearchbarController.php +++ b/public/typo3conf/ext/ep_products/Classes/Controller/AjaxSearchbarController.php @@ -68,16 +68,11 @@ class AjaxSearchbarController extends ActionController * @param array $searchParams * @return string */ - public function updateAction(array $searchParams = null) + public function indexAction(array $searchParams) { + $fixed = (bool)$this->settings['fixed']; $forcedConceptUids = GeneralUtility::trimExplode(',', $this->settings['forcedConceptUids'], true); - - if (null === $searchParams) { - $searchParams = $this->searchResultService->getNormalizedSearchParams(); - $filterSettings = $this->filterService->getNormalizedFilterSettings([], $forcedConceptUids); - } else { - $filterSettings = $this->filterService->getFilterSettingsFromSearchParams($searchParams); - } + $filterSettings = $this->filterService->getFilterSettingsFromSearchParams($searchParams); $excludedConceptUids = GeneralUtility::trimExplode(',', $this->settings['excludedConceptUids']); $excludedRegionUids = GeneralUtility::trimExplode(',', $this->settings['excludedRegionUids']); $filterOptions = $this->filterService->getFilterOptions( @@ -87,9 +82,11 @@ class AjaxSearchbarController extends ActionController $forcedConceptUids ); - return json_encode([ + $this->view->assignMultiple([ + 'filterSettings' => $filterSettings, 'filterOptions' => $filterOptions, 'searchParams' => $searchParams, - ], JSON_THROW_ON_ERROR); + 'fixed' => $fixed, + ]); } } diff --git a/public/typo3conf/ext/ep_products/Classes/Controller/GroupsPriceController.php b/public/typo3conf/ext/ep_products/Classes/Controller/GroupsPriceController.php index 067270f9..3d64017c 100644 --- a/public/typo3conf/ext/ep_products/Classes/Controller/GroupsPriceController.php +++ b/public/typo3conf/ext/ep_products/Classes/Controller/GroupsPriceController.php @@ -41,8 +41,8 @@ class GroupsPriceController extends ActionController }); $this->view->assign('hotel', $hotel); - $this->view->assign('configs', json_encode(array_values($configs))); - $this->view->assign('boards', json_encode($hotel->getGroupsPriceBoards()->toArray())); - $this->view->assign('options', json_encode($hotel->getGroupsPriceOptions()->toArray())); + $this->view->assign('configs', json_encode(array_values($configs), JSON_HEX_APOS)); + $this->view->assign('boards', json_encode($hotel->getGroupsPriceBoards()->toArray(), JSON_HEX_APOS)); + $this->view->assign('options', json_encode($hotel->getGroupsPriceOptions()->toArray(), JSON_HEX_APOS)); } } diff --git a/public/typo3conf/ext/ep_products/Classes/Domain/Model/GroupsPriceConfig.php b/public/typo3conf/ext/ep_products/Classes/Domain/Model/GroupsPriceConfig.php index 4a59d058..4f9cd902 100644 --- a/public/typo3conf/ext/ep_products/Classes/Domain/Model/GroupsPriceConfig.php +++ b/public/typo3conf/ext/ep_products/Classes/Domain/Model/GroupsPriceConfig.php @@ -143,7 +143,7 @@ class GroupsPriceConfig extends AbstractEntity implements \JsonSerializable /** * @return float */ - public function getPriceAdditionalPerson(): float + public function getPriceAdditionalPerson(): ?float { return $this->priceAdditionalPerson; } @@ -159,7 +159,7 @@ class GroupsPriceConfig extends AbstractEntity implements \JsonSerializable /** * @return float */ - public function getPriceAdditionalPersonGroup1(): float + public function getPriceAdditionalPersonGroup1(): ?float { return $this->priceAdditionalPersonGroup1; } @@ -175,7 +175,7 @@ class GroupsPriceConfig extends AbstractEntity implements \JsonSerializable /** * @return float */ - public function getPriceAdditionalPersonGroup2(): float + public function getPriceAdditionalPersonGroup2(): ?float { return $this->priceAdditionalPersonGroup2; } @@ -191,7 +191,7 @@ class GroupsPriceConfig extends AbstractEntity implements \JsonSerializable /** * @return float */ - public function getPriceAdditionalPersonGroup3(): float + public function getPriceAdditionalPersonGroup3(): ?float { return $this->priceAdditionalPersonGroup3; } diff --git a/public/typo3conf/ext/ep_products/Classes/Service/FilterService.php b/public/typo3conf/ext/ep_products/Classes/Service/FilterService.php index 5ecc4a02..bc4087e4 100644 --- a/public/typo3conf/ext/ep_products/Classes/Service/FilterService.php +++ b/public/typo3conf/ext/ep_products/Classes/Service/FilterService.php @@ -281,6 +281,7 @@ class FilterService implements SingletonInterface 'uid' => $index, 'min' => $range[0], 'max' => $range[1], + 'formatted' => $this->formatPriceRange($range[0], $range[1]), ]; } } @@ -303,8 +304,8 @@ class FilterService implements SingletonInterface $filterOptions = new FilterOptions(); $filterOptions->setPriceRanges($priceRanges); - $filterOptions->setDateFrom(new \DateTime($dateMin)); - $filterOptions->setDateTo(new \DateTime($dateMax)); + $filterOptions->setDateFrom($dateMin); + $filterOptions->setDateTo($dateMax); $filterOptions->setConcepts($concepts); $filterOptions->setDestinations($destinations); $filterOptions->setHotelTypes($hotelTypes); @@ -316,6 +317,18 @@ class FilterService implements SingletonInterface return $filterOptions; } + public function formatPriceRange(int $min, int $max): string + { + if ($min === 1) { + return sprintf('bis %d €', $max); + } + if ($max === 999) { + return sprintf('ab %d €', $min); + } + + return sprintf('%d - %d €', $min, $max); + } + public function getFiltersettingsFromSettings(array $settings): array { $filterSettings = $this->getNormalizedFilterSettings(); diff --git a/public/typo3conf/ext/ep_products/Classes/Service/HotelDataService.php b/public/typo3conf/ext/ep_products/Classes/Service/HotelDataService.php index 73412bb5..f4b71e9a 100644 --- a/public/typo3conf/ext/ep_products/Classes/Service/HotelDataService.php +++ b/public/typo3conf/ext/ep_products/Classes/Service/HotelDataService.php @@ -256,17 +256,14 @@ class HotelDataService implements SingletonInterface $hotel['dates'][] = $row['dateStart']; } - $dateStart = new \DateTime($row['dateStart']); - $dateEnd = new \DateTime($row['dateEnd']); - if ($hotel['minDateStart'] === null - || $hotel['minDateStart'] > $dateStart) { - $hotel['minDateStart'] = $dateStart; + || $hotel['minDateStart'] > $row['dateStart']) { + $hotel['minDateStart'] = $row['dateStart']; } if ($hotel['maxDateEnd'] === null - || $hotel['maxDateEnd'] < $dateEnd) { - $hotel['maxDateEnd'] = $dateEnd; + || $hotel['maxDateEnd'] < $row['dateEnd']) { + $hotel['maxDateEnd'] = $row['dateEnd']; } if ($hotel['minPrice'] === null diff --git a/public/typo3conf/ext/ep_products/Configuration/TypoScript/setup.typoscript b/public/typo3conf/ext/ep_products/Configuration/TypoScript/setup.typoscript index 3547ee70..7372212d 100644 --- a/public/typo3conf/ext/ep_products/Configuration/TypoScript/setup.typoscript +++ b/public/typo3conf/ext/ep_products/Configuration/TypoScript/setup.typoscript @@ -157,7 +157,7 @@ tx_epproducts_ajax_json { 1 = dates } AjaxSearchbar { - 1 = update + 1 = index } AjaxTable { 1 = datestable diff --git a/public/typo3conf/ext/ep_products/ext_localconf.php b/public/typo3conf/ext/ep_products/ext_localconf.php index 6447ecba..a6089944 100644 --- a/public/typo3conf/ext/ep_products/ext_localconf.php +++ b/public/typo3conf/ext/ep_products/ext_localconf.php @@ -371,7 +371,7 @@ $iconRegistry->registerIcon( [ 'AjaxSearch' => 'searchresult', 'AjaxDate' => 'dates', - 'AjaxSearchbar' => 'update', + 'AjaxSearchbar' => 'index', 'AjaxContingent' => 'list,rooms', 'AjaxTable' => 'datestable,pricetable,pricetableHtml,eventPricetable', 'AjaxCalendar' => 'range,contingents,availableRooms', @@ -381,7 +381,7 @@ $iconRegistry->registerIcon( [ 'AjaxSearch' => 'searchresult', 'AjaxDate' => 'dates', - 'AjaxSearchbar' => 'update', + 'AjaxSearchbar' => 'index', 'AjaxContingent' => 'list,rooms', // 'AjaxTable' => 'datestable,pricetable,pricetableHtml,eventPricetable', 'AjaxCalendar' => 'range,contingents,availableRooms', diff --git a/public/typo3conf/ext/ep_theme/Configuration/TypoScript/setup.typoscript b/public/typo3conf/ext/ep_theme/Configuration/TypoScript/setup.typoscript index 557730d7..71076f69 100644 --- a/public/typo3conf/ext/ep_theme/Configuration/TypoScript/setup.typoscript +++ b/public/typo3conf/ext/ep_theme/Configuration/TypoScript/setup.typoscript @@ -94,7 +94,7 @@ lib.stdheader.3.headerClass > @import 'EXT:ep_theme/Configuration/TypoScript/Page/*' config { - compressJs = 0 + compressJs = 1 compressCss = 1 typolinkCheckRootline = 1 typolinkEnableLinksAcrossDomains = 1 diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/_app.js b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/_app.js index 78964631..5e668be1 100644 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/_app.js +++ b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/_app.js @@ -3,7 +3,6 @@ require('cookieconsent') require('lazysizes') require('lazysizes/plugins/unveilhooks/ls.unveilhooks') require('picturefill') -import Glightbox from 'glightbox' // Polyfills import smoothscroll from 'smoothscroll-polyfill' @@ -11,26 +10,44 @@ smoothscroll.polyfill() // Alpine stuff import Alpine from 'alpinejs' -import parseAppConfig from './components/appconfig' -import appendPaCode from './components/pacode' import daytripDateSelect from './components/daytrip-date-select' import searchBar from './components/search-bar' -import calendar from './components/calendar' import contactForm from './components/contact-form' -const appConfig = parseAppConfig() -appendPaCode(appConfig) -Alpine.store('appconfig', appConfig) Alpine.data('daytripDateSelect', daytripDateSelect) Alpine.data('searchBar', searchBar) -Alpine.data('calendar', calendar) Alpine.data('contactForm', contactForm) Alpine.start() -Glightbox({ - selector: 'data-glightbox', - slideEffect: 'fade', -}) +document.addEventListener('DOMContentLoaded', () => { + const configElement = document.getElementById('appconfig') + if (null === configElement) { + return {} + } + const appConfig = JSON.parse(configElement.innerHTML) + const paCode = appConfig.paCode + const externalDomains = appConfig.externalDomains + if (paCode) { + document.querySelectorAll('a').forEach(element => { + if (element.hostname === location.hostname) { + return + } + if (externalDomains.indexOf(element.hostname) === -1) { + return + } + let url = element.href + if (!url) { + return + } + if (url.indexOf('agenturcode=') !== -1) { + return + } + const separator = url.indexOf('?') === -1 ? '?' : '&' + url += separator + 'agenturcode=' + paCode + element.href = url + }) + } +}, false) import { Application } from 'stimulus' import { definitionsFromContext } from 'stimulus/webpack-helpers' diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/GroupsPriceCalculator.vue b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/GroupsPriceCalculator.vue index 35655cd1..c54ebdab 100644 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/GroupsPriceCalculator.vue +++ b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/GroupsPriceCalculator.vue @@ -1,5 +1,5 @@