{% extends '@Contao/frontend_module/_base.html.twig' %}
{% use "@Contao/component/_list.html.twig" %}
{% use "@Contao/component/_figure.html.twig" %}

{%- macro listEntry(label, value, options = {}) -%}
  {%- set class = options.class|default({}) -%}
  {%- set prepend = options.prepend|default({}) %}
  {% set append = options.append|default({}) -%}
  {% set strong = options.strong is defined and options.strong ? true : false %}
  {% apply spaceless %}
    {% if label and value %}
      <li class="{% if class %}{{- class -}}{% endif %}{{- strong ? ' strong' : '' -}}">
        <span class="label">{{- label -}}</span>
        <span class="value">{% if prepend %}{{ prepend }}{% endif %}{{- value -}}{% if append %}{{ append }}{% endif %}</span>
      </li>
    {% endif %}
  {% endapply %}
{%- endmacro -%}
{%- macro backgroundWrapper_open(classes = '') -%}
<div class="{{ classes ? classes ~ ' ' : '' }}content-background-wrapper">
  <div class="content-background-wrapper-bg">
  </div>
  <div class="content-background-wrapper-fg">
    <div class="content-grid">
      <div class="fragments">
        {%- endmacro -%}
        {%- macro backgroundWrapper_close() -%}
      </div>
    </div>
  </div>
</div>
{%- endmacro -%}


{% block content %}
  {% import "@ContaoCore/Image/Studio/_macros.html.twig" as studio %}

  <div class="re_asset_expose">

    {{ _self.backgroundWrapper_open('-padding-medium') }}
    <p class="overviewLink"><a class="btn btn-outline-primary" href="{{ item.listUrl }}">Zurück zur Übersicht</a></p>
    <h1>{% if item.city %}{{ item.city }}{% endif %}{% if item.address %} {{ item.address }}{% endif %}</h1>
    {{ _self.backgroundWrapper_close }}

    {{ _self.backgroundWrapper_open('-alt-color-1 -padding-medium') }}

      <div class="teaser-wrapper">
        {% if item.teaserFigure %}
          {{- studio.figure(item.teaserFigure, { attr: { class: ('image_container media') }}) -}}
        {% endif %}
        {% if item.map %}
          {% block map %}<div class="map-embed">{{ item.map|default|insert_tag|raw }}</div>{% endblock %}
        {% endif %}
      </div>

      {% if item.description %}
        <div class="description">{{ item.description|raw }}</div>
      {% endif %}

    <div class="expose-gallery">
      {% with {items: item.galleryFigures} %}{{ block('list_component') }}{% endwith %}
    </div>
    {{ _self.backgroundWrapper_close }}

    {{ _self.backgroundWrapper_open('-padding') }}
    <p class="overviewLink"><a class="btn btn-outline-primary" href="{{ item.listUrl }}">Zurück zur Übersicht</a></p>
    {{ _self.backgroundWrapper_close }}


  </div>
{% endblock %}

{% block list_item %}
  {% with {figure: item} %}{{ block('figure_component') }}{% endwith %}
{% endblock %}
