src/Elements/Bundle/DemiFrontendBundle/Resources/views/Includes/ribbon.html.twig line 1

Open in your IDE?
  1. {% set from = elements_customDateFormat(app.request.get('from')) %}
  2. {% set to = elements_customDateFormat(app.request.get('to')) %}
  3. {% set units = 0 %}
  4. {% set guests = 0 %}
  5. {% set roomsTranslation = "demi.unit" %}
  6. {% set guestsTranslation = "demi.guest" %}
  7. {% set roomrows = searchParam.getRoomrows() %}
  8. {% if roomrows is not null %}
  9.     {% for roomrow in roomrows %}
  10.         {% set units = units +  roomrow.getUnits() %}
  11.         {% set guests = guests + roomrow.getAdults() %}
  12.        {% if roomrow.getChildAges() is not empty %}
  13.            {% set guests = guests + roomrow.getChildAges()|length %}
  14.        {% elseif roomrow.getChildBirthdays() is not empty %}
  15.            {% set guests = guests + roomrow.getChildBirthdays()|length %}
  16.        {% endif %}
  17.     {% endfor %}
  18.     {% if units>1 %}
  19.         {% set roomsTranslation = "demi.units" %}
  20.     {% endif %}
  21.     {%  if guests>1 %}
  22.         {% set guestsTranslation = "demi.guests" %}
  23.     {% endif %}
  24.     {% if app.request.get("occupancyType") is not empty %}
  25.         {% set roomsTranslation = "demi.search.multiple-rooms" %}
  26.         {% set unitStr = roomsTranslation|trans %}
  27.         {% set guestsStr = "" %}
  28.     {% elseif roomrows|length == 1 %}
  29.         {% if guests == 1 %}
  30.             {% set roomsTranslation = "demi.search.single-room" %}
  31.         {% elseif guests == 2 %}
  32.             {% set roomsTranslation = "demi.search.double-room" %}
  33.         {% endif %}
  34.         {% set unitStr = roomsTranslation|trans %}
  35.         {% set guestsStr = "" %}
  36.     {% else %}
  37.         {% set unitStr = units ~ " " ~ roomsTranslation|trans ~ ", " %}
  38.         {% set guestsStr = guests ~ " " ~ guestsTranslation|trans %}
  39.     {% endif %}
  40. {% endif %}
  41. {% set nights=app.request.get('nights') %}
  42. {% if nights is empty and to is not empty and from is not empty %}
  43.     {% set nights = searchParam.getPeriod() %}
  44. {% endif %}
  45. <script data-cookieconsent="ignore">
  46.     _config.searchData = true;
  47. </script>
  48. <div class="ribbon mb-4 row row--gutter-width-1">
  49.     {% if showBackButton == true %}
  50.     <div class="col col-auto d-flex flex-column">
  51.         <button type="button" onclick="history.back()" class="ribbon__item py-3 btn-no-styling px-3 flex-auto flex-row">
  52.             <span class="demi-icon demi-icon-chevron-left f17" aria-label="{{ 'demi.back'|trans }}" title="{{ 'demi.next'|trans }}"></span>
  53.         </button>
  54.     </div>
  55.     {% endif %}
  56.     <div class="col">
  57.         <div class="ribbon__item{% if withFlag == true %} ribbon__item--has-flag {% endif %} font-medium js-overlay__toggle" data-target="#search-overlay">
  58.             <div>
  59.                 <time datetime="{{ from is not empty ? from.formatLocalized('%Y-%m-%d') : '' }}" class="js-search-data__arrival">{{ from ? elements_dateFormat(from,'date-long') : '' }}</time>
  60.                 -
  61.                 <time datetime="{{ to is not empty ? to.formatLocalized('%Y-%m-%d') : '' }}" class="js-search-data__departure">{{ to ? elements_dateFormat(to,'date-long') : '' }}</time>
  62.                 (<span class="js-search-data__nights">{{ nights }} {{ 'demi.nights'|trans }}</span>)
  63.             </div>
  64.             <div class="js-search-data__occupancy">{{ unitStr }} {{ guestsStr }}</div>
  65.         </div>
  66.     </div>
  67. </div>