diff --git a/package-lock.json b/package-lock.json index 37583f30..a88ea6fd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3176,6 +3176,11 @@ "locate-path": "^2.0.0" } }, + "flatpickr": { + "version": "4.5.2", + "resolved": "https://registry.npmjs.org/flatpickr/-/flatpickr-4.5.2.tgz", + "integrity": "sha512-jDy4QYGpmiy7+Qk8QvKJ4spjDdxcx9cxMydmq1x427HkKWBw0qizLYeYM2F6tMcvvqGjU5VpJS55j4LnsaBblA==" + }, "flatten": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/flatten/-/flatten-1.0.2.tgz", diff --git a/package.json b/package.json index 9217edf9..80a77645 100644 --- a/package.json +++ b/package.json @@ -11,11 +11,12 @@ }, "dependencies": { "@fancyapps/fancybox": "^3.2.5", - "@fengyuanchen/datepicker": "^0.6.4", + "@fengyuanchen/datepicker": "^0.6.5", "bootstrap-sass": "^3.3.7", "bourbon": "^4.3.2", "cookieconsent": "^3.1.0", "dayjs": "^1.7.5", + "flatpickr": "^4.5.2", "font-awesome": "^4.7.0", "iframe-resizer": "^3.6.1", "jquery": "^2.2.4", diff --git a/web/typo3conf/ext/ep_products/Classes/Controller/AjaxSearchController.php b/web/typo3conf/ext/ep_products/Classes/Controller/AjaxSearchController.php index 6b8da39b..b496aba9 100644 --- a/web/typo3conf/ext/ep_products/Classes/Controller/AjaxSearchController.php +++ b/web/typo3conf/ext/ep_products/Classes/Controller/AjaxSearchController.php @@ -91,31 +91,35 @@ class AjaxSearchController extends ActionController { $dateSelected = false; $organic = true; + $forcedConceptUid = (int) $this->settings['forcedConceptUid']; + $excludedConceptUids = GeneralUtility::trimExplode(',', $this->settings['excludedConceptUids']); if ($filterSettings === null) { - $forcedConceptUid = (int) $this->settings['forcedConceptUid']; $filterSettings = $this->filterService->getDefaultFilterSettings($forcedConceptUid); - } elseif ($filterSettings->getDateFrom() !== null || $filterSettings->getDateTo() !== null) { + } + + if ($filterSettings->getDateFrom() !== null || $filterSettings->getDateTo() !== null) { $dateSelected = true; } - $excludedConceptUids = GeneralUtility::trimExplode(',', $this->settings['excludedConceptUids']); - $filterOptions = $this->filterService->getFilterOptions($filterSettings, $excludedConceptUids); - if ($filterOptions === null) { - $filterSettings = $this->filterService->getDefaultFilterSettings(); - $filterOptions = $this->filterService->getFilterOptions($filterSettings, $excludedConceptUids); - } + $searchResult = $this->searchResultService->getResult($filterSettings, $excludedConceptUids); + if ($searchResult->getTotal() === 0) { - $filterSettings = $this->filterService->getDefaultFilterSettings(); + $filterSettings = $this->filterService->getDefaultFilterSettings($forcedConceptUid); $searchResult = $this->searchResultService->getResult($filterSettings, $excludedConceptUids); $organic = false; } + + $filterOptions = $this->filterService->getFilterOptions($filterSettings, $excludedConceptUids); + $options = [ 'defaultDetailPageUid' => $this->settings['defaultDetailPageUid'], 'referringPageUid' => $referringPageUid, 'filterSettings' => $filterSettings, ]; + $this->searchResultUrlService->process($searchResult, $options); + return json_encode([ 'data' => $searchResult->getData(), 'filterOptions' => $filterOptions, diff --git a/web/typo3conf/ext/ep_products/Classes/Service/FilterService.php b/web/typo3conf/ext/ep_products/Classes/Service/FilterService.php index fd1f1648..fdda4349 100644 --- a/web/typo3conf/ext/ep_products/Classes/Service/FilterService.php +++ b/web/typo3conf/ext/ep_products/Classes/Service/FilterService.php @@ -91,7 +91,7 @@ class FilterService implements SingletonInterface } $filterOptionsData = static::$cache['filterOptions'][$key]; if (count($filterOptionsData) === 0) { - return null; + return new FilterOptions(); } $dateRange = $this->constrainDateRange($this->getDateRange()); return $this->preprocessFilterOptions($filterOptionsData, $dateRange); diff --git a/web/typo3conf/ext/ep_theme/Resources/Private/Assets/js/_styles.js b/web/typo3conf/ext/ep_theme/Resources/Private/Assets/js/_styles.js index 1ccc7ee0..af6a0214 100644 --- a/web/typo3conf/ext/ep_theme/Resources/Private/Assets/js/_styles.js +++ b/web/typo3conf/ext/ep_theme/Resources/Private/Assets/js/_styles.js @@ -5,3 +5,4 @@ require('cookieconsent/build/cookieconsent.min.css'); require('@fancyapps/fancybox/dist/jquery.fancybox.min.css'); require('slick-carousel/slick/slick.css'); require('leaflet/dist/leaflet.css'); +require('flatpickr/dist/flatpickr.css'); diff --git a/web/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/Datepicker.vue b/web/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/Datepicker.vue deleted file mode 100644 index 8f8943bf..00000000 --- a/web/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/Datepicker.vue +++ /dev/null @@ -1,77 +0,0 @@ - - - - diff --git a/web/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/DaterangeSelect.vue b/web/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/DaterangeSelect.vue index af3cf89a..a3a7f77c 100644 --- a/web/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/DaterangeSelect.vue +++ b/web/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/DaterangeSelect.vue @@ -4,13 +4,13 @@