diff --git a/public/typo3conf/ext/ep_products/Classes/Controller/AjaxFilterpanelController.php b/public/typo3conf/ext/ep_products/Classes/Controller/AjaxFilterpanelController.php deleted file mode 100644 index 990a39bf..00000000 --- a/public/typo3conf/ext/ep_products/Classes/Controller/AjaxFilterpanelController.php +++ /dev/null @@ -1,108 +0,0 @@ -, dreipunktnull - * - * All rights reserved - * - * This script is part of the TYPO3 project. The TYPO3 project is - * free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * The GNU General Public License can be found at - * http://www.gnu.org/copyleft/gpl.html. - * - * This script is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * This copyright notice MUST APPEAR in all copies of the script! - ***************************************************************/ - -use EP\EpProducts\Domain\Model\FilterSettings; -use EP\EpProducts\Service\DateService; -use EP\EpProducts\Service\FilterService; -use EP\EpProducts\Traits\RequestArgumentTypeConversionTrait; -use TYPO3\CMS\Core\Utility\GeneralUtility; -use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; - -class AjaxFilterpanelController extends ActionController -{ - - use RequestArgumentTypeConversionTrait; - - /** - * @var \EP\EpProducts\Service\FilterService - */ - protected $filterService; - - /** - * @var DateService - */ - protected $dateService; - - /** - * @param FilterService $filterService - */ - public function __construct(FilterService $filterService, DateService $dateService) - { - parent::__construct(); - $this->filterService = $filterService; - $this->dateService = $dateService; - } - - public function initializeAction() - { - $forcedConceptUids = GeneralUtility::trimExplode(',', $this->settings['forcedConceptUids'], true); - $this->processFilterSettingsArgument($forcedConceptUids); - } - - /** - * @param FilterSettings $filterSettings - */ - public function panelAction(FilterSettings $filterSettings) - { - $excludedConceptUids = GeneralUtility::trimExplode(',', $this->settings['excludedConceptUids']); - $excludedRegionUids = GeneralUtility::trimExplode(',', $this->settings['excludedRegionUids']); - - $filterOptions = $this->filterService->getFilterOptions( - $filterSettings, - $excludedConceptUids, - $excludedRegionUids - ); - - $this->view->assignMultiple([ - 'filterOptions' => $filterOptions, - 'filterSettings' => $filterSettings, - ]); - } - - /** - * @param FilterSettings $filterSettings - * @param string $search - * - * @return string - */ - public function autocompleteAction(FilterSettings $filterSettings, $search) - { - $excludedConceptUids = GeneralUtility::trimExplode(',', $this->settings['excludedConceptUids']); - $excludedRegionUids = GeneralUtility::trimExplode(',', $this->settings['excludedRegionUids']); - - $destinations = $this->dateService->getAutocompleteOptions( - $filterSettings, - $search, - $excludedConceptUids, - $excludedRegionUids - ); - return json_encode($destinations, JSON_THROW_ON_ERROR); - } - -} diff --git a/public/typo3conf/ext/ep_products/Classes/Controller/AjaxSearchController.php b/public/typo3conf/ext/ep_products/Classes/Controller/AjaxSearchController.php index e7ff9bfa..62c0e780 100644 --- a/public/typo3conf/ext/ep_products/Classes/Controller/AjaxSearchController.php +++ b/public/typo3conf/ext/ep_products/Classes/Controller/AjaxSearchController.php @@ -92,6 +92,7 @@ class AjaxSearchController extends ActionController $organic = true; $forcedConceptUids = GeneralUtility::trimExplode(',', $this->settings['forcedConceptUids'], true); $excludedConceptUids = GeneralUtility::trimExplode(',', $this->settings['excludedConceptUids']); + $excludedRegionUids = GeneralUtility::trimExplode(',', $this->settings['excludedRegionUids']); if ($filterSettings === null) { $filterSettings = $this->filterService->getDefaultFilterSettings($forcedConceptUids); @@ -115,6 +116,13 @@ class AjaxSearchController extends ActionController $this->searchResultUrlService->process($searchResult, $options); + $filterOptions = $this->filterService->getFilterOptions( + $filterSettings, + $excludedConceptUids, + $excludedRegionUids, + $forcedConceptUids + ); + $referringPageUri = $this ->uriBuilder ->reset() @@ -129,12 +137,13 @@ class AjaxSearchController extends ActionController ; $this->view->assignMultiple([ + 'filterSettings' => $filterSettings, + 'filterOptions' => $filterOptions, 'searchResult' => $searchResult->getData(), 'referringPageUri' => $referringPageUri, 'meta' => [ 'organic' => $organic, 'total' => $searchResult->getTotal(), - 'destinationName' => $filterSettings->getDestinationName(), 'dateRange' => DateUtility::formatDateRange($filterSettings->getDateFrom(), $filterSettings->getDateTo()), 'dateSelected' => $dateSelected, ], diff --git a/public/typo3conf/ext/ep_products/Classes/Controller/AjaxSearchbarController.php b/public/typo3conf/ext/ep_products/Classes/Controller/AjaxSearchbarController.php index d6c15ba4..109a4b63 100644 --- a/public/typo3conf/ext/ep_products/Classes/Controller/AjaxSearchbarController.php +++ b/public/typo3conf/ext/ep_products/Classes/Controller/AjaxSearchbarController.php @@ -55,8 +55,7 @@ class AjaxSearchbarController extends ActionController public function initializeAction() { - $forcedConceptUids = GeneralUtility::trimExplode(',', $this->settings['forcedConceptUids'], true); - $this->processSearchParamsArgument($forcedConceptUids); + $this->processSearchParamsArgument(); } /** @@ -65,16 +64,23 @@ class AjaxSearchbarController extends ActionController */ public function updateAction(SearchParams $searchParams = null) { + $forcedConceptUids = GeneralUtility::trimExplode(',', $this->settings['forcedConceptUids'], true); + if ($searchParams === null) { $searchParams = new SearchParams(); - $forcedConceptUids = GeneralUtility::trimExplode(',', $this->settings['forcedConceptUids'], true); $filterSettings = $this->filterService->getDefaultFilterSettings($forcedConceptUids); } else { $filterSettings = FilterSettings::fromSearchParams($searchParams); } $excludedConceptUids = GeneralUtility::trimExplode(',', $this->settings['excludedConceptUids']); $excludedRegionUids = GeneralUtility::trimExplode(',', $this->settings['excludedRegionUids']); - $filterOptions = $this->filterService->getFilterOptions($filterSettings, $excludedConceptUids, $excludedRegionUids); + $filterOptions = $this->filterService->getFilterOptions( + $filterSettings, + $excludedConceptUids, + $excludedRegionUids, + $forcedConceptUids + ); + return json_encode([ 'filterOptions' => $filterOptions, 'searchParams' => $searchParams, diff --git a/public/typo3conf/ext/ep_products/Classes/Controller/ProductController.php b/public/typo3conf/ext/ep_products/Classes/Controller/ProductController.php index 4e8de1a1..1c66d36b 100644 --- a/public/typo3conf/ext/ep_products/Classes/Controller/ProductController.php +++ b/public/typo3conf/ext/ep_products/Classes/Controller/ProductController.php @@ -33,7 +33,6 @@ use EP\EpProducts\Domain\Repository\HotelRepository; use EP\EpProducts\Domain\Repository\ProductRepository; use EP\EpProducts\Service\DateService; use EP\EpProducts\Service\FilterService; -use EP\EpProducts\Service\FilterSettingsEncoder; use EP\EpProducts\Service\HotelDataService; use EP\EpProducts\Service\ProductDataService; use TYPO3\CMS\Core\Utility\GeneralUtility; @@ -119,12 +118,11 @@ class ProductController extends ActionController // Redirect to search page in case no product can be determined if ($product === null) { $filterSettings = $this->filterService->getDefaultFilterSettings(); - $filterSettingsEncoded = FilterSettingsEncoder::encode($filterSettings); $this->redirect( 'searchresult', 'Search', null, - ['filterSettings' => $filterSettingsEncoded], + ['filterSettings' => $filterSettings->toArray()], $this->settings['defaultSearchPageUid'] ); } diff --git a/public/typo3conf/ext/ep_products/Classes/Controller/SearchController.php b/public/typo3conf/ext/ep_products/Classes/Controller/SearchController.php index 0009cdbb..cf39eaef 100644 --- a/public/typo3conf/ext/ep_products/Classes/Controller/SearchController.php +++ b/public/typo3conf/ext/ep_products/Classes/Controller/SearchController.php @@ -32,7 +32,6 @@ use EP\EpProducts\Domain\Model\SearchParams; use EP\EpProducts\Service\FilterService; use EP\EpProducts\Service\FilterSettingsEncoder; use EP\EpProducts\Traits\RequestArgumentTypeConversionTrait; -use TYPO3\CMS\Core\Log\LogManager; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; use TYPO3\CMS\Extbase\Mvc\Exception\StopActionException; @@ -64,18 +63,15 @@ class SearchController extends ActionController { parent::__construct(); $this->filterService = $filterService; - } - - public function initializeAction() - { $forcedConceptUids = GeneralUtility::trimExplode(',', $this->settings['forcedConceptUids'], true); + $excludedConceptUids = GeneralUtility::trimExplode(',', $this->settings['excludedConceptUids'], true); + $excludedRegionUids = GeneralUtility::trimExplode(',', $this->settings['excludedRegionUids'], true); $this->defaultFilterSettings = $this->filterService->getDefaultFilterSettings($forcedConceptUids); - $excludedConceptUids = GeneralUtility::trimExplode(',', $this->settings['excludedConceptUids']); - $excludedRegionUids = GeneralUtility::trimExplode(',', $this->settings['excludedRegionUids']); $this->defaultFilterOptions = $this->filterService->getFilterOptions( $this->defaultFilterSettings, $excludedConceptUids, - $excludedRegionUids + $excludedRegionUids, + $forcedConceptUids ); } @@ -103,8 +99,7 @@ class SearchController extends ActionController public function initializeProcessSearchAction() { - $forcedConceptUids = GeneralUtility::trimExplode(',', $this->settings['forcedConceptUids'], true); - $this->processSearchParamsArgument($forcedConceptUids); + $this->processSearchParamsArgument(); } /** @@ -143,11 +138,13 @@ class SearchController extends ActionController { $excludedConceptUids = GeneralUtility::trimExplode(',', $this->settings['excludedConceptUids']); $excludedRegionUids = GeneralUtility::trimExplode(',', $this->settings['excludedRegionUids']); + $forcedConceptUids = GeneralUtility::trimExplode(',', $this->settings['forcedConceptUids'], true); $filterOptions = $this->filterService->getFilterOptions( $filterSettings, $excludedConceptUids, - $excludedRegionUids + $excludedRegionUids, + $forcedConceptUids ); $this->view->assignMultiple([ @@ -172,21 +169,4 @@ class SearchController extends ActionController ['filterSettings' => $filterSettings] ); } - - /** - * @param SearchParams $searchParams - */ - private function logSearch(SearchParams $searchParams) - { - $ignoreIps = GeneralUtility::trimExplode(',', $this->settings['searchLogIgnoreIps'], true); - $remoteIp = GeneralUtility::getIndpEnv('REMOTE_ADDR'); - if (\in_array($remoteIp, $ignoreIps, false)) { - return; - } - /** @var $logger \TYPO3\CMS\Core\Log\Logger */ - $logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(__CLASS__); - $logger->info('Searchresult processed', [ - 'searchParams' => $searchParams, - ]); - } } diff --git a/public/typo3conf/ext/ep_products/Classes/Domain/Model/FilterOptions.php b/public/typo3conf/ext/ep_products/Classes/Domain/Model/FilterOptions.php index 6e098ab0..92b9b190 100644 --- a/public/typo3conf/ext/ep_products/Classes/Domain/Model/FilterOptions.php +++ b/public/typo3conf/ext/ep_products/Classes/Domain/Model/FilterOptions.php @@ -29,6 +29,18 @@ namespace EP\EpProducts\Domain\Model; class FilterOptions implements \JsonSerializable { + /** + * @var array + */ + public static $priceRangeOptions = [ + 1 => [ 1, 200 ], + 2 => [ 200, 300 ], + 3 => [ 300, 400 ], + 4 => [ 400, 500 ], + 5 => [ 500, 600 ], + 6 => [ 600, 999 ], + ]; + /** * @var array */ diff --git a/public/typo3conf/ext/ep_products/Classes/Domain/Model/FilterSettings.php b/public/typo3conf/ext/ep_products/Classes/Domain/Model/FilterSettings.php index 33736469..e90e3e96 100644 --- a/public/typo3conf/ext/ep_products/Classes/Domain/Model/FilterSettings.php +++ b/public/typo3conf/ext/ep_products/Classes/Domain/Model/FilterSettings.php @@ -34,46 +34,13 @@ use TYPO3\CMS\Extbase\Mvc\Request; class FilterSettings implements \JsonSerializable { - const DESTINATION_TYPE_COUNTRY = 'country'; - const DESTINATION_TYPE_REGION = 'region'; - const DESTINATION_TYPE_CITY = 'city'; - const DESTINATION_TYPE_HOTEL = 'hotel'; - const DESTINATION_TYPE_PRODUCT = 'product'; - - const DURATION_SHORT = 4; - const DURATION_LONG = 5; + public const DURATION_SHORT = 4; + public const DURATION_LONG = 5; /** * @var array */ - public static $priceRanges = [ - 1 => [ 1, 200 ], - 2 => [ 200, 300 ], - 3 => [ 300, 400 ], - 4 => [ 400, 500 ], - 5 => [ 500, 600 ], - 6 => [ 600, 999 ], - ]; - - /** - * @var int - */ - protected $priceRange = 0; - - /** - * @var string - */ - protected $destinationName = ''; - - /** - * @var int - */ - protected $destinationUid = 0; - - /** - * @var string - */ - protected $destinationType = ''; + protected $priceRanges = []; /** * @var array @@ -159,26 +126,39 @@ class FilterSettings implements \JsonSerializable public static function fromSearchParams(SearchParams $searchParams): self { $filterSettings = new self; - $filterSettings->setDateFrom($searchParams->getDateFrom()); - $filterSettings->setDateTo($searchParams->getDateTo()); - $filterSettings->setDestinationUid($searchParams->getDestinationUid()); - $filterSettings->setDestinationType($searchParams->getDestinationType()); if ($searchParams->getDestinationType() && $searchParams->getDestinationUid()) { + $destinationUid = $searchParams->getDestinationUid(); switch ($searchParams->getDestinationType()) { - case self::DESTINATION_TYPE_COUNTRY: - $filterSettings->setCountryUids([$searchParams->getDestinationUid()]); + case SearchParams::DESTINATION_TYPE_COUNTRY: + $filterSettings->setCountryUids([$destinationUid]); break; - case self::DESTINATION_TYPE_REGION: - $filterSettings->setRegionUids([$searchParams->getDestinationUid()]); + case SearchParams::DESTINATION_TYPE_REGION: + $filterSettings->setRegionUids([$destinationUid]); + break; + case SearchParams::DESTINATION_TYPE_CITY: + $filterSettings->setCityUids([$destinationUid]); + break; + case SearchParams::DESTINATION_TYPE_CONCEPT: + $filterSettings->setConceptUids([$destinationUid]); break; } } - if ($searchParams->getConceptUids()) { - $filterSettings->setConceptUids($searchParams->getConceptUids()); + if (null !== $searchParams->getDateFrom()) { + $filterSettings->setDateFrom($searchParams->getDateFrom()); } - $filterSettings->setPriceRange($searchParams->getPriceRange()); - $filterSettings->setPax($searchParams->getPax()); - $filterSettings->setNights($searchParams->getNights()); + if (null !== $searchParams->getDateTo()) { + $filterSettings->setDateTo($searchParams->getDateTo()); + } + if (null !== $searchParams->getPriceRange()) { + $filterSettings->setPriceRanges([$searchParams->getPriceRange()]); + } + if (null !== $searchParams->getPax()) { + $filterSettings->setPax($searchParams->getPax()); + } + if (null !== $searchParams->getNights()) { + $filterSettings->setNights($searchParams->getNights()); + } + return $filterSettings; } @@ -256,67 +236,19 @@ class FilterSettings implements \JsonSerializable } /** - * @return int + * @return array */ - public function getPriceRange() + public function getPriceRanges() { - return $this->priceRange; + return $this->priceRanges; } /** - * @param int $priceRange + * @param array $priceRanges */ - public function setPriceRange($priceRange) + public function setPriceRanges($priceRanges) { - $this->priceRange = $priceRange; - } - - /** - * @return string - */ - public function getDestinationName() - { - return $this->destinationName; - } - - /** - * @param string $destinationName - */ - public function setDestinationName($destinationName) - { - $this->destinationName = $destinationName; - } - - /** - * @return int - */ - public function getDestinationUid() - { - return $this->destinationUid; - } - - /** - * @param int $destinationUid - */ - public function setDestinationUid($destinationUid) - { - $this->destinationUid = (int) $destinationUid; - } - - /** - * @return string - */ - public function getDestinationType() - { - return $this->destinationType; - } - - /** - * @param string $destinationType - */ - public function setDestinationType($destinationType) - { - $this->destinationType = $destinationType; + $this->priceRanges = $priceRanges; } /** @@ -542,22 +474,10 @@ class FilterSettings implements \JsonSerializable $this->bus = $bus; } - /** - * @return bool - */ - public function getDestinationSelected() - { - return $this->destinationType !== ''; - } - - public function toArray(): array { return [ - 'priceRange' => $this->getPriceRange(), - 'destinationName' => $this->getDestinationName(), - 'destinationUid' => $this->getDestinationUid(), - 'destinationType' => $this->getDestinationType(), + 'priceRanges' => $this->getPriceRanges(), 'countryUids' => $this->getCountryUids(), 'regionUids' => $this->getRegionUids(), 'cityUids' => $this->getCityUids(), diff --git a/public/typo3conf/ext/ep_products/Classes/Domain/Model/SearchParams.php b/public/typo3conf/ext/ep_products/Classes/Domain/Model/SearchParams.php index f67824ea..75fa7385 100644 --- a/public/typo3conf/ext/ep_products/Classes/Domain/Model/SearchParams.php +++ b/public/typo3conf/ext/ep_products/Classes/Domain/Model/SearchParams.php @@ -32,10 +32,15 @@ use TYPO3\CMS\Extbase\Mvc\Request; class SearchParams implements \JsonSerializable { + public const DESTINATION_TYPE_COUNTRY = 'country'; + public const DESTINATION_TYPE_REGION = 'region'; + public const DESTINATION_TYPE_CITY = 'city'; + public const DESTINATION_TYPE_CONCEPT = 'concept'; + /** * @var int */ - protected $priceRange = 0; + protected $priceRange; /** * @var \DateTime @@ -50,22 +55,17 @@ class SearchParams implements \JsonSerializable /** * @var int */ - protected $destinationUid = 0; + protected $destinationUid; /** * @var string */ protected $destinationType; - /** - * @var array - */ - protected $conceptUids = []; - /** * @var int */ - protected $nights = 0; + protected $nights; /** * @var int @@ -75,7 +75,7 @@ class SearchParams implements \JsonSerializable /** * @var int */ - protected $pageUid = 0; + protected $pageUid; /** * @param int $pageUid @@ -187,22 +187,6 @@ class SearchParams implements \JsonSerializable $this->destinationType = $destinationType; } - /** - * @return array - */ - public function getConceptUids() - { - return $this->conceptUids; - } - - /** - * @param array $conceptUids - */ - public function setConceptUids(array $conceptUids) - { - $this->conceptUids = $conceptUids; - } - /** * @return int */ @@ -257,7 +241,6 @@ class SearchParams implements \JsonSerializable 'priceRange' => $this->getPriceRange(), 'destinationUid' => $this->getDestinationUid(), 'destinationType' => $this->getDestinationType(), - 'conceptUids' => $this->getConceptUids(), 'nights' => $this->getNights(), 'pax' => $this->getPax(), 'pageUid' => $this->getPageUid(), diff --git a/public/typo3conf/ext/ep_products/Classes/Domain/Repository/AbstractRepository.php b/public/typo3conf/ext/ep_products/Classes/Domain/Repository/AbstractRepository.php index d00681bd..c4ea8eea 100644 --- a/public/typo3conf/ext/ep_products/Classes/Domain/Repository/AbstractRepository.php +++ b/public/typo3conf/ext/ep_products/Classes/Domain/Repository/AbstractRepository.php @@ -27,6 +27,7 @@ namespace EP\EpProducts\Domain\Repository; * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ +use EP\EpProducts\Domain\Model\FilterOptions; use EP\EpProducts\Domain\Model\FilterSettings; use EP\EpProducts\Traits\DbConnectionTrait; use TYPO3\CMS\Core\Database\Connection; @@ -163,16 +164,21 @@ abstract class AbstractRepository extends \TYPO3\CMS\Extbase\Persistence\Reposit */ protected function addPriceRangeFilterConditions(QueryBuilder $query, FilterSettings $filterSettings) { - // Price range - $priceRange = (int) $filterSettings->getPriceRange(); - if ($priceRange > 0) { - [ $priceMin, $priceMax ] = FilterSettings::$priceRanges[$priceRange]; - $query - ->andWhere('date.min_price >= :priceMin') - ->andWhere('date.min_price < :priceMax') - ->setParameter('priceMin', $priceMin) - ->setParameter('priceMax', $priceMax) - ; + // Price ranges + if (count($filterSettings->getPriceRanges()) > 0) { + $orX = $query->expr()->orX(); + foreach ($filterSettings->getPriceRanges() as $priceRange) { + [ $priceMin, $priceMax ] = FilterOptions::$priceRangeOptions[$priceRange]; + $orX->add($query->expr()->andX( + $query->expr()->gte('date.min_price', ':priceMin'), + $query->expr()->lt('date.min_price', ':priceMax') + )); + $query + ->setParameter('priceMin', $priceMin) + ->setParameter('priceMax', $priceMax) + ; + } + $query->andWhere($orX); } } diff --git a/public/typo3conf/ext/ep_products/Classes/Domain/Repository/DateRepository.php b/public/typo3conf/ext/ep_products/Classes/Domain/Repository/DateRepository.php index 332ecc33..8e2fc9ef 100644 --- a/public/typo3conf/ext/ep_products/Classes/Domain/Repository/DateRepository.php +++ b/public/typo3conf/ext/ep_products/Classes/Domain/Repository/DateRepository.php @@ -72,21 +72,18 @@ class DateRepository extends AbstractRepository return [$dateRangeFrom, $dateRangeTo]; } - /** - * @param FilterSettings $filterSettings - * @param array $excludedConceptUids - * @param array $excludedRegionUids - * @return array - * @throws \Doctrine\DBAL\DBALException - */ - public function getFilterOptions(FilterSettings $filterSettings, $excludedConceptUids = [], $excludedRegionUids = []) - { + public function getFilterOptions( + FilterSettings $filterSettings, + array $excludedConceptUids = [], + array $excludedRegionUids = [], + array $forcedConceptUids = [] + ) { $qb = $this->getDbConnection()->createQueryBuilder(); $query = $qb ->select( 'date.concept as conceptUid', 'date.concept_name as conceptName', 'date.concept_sorting as conceptSorting', - 'date.concept_code as conceptCode', 'date.min_price as minPrice', + 'date.concept_code as conceptCode', 'date.min_price as minPrice', 'date.date_start as dateStart', 'date.date_end as dateEnd', 'date.country as countryUid','date.country_name as countryName', 'date.country_code as countryCode', 'date.region as regionUid', 'date.region_name as regionName', 'date.nights as nights', 'date.board as boardType', 'date.board_bus_pro_id as boardUid', @@ -120,6 +117,13 @@ class DateRepository extends AbstractRepository ; } + if (count($forcedConceptUids) > 0) { + $query + ->andWhere('date.concept IN (:forcedConceptUids)') + ->setParameter('forcedConceptUids', $forcedConceptUids, Connection::PARAM_INT_ARRAY) + ; + } + $this->addFiltersettingsConditions($query, $filterSettings); return $query->execute()->fetchAllAssociative(); diff --git a/public/typo3conf/ext/ep_products/Classes/Service/FilterService.php b/public/typo3conf/ext/ep_products/Classes/Service/FilterService.php index ac892c14..ea583d5b 100644 --- a/public/typo3conf/ext/ep_products/Classes/Service/FilterService.php +++ b/public/typo3conf/ext/ep_products/Classes/Service/FilterService.php @@ -27,10 +27,8 @@ namespace EP\EpProducts\Service; * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ -use EP\EpProducts\Domain\Model\Date; use EP\EpProducts\Domain\Model\FilterOptions; use EP\EpProducts\Domain\Model\FilterSettings; -use EP\EpProducts\Domain\Model\Product; use EP\EpProducts\Domain\Repository\DateRepository; use TYPO3\CMS\Core\SingletonInterface; use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; @@ -57,17 +55,14 @@ class FilterService implements SingletonInterface $this->dateRepository = $dateRepository; } - /** - * @param array $forcedConceptUids - * @param bool $respectBookableDaterange - * @param string $dateFromYmd - * @param string $dateToYmd - * @return FilterSettings - * @throws \Exception - */ - public function getDefaultFilterSettings(array $forcedConceptUids = [], $respectBookableDaterange = true, $dateFromYmd = null, $dateToYmd = null) - { - [ $dateFrom, $dateTo ] = $this->constrainDateRange($this->getDateRange()); + public function getDefaultFilterSettings + ( + array $forcedConceptUids = [], + bool $respectBookableDaterange = true, + string $dateFromYmd = null, + string $dateToYmd = null + ): FilterSettings { + [ $dateFrom, $dateTo ] = $this->constrainDateRange($this->dateRepository->getDateRange()); if (null !== $dateFromYmd) { $dateFrom = new \DateTime($dateFromYmd); @@ -87,37 +82,27 @@ class FilterService implements SingletonInterface return $filterSettings; } - /** - * @param FilterSettings $filterSettings - * @param array $excludedConceptUids - * @param array $excludedRegionUids - * @return FilterOptions - * @throws \Doctrine\DBAL\DBALException - */ - public function getFilterOptions(FilterSettings $filterSettings, $excludedConceptUids = [], $excludedRegionUids = []) - { - $key = md5(serialize($filterSettings) . serialize($excludedConceptUids). serialize($excludedRegionUids)); - if (empty(static::$cache['filterOptions'][$key])) { - static::$cache['filterOptions'][$key] = $this->dateRepository->getFilterOptions( - $filterSettings, - $excludedConceptUids, - $excludedRegionUids - ); - } - $filterOptionsData = static::$cache['filterOptions'][$key]; + public function getFilterOptions + ( + FilterSettings $filterSettings, + array $excludedConceptUids = [], + array $excludedRegionUids = [], + array $forcedConceptUids = [] + ): FilterOptions { + $filterOptionsData = $this->dateRepository->getFilterOptions( + $filterSettings, + $excludedConceptUids, + $excludedRegionUids, + $forcedConceptUids + ); if (count($filterOptionsData) === 0) { return new FilterOptions(); } - $dateRange = $this->constrainDateRange($this->getDateRange()); - return $this->preprocessFilterOptions($filterOptionsData, $dateRange); + + return $this->preprocessFilterOptions($filterOptionsData); } - /** - * @param array $filterOptionsData - * @param array $dateRange - * @return FilterOptions - */ - public function preprocessFilterOptions(array $filterOptionsData, array $dateRange) + public function preprocessFilterOptions(array $filterOptionsData): FilterOptions { $priceRanges = []; $busAvailable = false; @@ -127,12 +112,21 @@ class FilterService implements SingletonInterface $hotelTypes = []; $roomTypes = []; $boardTypes = []; + $dateMin = $dateMax = null; $absPath = ExtensionManagementUtility::extPath('ep_theme'); $baseUrl = '/' . PathUtility::stripPathSitePrefix($absPath); foreach ($filterOptionsData as $row) { + // Date + if (null === $dateMin || $row['dateStart'] < $dateMin) { + $dateMin = $row['dateStart']; + } + if (null === $dateMax || $row['dateEnd'] > $dateMax) { + $dateMax = $row['dateEnd']; + } + // Bus if ((bool) $row['busAvailable'] === true) { $busAvailable = true; @@ -193,14 +187,14 @@ class FilterService implements SingletonInterface } // Price range - foreach (FilterSettings::$priceRanges as $index => $priceRange) + foreach (FilterOptions::$priceRangeOptions as $index => $priceRange) { if (array_key_exists($index, $priceRanges)) { continue; } [$min, $max] = $priceRange; if ($row['minPrice'] >= $min && $row['minPrice'] < $max) { - $range = FilterSettings::$priceRanges[$index]; + $range = FilterOptions::$priceRangeOptions[$index]; $priceRanges[$index] = [ 'uid' => $index, 'min' => $range[0], @@ -225,12 +219,10 @@ class FilterService implements SingletonInterface return strcmp($a['label'], $b['label']); }); - list ($dateMin, $dateMax) = $dateRange; - $filterOptions = new FilterOptions(); $filterOptions->setPriceRanges($priceRanges); - $filterOptions->setDateFrom($dateMin); - $filterOptions->setDateTo($dateMax); + $filterOptions->setDateFrom(new \DateTime($dateMin)); + $filterOptions->setDateTo(new \DateTime($dateMax)); $filterOptions->setConcepts($concepts); $filterOptions->setDestinations($destinations); $filterOptions->setHotelTypes($hotelTypes); @@ -242,42 +234,7 @@ class FilterService implements SingletonInterface return $filterOptions; } - /** - * @param FilterSettings $filterSettings - * - * @return array - */ - public function getDateRange(FilterSettings $filterSettings = null) - { - $key = md5(serialize($filterSettings)); - if (empty(static::$cache['dateRange'][$key])) { - static::$cache['dateRange'][$key] = $this->dateRepository->getDateRange(); - } - return static::$cache['dateRange'][$key]; - } - - /** - * @param Product $product - * @param FilterSettings $filterSettings - * - * @return array - */ - public function getProductDateRange(Product $product, FilterSettings $filterSettings = null) - { - $key = md5($product->getUid() . serialize($filterSettings)); - if (empty(static::$cache['productDateRange'][$key])) { - static::$cache['productDateRange'][$key] = $this->dateRepository->getDateRange($product); - } - return $this->constrainDateRange(static::$cache['productDateRange'][$key], $filterSettings); - } - - /** - * @param array $dateRange - * @param FilterSettings $filterSettings - * - * @return array - */ - public function constrainDateRange(array $dateRange, FilterSettings $filterSettings = null) + public function constrainDateRange(array $dateRange, FilterSettings $filterSettings = null): array { [ $dateFrom, $dateTo ] = $dateRange; if ($filterSettings !== null) { @@ -293,67 +250,7 @@ class FilterService implements SingletonInterface return [$dateFrom, $dateTo]; } - /** - * @param FilterSettings $filterSettings - * @param int $conceptUid - * - * @return FilterSettings - */ - public function forceConceptUid(FilterSettings $filterSettings, $conceptUid = null) - { - if ($conceptUid) { - $conceptUids = $filterSettings->getConceptUids(); - if (!\in_array($conceptUid, $conceptUids, false)) { - $conceptUids[] = (int) $conceptUid; - $filterSettings->setConceptUids($conceptUids); - } - } - - return $filterSettings; - } - - /** - * Converts destination type and destination id combo - * from searchbar into appropriate filter setting for - * further processing - * - * @param FilterSettings $filterSettings - */ - public function convertDestinationData(FilterSettings $filterSettings) - { - if ($filterSettings->getDestinationUid() === 0) { - return; - } - - $destinationUid = $filterSettings->getDestinationUid(); - $destinationType = $filterSettings->getDestinationType(); - - switch ($destinationType) - { - case FilterSettings::DESTINATION_TYPE_COUNTRY: - $filterSettings->setCountryUids([$destinationUid]); - break; - case FilterSettings::DESTINATION_TYPE_REGION: - $filterSettings->setRegionUids([$destinationUid]); - break; - case FilterSettings::DESTINATION_TYPE_CITY: - $filterSettings->setCityUids([$destinationUid]); - break; - case FilterSettings::DESTINATION_TYPE_HOTEL: - $filterSettings->setHotelUid($destinationUid); - break; - case FilterSettings::DESTINATION_TYPE_PRODUCT: - $filterSettings->setProductUid($destinationUid); - break; - } - - } - - /** - * @param array $settings - * @return FilterSettings - */ - public function getFiltersettingsFromSettings(array $settings) + public function getFiltersettingsFromSettings(array $settings): FilterSettings { $filterSettings = new FilterSettings(); if (isset($settings['regionUid']) && (int) $settings['regionUid'] > 0) { @@ -384,6 +281,7 @@ class FilterService implements SingletonInterface $hotelTypes = GeneralUtility::trimExplode(',', $settings['hotelTypes'], true); $filterSettings->setHotelTypes($hotelTypes); } + return $filterSettings; } } diff --git a/public/typo3conf/ext/ep_products/Classes/Service/FilterSettingsEncoder.php b/public/typo3conf/ext/ep_products/Classes/Service/FilterSettingsEncoder.php index 1f9fd3e2..c2f40c83 100644 --- a/public/typo3conf/ext/ep_products/Classes/Service/FilterSettingsEncoder.php +++ b/public/typo3conf/ext/ep_products/Classes/Service/FilterSettingsEncoder.php @@ -38,9 +38,6 @@ class FilterSettingsEncoder protected static function getMapping() { return [ - [ 'destinationName', 'string' ], - [ 'destinationUid', 'string' ], - [ 'destinationType', 'string' ], [ 'countryUids', 'array' ], [ 'regionUids', 'array' ], [ 'cityUids', 'array' ], @@ -84,7 +81,7 @@ class FilterSettingsEncoder $values = explode('|', $data); foreach (static::getMapping() as $index => $property) { - list($name, $type) = $property; + [$name, $type] = $property; $value = $values[$index]; if ($type === 'array') { $value = GeneralUtility::trimExplode(';', $value, true); diff --git a/public/typo3conf/ext/ep_products/Classes/Service/LogService.php b/public/typo3conf/ext/ep_products/Classes/Service/LogService.php index 3ed1e328..8fd63cb5 100644 --- a/public/typo3conf/ext/ep_products/Classes/Service/LogService.php +++ b/public/typo3conf/ext/ep_products/Classes/Service/LogService.php @@ -26,7 +26,7 @@ namespace EP\EpProducts\Service; * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ -use EP\EpProducts\Domain\Model\FilterSettings; +use EP\EpProducts\Domain\Model\FilterOptions; use EP\EpProducts\Traits\DbConnectionTrait; use TYPO3\CMS\Backend\Utility\BackendUtility; use TYPO3\CMS\Core\SingletonInterface; @@ -75,7 +75,7 @@ class LogService implements SingletonInterface $searchParams = $data->searchParams; $priceRange = null; if ($searchParams->priceRange) { - list ($priceFrom, $priceTo) = FilterSettings::$priceRanges[$searchParams->priceRange]; + list ($priceFrom, $priceTo) = FilterOptions::$priceRangeOptions[$searchParams->priceRange]; $priceRange = sprintf('%s - %s', $priceFrom, $priceTo); } $pageTitle = ''; diff --git a/public/typo3conf/ext/ep_products/Classes/Traits/RequestArgumentTypeConversionTrait.php b/public/typo3conf/ext/ep_products/Classes/Traits/RequestArgumentTypeConversionTrait.php index 2f0b5b05..7584ff12 100644 --- a/public/typo3conf/ext/ep_products/Classes/Traits/RequestArgumentTypeConversionTrait.php +++ b/public/typo3conf/ext/ep_products/Classes/Traits/RequestArgumentTypeConversionTrait.php @@ -38,17 +38,12 @@ trait RequestArgumentTypeConversionTrait /** * Converts array to searchparams object - * @param array $forcedConceptUids */ - public function processSearchParamsArgument(array $forcedConceptUids = []) + public function processSearchParamsArgument() { if ($this->request->hasArgument('searchParams')) { $searchParamsObject = SearchParams::fromRequest($this->request); - if ($forcedConceptUids) { - $searchParamsObject->setConceptUids($forcedConceptUids); - } - $this->request->setArgument('searchParams', $searchParamsObject); } } @@ -75,8 +70,6 @@ trait RequestArgumentTypeConversionTrait array_push($conceptUids, ...$forcedConceptUids); $filterSettingsObject->setConceptUids($conceptUids); } - - $filterService->convertDestinationData($filterSettingsObject); } $this->request->setArgument('filterSettings', $filterSettingsObject); diff --git a/public/typo3conf/ext/ep_products/Classes/Utility/TypeConversionUtility.php b/public/typo3conf/ext/ep_products/Classes/Utility/TypeConversionUtility.php index 3025ae53..2168d79c 100644 --- a/public/typo3conf/ext/ep_products/Classes/Utility/TypeConversionUtility.php +++ b/public/typo3conf/ext/ep_products/Classes/Utility/TypeConversionUtility.php @@ -24,6 +24,9 @@ class TypeConversionUtility return static::convertType($item); }, $value); } + if (empty($value)) { + return null; + } return $value; } } diff --git a/public/typo3conf/ext/ep_products/Configuration/TypoScript/setup.typoscript b/public/typo3conf/ext/ep_products/Configuration/TypoScript/setup.typoscript index f217e5ca..254f27f1 100644 --- a/public/typo3conf/ext/ep_products/Configuration/TypoScript/setup.typoscript +++ b/public/typo3conf/ext/ep_products/Configuration/TypoScript/setup.typoscript @@ -158,10 +158,6 @@ tx_epproducts_ajax_json { AjaxSearchbar { 1 = update } - AjaxFilterpanel { - 1 = panel - 2 = autocomplete - } AjaxTable { 1 = pricetable 2 = pricetableHtml diff --git a/public/typo3conf/ext/ep_products/ext_localconf.php b/public/typo3conf/ext/ep_products/ext_localconf.php index 17b9f502..64bee374 100644 --- a/public/typo3conf/ext/ep_products/ext_localconf.php +++ b/public/typo3conf/ext/ep_products/ext_localconf.php @@ -371,7 +371,6 @@ $iconRegistry->registerIcon( [ 'AjaxSearch' => 'searchresult', 'AjaxDate' => 'dates', - 'AjaxFilterpanel' => 'panel,autocomplete', 'AjaxSearchbar' => 'update', 'AjaxContingent' => 'list,rooms', 'AjaxTable' => 'pricetable,pricetableHtml,eventPricetable', @@ -382,7 +381,6 @@ $iconRegistry->registerIcon( [ 'AjaxSearch' => 'searchresult', 'AjaxDate' => 'dates', - 'AjaxFilterpanel' => 'panel,autocomplete', 'AjaxSearchbar' => 'update', 'AjaxContingent' => 'list,rooms', 'AjaxTable' => 'pricetable,pricetableHtml,eventPricetable', 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 82b4c66c..b5f4e4dc 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 @@ -28,8 +28,7 @@ import osmMap from './components/osm-map' import productDetail from './components/product-detail' import daytripDateSelect from './components/daytrip-date-select' import searchBar from './components/search-bar' -import searchResult from './components/search-result' -import filterPanel from './components/filter-panel' +import search from './components/search' import defaultFilterSettings from './_filtersettings' import defaultFilterOptions from './_filteroptions' @@ -63,8 +62,7 @@ document.addEventListener('DOMContentLoaded', () => { Alpine.data('productDetail', productDetail) Alpine.data('daytripDateSelect', daytripDateSelect) Alpine.data('searchBar', searchBar) - Alpine.data('searchResult', searchResult) - Alpine.data('filterPanel', filterPanel) + Alpine.data('search', search) Alpine.start() Glightbox({ diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/_filtersettings.js b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/_filtersettings.js index b6098ffb..8aa49321 100644 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/_filtersettings.js +++ b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/_filtersettings.js @@ -1,7 +1,4 @@ export default { - destinationName: '', - destinationUid: 0, - destinationType: '', productUid: 0, hotelUid: 0, countryUids: [], @@ -10,7 +7,7 @@ export default { conceptUids: [], dateFrom: null, dateTo: null, - priceRange: 0, + priceRanges: [], nights: 0, pax: 1, hotelTypes: [], diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/_styles.js b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/_styles.js index f7a9e8e5..56c65a7b 100644 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/_styles.js +++ b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/_styles.js @@ -2,4 +2,4 @@ require('font-awesome/css/font-awesome.min.css') require('cookieconsent/build/cookieconsent.min.css') require('glightbox/dist/css/glightbox.css') require('leaflet/dist/leaflet.css') -require('flatpickr/dist/flatpickr.css') + diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/search-bar.js b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/search-bar.js index a8c59ee5..dd9e9c98 100644 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/search-bar.js +++ b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/search-bar.js @@ -53,9 +53,11 @@ export default props => ({ this.filterOptions.destinations = filterOptions.destinations if (filterOptions.dateFrom !== null) { this.filterOptions.selectableRangeFrom = filterOptions.dateFrom + this.picker.set('minDate', new Date(filterOptions.dateFrom)) } if (filterOptions.dateTo !== null) { this.filterOptions.selectableRangeTo = filterOptions.dateTo + this.picker.set('maxDate', new Date(filterOptions.dateTo)) } }, updateSearchParam(param, value) { @@ -75,24 +77,18 @@ export default props => ({ }, selectDestination(uid, name, type) { this.destinationName = name - this.destinationSelected = true - this.conceptSelected = false + this.destinationSelected = type !== 'concept' + this.conceptSelected = type === 'concept' this.searchParams.destinationUid = uid this.searchParams.destinationType = type this.load() }, - selectConcept(uid, name) { - this.destinationName = name - this.destinationSelected = false - this.conceptSelected = true - this.searchParams.destinationUid = uid - this.searchParams.destinationType = 'concept' - this.load() - }, resetDestination() { this.destinationName = 'beliebig' this.destinationSelected = false this.conceptSelected = false + this.searchParams.destinationUid = null + this.searchParams.destinationType = null this.load() }, initDatePicker() { @@ -106,14 +102,14 @@ export default props => ({ } } }) - let minDate = this.filterOptions.minDate ? new Date(this.filterOptions.minDate) : new Date + let minDate = this.filterOptions.dateFrom ? new Date(this.filterOptions.dateFrom) : new Date this.picker.set('minDate', minDate) - if (this.filterOptions.maxDate) { - this.picker.set('maxDate', new Date(this.filterOptions.maxDate)) + if (this.filterOptions.dateTo) { + this.picker.set('maxDate', new Date(this.filterOptions.dateTo)) } }, priceRangeLabel() { - if (this.searchParams.priceRange === 0) { + if (null === this.searchParams.priceRange) { return 'beliebig' } let range = this.filterOptions.priceRanges[this.searchParams.priceRange] diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/search-result.js b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/search-result.js deleted file mode 100644 index aa0e4b85..00000000 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/search-result.js +++ /dev/null @@ -1,27 +0,0 @@ -import axios from 'axios' - -export default props => ({ - loading: false, - uri: props.uri, - filterSettings: props.initialFilterSettings, - init() { - this.load() - }, - onFilterSettingsUpdated(e) { - this.filterSettings = e.detail - this.load() - }, - load() { - this.loading = true - let data = new URLSearchParams({ - 'tx_epproducts_ajax[filterSettings]': JSON.stringify(this.filterSettings) - }) - axios.post(this.uri, data) - .then(response => { - this.$refs.results.innerHTML = response.data - }) - .finally(() => { - this.loading = false - }) - } -}) diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/filter-panel.js b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/search.js similarity index 71% rename from public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/filter-panel.js rename to public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/search.js index 0e1090c4..c1ea372c 100644 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/filter-panel.js +++ b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/search.js @@ -14,15 +14,16 @@ export default props => ({ filterCount: 0, dateRangeSelected: { from: null, to: null }, dateRangeLabel: null, + contentWrapper: null, init() { + this.contentWrapper = this.$refs.container this.updateFilterCount() this.load() - this.$watch('filterSettings', () => { - this.$dispatch('filter-settings-updated', this.filterSettings) - this.updateFilterCount() - this.updateDateRangeLabel() - this.load() - }) + }, + refresh() { + this.updateFilterCount() + this.updateDateRangeLabel() + this.load() }, load() { this.loading = true @@ -31,7 +32,7 @@ export default props => ({ }) axios.post(this.uri, data) .then(response => { - this.$refs.panel.innerHTML = response.data + this.contentWrapper.innerHTML = response.data }) .finally(() => { this.loading = false @@ -45,6 +46,7 @@ export default props => ({ }, reset() { this.filterSettings = {...this.defaultFilterSettings} + this.dateRangeSelected = { from: null, to: null } this.dateRangeLabel = null }, initDatePicker(minDate, maxDate) { @@ -61,7 +63,6 @@ export default props => ({ dateFrom: flatpickr.formatDate(selectedDates[0], 'Y-m-d'), dateTo: flatpickr.formatDate(selectedDates[1], 'Y-m-d'), }) - this.updateDateRangeLabel() this.show = null } } @@ -74,13 +75,12 @@ export default props => ({ selectDateRangePreset(preset) { let dateFrom = new Date(preset.dateFrom) let dateTo = new Date(preset.dateTo) + this.picker.setDate([ dateFrom, dateTo ]) this.dateRangeSelected = { from: dateFrom, to: dateTo } this.updateFilterSettings({ dateFrom: flatpickr.formatDate(dateFrom, 'Y-m-d'), dateTo: flatpickr.formatDate(dateTo, 'Y-m-d'), }) - this.updateDateRangeLabel() - this.picker.setDate([ dateFrom, dateTo ]) this.show = null }, resetDateRange() { @@ -89,40 +89,8 @@ export default props => ({ dateFrom: null, dateTo: null, }) - this.updateDateRangeLabel() this.show = null }, - toggleFilterValue(name, value, multiple = false) { - let updates = {} - let newValue = this.filterSettings[name] - if (!multiple) { - newValue = newValue === value ? null : value - } else { - let index = newValue.indexOf(value) - if (index !== -1) { - newValue.splice(index, 1) - } else { - newValue.push(value) - } - } - updates[name] = newValue - this.updateFilterSettings(updates) - }, - toggleDestinationOrConcept(uid, name, type) { - let values = { destinationUid: null, destinationName: null, destinationType: null } - if ('concept' === type) { - values = {...values, conceptUids: []} - } - let currentUid = this.filterSettings.destinationUid - let currentType = this.filterSettings.destinationType - if (currentUid !== uid || currentType !== type) { - values = { destinationUid: uid, destinationName: name, destinationType: type } - if ('concept' === type) { - values = {...values, conceptUids: [uid]} - } - } - this.updateFilterSettings(values) - }, updateDateRangeLabel() { let dateRangeLabel = '' if (null !== this.dateRangeSelected.from && null !== this.dateRangeSelected.to) { @@ -134,8 +102,8 @@ export default props => ({ }, updateFilterCount() { let count = 0 - if (this.filterSettings.destinationUid) count++ - if (this.filterSettings.destinationName) count++ + if (this.filterSettings.dateFrom !== null) count++ + if (this.filterSettings.dateTo !== null) count++ if (this.filterSettings.countryUids.length > 0) count++ if (this.filterSettings.regionUids.length > 0) count++ if (this.filterSettings.cityUids.length > 0) count++ @@ -143,9 +111,7 @@ export default props => ({ if (this.filterSettings.hotelTypes.length > 0) count++ if (this.filterSettings.boardTypes.length > 0) count++ if (this.filterSettings.roomTypes.length > 0) count++ - if (this.filterSettings.dateFrom !== null) count++ - if (this.filterSettings.dateTo !== null) count++ - if (this.filterSettings.priceRange > 0) count++ + if (this.filterSettings.priceRanges.length > 0) count++ if (this.filterSettings.bus) count++ if (this.filterSettings.pax > 2) count++ this.filterCount = count diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/scss/remix/_datepicker.scss b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/scss/remix/_datepicker.scss index ad979be6..878a26bc 100644 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/scss/remix/_datepicker.scss +++ b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/scss/remix/_datepicker.scss @@ -1,5 +1,10 @@ +@import "~flatpickr/dist/flatpickr.css"; + .flatpickr-calendar { box-shadow: none; + &.inline { + border: none !important; + } } .daterange { diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Templates/AjaxFilterpanel/Panel.html b/public/typo3conf/ext/ep_theme/Resources/Private/Templates/AjaxFilterpanel/Panel.html deleted file mode 100644 index 21f9a7b9..00000000 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Templates/AjaxFilterpanel/Panel.html +++ /dev/null @@ -1,223 +0,0 @@ - - -
- - diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Templates/AjaxSearch/Searchresult.html b/public/typo3conf/ext/ep_theme/Resources/Private/Templates/AjaxSearch/Searchresult.html index 92aab859..0d076676 100644 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Templates/AjaxSearch/Searchresult.html +++ b/public/typo3conf/ext/ep_theme/Resources/Private/Templates/AjaxSearch/Searchresult.html @@ -3,51 +3,83 @@ xmlns:f="http://typo3.org/ns/fluid/ViewHelpers" xmlns:ep="http://typo3.org/ns/EP/EpTheme/ViewHelpers"> -