{% extends 'base.html.twig' %}
{% block title %}Boutique{% endblock %}
{% block description %}{% endblock %}
{% block nbProduit %}{% if panier %}<p class="nb-produit">{{panier.nbProduit}}</p>{% endif %}{% endblock %}
{% block nbProduit2 %}{% if panier %}<p class="nb-produit nb-produit-second">{{panier.nbProduit}}</p>{% endif %}{% endblock %}
{% block nbProduit3 %}{% if panier %}<p class="nb-produit nb-produit-third">{{panier.nbProduit}}</p>{% endif %}{% endblock %}
{% block nbProduit4 %}{% if panier %}<p class="nb-produit nb-produit-fourth">{{panier.nbProduit}}</p>{% endif %}{% endblock %}
{% block body %}
<div id="{{ page.id }}" class="bandeau-page">
<h1>{{ page.titre }}</h1>
</div>
<div class="presentation">
<div class="container">
<div class="row top-page top-page-boutique">
{% if drive is defined and drive is not null and drive.active == false %}
<div class="text-center">
<p class="m-3">{{drive.content}}</p>
</div>
{% elseif connected is empty %}
<div class="text-center border rounded">
<p class="m-3">Connectez-vous pour enregistrer votre panier</p>
<div class="d-flex justify-content-center flex-column flex-md-row">
<a href="/login" class="btn btn-primary m-3 button-responsive">Se connecter</a>
<a href="/register" class="btn btn-primary m-3 button-responsive">S'inscrire</a>
</div>
</div>
</div>
{% endif %}
<section class="content-page d-flex boutique mt-0 align-items-md-start">
<div class="filter">
{% include 'pages/_filter.html.twig' with {form: form, fromageDisplay: fromageDisplay, cremerieDisplay: cremerieDisplay,
cidreDisplay: cidreDisplay, plateauDisplay: plateauDisplay, nbPersonnesDisplay: nbPersonnesDisplay} only %}
</div>
<div class="d-flex flex-wrap justify-content-center w-100">
{% if produits %}
{% for produit in produits %}
{% include 'pages/card_product.html.twig' with {product: produit, drive: drive, connected: connected} only %}
{% endfor %}
{% else %}
<p>Pas de résultat trouvé, veuillez modifier votre recherche.</p>
{% endif %}
</div>
</section>
{% if nbPages > 1 %}
{% set nearbyPagesLimit = 4 %}
{% set categories = [] %}
{% for categorie in app.request.get('categories') %}
{% set categories = categories | merge([categorie]) %}
{% endfor %}
{% set origines = [] %}
{% for origine in app.request.get('origines') %}
{% set origines = origines | merge([origine]) %}
{% endfor %}
{% set types = [] %}
{% for type in app.request.get('types') %}
{% set types = types | merge([type]) %}
{% endfor %}
{% set laits = [] %}
{% for lait in app.request.get('laits') %}
{% set laits = laits | merge([lait]) %}
{% endfor %}
{% set laitsTraitement = [] %}
{% for laitTraitement in app.request.get('laitsTraitement') %}
{% set laitsTraitement = laitsTraitement | merge([laitTraitement]) %}
{% endfor %}
<div class="d-flex justify-content-center">
<ul class="pagination">
{% set currentPage = currentPage + 1 %}
{% if currentPage != 1 %}
<li class="m-3">
<a class="btn btn-primary w-100" href="{{ path('boutique', { 'page': 1, categories, origines, types, laits, laitsTraitement} ) }}">Première page</a>
</li>
{% endif %}
{% for i in 1..nbPages %}
{% if 0 == (currentPage - nearbyPagesLimit) - loop.index %}
<li class="m-3 disabled"><button class="input-active btn btn-primary w-100">...</button></li>
{% elseif 0 == (currentPage + nearbyPagesLimit) - loop.index %}
<li class="m-3 disabled"><button class="input-active btn btn-primary w-100">...</button></li>
{% elseif 0 < (currentPage - nearbyPagesLimit) - loop.index %}
{% elseif 0 > (currentPage + nearbyPagesLimit) - loop.index %}
{% else %}
<li {% if currentPage == loop.index %} class="m-3 active"{% else %} class="m-3"{% endif %}>
<a class="input-active btn btn-primary w-100" href="{{ path('boutique', { 'page': loop.index, categories, origines, types, laits, laitsTraitement}) }}">{{ loop.index }}</a>
</li>
{% endif %}
{% endfor %}
{% if currentPage != nbPages %}
<li class="m-3">
<a class="btn btn-primary w-100" href="{{ path('boutique', { 'page': nbPages, categories, origines, types, laits, laitsTraitement}) }}">Dernière page</a>
</li>
{% endif %}
</ul>
</div>
{% endif %}
</div>
</div>
<div id="top-shop" class="top-shop d-none">
<i class="fas fa-arrow-up"></i>
</div>
{% endblock %}