{% set introClass = "team-project-section" %}
<div class="preview-article mt-1em">
{% if block.articles_smart_content is defined and block.articles_smart_content is not empty and block.articles_smart_content|length > 0 %}
{% if block.filter == "fiches_territoires" %}
{% include "filter/sub-filters/type-territoire.html.twig" %}
{% endif %}
<div class="dflex jcsb button-container fwwrap">
<div class="dflex jcsb w100">
{% if block.filter != "groupe_travail" and block.filter != "fiches_territoires" %}
<button id="filter" class="bgblue cwhite shadow-button jcsa br6 fs14 fw400 lh20 visible {% if block.filter == 'experiences' %} filter-experiences-custom {% else %} toggleable{% endif %} {{ introClass }}">
<img src="/resources/img/filter-icon.svg" width="14" height="16" alt="" loading="lazy">
Filtrer
</button>
{% endif %}
<div class="prelative document-search-cont">
<input placeholder="Rechercher" id="document-search" name="q" class="br6 p-1em">
<div class="icon-cont pabsolute dflex aic jcc">
<img class="loupe" src="/resources/img/search-icon.svg" alt="Icone de recherche loupe" style="pointer-events: none;" width="16" height="16" loading="lazy">
</div>
</div>
</div>
<div class="{% if block.filter == "groupe_travail" %} mla {% endif %} toggleable visible aic" >
{% set elems = 9 %}
<label for="elems-number">
Éléments par page :
</label>
{% if block.filter == "articles" %}
{% set elems = 9 %}
{% elseif block.filter == "agenda" %}
{% set elems = 8 %}
{% elseif block.filter == "aapami" %}
{% set elems = 12 %}
{% elseif block.filter == "offre" or block.filter == "groupe_travail" %}
{% set elems = 10 %}
{% elseif block.filter == "newsletters" or block.filter == "analyses" or block.filter == "experiences" or block.filter == "guides_outils" or block.filter == "fiches_territoires" %}
{% set elems = 6 %}
{% endif %}
{% include "blocks/sub-blocks/elems-number.html.twig" with {number: elems} %}
</div>
<div class="switch-map-cont">
<button class="switch-map-btn">Carte</button>
</div>
</div>
{% set structure = '' %}
{% if block.filter %}
{% if block.filter == "annuaire" %}
{% include "filter/annuaire_filter.html.twig" %}
{% set structure = 'annuaire' %}
{% elseif block.filter == "experiences" %}
{% include "filter/experiences_filter.html.twig" %}
{% set structure = 'experiences' %}
{% elseif block.filter == "fiches_territoires" %}
{% set structure = 'fiches_territoires' %}
{% elseif block.filter == "articles" %}
{% include "filter/articles_filter.html.twig" %}
{% set structure = 'articles' %}
{% elseif block.filter == "guides_outils" %}
{% include "filter/articles_filter.html.twig" %}
{% set structure = 'guides_outils' %}
{% elseif block.filter == "agenda" %}
{% include "filter/agenda_filter.html.twig" %}
{% set structure = 'agenda' %}
{% elseif block.filter == "offre" %}
{% include "filter/offre_filter.html.twig" %}
{% set structure = 'offres' %}
{% elseif block.filter == "aapami" %}
{% include "filter/aapami_filter.html.twig" %}
{% set structure = 'aapami' %}
{% elseif block.filter == "analyses" %}
{% include "filter/articles_filter.html.twig" %}
{% set structure = 'analyses' %}
{% elseif block.filter == "newsletters" %}
{% include "filter/newsletter_filter.html.twig" %}
{% set structure = 'newsletters' %}
{% elseif block.filter == "groupe_travail" %}
{% set structure = 'groupe-travail' %}
{% endif %}
{% endif %}
{% if app.request.get('q') is not empty %}
{% set q = app.request.get('q') %}
{% else %}
{% set q = '' %}
{% endif %}
{% if app.request.get('elems') is not empty %}
{% set elems = app.request.get('elems') %}
{% endif %}
{% if app.request.get('theme') is not empty %}
{% set t = app.request.get('theme') %}
{% else %}
{% set t = '' %}
{% endif %}
{% if app.request.get('start') is not empty %}
{% set start = app.request.get('start') %}
{% else %}
{% set start = '' %}
{% endif %}
{% if app.request.get('end') is not empty %}
{% set end = app.request.get('end') %}
{% else %}
{% set end = '' %}
{% endif %}
{% if app.request.get('page') is not empty %}
{% set page = app.request.get('page') %}
{% else %}
{% set page = 1 %}
{% endif %}
{% if app.request.get('format') is not empty %}
{% set f = app.request.get('format') %}
{% else %}
{% set f = '' %}
{% endif %}
{% if app.request.get('type_territoire') is not empty %}
{% set typeTerritoire = app.request.get('type_territoire') %}
{% else %}
{% if block.filter == "fiches_territoires" %}
{% set typeTerritoire = 'contractualisation' %}
{% else %}
{% set typeTerritoire = '' %}
{% endif %}
{% endif %}
{% if block.filter == "fiches_territoires" or block.filter == "experiences" %}
<div class="dflex territoire-container">
{% endif %}
<div class="w100 h100 prelative articles-cont">
<div id="articles-container" class="dflex fdc" data-type="{{ structure }}">
{{ render(controller(
'App\\Controller\\Website\\ApiSearchController::queryAction',
{ "q": q, "elems": elems, "page": page, "start": start, "end" : end, "theme": t, 'structure': structure, 'format': f, "type_territoire": typeTerritoire }
)) }}
</div>
<div class="w100 h100 pabsolute with-loader">
<div class="lds-dual-ring pabsolute form-loader" id="loader"></div>
</div>
</div>
{% endif %}
{% if block.filter == "fiches_territoires" or block.filter == "experiences" %}
<div id="map-div">
{% set territory_list_set = true %}
{% set full_size_map_exists = true %}
{% if block.filter == "experiences" %}
{% set territory_list_set = false %}
{% endif %}
{% include "blocks/map.html.twig" with {'territory_list_set': territory_list_set} %}
</div>
{% endif %}
{% if block.filter == "fiches_territoires" or block.filter == "experiences" %}
</div>
{% endif %}
</div>