{% set from = elements_customDateFormat(app.request.get('from')) %}
{% set to = elements_customDateFormat(app.request.get('to')) %}
{% set units = 0 %}
{% set guests = 0 %}
{% set roomsTranslation = "demi.unit" %}
{% set guestsTranslation = "demi.guest" %}
{% set roomrows = searchParam.getRoomrows() %}
{% if roomrows is not null %}
{% for roomrow in roomrows %}
{% set units = units + roomrow.getUnits() %}
{% set guests = guests + roomrow.getAdults() %}
{% if roomrow.getChildAges() is not empty %}
{% set guests = guests + roomrow.getChildAges()|length %}
{% elseif roomrow.getChildBirthdays() is not empty %}
{% set guests = guests + roomrow.getChildBirthdays()|length %}
{% endif %}
{% endfor %}
{% if units>1 %}
{% set roomsTranslation = "demi.units" %}
{% endif %}
{% if guests>1 %}
{% set guestsTranslation = "demi.guests" %}
{% endif %}
{% if app.request.get("occupancyType") is not empty %}
{% set roomsTranslation = "demi.search.multiple-rooms" %}
{% set unitStr = roomsTranslation|trans %}
{% set guestsStr = "" %}
{% elseif roomrows|length == 1 %}
{% if guests == 1 %}
{% set roomsTranslation = "demi.search.single-room" %}
{% elseif guests == 2 %}
{% set roomsTranslation = "demi.search.double-room" %}
{% endif %}
{% set unitStr = roomsTranslation|trans %}
{% set guestsStr = "" %}
{% else %}
{% set unitStr = units ~ " " ~ roomsTranslation|trans ~ ", " %}
{% set guestsStr = guests ~ " " ~ guestsTranslation|trans %}
{% endif %}
{% endif %}
{% set nights=app.request.get('nights') %}
{% if nights is empty and to is not empty and from is not empty %}
{% set nights = searchParam.getPeriod() %}
{% endif %}
<script data-cookieconsent="ignore">
_config.searchData = true;
</script>
<div class="ribbon mb-4 row row--gutter-width-1">
{% if showBackButton == true %}
<div class="col col-auto d-flex flex-column">
<button type="button" onclick="history.back()" class="ribbon__item py-3 btn-no-styling px-3 flex-auto flex-row">
<span class="demi-icon demi-icon-chevron-left f17" aria-label="{{ 'demi.back'|trans }}" title="{{ 'demi.next'|trans }}"></span>
</button>
</div>
{% endif %}
<div class="col">
<div class="ribbon__item{% if withFlag == true %} ribbon__item--has-flag {% endif %} font-medium js-overlay__toggle" data-target="#search-overlay">
<div>
<time datetime="{{ from is not empty ? from.formatLocalized('%Y-%m-%d') : '' }}" class="js-search-data__arrival">{{ from ? elements_dateFormat(from,'date-long') : '' }}</time>
-
<time datetime="{{ to is not empty ? to.formatLocalized('%Y-%m-%d') : '' }}" class="js-search-data__departure">{{ to ? elements_dateFormat(to,'date-long') : '' }}</time>
(<span class="js-search-data__nights">{{ nights }} {{ 'demi.nights'|trans }}</span>)
</div>
<div class="js-search-data__occupancy">{{ unitStr }} {{ guestsStr }}</div>
</div>
</div>
</div>