{% 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 media') }}) -}}
                    {% endif %}

                    <div class="details">
                        <ul>
                            <li>
                                <span class="label">Adresse:</span>
                                {% if item.address is not empty %}{{ item.address }}<br>{% endif %}
                                {% if item.postal is not empty and item.city is not empty %}{{ item.postal }} {{ item.city }}<br>{% endif %}
                            </li>
                            {% if item.livingSpace > 0 %}
                                <li>
                                    <span class="label">Wohnfläche:</span>
                                    {{ item.livingSpace|number_format(2, ',', '') }} m²
                                </li>
                            {% endif %}
                            <li>
                                <span class="label">Kaltmiete:</span>
                                {% if item.coldRent is not empty %}{{ item.coldRent|number_format(2, ',', '') }} €{% endif %}
                            </li>
                        </ul>
                        {% if item.detailsUrl %}
                            <a class="link" href="{{ item.detailsUrl }}"></a>
                        {% endif %}
                    </div>
                </div>
            {% endfor %}
        </div>
    {% endif %}
{% endblock %}
