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

Open in your IDE?
  1. {#
  2. /**
  3.  * @var \\Pimcore\\Templating\\GlobalVariables app
  4.  * #
  5.  * @var productData array
  6.  * @var accommodation \\Elements\\Demi\\Model\\AccommodationServiceProvider
  7.  * @var settlerCode string
  8.  * @var bookOnRequest bool
  9.  * @var availabilityIsChecked bool
  10.  * @var hasSingleRoomRow bool
  11.  */ #}
  12. {% if searchParam is not defined or searchParam.getDateFrom() is empty %}
  13.     {% set fromDate = null %}
  14. {% else %}
  15.     {% set fromDate = demi_getSearchFrom() %}
  16. {% endif %}
  17. {% if productData is iterable and productData.roomRow[0] is defined and productData.products[0] is defined%}
  18.     {% set possibleIndices = productData.roomRow | keys %}
  19.     {% set i = possibleIndices | first %}
  20.     {% set roomRow = productData.roomRow[i].getRowObject() %}
  21.     {% set product = productData.products[i] %}
  22.     {% set accommodationProduct = pimcore_object(product.getProductId()) %}
  23.     {% if accommodationProduct and accommodationProduct.isPublished() %}
  24.         <li>
  25.             {% if product %}
  26.                 {% if roomRow %}
  27.                     {% set priceData = product.getPriceData() %}
  28.                     {% set price = product.getPrice() %}
  29.                     {% set showVacancy = true %}
  30.                     {% set showSelection = true %}
  31.                     {% set vacancyCount = product.getUnits() %}
  32.                 {% else %}
  33.                     {% set priceData = null %}
  34.                     {% set price = product.getBasePrice() %}
  35.                     {% set showVacancy = false %}
  36.                     {% set showSelection = false %}
  37.                     {% set vacancyCount = 0 %}
  38.                     {% set priceInfo = product.getPriceInfo() ?? null %}
  39.                     {% set priceInfoText = priceInfo is not null ? include('@ElementsDemiFrontend/Includes/priceInfoStr.html.twig', {'type' : priceInfo.type ?? null, 'nights' : priceInfo.nights ?? null}) : '' %}
  40.                 {% endif %}
  41.             {% endif %}
  42.             {% set images = accommodationProduct ? demi_getRoomPictures(accommodationProduct,fromDate) : [] %}
  43.             {% set moreRoomRows = true %}
  44.             <div class="js-room-selection__room my-3"
  45.                  data-availability-reference-id="{{ product.getAvailabilityReference() is same as "Service" ? product.getServiceId() : product.getProductId() }}"
  46.                  data-room-id="{{ product.getProductId() }}"
  47.                  data-tracking-variant="{{ demi_impressionVariant(accommodationProduct ?: product, tvbPackage) }}"
  48.                  data-tracking-variant-id="{{ product.getProductId() }}"
  49.                  data-settler-code="{{ settlerCode }}"
  50.                  data-booking-type="{{ product.getBookable() ? 'bookable' : 'onrequest' }}">
  51.                 <div class="card">
  52.                     {% if not availabilityIsChecked or not hasSingleRoomRow %}
  53.                         {% set firstPossibleIndex = productData.products | keys | first%}
  54.                         {% set product = productData.products[firstPossibleIndex] %}
  55.                         {{ include("@ElementsDemiFrontend/Includes/teaser/room-teaser-content.desktop.html.twig", {
  56.                             "count" : firstPossibleIndex,
  57.                             "product" : product,
  58.                             "productData" : productData,
  59.                             "images" : images,
  60.                             "tableOnSide" : true,
  61.                             "hasSingleRoomRow" : true,
  62.                             "availabilityIsChecked" : availabilityIsChecked,
  63.                             "priceData" : priceData,
  64.                             "priceInfoText" : priceInfoText,
  65.                             'tvbPackage' : tvbPackage,
  66.                             'dateFrom' : fromDate,
  67.                             'moreRoomRows' : false
  68.                         }) }}
  69.                     {% endif %}
  70.                     <div id="room-row-collapse-parent-{{ product.getProductId() }}">
  71.                         <div class="panel">
  72.                             {% if not availabilityIsChecked or not hasSingleRoomRow %}
  73.                                     {{ include("@ElementsDemiFrontend/Includes/teaser/room-details.html.twig", {
  74.                                         "id" : product.getProductId(),
  75.                                         "accommodationProduct" : accommodationProduct,
  76.                                         "images" : images,
  77.                                         "availabilityIsChecked" : availabilityIsChecked,
  78.                                         "moreRoomRows" : not hasSingleRoomRow ? moreRoomRows : '',
  79.                                         "accommodation" : accommodation,
  80.                                         "dateFrom" : fromDate,
  81.                                         "pakcage" : tvbPackage
  82.                                     }) }}
  83.                             {% endif %}
  84.                             {% if availabilityIsChecked %}
  85.                                 {% for productIndex, product in productData.products %}
  86.                                     {{ include("@ElementsDemiFrontend/Includes/teaser/room-teaser-content.desktop.html.twig", {
  87.                                         "count" : productIndex,
  88.                                         "product" : product,
  89.                                         "productData" : productData,
  90.                                         "images" : images,
  91.                                         "tableOnSide" : false,
  92.                                         "hasSingleRoomRow" : hasSingleRoomRow,
  93.                                         "availabilityIsChecked" : availabilityIsChecked,
  94.                                         "moreRoomRows" : not hasSingleRoomRow ? moreRoomRows : null,
  95.                                         'tvbPackage' : tvbPackage,
  96.                                         'dateFrom' : fromDate,
  97.                                     }) }}
  98.                                     {% if hasSingleRoomRow %}
  99.                                         {{ include("@ElementsDemiFrontend/Includes/teaser/room-details.html.twig", {
  100.                                             'id' : product.getProductId(),
  101.                                             "accommodationProduct" : accommodationProduct,
  102.                                             "images" : images,
  103.                                             "availabilityIsChecked" : availabilityIsChecked,
  104.                                             "moreRoomRows" : null,
  105.                                             "dateFrom" : fromDate,
  106.                                             "package" : tvbPackage
  107.                                         }) }}
  108.                                     {% endif %}
  109.                                 {% endfor %}
  110.                             {% elseif showAvailablityCalendar %}
  111.                                 {{ include("@ElementsDemiFrontend/Includes/teaser/room-availabilities.html.twig", {
  112.                                     'product' : accommodationProduct,
  113.                                     "accommodation" : accommodation
  114.                                 }) }}
  115.                             {% endif %}
  116.                         </div>
  117.                     </div>
  118.                 </div>
  119.             </div>
  120.         </li>
  121.     {% endif %}
  122. {% endif %}