{#
/**
* @var \Pimcore\Templating\PhpEngine $this
* @var \Pimcore\Templating\PhpEngine $view
* @var \Pimcore\Templating\GlobalVariables $app
* #
* @var \Elements\Bundle\DemiFrontendBundle\Templating\Helper\Filter $demiFilterHelper
* @var \Elements\Demi\Accommodation\Search\Parameter $searchParam
* @var \Zend\Paginator\Paginator $paginator
* @var int $totalPages
* @var bool $noDate
* @var boolean $editmode
* @var $isPackageSearch
*/
#}
{% do jsConfig("_config").add('noDate', noDate) %}
{% set pages = demi_getPagesArray(accommodationPaginator) %}
{% if searchParam is instanceof("\\Elements\\Demi\\Accommodation\\Search\\Parameter") %}
{% set resultCount = (pages.totalCount ?? pages.totalItemCount) ?: 0 %}
{% elseif searchParam is instanceof("\\Elements\\Demi\\Pacakge\\Search\\Parameter") %}
{% set resultCount = accommodationPaginator.getTotalItemCount() %}
{% endif %}
{% set error = error is defined ? error : '' %}
{% set searchError = searchError is defined ? searchError : '' %}
{% set isMapAllowed = not pimcore_checkbox('noMapAllowed').isChecked() %}
{% set showMapToggle = pimcore_checkbox('showMapToggle').isChecked() %}
{% set showMapInitially = not pimcore_checkbox('hideMapInitially').isChecked() %}
{% set useListTeaserStyle = not pimcore_checkbox('useListTiles').isChecked() %}
{% set showMap = isMapAllowed and not pimcore_device().isPhone() and ((app.request.get('showMap') is null and showMapInitially) or app.request.get('showMap') == 1) %}
{% set listView = not accommodationListTilesEnabled or (showMap and useListTeaserStyle) or pimcore_device().isPhone() %}
{% set filterTexte = [] %}
{% if app.request.get('mapPoly') %}
{% set filterTexte = filterTexte|merge([{
'name' : 'notBookOnly',
'value' : 'on',
'text' : "demi.filter.only-not-bookable" | trans,
}]) %}
{% endif %}
<script type="text/javascript" data-cookieconsent="ignore">
_config.viewType = "list";
_config.accoListAlternativeUrl = "{{ accoListAlternativeUrl is defined ? accoListAlternativeUrl|raw : '' }}";
_config.totalResultCount = {{ resultCount }};
{% if not pimcore_device().isPhone() %}
_config.showOnMapLinks = "true";
{% endif %}
_config.minPrice = {{ minPrice }};
_config.maxPrice = {{ maxPrice }};
</script>
{% if error is not empty or searchError is not empty %}
{{ include('@ElementsDemiFrontend/Checkout/includes/error-container.html.twig', {
'error' : error ?: searchError,
'styleModifier' : 'mb-0 mt-0',
'isList' : true
}) }}
{% endif %}
<div class="{{ listView ? '' : 'container mt-4' }}">
{% if searchParam is instanceof("\\Elements\\Demi\\Accommodation\\Search\\Parameter") and searchParam.getOrderKey() is iterable and searchParam.getOrderKey()|first == "nearbySearchAsc" %}
{% set nearbySearchObject = pimcore_object(app.request.get('nearbySearchId')) %}
{% set nearbySearchName = null %}
{% if nearbySearchObject is instanceof("\\Pimcore\\Model\\DataObject\\Concrete") %}
{% set nearbySearchName = nearbySearchObject.getName() %}
{% elseif app.request.get('nearbySearchId') == 'location'%}
{% set nearbySearchName = 'demi.search.nearby.my-location'|trans %}
{% endif %}
{% if nearbySearchName is not null %}
<h3 class="mt-3">{{ demi_fillTranslation({
"[OBJECT]" : nearbySearchName
},"demi.list.nearby-search.title" ) }}</h3>
{% endif %}
{% endif %}
{{ include('@ElementsDemiFrontend/List/includes/list-top.html.twig', {
'searchParam' : searchParam,
'noDate' : noDate,
'resultCount' : resultCount,
'page' : accommodationPaginator.getCurrentPageNumber(),
'totalPages' : pages.pageCount
}) }}
{% set extraClasses = showMap ? 'row row--gutter-width-20 row--vertical-gutter-20' : 'row row--gutter-width-30 row--vertical-gutter-30 mb-5' %}
<ul class="list-unstyled {{ listView ? '' : extraClasses }}">
{% set hrClass = pimcore_device().isPhone() ? "hr--bold hr--light my-3" : "hr--border-gray my-0" %}
{% set addPositions = (accommodationPaginator.getCurrentPageNumber() - 1) * demi_getItemCountPerPage(accommodationPaginator) %}
{% set colClass = listView ? '' : ('d-flex flex-column ' ~ (showMap ? 'col-6' : 'col-sm-6 col-md-4 col-xl-3')) %}
{% set templateType = listView ? '@ElementsDemiFrontend/Includes/teaser/acco-teaser.html.twig' :
'@ElementsDemiFrontend/Includes/teaser/acco-teaser-card.html.twig' %}
{% for accommodationItem in accommodationPaginator %}
<li class="{{ colClass }}">
{{ include(templateType, {
'accommodationItem' : accommodationItem,
'isPackageSearch' : isPackageSearch,
'styleModifier' : 'js-acco-list__item flex-fill',
'noDate' : noDate,
'position' : loop.index + addPositions,
'nearbySearchName' : nearbySearchName ?? null,
'tvbPackage' : null,
'bodyPadding' : false,
'housePackageMaster' : null,
'targetBlank' : false
}) }}
{% if listView %}
<hr class="{{ hrClass }}">
{% endif %}
</li>
{% endfor %}
</ul>
{% if searchParam is instanceof ("\\Elements\\Demi\\Accommodation\\Search\\Parameter") and pages.pageCount >= 1 %}
{% set templateName = demi_getDeviceDependentTemplate('@ElementsDemiFrontend/Includes/elements/', 'paging', container) %}
{{ include(templateName, demi_getPaginatorVariables(accommodationPaginator)|merge([{"searchParam" : searchParam}])) }}
{% endif %}
{% if resultCount <= minResult %}
<section class="container text-center mt-3">
{% if resultCount == 0 %}
<h3 class="text-primary text-danger h4">{{ 'demi.list.no-results' | trans }}</h3>
{% if not searchParam.getIsAlternative() %}
<script type="text/javascript" data-cookieconsent="ignore">
_config.makeAlternativeSearchRequest = {{ makeAlternativeSearchRequest == true ? "true" : "false" }};
</script>
{% endif %}
{% elseif searchParam is instanceof ("\\Elements\\Demi\\Accommodation\\Search\\Parameter") and demi_hasRemovableFilter(searchParam) %}
<h3 class="text-primary">{{ 'demi.list.few-results' | trans }}</h3>
{% else %}
{% if not searchParam.getIsAlternative() %}
<script type="text/javascript" data-cookieconsent="ignore">
_config.makeAlternativeSearchRequest = {{ makeAlternativeSearchRequest == true ? "true" : "false" }};
</script>
{% endif %}
{% endif %}
<div class="js-quick-filter">
<div class="mt-3">
{{ 'demi.list.try-remove-filter' | trans }}:
</div>
<div class="mt-3">
<div class="js-quick-filter__list"></div>
</div>
<div class="mt-3">
<button type="button" class="btn btn-small btn btn-success-dark btn-sm js-remove-all-filter">
<script data-cookieconsent="ignore">
_config.removeAllFilter = true;
</script>
<span aria-hidden="true" class="btn__icon demi-icon demi-icon-close-circle mr-1"></span>
{{ 'demi.list.remove-all-filters' | trans}}
</button>
</div>
</div>
</section>
{% endif %}
{% if not noDate and document.getEditable('useBookOnly') and document.getEditable('useBookOnly').isChecked() %}
{% set filterTexte = filterTexte|merge([{
'name' : 'notBookOnly',
'value' : 'on',
'text' : "demi.filter.only-not-bookable" | trans,
}]) %}
{% set lastPage = demi_getPagesArray(paginator)['lastPageInRange'] <= paginator.getCurrentPageNumber() %}
{% if lastPage and not searchParam.getNotBookOnly() %}
{{ include('@ElementsDemiFrontend/List/includes/bookOnlyLink.html.twig') }}
{% endif %}
{% endif %}
</div>
<script type="text/javascript" data-cookieconsent="ignore">
_filterTexte = window['_filterTexte'] || [];
_filterTexte.push.apply( _filterTexte, {{ filterTexte | json_encode | raw }});
</script>
{% if not editmode and not pimcore_device().isPhone() %}
{% do elements_head_meta().setDescription(pimcore_wysiwyg('description').getData(), false) %}
<section class="js-search-data__hide-if-submitted">
<hr class="hr--border-gray my-4">
<div class="container wysiwyg">
{{ pimcore_wysiwyg('description') }}
</div>
</section>
{% endif %}