{#
/**
* @var \Pimcore\Templating\PhpEngine this
* @var \Pimcore\Templating\PhpEngine view
* @var \Pimcore\Templating\GlobalVariables app
* #
* @var \Elements\Demi\Accommodation\Search\ResultSet\Product product
* @var bool useCancellationInfo
* @var bool tableOnSide
* @var \Elements\Demi\Model\AccommodationServiceProvider accommodation
* @var array productData
* @var int count
* @var searchParam \Elements\Demi\Accommodation\Search\Parameter
*/ #}
{% set accommodationProduct = pimcore_object(product.getProductId()) %}
{% set roomRow = productData.roomRow[count].getRowObject() %}
{% set priceData = product.getPriceData() %}
{% set price = roomRow ? product.getPrice() : product.getBasePrice() %}
{% set id = product.getProductId() %}
{% set title = moreRoomRows ? ('demi.detail.room.select-headline-' ~ accommodationProduct.getAccommodationType() | lower) | trans ~ " " ~ (count + 1) : accommodationProduct.getName() %}
{% if searchParam and searchParam is instanceof("\\Elements\\Demi\\Accommodation\\Search\\AbstractParameter") and searchParam.getDateFrom() %}
{% set dateFrom = searchParam.getDateFrom() %}
{% if searchParam is instanceof("\\Elements\\Demi\\Package\\Search\\Parameter") %}
{% set mealArray = [] %}
{% else %}
{% set mealArray = accommodationProduct.getValidMeals(searchParam.getPeriod(),searchParam.getDateFrom()) %}
{% endif %}
{% set liveMeal = product.getMealCode() %}
{% if liveMeal is not empty %}
{% set liveMealObj = demi_getClassByStringAndIdentifier("\\Elements\\Demi\\Model\\MealType", "getByFid", liveMeal) %}
{% if not liveMeal in mealArray | keys %}
{% set mealArray = [liveMealObj] %}
{% endif %}
{% else %}
{% set liveMealObj = null %}
{% endif %}
{% else %}
{% set dateFrom = carbon().now() %}
{% set mealArray = accommodationProduct.getValidMeals(0, dateFrom) %}
{% endif %}
{% set href = (accommodationProduct and demi_hasRoomDetails(accommodationProduct, dateFrom, app.request.getLocale(), tableOnSide) and moreRoomRows != true) ? "#detail-" ~ id : "" %}
<section class="js-room-selection__room-row"
data-room-row-id="{{ count }}"
data-initial-price="{{ product.getPrice() | number_format(2, '.','') }}"
{% if priceData and priceData.getPriceBeforeSpecial() > product.getPrice() %}
data-initial-price-before-special="{{ priceData.getPriceBeforeSpecial() | number_format(2, '.','') }}"
{% endif %}
data-room-row-title="{{ title }}">
<div class="room-selection-box {{ moreRoomRows ? 'border-top-0' : '' }}">
<script type="text/javascript" data-cookieconsent="ignore">
_config.lightbox = true;
_config.lazyImg = true;
</script>
<div class="row row--gutter-width-20">
{% if moreRoomRows == null %}
<div class="col-2 room-row__image d-flex flex-column">
{% if priceData and priceData.getSpecialPriceType() is same as "None" and priceData.getSpecialPriceName() and moreRoomRows is null %}
<div class="teaser__label bg-warning text-center p-1 small text-white strong">
{% if priceData.getSplitPay() and priceData.getSplitStay() and priceData.getSplitPay() != priceData.getSplitStay() %}
{{ demi_fillTranslation({
'[STAY]' : priceData.getSplitStay(),
'[PAY]' : priceData.getSplitPay()
}, 'demi.price-special-type.splitpay') }}
{% else %}
{{ priceData.getSpecialPriceName() }}
{% endif %}
</div>
{% endif %}
{% if priceData and priceData.getSpecialPriceType() and priceData.getSpecialPriceType()!= priceData.getSpecialPriceName() and priceData.getSpecialPriceType() is not same as "None" %}
<div class="teaser__label bg-warning text-center p-1 small text-white strong">
{{ ("demi.price-special-type." ~ priceData.getSpecialPriceType() | lower) | trans }}
</div>
{% endif %}
{% set useGal = true %}
{% if images | length == 0 %}
{% set images = [demi_core_configuration("getTeaserFallbackImage",{})] %}
{% set useGal = false %}
{% endif %}
{% if images[0] %}
{% set thumbnail = images[0].getThumbnail('demi-desktop-room-teaser') %}
<button type="button" class="btn-no-styling teaser__img btn-show-gallery-container js-lightbox--open-lightbox"
data-lightbox-target="#{{ product.getProductId() }}-lightbox"
data-sub-html="{{ demi_getNameAndCopyrightForImage(images[0])}}"
style="background-image:url({{ thumbnail }});"
{% set nameAndCopyRight = demi_getNameAndCopyrightForImage(images[0], true) %}
{% if nameAndCopyRight is not empty %}
title="© {{ nameAndCopyRight }}"
{% endif %} >
<!-- end of button tag -->
{{ thumbnail.getHTML({ 'imgAttributes': {'class' : 'sr-only', 'alt' : 'demi.image-alt-prefix' | trans ~ ' ' ~ (accommodationProduct ? accommodationProduct.getName() : product.getDescription()|raw ) }}) |raw }}
{% if useGal %}
<span class="btn-show-gallery btn-no-styling" title="{{ "demi.details.open-gallery | trans" }}">
<span class="demi-icon demi-icon-search btn-show-gallery__icon" aria-hidden="true"></span>
</span>
{% endif %}
</button>
{% endif %}
</div>
{% endif %}
<div class="col d-flex flex-column">
<div class="teaser__main-body">
<h3 class="h4 mb-1">
<a {{ (href != "") ? 'href=' ~ href : 'href=""' }}
aria-controls="detail-{{ id }}"
aria-expanded="false"
data-toggle="collapse"
class="collapsed"
>{{ title }}</a>
</h3>
<div class="mb-1 small text-muted">
<div class="media">
{% if not (tableOnSide and availabilityIsChecked) %}
<div class="demi-icon demi-icon-person mr-1 icon-in-text"
aria-hidden="true"></div>
<div class="media-body">
{% if roomRow and not tableOnSide %}
{% 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 %}
{% elseif (accommodationProduct.getBedsMin() != accommodationProduct.getBedsMax()) %}
{% set adultsStr = accommodationProduct.getBedsMin() ~ ' - ' ~ accommodationProduct.getBedsMax() ~
' ' ~ 'demi.detail.room.occupancy.persons'| trans %}
{% else %}
{% set adultsStr = accommodationProduct.getBedsMin() ~ ' ' ~ 'demi.detail.room.occupancy.person'| trans %}
{% endif %}
{{ adultsStr }}
{% if children is defined and children > 0 %}
, {{ childrenStr }}
{% endif %}
</div>
{% endif %}
</div>
</div>
{% if showVacancy and moreRoomRows == null %}
{{ include('@ElementsDemiFrontend/Includes/elements/vacancy-info.html.twig', {
'vacancyCount':vacancyCount, 'tvbPackage':tvbPackage
}) }}
{% endif %}
</div>
<div>
{% if not availabilityIsChecked and price and price > 0 %}
<strong class="mb-1 d-block">
<span class="room-row__price text-success" aria-live="polite">
<span class="js-room-selection__price">
{{ 'demi.price-from-short'| trans }}
{{ demi_paymentGetPriceObject(price, accommodationProduct.getService().getServiceProvider()) }}
</span>
<span class="js-room-selection__price-loading" hidden>
<span class="circle-spinner"
aria-label="{{ 'demi.content-loading' | trans }}"
title="{{ 'demi.content-loading'| trans }}"></span>
</span>
</span>
</strong>
{% endif %}
</div>
{% if hasSingleRoomRow and accommodationProduct %}
<div class="row row--vertical-gutter-6 mt-auto">
{% if demi_hasRoomDetails(accommodationProduct, dateFrom, app.request.getLocale(), tableOnSide) %}
<div class="col">
<a class="collapsed text-nowrap"
aria-expanded="false"
aria-controls="detail-{{ id }}"
{{ (href != "") ? 'href=' ~ href : 'href=""' }}
data-toggle="collapse">
{{ "demi.detail.room-details" | trans }}
<span
class="demi-icon demi-icon-chevron-down collapse-arrow ml-1 icon-in-text"></span>
</a>
</div>
{% endif %}
{% if not availabilityIsChecked and showAvailablityCalendar %}
<div class="col-auto">
<a class="collapsed text-nowrap mr-2 js-tracking--click-piwik"
data-tracking-category="Product"
data-tracking-action="click availability calendar"
aria-expanded="false"
aria-controls="availabilities-{{ id }}"
href="#availabilities-{{ id }}"
data-toggle="collapse">
{{ "demi.detail.room-availabilities" | trans }}
<span
class="demi-icon demi-icon-chevron-down collapse-arrow ml-1 icon-in-text"></span>
</a>
</div>
{% endif %}
</div>
{% endif %}
</div>
{% if not tableOnSide %}
<div class="{{ moreRoomRows ? 'col-8' : 'col-6' }}">
<div class="row row--gutter-width-40 h-100">
{% if liveMealObj and not hasSingleRoomRow %}
<div class="col-4 room-row__border-left">
<div class="mb-1 small text-muted">
<div>
<span>
<label class="form-box form-box--gray mb-2">
{% if mealArray | length > 0 %}
<select id="meal-selector-{{ product.getProductId() }}"
name="meal-selector-{{ product.getProductId() }}"
class="form-box__content form-control js-room-selection__meal"
{{ mealArray | length == 1 ? "disabled" : "" }}
>
{% for mealObj in mealArray %}
<option value="{{ mealObj.getId() }}" {{ liveMealObj.getText() == mealObj.getText() ? "selected" : "" }}>{{ mealObj.getText() }}</option>
{% endfor %}
</select>
{% if mealArray != 1 %}
<span class="demi-icon demi-icon-chevron-down form-box__select-icon"
aria-hidden="true"></span>
{% endif %}
{% endif %}
</label>
</span>
</div>
</div>
</div>
{% endif %}
<div class="{{ moreRoomRows ? 'col-4' : 'col-6' }} room-row__border-left d-flex flex-column">
<div>
{% if liveMealObj and hasSingleRoomRow %}
<div class="mb-1 small text-muted">
<div>
<span>
<label class="form-box form-box--gray mb-2">
{% if mealArray | length > 0 %}
<select id="meal-selector-{{ product.getProductId() }}"
name="meal-selector-{{ product.getProductId() }}"
class="form-box__content form-control js-room-selection__meal"
{{ mealArray | length == 1 ? "disabled" : "" }} >
{% for mealObj in mealArray %}
{% set rate=null %}
<option {{ rate ? ' data-rate="' ~ rate ~ '"' : '' }} value="{{ mealObj.getId() }}" {{ liveMealObj.getText() == mealObj.getText() ? "selected" : "" }}>{{ mealObj.getText() }}</option>
{% endfor %}
</select>
{% if mealArray | length != 1 %}
<span
class="demi-icon demi-icon-chevron-down form-box__select-icon"
aria-hidden="true"></span>
{% endif %}
{% endif %}
</label>
</span>
</div>
</div>
{% endif %}
<div class="">
{% if priceData and priceData.getPriceBeforeSpecial() > product.getPrice() %}
<span class="sr-only">{{ 'demi.detail.room.old-price' | trans }}</span>
<s class="text-muted fz13 js-room-selection__price-before-special">{{ demi_paymentGetPriceObject(priceData.getPriceBeforeSpecial(), accommodation) }}</s>
{% endif %}
{% if priceInfoText is defined %}
<div class="small text-muted">
{{ priceInfoText }}
</div>
{% endif %}
</div>
{% if price and price > 0 %}
<strong class="mb-1 d-block">
<span class="room-row__price text-success">
{% if tvbPackage and tvbPackage.showFromPriceInAccoDetail() %}
{{ 'demi.price-from-short' | trans }}
{% endif %}
<span class="js-room-selection__price">
{% if not roomRow %}
{{ 'demi.price-from-short' | trans }}
{% endif %} {{ demi_paymentGetPriceObject(price, accommodation) }}
</span>
<span class="js-room-selection__price-loading" hidden>
<span class="circle-spinner"
aria-label="{{ 'demi.content-loading' | trans }}"
title="{{ 'demi.content-loading' | trans }}"></span>
</span>
</span>
</strong>
{% endif %}
</div>
{% if (useCancellationInfo is defined and product.getCancellationInformation()) %}
{% set cancellationInformation = product.getCancellationInformation() %}
{% set displayInfo = demi_getCancellationDisplayInfo(cancellationInformation,searchParam.getDateFrom()) %}
{% set freeCancelText = displayInfo.getFreeCancellationText() %}
{% set promotionText = freeCancelText == "" ? null : freeCancelText %}
{% endif %}
{% set ajaxUrl = demi_demiUrl({
'accommodation' : accommodation
}, 'demi_acco_ajax') %}
{% if "?" in ajaxUrl %}
{% set ajaxUrl = ajaxUrl | split("?")[0] %}
{% endif %}
{% set paymentInfoUrl = ajaxUrl ~ "?ajaxRequestType=getPaymentInformation&productId=" ~
(accommodationProduct ? accommodationProduct.getId() : '') ~ "&roomindex=" ~ count ~ "&bookonrequest=" %}
<div class="mt-auto">
{% if priceData %}
<script>
_config.ajaxBtn = true;
</script>
<button aria-expanded="false"
type="button"
data-target="#price-info-{{ id }}-room-row-{{ count }}"
data-toggle="collapse"
class="btn-no-styling collapsed js-ajax-btn js-ajax-btn--prefer-corridor-dates"
data-ajax-btn-url="{{ paymentInfoUrl }}"
data-ajax-btn-target="#payment-terms-{{ id }}-room-row-{{ count }}">
<span class="demi-icon demi-icon-info-circle icon-in-text text-muted"
title="{{ 'demi.detail.room.price-info' | trans }}"
aria-hidden="true"></span> {{ 'demi.detail.room.price-info'| trans }}
<span
class="demi-icon demi-icon-chevron-down collapse-arrow ml-1 icon-in-text"></span>
</button>
{% endif %}
</div>
</div>
<div class="{{ moreRoomRows ? 'col-4' : 'col-6' }} room-row__border-left">
{{ include("@ElementsDemiFrontend/Includes/teaser/room-buttons.html.twig", {
'accommodationProduct' : accommodationProduct,
'product' : product,
'availabilityIsChecked' : availabilityIsChecked,
'showSelection' : showSelection,
'tvbPackage' : tvbPackage,
'promotionText' : promotionText ?? null,
'roomRowIndex' : count,
'divClass' : ''
}) }}
</div>
</div>
</div>
{% else %}
<div class="col-4 ml-auto">
{{ include("@ElementsDemiFrontend/Includes/teaser/room-details-table.html.twig", {
"accommodationProduct" : accommodationProduct,
"availabilityIsChecked" : availabilityIsChecked,
'service' : accommodationProduct.getService()
}) }}
</div>
{% endif %}
</div>
</div>
<!-- for every single-room-->
{% if priceData and not(tableOnSide and availabilityIsChecked) %}
{{ include('@ElementsDemiFrontend/Includes/teaser/price-info.desktop.html.twig', {
'title' : 'demi.detail.room.price-info' | trans ,
'id' : id,
'priceData' : priceData,
'accommodationProduct' : accommodationProduct,
'roomRow' : roomRow,
'roomRowIndex' : count,
'productSet' : product,
'moreRoomRows' : moreRoomRows
}) }}
{% endif %}
</section>