{% set productSets = accommodationResultSet is defined and accommodationResultSet is not null ? accommodationResultSet.getMinPriceProductSets() : [] %}
{% set isCorridor = isCorridor is defined ? isCorridor : false %}
{% set useCancellationInfo = useCancellationInfo is defined ? useCancellationInfo : false %}
{% set detailUrl = pimcore_url({'object': accommodation}, 'demi_acco_detail_page') %}
{% if tvbPackage is defined %}
{% set productSets = [productResultSet] %}
{% endif %}
{% if productSets is not defined or productSets is empty %}
{% set productSets = (productResultSet is defined and productResultSet is not empty and productResultSet.getProducts() is not null) ? productResultSet.getProducts() : [] %}
{% if packages is defined and packages is not null %}
{% set packageSets = [] %}
{% set minPrice = 0 %}
{% for hpm in packages %}
{% set packageSets = packageSets + (hpm.getRoomRows()|first).getProducts() %}
{% endfor %}
{# Cheapest product if there are packages but no rooms (no accommodationResultSet) #}
{% set cp = demi_getMinPriceOfHousePackageMasterResultSet(packageSets)["cP"] %}
{% set productSets = productSets + packageSets %}
{% elseif accommodationResultSet is instanceof('\\Elements\\Demi\\Accommodation\\Search\\ResultSet\\HousePackageMaster') %}
{# Cheapest product (no minPrice and package site) #}
{% set cp = demi_getMinPriceOfHousePackageMasterResultSet(accommodationResultSet)["cP"] %}
{% endif %}
{% if accommodationResultSet is defined and accommodationResultSet is not null and accommodationResultSet.getMinPriceBaseProductId() %}
{% set minId = accommodationResultSet.getMinPriceBaseProductId() %}
{% set productSets = productSets[minId] is defined ? [productSets[minId]] : [] %}
{% elseif availabilityIsChecked is defined and not availabilityIsChecked %}
{% if cp is defined %}
{% set productSets = [cp] %}
{% endif %}
{% endif %}
{% endif %}
{% if accommodationResultSet is defined and accommodationResultSet is not empty %}
{% set accommodation = pimcore_object(accommodationResultSet.getAccommodationId()) %}
{% endif %}
{% set href = "rooms" %}
{% if isPackage %}
{% set href = "booking" %}
{% endif %}
{# // no search date - no date for images #}
{% if availabilityIsChecked is defined and not availabilityIsChecked %}
{% set fromDate = null %}
{% else %}
{% set fromDate = demi_getSearchFrom() %}
{% endif %}
{% set hasBookingLink = hasBookingLink is defined ? hasBookingLink : false %}
<div>
{% if ((not isCorridor and productSets is defined and productSets is not empty and productSets|first is not null) ) and not hasBookingLink %}
{% if accommodationResultSet is not null and accommodationResultSet.getRoomRows()|length < productSets|length %}
{% set productSets = productSets|slice(0, accommodationResultSet.getRoomRows()|length) %}
{% endif %}
{% set rowCounter=0 %}
{% for productSet in productSets %}
{% if productSet is not empty %}
{% set images = [] %}
{% set accommodationProduct = pimcore_object(productSet.getProductId()) %}
{% set housePackageMaster = accommodationProduct is not null ? accommodationProduct.getPackageMaster() : null %}
{% if accommodationProduct is not null and accommodationProduct.getProductType()=="Package" and not isPackage and housePackageMaster is not null %}
{% set firstImage = demi_getFirstImageForHousePackageMaster(housePackageMaster, accommodation, fromDate) %}
{% if firstImage is not null %}
{% set images = images|merge([firstImage]) %}
{% endif %}
{% set headline = housePackageMaster.getName() %}
{% set headlineSmall = accommodationProduct.getName() %}
{% else %}
{% set images = accommodationProduct is not null ? demi_getRoomPictures(accommodationProduct,fromDate) : [] %}
{% set headline = accommodationProduct ? accommodationProduct.getName() : productSet.getDescription()|raw %}
{% set headline = headline is not empty ? headline : accommodationProduct.getService().getName() %}
{% endif %}
{% if accommodationResultSet is not null %}
{% set priceTest = accommodationResultSet.getMinPrice() is not empty ? accommodationResultSet.getMinPrice() : accommodationResultSet.getMinPriceBase() %}
{% else %}
{% set priceTest = null %}
{% endif %}
{% if accommodationResultSet is not null and priceTest is not empty %}
<div class="row row--gutter-width-20">
<div class="col-auto d-flex flex-column">
<div class="teaser__label bg-warning text-center p-1 small text-white strong" hidden>
</div>
{% if images[0] is defined %}
<div class="teaser__img offer-box__img btn-show-gallery-container"
style="background-image:url({{ images[0].getThumbnail('demi-desktop-searchInfoBox-teaser') }})">
{{ images[0].getThumbnail('demi-desktop-searchInfoBox-teaser').getHTML({ 'imgAttributes': {'class': 'sr-only', 'alt': ('demi.image-alt-prefix'|trans) ~ ' ' ~ accommodationProduct.getName()}})|raw }}
</div>
{% endif %}
</div>
<div class="col d-flex flex-column collapsed" data-toggle="collapse"
data-target="#detail-{{ productSet.getProductId() }}">
<!-- no button/a-tag and aria because this is just to increase the clickable area (like isClickable) -->
<div class="teaser__main-body">
<div class="offer-box__title mb-2">
{{ headline }}
</div>
{{ headlineSmall is defined ? headlineSmall : '' }}
<div class="small text-muted">
<div class="media">
{% if accommodationResultSet is not null and accommodationResultSet.getRoomRows()[rowCounter] %}
{% set roomRow = accommodationResultSet.getRoomRows()[rowCounter].getRowObject() ? accommodationResultSet.getRoomRows()[rowCounter].getRowObject() : null %}
{% endif %}
{% if roomRow is defined and roomRow is not empty %}
<div class="demi-icon demi-icon-person mr-1 icon-in-text"
aria-hidden="true"></div>
<div class="media-body">
{% set adults = roomRow.getAdults() %}
{% set children = roomRow.getChildAges()|length %}
{% set adultsStr = adults > 1 ? adults ~ " " ~ ('demi.detail.room.occupancy.adults'|trans) : adults ~ " " ~ ('demi.detail.room.occupancy.adult'|trans) %}
{% set childrenStr = children > 1 ? children ~ " " ~ ('demi.detail.room.occupancy.children'|trans) : children ~ " " ~ ('demi.detail.room.occupancy.child'|trans) %}
{{ adultsStr }}
{% if children > 0 %}
, {{ childrenStr }}
{% endif %}
</div>
{% endif %}
</div>
</div>
</div>
</div>
</div>
<hr class="hr--border-gray my-4">
{% endif %}
{% set mealObj = demi_getMealTypeByFid(productSet.getMealCode() ?? '') %}
<div class="row align-items-end row--gutter-width-10">
<div class="col text-muted">
{% if mealObj %}
<div class="small text-nowrap">
<div class="demi-icon demi-icon-restaurant mr-1 icon-in-text"
aria-label="{{ "demi.detail.room.meals"|trans }}"
title="{{ "demi.detail.room.meals"|trans }}"></div>
{{ mealObj.getText() }}
</div>
{% endif %}
{% if roomRow is defined and roomRow is null and productSet.getPriceInfo is iterable %}
{% set priceInfo = productSet.getPriceInfo() %}
{% if priceInfo['type'] is defined and priceInfo['nights'] is defined %}
{{ include('@ElementsDemiFrontend/Includes/priceInfoStr.html.twig', {'type': priceInfo['type'], 'nights': priceInfo['nights']}) }}
{% endif %}
{% endif %}
{% if productSet.getPriceData() is not null and productSet.getPriceData().getPriceBeforeSpecial() != productSet.getPrice() %}
<div class="sr-only">{{ "demi.instead-of"|trans }}</div>
<s>{{ demi_paymentGetPriceObject(productSet.getPriceData().getPriceBeforeSpecial(), pimcore_object(accommodation.getId())) }}</s>
{% endif %}
</div>
{% set price = productSet.getPrice() ? productSet.getPrice() : productSet.getBasePrice() %}
{% if price > 0 %}
<div class="col col-auto text-right">
<strong
class="font-medium offer-box__price text-success">{{ 'demi.price-from-short'|trans }} {{ demi_paymentGetPriceObject(price,accommodation) }}</strong>
</div>
{% endif %}
</div>
{% if useCancellationInfo and productSet is not empty and productSet.getCancellationInformation() is not empty %}
{% set cancellationInformation = productSet.getCancellationInformation() %}
{% set displayInfo = demi_getCancellationDisplayInfo(cancellationInformation,fromDate) %}
{% set freeCancelText = displayInfo.getFreeCancellationText() %}
{% set freeCancelText = freeCancelText == "" ? null : ('demi.list.free-cancellation'|trans) %}
{% endif %}
{% set rowCounter = rowCounter + 1 %}
{% if rowCounter == productSets|length %}
<div class="mt-3">
{% if roomRow is defined and roomRow is not empty %}
{% if accommodationProduct is not null and accommodationProduct.getProductType()=="Package" and not isPackage and housePackageMaster is not null %}
{% set translation = "demi.detail.show-package" %}
{% set packageDetailUrl = demi_demiUrl({
'accommodation': accommodation,
'package': housePackageMaster
}, 'demi_acco_detail_package_page') %}
<a href="{{ packageDetailUrl }}" class="btn btn-success btn-block btn-lg">
{% else %}
{% set translation = "demi.detail.show-offer" %}
<a href="#{{ href }}"
data-target="#{{ href }}"
aria-controls="<{{ href }}"
data-tracking-category="Accommodation detail"
data-tracking-action="click booking search info"
class="btn btn-success btn-block btn-lg js-open-tab-and-scroll js-tracking--click">
{% endif %}
<script data-cookieconsent="ignore">
_config.openTabAndSroll = true;
</script>
{{ translation|trans }}<span class="demi-icon demi-icon-arrow-right btn__icon ml-2"
aria-hidden="true"></span>
</a>
{% else %}
<button type="button" class="btn btn-success btn-block btn-lg js-overlay__toggle"
data-target="#search-overlay">
{{ "demi.list.search-vacancies-button"|trans }}
</button>
{% endif %}
<div
class="mt-2 text-center text-primary js-search-data__hide-if-submitted" {{ roomRow is defined and roomRow is not null ? 'hidden' : '' }}>
<a class="js-open-tab-and-scroll" href="#{{ href }}">
{% set translation = " " ~ (demi_getRoomsTabTranslationKey(accommodation)|trans) %}
<span class="demi-icon demi-icon-arrow-right btn__icon mr-1"
aria-hidden="true"></span>{{ ("demi.detail.show-all"|trans) ~ translation }}
</a>
</div>
</div>
{% else %}
<hr class="hr--border-gray my-4">
{% endif %}
{% endif %}
{% endfor %}
{% else %}
{% if isCorridor and (accommodationResultSet is not null or alternativeResultSet is not null) %}
{% if alternativeResultSet and alternativeResultSet.getMinPrice() %}
{{ "demi.detail.no-rooms-long-with-alternatives"|trans }}
<div class="mt-2">
<a href="#{{ href }}"
data-target="#{{ href }}"
aria-controls="{{ href }}"
data-alternative-from="{{ elements_customDateFormat(alternativeSearchParameter.getDateFrom()) }}"
data-alternative-to="{{ elements_customDateFormat(alternativeSearchParameter.getDateTo()) }}"
data-alternative-duration-type="variable"
data-alternative-duration-nights="{{ min(alternativeSearchParameter.getNights()) }}-{{ max(alternativeSearchParameter.getNights()) }}"
class="btn btn-success btn-block btn-lg js-open-tab-and-scroll mt-2 js-alternative-search">
{{ 'demi.detail.change-search-params'|trans }}
</a>
</div>
{% else %}
{% if isCorridor %}
{{ "demi.detail.choose-result-corridor"|trans }}
<div class="mt-2">
<a href="#{{ href }}"
data-target="#{{ href }}"
aria-controls="{{ href }}"
class="btn btn-success btn-block btn-lg js-open-tab-and-scroll mt-2">
{{ 'demi.detail.show-offers-corridor'|trans }}
</a>
</div>
{% else %}
{{ "demi.detail.no-rooms-long"|trans }}
{% endif %}
{% endif %}
{% else %}
{% if hasBookingLink %}
{{ "demi.detail.external-booking.longtext"|trans }}
{% endif %}
{% if alternativeResultSet is defined and alternativeResultSet is not null and alternativeResultSet.getMinPrice() %}
{{ "demi.detail.no-rooms-long-with-alternatives"|trans }}
<div class="mt-2">
<a href="#{{ href }}"
data-target="#{{ href }}"
aria-controls="{{ href }}"
data-alternative-from="{{ elements_customDateFormat(alternativeSearchParameter.getDateFrom()) }}"
data-alternative-to="{{ elements_customDateFormat(alternativeSearchParameter.getDateTo()) }}"
data-alternative-duration-type="variable"
data-alternative-duration-nights="{{ min(alternativeSearchParameter.getNights()) }}-{{ max(alternativeSearchParameter.getNights()) }}"
class="btn btn-success btn-block btn-lg js-open-tab-and-scroll mt-2 js-alternative-search">
{{ 'demi.detail.change-search-params'|trans }}
</a>
</div>
{% else %}
{{ accommodation.getSystemIdentifier() is same as "Deskline" ? "demi.detail.no-rooms-long"|trans : '' }}
<div class="row row--gutter-width-10 mt-4">
{% if hasBookingLink %}
<div class="col col-auto mb-3">
<a target="_blank" class="btn btn-success" href="{{ bookingLink }}">
{{ "demi.detail.external-booking.cta"|trans }}
</a>
</div>
{% elseif accommodation.getSystemIdentifier() is same as "Deskline" %}
<div class="col col-auto mb-3">
<button type="button" class="btn btn-success js-overlay__toggle"
data-target="#search-overlay">
{{ "demi.search.change"|trans }}
</button>
</div>
{% endif %}
<div class="col">
{{ include("@ElementsDemiFrontend/Accommodation/includes/enquiry-button.html.twig", {
"text": 'demi.detail.enquiry-button-simple'|trans,
"accommodation": accommodation,
"trackingCategory": isPackage ? "Package detail" : "Accommodation detail",
"trackingAction": "click enquiry search info"
}) }}
</div>
</div>
{% if accommodation.getSystemIdentifier() is same as "Deskline" %}
<div class="row row--gutter-width-10 mt-4 text-primary">
{% set roomsString = (demi_getRoomsTabTranslationKey(accommodation))|trans %}
<span class="demi-icon demi-icon-arrow-right btn__icon mr-1" aria-hidden="true"></span>
<a href="{{ detailUrl }}?&activeTab=%23rooms" class="text-underline">
{{ demi_fillTranslation({'[ROOMS]': roomsString}, "demi.detail.show-room-list") }}
</a>
</div>
{% endif %}
{% endif %}
{% endif %}
{% endif %}
{% if freeCancelText is defined and freeCancelText is not empty %}
<div class="text-success small text-center mt-2">
{{ freeCancelText }}
</div>
{% endif %}
</div>