src/Elements/Bundle/DemiFrontendBundle/Resources/views/Accommodation/searchInfoBox.desktop.html.twig line 1

Open in your IDE?
  1. {% set productSets = accommodationResultSet is defined and accommodationResultSet is not null ? accommodationResultSet.getMinPriceProductSets() : [] %}
  2. {% set isCorridor = isCorridor is defined ? isCorridor : false %}
  3. {% set useCancellationInfo = useCancellationInfo is defined ? useCancellationInfo : false %}
  4. {% set detailUrl = pimcore_url({'object': accommodation}, 'demi_acco_detail_page') %}
  5. {% if tvbPackage is defined %}
  6.     {% set productSets = [productResultSet] %}
  7. {% endif %}
  8. {% if productSets is not defined or productSets is empty %}
  9.     {% set productSets = (productResultSet is defined and productResultSet is not empty and productResultSet.getProducts() is not null) ? productResultSet.getProducts() : [] %}
  10.     {% if packages is defined and packages is not null %}
  11.         {% set packageSets = [] %}
  12.         {% set minPrice = 0 %}
  13.         {% for hpm in packages %}
  14.             {% set packageSets = packageSets + (hpm.getRoomRows()|first).getProducts() %}
  15.         {% endfor %}
  16.         {# Cheapest product if there are packages but no rooms (no accommodationResultSet) #}
  17.         {% set cp = demi_getMinPriceOfHousePackageMasterResultSet(packageSets)["cP"] %}
  18.         {% set productSets = productSets + packageSets %}
  19.     {% elseif accommodationResultSet is instanceof('\\Elements\\Demi\\Accommodation\\Search\\ResultSet\\HousePackageMaster') %}
  20.         {# Cheapest product (no minPrice and package site) #}
  21.         {% set cp = demi_getMinPriceOfHousePackageMasterResultSet(accommodationResultSet)["cP"] %}
  22.     {% endif %}
  23.     {% if accommodationResultSet is defined and accommodationResultSet is not null and accommodationResultSet.getMinPriceBaseProductId() %}
  24.         {% set minId = accommodationResultSet.getMinPriceBaseProductId() %}
  25.         {% set productSets = productSets[minId] is defined ? [productSets[minId]] : [] %}
  26.     {% elseif availabilityIsChecked is defined and not availabilityIsChecked %}
  27.         {% if cp is defined %}
  28.             {% set productSets = [cp] %}
  29.         {% endif %}
  30.     {% endif %}
  31. {% endif %}
  32. {% if accommodationResultSet is defined and accommodationResultSet is not empty %}
  33.     {% set accommodation = pimcore_object(accommodationResultSet.getAccommodationId()) %}
  34. {% endif %}
  35. {% set href = "rooms" %}
  36. {% if isPackage %}
  37.     {% set href = "booking" %}
  38. {% endif %}
  39. {# // no search date - no date for images #}
  40.  {% if availabilityIsChecked is defined and not availabilityIsChecked %}
  41.      {% set fromDate = null %}
  42.  {% else %}
  43.      {% set fromDate = demi_getSearchFrom() %}
  44.  {% endif %}
  45. {% set hasBookingLink = hasBookingLink is defined ? hasBookingLink : false %}
  46. <div>
  47.     {% if ((not isCorridor and  productSets is defined and  productSets is not empty and productSets|first is not null) ) and not hasBookingLink %}
  48.         {% if accommodationResultSet is not null and  accommodationResultSet.getRoomRows()|length < productSets|length %}
  49.             {% set productSets = productSets|slice(0, accommodationResultSet.getRoomRows()|length) %}
  50.         {% endif %}
  51.         {% set rowCounter=0 %}
  52.         {% for productSet in productSets %}
  53.             {% if productSet is not empty %}
  54.                 {% set images = [] %}
  55.                 {% set accommodationProduct = pimcore_object(productSet.getProductId()) %}
  56.                 {% set housePackageMaster = accommodationProduct is not null ? accommodationProduct.getPackageMaster() : null %}
  57.                 {% if accommodationProduct is not null and accommodationProduct.getProductType()=="Package" and not isPackage and housePackageMaster is not null %}
  58.                     {% set firstImage = demi_getFirstImageForHousePackageMaster(housePackageMaster, accommodation, fromDate) %}
  59.                     {% if firstImage is not null %}
  60.                         {% set images = images|merge([firstImage]) %}
  61.                     {% endif %}
  62.                     {% set headline = housePackageMaster.getName() %}
  63.                     {% set headlineSmall = accommodationProduct.getName() %}
  64.                 {% else %}
  65.                     {% set images = accommodationProduct is not null ? demi_getRoomPictures(accommodationProduct,fromDate) : [] %}
  66.                     {% set headline = accommodationProduct ? accommodationProduct.getName() : productSet.getDescription()|raw %}
  67.                     {% set headline = headline is not empty ? headline : accommodationProduct.getService().getName() %}
  68.                 {% endif %}
  69.                 {% if accommodationResultSet is not null %}
  70.                     {% set priceTest = accommodationResultSet.getMinPrice() is not empty ? accommodationResultSet.getMinPrice() : accommodationResultSet.getMinPriceBase() %}
  71.                 {% else %}
  72.                     {% set priceTest = null %}
  73.                 {% endif %}
  74.                 {% if accommodationResultSet is not null and priceTest is not empty %}
  75.                     <div class="row row--gutter-width-20">
  76.                         <div class="col-auto d-flex flex-column">
  77.                             <div class="teaser__label bg-warning text-center p-1 small text-white strong" hidden>
  78.                             </div>
  79.                             {% if images[0] is defined %}
  80.                                 <div class="teaser__img offer-box__img btn-show-gallery-container"
  81.                                      style="background-image:url({{ images[0].getThumbnail('demi-desktop-searchInfoBox-teaser') }})">
  82.                                     {{ images[0].getThumbnail('demi-desktop-searchInfoBox-teaser').getHTML({ 'imgAttributes': {'class': 'sr-only', 'alt': ('demi.image-alt-prefix'|trans) ~ ' ' ~  accommodationProduct.getName()}})|raw }}
  83.                                 </div>
  84.                             {% endif %}
  85.                         </div>
  86.                         <div class="col d-flex flex-column collapsed" data-toggle="collapse"
  87.                              data-target="#detail-{{ productSet.getProductId() }}">
  88.                             <!-- no button/a-tag and aria because this is just to increase the clickable area (like isClickable)  -->
  89.                             <div class="teaser__main-body">
  90.                                 <div class="offer-box__title mb-2">
  91.                                     {{ headline }}
  92.                                 </div>
  93.                                 {{ headlineSmall is defined ? headlineSmall : '' }}
  94.                                 <div class="small text-muted">
  95.                                     <div class="media">
  96.                                         {% if accommodationResultSet is not null and accommodationResultSet.getRoomRows()[rowCounter] %}
  97.                                             {% set roomRow = accommodationResultSet.getRoomRows()[rowCounter].getRowObject() ? accommodationResultSet.getRoomRows()[rowCounter].getRowObject() : null %}
  98.                                         {% endif %}
  99.                                         {% if roomRow is defined and roomRow is not empty %}
  100.                                             <div class="demi-icon demi-icon-person mr-1 icon-in-text"
  101.                                                  aria-hidden="true"></div>
  102.                                             <div class="media-body">
  103.                                                 {% set adults = roomRow.getAdults() %}
  104.                                                 {% set children = roomRow.getChildAges()|length %}
  105.                                                 {% set adultsStr = adults > 1 ? adults ~ " " ~ ('demi.detail.room.occupancy.adults'|trans) : adults ~ " " ~ ('demi.detail.room.occupancy.adult'|trans) %}
  106.                                                 {% set childrenStr = children > 1 ? children ~ " " ~ ('demi.detail.room.occupancy.children'|trans) : children ~ " " ~ ('demi.detail.room.occupancy.child'|trans) %}
  107.                                                 {{ adultsStr }}
  108.                                                 {% if children > 0 %}
  109.                                                     , {{ childrenStr }}
  110.                                                 {% endif %}
  111.                                             </div>
  112.                                         {% endif %}
  113.                                     </div>
  114.                                 </div>
  115.                             </div>
  116.                         </div>
  117.                     </div>
  118.                     <hr class="hr--border-gray my-4">
  119.                 {% endif %}
  120.                 {% set mealObj = demi_getMealTypeByFid(productSet.getMealCode() ?? '') %}
  121.                 <div class="row align-items-end row--gutter-width-10">
  122.                     <div class="col text-muted">
  123.                         {% if mealObj %}
  124.                             <div class="small text-nowrap">
  125.                                 <div class="demi-icon demi-icon-restaurant mr-1 icon-in-text"
  126.                                      aria-label="{{ "demi.detail.room.meals"|trans }}"
  127.                                      title="{{ "demi.detail.room.meals"|trans }}"></div>
  128.                                 {{ mealObj.getText() }}
  129.                             </div>
  130.                         {% endif %}
  131.                         {% if roomRow is defined and roomRow is null and   productSet.getPriceInfo is iterable %}
  132.                             {% set priceInfo = productSet.getPriceInfo() %}
  133.                             {% if priceInfo['type'] is defined and  priceInfo['nights'] is defined %}
  134.                                 {{ include('@ElementsDemiFrontend/Includes/priceInfoStr.html.twig', {'type': priceInfo['type'], 'nights': priceInfo['nights']}) }}
  135.                             {% endif %}
  136.                         {% endif %}
  137.                         {% if productSet.getPriceData() is not null and productSet.getPriceData().getPriceBeforeSpecial() != productSet.getPrice() %}
  138.                             <div class="sr-only">{{ "demi.instead-of"|trans }}</div>
  139.                             <s>{{ demi_paymentGetPriceObject(productSet.getPriceData().getPriceBeforeSpecial(), pimcore_object(accommodation.getId())) }}</s>
  140.                         {% endif %}
  141.                     </div>
  142.                     {% set price = productSet.getPrice() ? productSet.getPrice() : productSet.getBasePrice() %}
  143.                     {% if price > 0 %}
  144.                         <div class="col col-auto text-right">
  145.                             <strong
  146.                                 class="font-medium offer-box__price text-success">{{ 'demi.price-from-short'|trans }} {{ demi_paymentGetPriceObject(price,accommodation) }}</strong>
  147.                         </div>
  148.                     {% endif %}
  149.                 </div>
  150.                 {% if useCancellationInfo and productSet is not empty and productSet.getCancellationInformation() is not empty %}
  151.                     {% set cancellationInformation = productSet.getCancellationInformation() %}
  152.                     {% set displayInfo = demi_getCancellationDisplayInfo(cancellationInformation,fromDate) %}
  153.                     {% set freeCancelText = displayInfo.getFreeCancellationText() %}
  154.                     {% set freeCancelText = freeCancelText == ""  ? null : ('demi.list.free-cancellation'|trans) %}
  155.                 {% endif %}
  156.                 {% set rowCounter = rowCounter + 1 %}
  157.                 {% if rowCounter == productSets|length %}
  158.                     <div class="mt-3">
  159.                         {% if  roomRow is defined and roomRow  is not empty %}
  160.                         {% if accommodationProduct is not null and  accommodationProduct.getProductType()=="Package" and not isPackage and housePackageMaster is not null %}
  161.                         {% set translation =  "demi.detail.show-package" %}
  162.                         {% set packageDetailUrl = demi_demiUrl({
  163.                             'accommodation': accommodation,
  164.                             'package': housePackageMaster
  165.                         }, 'demi_acco_detail_package_page') %}
  166.                         <a href="{{ packageDetailUrl }}" class="btn btn-success btn-block btn-lg">
  167.                             {% else %}
  168.                             {% set translation = "demi.detail.show-offer" %}
  169.                             <a href="#{{ href }}"
  170.                                data-target="#{{ href }}"
  171.                                aria-controls="<{{ href }}"
  172.                                data-tracking-category="Accommodation detail"
  173.                                data-tracking-action="click booking search info"
  174.                                class="btn btn-success btn-block btn-lg js-open-tab-and-scroll js-tracking--click">
  175.                                 {% endif %}
  176.                                 <script data-cookieconsent="ignore">
  177.                                     _config.openTabAndSroll = true;
  178.                                 </script>
  179.                                 {{ translation|trans }}<span class="demi-icon demi-icon-arrow-right btn__icon ml-2"
  180.                                                              aria-hidden="true"></span>
  181.                             </a>
  182.                             {% else %}
  183.                                 <button type="button" class="btn btn-success btn-block btn-lg js-overlay__toggle"
  184.                                         data-target="#search-overlay">
  185.                                     {{ "demi.list.search-vacancies-button"|trans }}
  186.                                 </button>
  187.                             {% endif %}
  188.                             <div
  189.                                 class="mt-2 text-center text-primary js-search-data__hide-if-submitted" {{ roomRow is defined and roomRow is not null ? 'hidden' : '' }}>
  190.                                 <a class="js-open-tab-and-scroll" href="#{{ href }}">
  191.                                     {% set translation = " " ~ (demi_getRoomsTabTranslationKey(accommodation)|trans) %}
  192.                                     <span class="demi-icon demi-icon-arrow-right btn__icon mr-1"
  193.                                           aria-hidden="true"></span>{{ ("demi.detail.show-all"|trans) ~ translation }}
  194.                                 </a>
  195.                             </div>
  196.                     </div>
  197.                 {% else %}
  198.                     <hr class="hr--border-gray my-4">
  199.                 {% endif %}
  200.             {% endif %}
  201.         {% endfor %}
  202.     {% else %}
  203.         {% if isCorridor and (accommodationResultSet is not null or alternativeResultSet is not null) %}
  204.             {% if alternativeResultSet and alternativeResultSet.getMinPrice() %}
  205.                 {{ "demi.detail.no-rooms-long-with-alternatives"|trans }}
  206.                 <div class="mt-2">
  207.                     <a href="#{{ href }}"
  208.                        data-target="#{{ href }}"
  209.                        aria-controls="{{ href }}"
  210.                        data-alternative-from="{{ elements_customDateFormat(alternativeSearchParameter.getDateFrom()) }}"
  211.                        data-alternative-to="{{ elements_customDateFormat(alternativeSearchParameter.getDateTo()) }}"
  212.                        data-alternative-duration-type="variable"
  213.                        data-alternative-duration-nights="{{ min(alternativeSearchParameter.getNights()) }}-{{ max(alternativeSearchParameter.getNights()) }}"
  214.                        class="btn btn-success btn-block btn-lg js-open-tab-and-scroll mt-2 js-alternative-search">
  215.                         {{ 'demi.detail.change-search-params'|trans }}
  216.                     </a>
  217.                 </div>
  218.             {% else %}
  219.                 {% if isCorridor %}
  220.                     {{ "demi.detail.choose-result-corridor"|trans }}
  221.                     <div class="mt-2">
  222.                         <a href="#{{ href }}"
  223.                            data-target="#{{ href }}"
  224.                            aria-controls="{{ href }}"
  225.                            class="btn btn-success btn-block btn-lg js-open-tab-and-scroll mt-2">
  226.                             {{ 'demi.detail.show-offers-corridor'|trans }}
  227.                         </a>
  228.                     </div>
  229.                 {% else %}
  230.                     {{ "demi.detail.no-rooms-long"|trans }}
  231.                 {% endif %}
  232.             {% endif %}
  233.         {% else %}
  234.             {% if hasBookingLink %}
  235.                 {{ "demi.detail.external-booking.longtext"|trans }}
  236.             {% endif %}
  237.             {% if alternativeResultSet is defined and alternativeResultSet is not null and alternativeResultSet.getMinPrice() %}
  238.                 {{ "demi.detail.no-rooms-long-with-alternatives"|trans }}
  239.                 <div class="mt-2">
  240.                     <a href="#{{ href }}"
  241.                        data-target="#{{ href }}"
  242.                        aria-controls="{{ href }}"
  243.                        data-alternative-from="{{ elements_customDateFormat(alternativeSearchParameter.getDateFrom()) }}"
  244.                        data-alternative-to="{{ elements_customDateFormat(alternativeSearchParameter.getDateTo()) }}"
  245.                        data-alternative-duration-type="variable"
  246.                        data-alternative-duration-nights="{{ min(alternativeSearchParameter.getNights()) }}-{{ max(alternativeSearchParameter.getNights()) }}"
  247.                        class="btn btn-success btn-block btn-lg js-open-tab-and-scroll mt-2 js-alternative-search">
  248.                         {{ 'demi.detail.change-search-params'|trans }}
  249.                     </a>
  250.                 </div>
  251.             {% else %}
  252.                 {{ accommodation.getSystemIdentifier() is same as "Deskline" ? "demi.detail.no-rooms-long"|trans : '' }}
  253.                 <div class="row row--gutter-width-10 mt-4">
  254.                     {% if hasBookingLink %}
  255.                         <div class="col col-auto mb-3">
  256.                             <a target="_blank" class="btn btn-success" href="{{ bookingLink }}">
  257.                                 {{ "demi.detail.external-booking.cta"|trans }}
  258.                             </a>
  259.                         </div>
  260.                     {% elseif accommodation.getSystemIdentifier() is same as "Deskline" %}
  261.                         <div class="col col-auto mb-3">
  262.                             <button type="button" class="btn btn-success js-overlay__toggle"
  263.                                     data-target="#search-overlay">
  264.                                 {{ "demi.search.change"|trans }}
  265.                             </button>
  266.                         </div>
  267.                     {% endif %}
  268.                     <div class="col">
  269.                         {{ include("@ElementsDemiFrontend/Accommodation/includes/enquiry-button.html.twig", {
  270.                             "text": 'demi.detail.enquiry-button-simple'|trans,
  271.                             "accommodation": accommodation,
  272.                             "trackingCategory": isPackage ? "Package detail" : "Accommodation detail",
  273.                             "trackingAction": "click enquiry search info"
  274.                         }) }}
  275.                     </div>
  276.                 </div>
  277.                 {% if accommodation.getSystemIdentifier() is same as "Deskline" %}
  278.                     <div class="row row--gutter-width-10 mt-4 text-primary">
  279.                         {% set roomsString = (demi_getRoomsTabTranslationKey(accommodation))|trans %}
  280.                         <span class="demi-icon demi-icon-arrow-right btn__icon mr-1" aria-hidden="true"></span>
  281.                         <a href="{{ detailUrl }}?&activeTab=%23rooms" class="text-underline">
  282.                             {{ demi_fillTranslation({'[ROOMS]': roomsString}, "demi.detail.show-room-list") }}
  283.                         </a>
  284.                     </div>
  285.                 {% endif %}
  286.             {% endif %}
  287.         {% endif %}
  288.     {% endif %}
  289.     {% if freeCancelText is defined and freeCancelText is not empty %}
  290.         <div class="text-success small text-center mt-2">
  291.             {{ freeCancelText }}
  292.         </div>
  293.     {% endif %}
  294. </div>