{% extends "@core/views/_views-view-withwrapper.html.twig" %}

{% block view_header %}

  <div class="row mb-4">

    {% if offers_header.header_text %}
      <div class="col-md-6">
        {{ offers_header.header_text }}
      </div>
    {% endif %}

    {% if offers_header.header_nodes is iterable %}
      <div class="col-md-6">
        <div class="row">
        {% for pinned_offer in offers_header.header_nodes %}
          <div class="col-lg-6">
            {% include "@molecules/tm-lb/link-block/link-block.twig" with {
              "image_src": pinned_offer.img_url,
              "image_alt": pinned_offer.img_alt,
              "block_link": pinned_offer.link,
              "title": pinned_offer.title|length > 30 ? pinned_offer.title|slice(0, 30) ~ '…' : pinned_offer.title,
              "image_fluid": false,
              "icon_right": "fas fa-chevron-right",
              "block_class": "bl-vf cbelianr",
              "header_tag": "h3",
              "link_classes": "belirf",
              "layout": "hoz",
              "order": "bwd",
              "link_scope": "block"
            } %}
          </div>
        {% endfor %}
        </div>
      </div>
    {% endif %}

  </div>

{% endblock %}

{% block view_rows %}
  {# Views Rows #}
  {% set cards = [] %}

  {% for item in items %}

    {% set card %}

      {% embed "@molecules/tm-cards/offer-card-alt/offer-card-alt.twig" %}
        {# SETTINGS #}
        {% set show_itinerary = false %}
        {% set badge = item.badge %}
        {# FIELDS #}
        {% set img_url = item.img_url %}
        {% set img_alt = item.img_alt %}
        {% set title = item.title %}
        {% set content = '' %}
        {% set badge_text_top = item.badge_text_top %}
        {% set badge_text_bottom = item.badge_text_bottom %}
        {% set card_link = item.card_link %}
        {% set location = item.location %}
        {% set tags = item.tags %}
        {% set visible_limit = "2" %}
        {% set show_itinerary = item.show_itinerary %}
        {% set oid = item.oid %}
      {% endembed %}

    {% endset %}

    {% set cards = cards|merge([card]) %}

  {% endfor %}

  {# Pass the cards array and the rows scaffolding. #}
  {% include "@organisms/tm-scaffold/rows-cols/rows-cols.twig" with {
    'batch': 3,
    'items': cards,
    'auto_height': true,
    'row_class': ' ',
    'col_class': 'mb-5 col-md-4',
  } only %}

{% endblock %}
