src/Elements/Bundle/DemiFrontendBundle/Resources/views/Includes/teaser/room-teaser-content.desktop.html.twig line 1

Open in your IDE?
  1. {#
  2. /**
  3.  * @var \Pimcore\Templating\PhpEngine this
  4.  * @var \Pimcore\Templating\PhpEngine view
  5.  * @var \Pimcore\Templating\GlobalVariables app
  6.  * #
  7.  * @var \Elements\Demi\Accommodation\Search\ResultSet\Product product
  8.  * @var bool useCancellationInfo
  9.  * @var bool tableOnSide
  10.  * @var \Elements\Demi\Model\AccommodationServiceProvider accommodation
  11.  * @var array productData
  12.  * @var int count
  13.  * @var searchParam \Elements\Demi\Accommodation\Search\Parameter
  14. */ #}
  15. {% set accommodationProduct = pimcore_object(product.getProductId()) %}
  16. {% set roomRow = productData.roomRow[count].getRowObject() %}
  17. {% set priceData = product.getPriceData() %}
  18. {% set price = roomRow ? product.getPrice() : product.getBasePrice() %}
  19. {% set id = product.getProductId() %}
  20. {% set title = moreRoomRows ? ('demi.detail.room.select-headline-' ~ accommodationProduct.getAccommodationType() | lower) | trans  ~ " " ~ (count + 1) : accommodationProduct.getName() %}
  21. {% if searchParam and searchParam is instanceof("\\Elements\\Demi\\Accommodation\\Search\\AbstractParameter") and searchParam.getDateFrom() %}
  22.     {% set dateFrom = searchParam.getDateFrom() %}
  23.     {% if searchParam is instanceof("\\Elements\\Demi\\Package\\Search\\Parameter") %}
  24.         {% set mealArray =  [] %}
  25.     {% else %}
  26.         {% set mealArray = accommodationProduct.getValidMeals(searchParam.getPeriod(),searchParam.getDateFrom()) %}
  27.     {% endif %}
  28.     {% set liveMeal = product.getMealCode() %}
  29.     {% if liveMeal is not empty %}
  30.         {% set liveMealObj = demi_getClassByStringAndIdentifier("\\Elements\\Demi\\Model\\MealType", "getByFid", liveMeal) %}
  31.         {% if not liveMeal in mealArray | keys %}
  32.             {% set mealArray = [liveMealObj] %}
  33.         {% endif %}
  34.     {% else %}
  35.         {% set liveMealObj = null %}
  36.     {% endif %}
  37. {% else %}
  38.     {% set dateFrom = carbon().now() %}
  39.     {% set mealArray = accommodationProduct.getValidMeals(0, dateFrom) %}
  40. {% endif %}
  41. {% set href = (accommodationProduct and demi_hasRoomDetails(accommodationProduct, dateFrom, app.request.getLocale(), tableOnSide) and moreRoomRows != true) ? "#detail-" ~ id : "" %}
  42. <section class="js-room-selection__room-row"
  43.          data-room-row-id="{{ count }}"
  44.          data-initial-price="{{ product.getPrice() | number_format(2, '.','') }}"
  45.     {% if priceData and priceData.getPriceBeforeSpecial() > product.getPrice() %}
  46.         data-initial-price-before-special="{{ priceData.getPriceBeforeSpecial() | number_format(2, '.','') }}"
  47.     {% endif %}
  48.          data-room-row-title="{{ title }}">
  49.     <div class="room-selection-box  {{ moreRoomRows ? 'border-top-0' : '' }}">
  50.         <script type="text/javascript" data-cookieconsent="ignore">
  51.             _config.lightbox = true;
  52.             _config.lazyImg = true;
  53.         </script>
  54.         <div class="row row--gutter-width-20">
  55.             {% if moreRoomRows == null %}
  56.                 <div class="col-2 room-row__image d-flex flex-column">
  57.                     {% if priceData and priceData.getSpecialPriceType() is same as "None" and priceData.getSpecialPriceName() and moreRoomRows is null %}
  58.                         <div class="teaser__label bg-warning text-center p-1 small text-white strong">
  59.                             {% if priceData.getSplitPay() and priceData.getSplitStay()  and priceData.getSplitPay() != priceData.getSplitStay() %}
  60.                                 {{ demi_fillTranslation({
  61.                                     '[STAY]' : priceData.getSplitStay(),
  62.                                     '[PAY]' : priceData.getSplitPay()
  63.                                 }, 'demi.price-special-type.splitpay') }}
  64.                             {% else %}
  65.                                 {{ priceData.getSpecialPriceName() }}
  66.                             {% endif %}
  67.                         </div>
  68.                     {% endif %}
  69.                     {% if priceData and priceData.getSpecialPriceType() and priceData.getSpecialPriceType()!= priceData.getSpecialPriceName() and priceData.getSpecialPriceType() is not same as "None" %}
  70.                         <div class="teaser__label bg-warning text-center p-1 small text-white strong">
  71.                             {{ ("demi.price-special-type." ~ priceData.getSpecialPriceType() | lower) | trans }}
  72.                         </div>
  73.                     {% endif %}
  74.                     {% set useGal = true %}
  75.                     {% if images | length == 0 %}
  76.                         {% set images = [demi_core_configuration("getTeaserFallbackImage",{})] %}
  77.                         {% set useGal = false %}
  78.                     {% endif %}
  79.                     {% if images[0] %}
  80.                         {% set thumbnail = images[0].getThumbnail('demi-desktop-room-teaser') %}
  81.                     <button type="button" class="btn-no-styling teaser__img btn-show-gallery-container js-lightbox--open-lightbox"
  82.                             data-lightbox-target="#{{ product.getProductId() }}-lightbox"
  83.                             data-sub-html="{{ demi_getNameAndCopyrightForImage(images[0])}}"
  84.                             style="background-image:url({{ thumbnail }});"
  85.                         {% set nameAndCopyRight = demi_getNameAndCopyrightForImage(images[0], true) %}
  86.                     {% if nameAndCopyRight is not empty %}
  87.                     title="&copy; {{ nameAndCopyRight }}"
  88.                     {% endif %} >
  89.                     <!-- end of button tag -->
  90.                     {{ thumbnail.getHTML({ 'imgAttributes': {'class' : 'sr-only', 'alt' : 'demi.image-alt-prefix' | trans  ~ ' ' ~ (accommodationProduct ? accommodationProduct.getName() : product.getDescription()|raw ) }}) |raw }}
  91.                     {% if useGal %}
  92.                     <span class="btn-show-gallery btn-no-styling" title="{{ "demi.details.open-gallery | trans"  }}">
  93.                     <span class="demi-icon demi-icon-search btn-show-gallery__icon" aria-hidden="true"></span>
  94.                     </span>
  95.                     {% endif %}
  96.                     </button>
  97.                     {% endif %}
  98.                 </div>
  99.             {% endif %}
  100.             <div class="col d-flex flex-column">
  101.                 <div class="teaser__main-body">
  102.                     <h3 class="h4 mb-1">
  103.                         <a {{ (href != "") ? 'href=' ~ href : 'href=""' }}
  104.                             aria-controls="detail-{{ id }}"
  105.                             aria-expanded="false"
  106.                             data-toggle="collapse"
  107.                             class="collapsed"
  108.                         >{{ title }}</a>
  109.                     </h3>
  110.                     <div class="mb-1 small text-muted">
  111.                             <div class="media">
  112.                                 {% if not (tableOnSide and availabilityIsChecked) %}
  113.                                     <div class="demi-icon demi-icon-person mr-1 icon-in-text"
  114.                                          aria-hidden="true"></div>
  115.                                     <div class="media-body">
  116.                                         {% if roomRow and not tableOnSide %}
  117.                                             {% set adults = roomRow.getAdults() %}
  118.                                             {% set children = roomRow.getChildAges() | length %}
  119.                                             {% set adultsStr = adults > 1 ? adults ~ " " ~ 'demi.detail.room.occupancy.adults' | trans  : adults ~ " " ~ 'demi.detail.room.occupancy.adult' | trans %}
  120.                                             {% set childrenStr = children > 1 ? children ~ " " ~ 'demi.detail.room.occupancy.children'| trans  : children ~ " " ~ 'demi.detail.room.occupancy.child'| trans %}
  121.                                         {% elseif (accommodationProduct.getBedsMin() != accommodationProduct.getBedsMax()) %}
  122.                                             {% set adultsStr = accommodationProduct.getBedsMin() ~ ' - ' ~ accommodationProduct.getBedsMax() ~
  123.                                                 ' ' ~ 'demi.detail.room.occupancy.persons'| trans %}
  124.                                         {% else %}
  125.                                             {% set adultsStr = accommodationProduct.getBedsMin()  ~ ' ' ~ 'demi.detail.room.occupancy.person'| trans %}
  126.                                         {% endif %}
  127.                                         {{ adultsStr }}
  128.                                         {% if children is defined and  children > 0 %}
  129.                                             , {{ childrenStr }}
  130.                                         {% endif %}
  131.                                     </div>
  132.                                 {% endif %}
  133.                             </div>
  134.                     </div>
  135.                     {% if showVacancy and moreRoomRows == null %}
  136.                         {{ include('@ElementsDemiFrontend/Includes/elements/vacancy-info.html.twig', {
  137.                             'vacancyCount':vacancyCount, 'tvbPackage':tvbPackage
  138.                         }) }}
  139.                     {% endif %}
  140.                 </div>
  141.                 <div>
  142.                     {% if not availabilityIsChecked and price and price > 0 %}
  143.                         <strong class="mb-1 d-block">
  144.                             <span class="room-row__price text-success" aria-live="polite">
  145.                                 <span class="js-room-selection__price">
  146.                                     {{ 'demi.price-from-short'| trans }}
  147.                                     {{ demi_paymentGetPriceObject(price, accommodationProduct.getService().getServiceProvider()) }}
  148.                                 </span>
  149.                                 <span class="js-room-selection__price-loading" hidden>
  150.                                     <span class="circle-spinner"
  151.                                           aria-label="{{ 'demi.content-loading' | trans }}"
  152.                                           title="{{ 'demi.content-loading'| trans }}"></span>
  153.                                 </span>
  154.                             </span>
  155.                         </strong>
  156.                     {% endif %}
  157.                 </div>
  158.                 {% if hasSingleRoomRow and accommodationProduct %}
  159.                     <div class="row row--vertical-gutter-6 mt-auto">
  160.                         {% if demi_hasRoomDetails(accommodationProduct, dateFrom, app.request.getLocale(), tableOnSide) %}
  161.                             <div class="col">
  162.                                 <a class="collapsed text-nowrap"
  163.                                    aria-expanded="false"
  164.                                    aria-controls="detail-{{ id }}"
  165.                                     {{ (href != "") ? 'href=' ~ href : 'href=""' }}
  166.                                    data-toggle="collapse">
  167.                                     {{ "demi.detail.room-details" | trans }}
  168.                                     <span
  169.                                         class="demi-icon demi-icon-chevron-down collapse-arrow ml-1 icon-in-text"></span>
  170.                                 </a>
  171.                             </div>
  172.                         {% endif %}
  173.                         {% if not availabilityIsChecked  and showAvailablityCalendar %}
  174.                             <div class="col-auto">
  175.                                 <a class="collapsed text-nowrap mr-2 js-tracking--click-piwik"
  176.                                    data-tracking-category="Product"
  177.                                    data-tracking-action="click availability calendar"
  178.                                    aria-expanded="false"
  179.                                    aria-controls="availabilities-{{ id }}"
  180.                                    href="#availabilities-{{ id }}"
  181.                                    data-toggle="collapse">
  182.                                     {{ "demi.detail.room-availabilities" | trans }}
  183.                                     <span
  184.                                         class="demi-icon demi-icon-chevron-down collapse-arrow ml-1 icon-in-text"></span>
  185.                                 </a>
  186.                             </div>
  187.                         {% endif %}
  188.                     </div>
  189.                 {% endif %}
  190.             </div>
  191.             {% if not tableOnSide %}
  192.                 <div class="{{ moreRoomRows ? 'col-8' : 'col-6' }}">
  193.                     <div class="row row--gutter-width-40 h-100">
  194.                         {% if liveMealObj and not hasSingleRoomRow %}
  195.                             <div class="col-4 room-row__border-left">
  196.                                 <div class="mb-1 small text-muted">
  197.                                     <div>
  198.                                         <span>
  199.                                             <label class="form-box form-box--gray mb-2">
  200.                                                 {% if mealArray | length > 0 %}
  201.                                                     <select id="meal-selector-{{ product.getProductId() }}"
  202.                                                             name="meal-selector-{{ product.getProductId() }}"
  203.                                                             class="form-box__content form-control js-room-selection__meal"
  204.                                                 {{ mealArray | length == 1 ? "disabled" : "" }}
  205.                                                 >
  206.                                                 {% for mealObj in mealArray %}
  207.                                                     <option value="{{ mealObj.getId() }}" {{ liveMealObj.getText() == mealObj.getText() ? "selected" : "" }}>{{ mealObj.getText() }}</option>
  208.                                                 {% endfor %}
  209.                                                 </select>
  210.                                                 {% if mealArray != 1 %}
  211.                                                     <span class="demi-icon demi-icon-chevron-down form-box__select-icon"
  212.                                                           aria-hidden="true"></span>
  213.                                                 {% endif %}
  214.                                                 {% endif %}
  215.                                             </label>
  216.                                         </span>
  217.                                     </div>
  218.                                 </div>
  219.                             </div>
  220.                         {% endif %}
  221.                         <div class="{{ moreRoomRows ? 'col-4' : 'col-6' }} room-row__border-left d-flex flex-column">
  222.                             <div>
  223.                                 {% if liveMealObj and hasSingleRoomRow %}
  224.                                     <div class="mb-1 small text-muted">
  225.                                         <div>
  226.                                             <span>
  227.                                                 <label class="form-box form-box--gray mb-2">
  228.                                                     {% if mealArray | length > 0 %}
  229.                                                         <select id="meal-selector-{{ product.getProductId() }}"
  230.                                                                 name="meal-selector-{{ product.getProductId() }}"
  231.                                                                 class="form-box__content form-control js-room-selection__meal"
  232.                                                     {{ mealArray | length == 1 ? "disabled" : "" }} >
  233.                                                     {% for mealObj in mealArray %}
  234.                                                         {% set rate=null %}
  235.                                                         <option {{ rate ? ' data-rate="' ~ rate ~ '"' : '' }} value="{{ mealObj.getId() }}" {{ liveMealObj.getText() == mealObj.getText() ? "selected" : "" }}>{{ mealObj.getText() }}</option>
  236.                                                     {% endfor %}
  237.                                                     </select>
  238.                                                     {% if mealArray | length != 1 %}
  239.                                                         <span
  240.                                                             class="demi-icon demi-icon-chevron-down form-box__select-icon"
  241.                                                             aria-hidden="true"></span>
  242.                                                     {% endif %}
  243.                                                     {% endif %}
  244.                                                 </label>
  245.                                             </span>
  246.                                         </div>
  247.                                     </div>
  248.                                 {% endif %}
  249.                                 <div class="">
  250.                                     {% if priceData and priceData.getPriceBeforeSpecial() > product.getPrice() %}
  251.                                         <span class="sr-only">{{ 'demi.detail.room.old-price' | trans }}</span>
  252.                                         <s class="text-muted fz13 js-room-selection__price-before-special">{{ demi_paymentGetPriceObject(priceData.getPriceBeforeSpecial(), accommodation) }}</s>
  253.                                     {% endif %}
  254.                                     {% if priceInfoText is defined %}
  255.                                         <div class="small text-muted">
  256.                                             {{ priceInfoText }}
  257.                                         </div>
  258.                                     {% endif %}
  259.                                 </div>
  260.                                 {% if price and price > 0 %}
  261.                                     <strong class="mb-1 d-block">
  262.                                 <span class="room-row__price text-success">
  263.                                     {% if tvbPackage and tvbPackage.showFromPriceInAccoDetail() %}
  264.                                         {{ 'demi.price-from-short' | trans }}
  265.                                     {% endif %}
  266.                                     <span class="js-room-selection__price">
  267.                                         {% if not roomRow %}
  268.                                             {{ 'demi.price-from-short' | trans }}
  269.                                         {% endif %} {{ demi_paymentGetPriceObject(price, accommodation) }}
  270.                                     </span>
  271.                                     <span class="js-room-selection__price-loading" hidden>
  272.                                         <span class="circle-spinner"
  273.                                               aria-label="{{ 'demi.content-loading' | trans }}"
  274.                                               title="{{ 'demi.content-loading' | trans }}"></span>
  275.                                     </span>
  276.                                 </span>
  277.                                     </strong>
  278.                                 {% endif %}
  279.                             </div>
  280.                             {% if (useCancellationInfo is defined and product.getCancellationInformation()) %}
  281.                                 {% set cancellationInformation = product.getCancellationInformation() %}
  282.                                 {% set displayInfo = demi_getCancellationDisplayInfo(cancellationInformation,searchParam.getDateFrom()) %}
  283.                                 {% set freeCancelText = displayInfo.getFreeCancellationText() %}
  284.                                 {% set promotionText = freeCancelText == ""  ? null : freeCancelText %}
  285.                             {% endif %}
  286.                             {% set ajaxUrl = demi_demiUrl({
  287.                                 'accommodation' : accommodation
  288.                             }, 'demi_acco_ajax') %}
  289.                             {% if "?" in ajaxUrl %}
  290.                                 {% set ajaxUrl = ajaxUrl | split("?")[0] %}
  291.                             {% endif %}
  292.                             {% set paymentInfoUrl = ajaxUrl ~ "?ajaxRequestType=getPaymentInformation&productId=" ~
  293.                                 (accommodationProduct ? accommodationProduct.getId() : '') ~ "&roomindex=" ~ count ~ "&bookonrequest=" %}
  294.                             <div class="mt-auto">
  295.                                 {% if priceData %}
  296.                                     <script>
  297.                                         _config.ajaxBtn = true;
  298.                                     </script>
  299.                                     <button aria-expanded="false"
  300.                                             type="button"
  301.                                             data-target="#price-info-{{ id }}-room-row-{{ count }}"
  302.                                             data-toggle="collapse"
  303.                                             class="btn-no-styling  collapsed js-ajax-btn js-ajax-btn--prefer-corridor-dates"
  304.                                             data-ajax-btn-url="{{ paymentInfoUrl }}"
  305.                                             data-ajax-btn-target="#payment-terms-{{ id }}-room-row-{{ count }}">
  306.                         <span class="demi-icon demi-icon-info-circle icon-in-text text-muted"
  307.                               title="{{ 'demi.detail.room.price-info' | trans }}"
  308.                               aria-hidden="true"></span> {{ 'demi.detail.room.price-info'| trans }}
  309.                                         <span
  310.                                             class="demi-icon demi-icon-chevron-down collapse-arrow ml-1 icon-in-text"></span>
  311.                                     </button>
  312.                                 {% endif %}
  313.                             </div>
  314.                         </div>
  315.                         <div class="{{ moreRoomRows ? 'col-4' : 'col-6' }} room-row__border-left">
  316.                             {{ include("@ElementsDemiFrontend/Includes/teaser/room-buttons.html.twig", {
  317.                                 'accommodationProduct' : accommodationProduct,
  318.                                 'product' : product,
  319.                                 'availabilityIsChecked' : availabilityIsChecked,
  320.                                 'showSelection' : showSelection,
  321.                                 'tvbPackage' : tvbPackage,
  322.                                 'promotionText' : promotionText ?? null,
  323.                                 'roomRowIndex' : count,
  324.                                 'divClass' : ''
  325.                             }) }}
  326.                         </div>
  327.                     </div>
  328.                 </div>
  329.             {% else %}
  330.                 <div class="col-4 ml-auto">
  331.                     {{ include("@ElementsDemiFrontend/Includes/teaser/room-details-table.html.twig", {
  332.                         "accommodationProduct" : accommodationProduct,
  333.                         "availabilityIsChecked" : availabilityIsChecked,
  334.                         'service' : accommodationProduct.getService()
  335.                     }) }}
  336.                 </div>
  337.             {% endif %}
  338.         </div>
  339.     </div>
  340.     <!--            for every single-room-->
  341.     {% if priceData and not(tableOnSide and availabilityIsChecked) %}
  342.         {{ include('@ElementsDemiFrontend/Includes/teaser/price-info.desktop.html.twig', {
  343.             'title' : 'demi.detail.room.price-info' | trans ,
  344.             'id' : id,
  345.             'priceData' : priceData,
  346.             'accommodationProduct' : accommodationProduct,
  347.             'roomRow' : roomRow,
  348.             'roomRowIndex' : count,
  349.             'productSet' : product,
  350.             'moreRoomRows' : moreRoomRows
  351.         }) }}
  352.     {% endif %}
  353. </section>