{% extends '@Contao/frontend_module/_base.html.twig' %}

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

  {% if items is not defined or items is empty %}
    <p class="alert alert-secondary">{{ 'MSC.re_empty'|trans({}, 'contao_default') }}</p>
  {% else %}
    <div class="assetList">
      {% for item in items %}
        <div class="asset re_asset_card">
          {% if item.teaserFigure %}
            {{- studio.figure(item.teaserFigure, { attr: { class: ('image_container ') }}) -}}
          {% endif %}
          <h4>{{ item.title }}</h4>
          <div class="location"><div class="label">
          {% if item.livingSpace > 0 %}
            {{ item.address }}
          {% else %}
            {{ item.city }}
          {% endif %}
          </div></div>
          {% if item.livingSpace > 0 %}
            <div class="livingSpace"><div class="label">{{ item.livingSpace|number_format(2, ',', '') }} m²</div></div>
          {% else %}
            <div class="addr"><div class="label">{{ item.address }}</div></div>
          {% endif %}
          {% if item.detailsUrl %}
            <a class="link" href="{{ item.detailsUrl }}"></a>
          {% endif %}
        </div>
      {% endfor %}
    </div>
  {% endif %}
{% endblock %}
