{% extends 'base.html.twig' %}
{% block body %}
<!-- ░░░ Navigation ░░░ -->
{{include('section/nav.html.twig')}}
<section class="cat-hero position-relative">
<img src="{{ asset('img/bg/bg-category.png') }}" class="img-fluid w-100" alt="{#{ category.name }#} banner">
<div class="cat-hero-caption position-absolute start-0 bottom-0 p-4">
<h1 class="h4 text-white fw-bold mb-1">{#{ category.name }#}</h1>
<p class="small text-white mb-0">Découvrez notre sélection 2025</p>
</div>
</section>
{# ░░░ MAIN CONTENT ░░░ #}
<section class="py-5">
<div class="container">
<div class="row g-5">
{# ——— LEFT SIDEBAR ——— #}
<aside class="col-md-3">
<!-- sous-categories -->
<h6 class="fw-bold text-uppercase small mb-3">{{ parentCategory.name|default('Équipements et accessoires') }}</h6>
<ul class="list-unstyled small mb-5">
{% for sub in subcategories %}
<li class="mb-1">
<a href="{#{ path('app_category_show', { slug: sub.slug }) }}" class="text-decoration-none {{ sub.id==category.id ? 'fw-bold text-acti-blue' }#}">
{{ sub.name }}
</a>
</li>
{% endfor %}
</ul>
<!-- marques -->
<h6 class="fw-bold text-uppercase small mb-3">Les marques</h6>
<form method="get" class="brand-filter">
{#{% for brand in brands %}
<div class="form-check mb-1">
<input class="form-check-input" type="checkbox" name="brand[]" value="{{ brand.slug }}" id="b{{ loop.index }}" {{ brand.selected ? 'checked' }}>
<label class="form-check-label small" for="b{{ loop.index }}">{{ brand.name }}</label>
</div>
{% endfor %} #}
<button type="submit" class="btn btn-outline-secondary btn-sm mt-2">Filtrer</button>
</form>
</aside>
{# ——— RIGHT CONTENT ——— #}
<div class="col-md-9">
<div class="d-flex justify-content-end mb-3">
<form method="get" class="ms-auto d-flex align-items-center gap-2">
<label class="small mb-0" for="sort">Trier</label>
<select name="sort" id="sort" class="form-select form-select-sm" style="max-width:160px;">
{# <option value="popularity" {% if sort=='popularity' %}selected{% endif %}>Popularité</option>
<option value="price_asc" {% if sort=='price_asc' %}selected{% endif %}>Prix croissant</option>
<option value="price_desc" {% if sort=='price_desc' %}selected{% endif %}>Prix décroissant</option>
<option value="new" {% if sort=='new' %}selected{% endif %}>Nouveautés</option> #}
</select>
</form>
</div>
<!-- grille produits -->
<div class="row row-cols-2 row-cols-md-3 g-4">
{% for product in products %}
<div class="col">
<div class="card h-100 product-card border-0">
<a href="{{ path('produit', { slug: product.slug }) }}" class="ratio ratio-1x1">
<img src="{{ asset(product.image) }}" class="img-fluid object-fit-cover" alt="{{ product.name }}">
</a>
<div class="card-body px-0">
<h6 class="card-title small mb-1 fw-bold text-dark">{{ product.name }}</h6>
<p class="card-text small text-muted mb-1">{{ product.shortDescription }}</p>
<p class="fw-bold mb-0">{{ product.price|number_format(2, ',', ' ') }} €</p>
</div>
</div>
</div>
{% endfor %}
</div>
{# pagination #}
{% if pagination is defined %}
<div class="mt-4">
{#{ knp_pagination_render(pagination) }#}
</div>
{% endif %}
</div>
</div>
</div>
</section>
<!-- ░░░ MARQUES ░░░ -->
{{include('section/marque.html.twig')}}
<!-- ░░░ FOOTER ░░░ -->
{{include('section/footer.html.twig')}}
{% endblock %}