{% if eventsList %}
    {% block titre_agenda %}
        {% if rootTitle %}
            <div class="bloc-titre-agenda">
                <h2 class="h2-theme-2">{{ rootTitle|raw }}</h2>
            </div>
        {% endif %}
    {% endblock %}

    <div class="agenda-2-wrap">
        <div class="agenda-2">
            <div class="agenda-2-in" id="mea-agenda">
                <div class="inner-agenda">
                    <div class="in-agenda swiper-container swiper-container-horizontal">
                        <div class="inner-inner-agenda swiper-wrapper">
                            {% for locationId,event in eventsList %}
                                <article class="swiper-slide">
                                    <a href="{{ path('ez_urlalias', {'locationId': locationId }) }}"
                                       title="{{ ez_field_value(event, 'titre')|escape }}">
                                        <div class="bloc-date">
                                            {% if event.fields.date_debut is defined and not ez_is_field_empty( event, "date_debut" ) %}
                                                <div>
                                                    <strong class="date">
                                                        <span class="day">{{ ez_field_value(event, "date_debut")|localizeddate('none', 'none', app.request.locale, null, "dd") }}</span>
                                                        <span class="month">{{ ez_field_value(event, "date_debut")|localizeddate('none', 'none', app.request.locale, null, "MMM") }}</span>
                                                    </strong>
                                                </div>
                                            {% endif %}
                                            {% if event.fields.date_debut is defined and not ez_is_field_empty( event, "date_debut" ) and event.fields.date_fin is defined and not ez_is_field_empty( event, "date_fin" ) and event.getFieldValue('date_debut').date != event.getFieldValue('date_fin').date %}
                                                <div>
                                                    <strong class="date">
                                                        <span class="day">{{ ez_field_value(event, "date_fin")|localizeddate('none', 'none', app.request.locale, null, "dd") }}</span>
                                                        <span class="month">{{ ez_field_value(event, "date_fin")|localizeddate('none', 'none', app.request.locale, null, "MMM") }}</span>
                                                    </strong>
                                                </div>
                                            {% endif %}
                                        </div>
                                        <div class="inner-article">
                                            <div class="description-event">
                                                <div class="sous_titre_event">{{ ez_render_field(event, 'thematiques') }}</div>
                                                <h3 class="event_name">{{ ez_render_field(event, 'titre')|raw }}</h3>
                                            </div>
                                            {% if event.getFieldValue( 'vignette' ).destinationContentId is defined and event.getFieldValue( 'vignette' ).destinationContentId %}
                                                {% set imageContent = load_content_by_content_id(event.getFieldValue('vignette').destinationContentId) %}
                                                {{ ez_render_field( imageContent, "image", {'parameters': { 'alias': 'event_home'} } ) }}
                                            {% endif %}
                                        </div>
                                    </a>
                                </article>
                            {% endfor %}
                        </div>
                        <div class="swiper-scrollbar"></div>
                    </div>
                </div>
                {% block lien_agenda %}
                    {% if rootID %}
                        <div class="voir-tout-wrapper">
                            <a href="{{ path( 'ez_urlalias', {'locationId': rootID } ) }}" class="voir-plus">Tout l'agenda</a>
                        </div>
                    {% endif %}
                {% endblock %}
            </div>

        </div>
    </div>
{% endif %}