{% load cms_tags allink_cms_tags sekizai_tags i18n thumbnail allink_image_tags %}

{% for object in object_list %}

    <div class="locations-plugin details-container {{ instance.css_classes }}">

        <div class="details__col-container">
            <div class="details__col details__col-1 contact-container">

                <h2 class="heading">{% trans 'Contact' %}</h2>

                <div class="text-container">
                    {% if object.title %}
                        <p class="footer-container__heading">{% render_model_ajax object "title" %}</p>
                    {% endif %}
                    <p>
                        {% if object.subtitle %}
                            {{object.subtitle}}<br>
                        {% endif %}
                        {% if object.street %}
                            {{object.street}} {{object.street_nr}}<br>
                        {% endif %}
                        {% if object.zip_code or object.place %}
                            {{object.zip_code}} {{object.place}}<br>
                        {% endif %}
                        {% if object.map_link %}
                            {% trans "Directions" as link_label %}
                            {% include "partials/buttons/link.html" with link_url=object.map_link link_label=link_label link_classes="text" link_attributes='target="_blank" rel="noopener"' icon="arrow-external" %}
                        {% endif %}
                    </p>

                    <p>
                        {% if object.email %}
                            {% include "partials/buttons/link.html" with link_prefix="mailto:" link_url=object.email link_label=object.email link_classes="text" %}<br>
                        {% endif %}
                        {% if object.phone %}
                            {% include "partials/buttons/link.html" with link_prefix="tel:" link_url=object.phone link_label=object.phone_formatted link_classes="text" %}<br>
                        {% endif %}
                        {% if object.mobile %}
                            {% include "partials/buttons/link.html" with link_prefix="tel:" link_url=object.mobile link_label=object.mobile_formatted link_classes="text" %}<br>
                        {% endif %}
                        {% if object.fax %}
                            {% include "partials/buttons/link.html" with link_prefix="tel:" link_url=object.fax link_label=object.fax_formatted link_classes="text" %}<br>
                        {% endif %}
                    </p>
                </div>
            </div>
            <div class="details__col details__col-2 openinghours-container">

                <h2 class="heading">{% trans 'Opening hours' %}</h2>

                <div class="timeslot-list">
                    {% for day in object.opening_hours %}
                        {% if day.start_day %}
                            <div class="timeslot-list__entry">
                                <div class="days">{{ day.start_day }}{% if day.start_day != day.end_day %} – {{ day.end_day }}{% endif %}</div>
                                <div class="hours">
                                    {% if day.morning %}
                                        <div class="hours__entry">{{ day.morning }} {% trans 'h' %}</div>
                                    {% endif %}
                                    {% if day.afternoon %}
                                        <div class="hours__entry">{{ day.afternoon }} {% trans 'h' %}</div>
                                    {% endif %}
                                </div>
                            </div>
                        {% endif %}
                    {% endfor %}
                    {% if object.holidays_start_date and object.holidays_end_date %}
                        <div class="timeslot-list__entry">
                            <div class="days">{% trans 'Holidays' %}</div>
                            <div class="hours">
                                <div class="hours__entry">{{ object.holidays_start_date|date:"j. F Y" }} – <br> {{ object.holidays_end_date|date:"j. F Y" }}</div>
                            </div>
                        </div>
                    {% endif %}
                </div>

            </div>
        </div>

    </div>

{% endfor %}
