src/Elements/Bundle/DemiFrontendBundle/Resources/views/Includes/teaser/room-buttons.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\Model\AccommodationProduct accommodationProduct
  8.  * @var \Elements\Demi\Accommodation\Search\ResultSet\Product product
  9.  * @var \Elements\Demi\Model\MealType[] mealArray ,
  10.  * @var \Elements\Demi\Model\MealType liveMealObj
  11.  * @var bool showSelection
  12.  * @var string promotionText
  13.  * @var bool availabilityIsChecked
  14.  * @var \Elements\Demi\Model\Package tvbPackage
  15.  */
  16. #}
  17. {% if showSelection and (product.getBookableOnRequest() or product.getBookable()) %}
  18.     <div class="js-room-selection__detail collapse">
  19.         <div class="row align-items-center">
  20.             <label for="{{ product.getProductId() }}-count"
  21.                    class="col {{ pimcore_device().isPhone() ? "" : "sr-only" }}">
  22.                 {{ 'demi.detail.room.select-amount' | trans }}
  23.             </label>
  24.             <div class="col col-auto">
  25.                 {{ include('@ElementsDemiFrontend/Includes/elements/form-elements/number-spinner.html.twig', {
  26.                     'id' : product.getProductId() ~ '-count',
  27.                     'name' : product.getProductId() ~ '--count',
  28.                     'styleModifier' : 'js-room-selection__room-count',
  29.                     'roomId' : product.getProductId(),
  30.                     'max' : 7,
  31.                     'min' : 0
  32.                 }) }}
  33.             </div>
  34.         </div>
  35.         {% if pimcore_device().isPhone() %}
  36.             {% if mealArray | length > 1 %}
  37.                 <label class="form-box form-box--gray my-3">
  38.                     <span class="form-box__label">{{ 'demi.detail.room.meals' | trans }}</span>
  39.                     <select id="meal-selector-{{ product.getProductId() }}"
  40.                             name="meal-selector-{{ product.getProductId() }}"
  41.                             class="form-box__content form-control js-room-selection__meal">
  42.                         {% for mealObj in mealArray %}
  43.                             <option value="{{ mealObj.getId() }}" {{ liveMealObj.getText() == mealObj.getText() ? "selected" : "" }}>{{ mealObj.getText() }}</option>
  44.                         {% endfor %}
  45.                     </select>
  46.                     {% if mealArray | length is not same as 1 %}
  47.                         <span class="demi-icon demi-icon-chevron-down form-box__select-icon" aria-hidden="true"></span>
  48.                     {% endif %}
  49.                 </label>
  50.             {% elseif mealArray | length is same as 1 %}
  51.                 {% set mealObj = mealArray | first %}
  52.                 <input id="meal-selector-{{ product.getProductId() }}" type="hidden"
  53.                        name="meal-selector-{{ product.getProductId() }}" value="{{ mealObj.getId() }}"
  54.                        class="js-room-selection__meal">
  55.             {% endif %}
  56.         {% endif %}
  57.         {% set bookableOnRequest = (product.getBookableOnRequest() and not product.getBookable()) %}
  58.         {% if pimcore_device().isPhone() %}
  59.             {% set spanClass = "mr-2" %}
  60.             {% set btnClasses = "btn-block" %}
  61.         {% else %}
  62.             {% set btnClasses = "room-row__book-now-btn" %}
  63.             {% set spanClass = "mr-1" %}
  64.         {% endif %}
  65.         {% if product.getBookable() %}
  66.             <button type="submit" class="btn btn-success {{ btnClasses }} js-room-selection__submit mt-3"
  67.                     data-book-type="bookable">
  68.                 <span class="btn__icon demi-icon demi-icon-cart {{ spanClass }}" aria-hidden="true"></span>
  69.                 {{ 'demi.detail.room.booking-button' | trans }}
  70.             </button>
  71.         {% elseif bookableOnRequest %}
  72.             <button type="submit" class="btn btn-success {{ btnClasses }} js-room-selection__submit"
  73.                     data-book-type="onrequest">
  74.                 <span class="btn__icon demi-icon demi-icon-cart {{ spanClass }}" aria-hidden="true"></span>
  75.                 {{ 'demi.detail.room.booking-on-request-button' | trans }}
  76.             </button>
  77.         {% endif %}
  78.         <div class="mt-2 text-success small text-center">
  79.             {% if isAffiliate %}
  80.                 {{ 'demi.detail.promote-booking-speed-affiliate' | trans }}
  81.             {% elseif tvbPackage is not null %}
  82.                 {% for section in tvbPackage.getSections() %}
  83.                     {% if section.getProductType() is not same as "Accommodation" %}
  84.                         {% if section.getSelectionRulesType() is not same as "Mandatory" %}
  85.                             {{ 'demi.detail.room.destinationpackage-additional-services' | trans }}
  86.                         {% else %}
  87.                             {{ 'demi.detail.room.destinationpackage-additional-services-mandatory' | trans }}
  88.                         {% endif %}
  89.                         break
  90.                     {% endif %}
  91.                 {% endfor %}
  92.             {% else %}
  93.                 {{ promotionText ? promotionText : 'demi.detail.promote-booking-speed' | trans }}
  94.             {% endif %}
  95.         </div>
  96.     </div>
  97.     {% if not pimcore_device().isPhone() %}
  98.         {% set btnClasses = "room-row__select-room" %}
  99.     {% else %}
  100.         {% set btnClasses = "" %}
  101.     {% endif %}
  102.     <div class="js-room-selection__detail js-room-selection__detail--show-if-empty collapse show">
  103.         <button type="button" class="btn btn-success btn-block btn-breakable {{ btnClasses }} js-room-selection__add">
  104.             <span class="btn__icon demi-icon demi-icon-cart {{ spanClass }}" aria-hidden="true"></span>
  105.             {% if tvbPackage is not null or (accommodationProduct and accommodationProduct.getProductType() == constant('\\Elements\\Demi\\Accommodation\\Search\\Parameter::PRODUCT_TYPE_PACKAGE')) %}
  106.                 {{ 'demi.detail.room.select-button-package' | trans }}
  107.             {% else %}
  108.                 {{ (accommodationProduct ? 'demi.detail.room.select-button-' ~ accommodationProduct.getAccommodationType() | lower: 'demi.detail.room.select-button-hotelroom') | trans }}
  109.             {% endif %}
  110.         </button>
  111.         <div class="mt-2 {{ pimcore_device().isPhone() ? 'text-center' : '' }} text-success small">
  112.             {% if isAffiliate %}
  113.                 {{ 'demi.detail.promote-booking-speed-affiliate' | trans }}
  114.             {% elseif tvbPackage is not null %}
  115.                 {% set break = false %}
  116.                 {% for section in tvbPackage.getSections() | filter(section.getProductType() is not same as "Accommodation") %}
  117.                     {% if section.getSelectionRulesType() is not same as "Mandatory" %}
  118.                         {{ 'demi.detail.room.destinationpackage-additional-services' | trans }}
  119.                     {% else %}
  120.                         {{ 'demi.detail.room.destinationpackage-additional-services-mandatory' | trans }}
  121.                     {% endif %}
  122.                     {% set break = true %}
  123.                 {% endfor %}
  124.             {% else %}
  125.                 {{ promotionText ? promotionText : 'demi.detail.promote-booking-speed' | trans }}
  126.             {% endif %}
  127.         </div>
  128.     </div>
  129. {% elseif availabilityIsChecked %}
  130.     {% if pimcore_device().isPhone() %}
  131.         {% set divClass = "my-3" %}
  132.         {% set btnClasses = "btn-block" %}
  133.         <hr class="m-0">
  134.     {% else %}
  135.         {% set btnClasses = "room-row__book-now-btn" %}
  136.     {% endif %}
  137.     <div class="{{ divClass }}">
  138.         <div class="font-medium text-muted">
  139.             <div class="row row--gutter-width-10">
  140.                 <div class="col col-auto">
  141.                         <span class="demi-icon demi-icon-warning icon-in-text"
  142.                               aria-label="{{ 'demi.warning' | trans }}"
  143.                               title="{{ 'demi.warning' | trans }}"></span>
  144.                 </div>
  145.                 <div class="col {{ pimcore_device().isPhone() ? "" : "mb-2" }}">
  146.                     {{ 'demi.detail.product-not-bookable' | trans }}
  147.                 </div>
  148.             </div>
  149.         </div>
  150.     </div>
  151.     {% if not isAffiliate %}
  152.         {{ include("@ElementsDemiFrontend/Accommodation/includes/enquiry-button.html.twig", {
  153.             "text" : (accommodationProduct ? 'demi.detail.room.enquiry-button-' ~ accommodationProduct.getAccommodationType() | lower : 'demi.detail.room.enquiry-button-hotelroom') | trans,
  154.             "buttonClass" : btnClasses,
  155.             "trackingCategory" : "Product",
  156.             "trackingAction" : "click enquiry",
  157.             "singleProductEnquiry" : true
  158.         }) }}
  159.     {% endif %}
  160. {% endif %}