{% extends base ~ "/base.html.twig" %}
{% import "macros/category.html.twig" as categoryMacro %}
{% block title %}Tous nos articles{% endblock %}
{% block javascripts %}
<script>
$(document).ready(function () {
$(document).on('change', '#sortby', function () {
let val = $(this).val();
window.location.href = "/change-sort/" + val;
});
})
</script>
{% endblock %}
{% block main %}
{% set route_name = app.request.get('_route') %}
<main class="main">
<nav aria-label="breadcrumb" class="breadcrumb-nav mb-0">
<div class="container d-flex align-items-center">
<ol class="breadcrumb">
<li class="breadcrumb-item">
<a href="/">Accueil</a>
</li>
{% if route_name == 'articles' %}
<li class="breadcrumb-item active" aria-current="page">{{'Store'|trans}}</li>
{% elseif route_name == 'articles_category' %}
{% set filtre1 = categories.filtre1(app.request.get('category')) %}
<li class="breadcrumb-item">
<a href="{{ path('articles') }}">{{'Store'|trans}}</a>
</li>
<li class="breadcrumb-item">
<a {{ categoryMacro.href_category(filtre1) }} >
{{ filtre1.title}}
</a>
</li>
{% endif %}
</ol>
<!-- End .pager-nav -->
</div>
<!-- End .container -->
</nav>
<div class="page-content pt-2">
<div class="container">
{% include "includes/_alerte.html.twig" %}
<div class="row">
<div class="col-lg-9">
<div class="toolbox">
<div class="toolbox-left">
<div class="toolbox-info">
{{'Showing'|trans}} <span>{{ articles|length}} {{'of'|trans}} {{ articles.totalItemCount }}</span>
{{'Products'|trans}}
</div><!-- End .toolbox-info -->
</div><!-- End .toolbox-left -->
<div class="toolbox-right">
<div class="toolbox-sort">
<label for="sortby">{{'Sort by'|trans}}:</label>
<div class="select-custom">
{% set sort_by = app.request.session.get('sort_by') %}
<select name="sortby" id="sortby" class="form-control">
<option {{ ((sort_by=='vide' ) or (sort_by is null) )? 'selected' :'' }} value="vide">
{# {{'No sort'|trans}} #}
Non trier
</option>
<option {{ (sort_by=='price:ASC' )? 'selected' :'' }} value='price:ASC'>
{{' Ascending price'|trans}}
{# Prix Croissant #}
</option>
<option {{ (sort_by=='price:DESC' )? 'selected' :'' }} value='price:DESC'>
{{'Price Descending'|trans}}
{# Prix Déscroissant #}
</option>
{# <option {{ (sort_by=='created_at:ASC' )? 'selected' :'' }}
value='created_at:ASC'>
{{'Date Ascending'|trans}}
</option>
<option {{ (sort_by=='created_at:DESC' )? 'selected' :'' }}
value='created_at:DESC'>
{{'Descending Date'|trans}}
</option> #}
</select>
</div>
</div><!-- End .toolbox-sort -->
{% set cols_article = app.request.session.get('cols') %}
<div class="toolbox-layout">
<a href="{{ path('cols',{cols:'list'}) }}"
class="btn-layout {{ ( cols_article == 'list' or cols_article is null) ? 'active':'' }}">
<svg width="16" height="10">
<rect x="0" y="0" width="4" height="4"></rect>
<rect x="6" y="0" width="10" height="4"></rect>
<rect x="0" y="6" width="4" height="4"></rect>
<rect x="6" y="6" width="10" height="4"></rect>
</svg>
</a>
{# <a href="{{ path('cols',{cols:'2cols'}) }}" class="btn-layout">
<svg width="10" height="10">
<rect x="0" y="0" width="4" height="4"></rect>
<rect x="6" y="0" width="4" height="4"></rect>
<rect x="0" y="6" width="4" height="4"></rect>
<rect x="6" y="6" width="4" height="4"></rect>
</svg>
</a> #}
{# <a href="{{ path('cols',{cols:'3cols'}) }}" class="btn-layout">
<svg width="16" height="10">
<rect x="0" y="0" width="4" height="4"></rect>
<rect x="6" y="0" width="4" height="4"></rect>
<rect x="12" y="0" width="4" height="4"></rect>
<rect x="0" y="6" width="4" height="4"></rect>
<rect x="6" y="6" width="4" height="4"></rect>
<rect x="12" y="6" width="4" height="4"></rect>
</svg>
</a> #}
<a href="{{ path('cols',{cols:'4cols'}) }}"
class="btn-layout {{ (cols_article == '4cols') ? 'active':'' }}">
<svg width="22" height="10">
<rect x="0" y="0" width="4" height="4"></rect>
<rect x="6" y="0" width="4" height="4"></rect>
<rect x="12" y="0" width="4" height="4"></rect>
<rect x="18" y="0" width="4" height="4"></rect>
<rect x="0" y="6" width="4" height="4"></rect>
<rect x="6" y="6" width="4" height="4"></rect>
<rect x="12" y="6" width="4" height="4"></rect>
<rect x="18" y="6" width="4" height="4"></rect>
</svg>
</a>
</div><!-- End .toolbox-layout -->
</div><!-- End .toolbox-right -->
</div><!-- End .toolbox -->
{% if cols_article == 'list' %}
{% include base ~"/shop/_articles_list.html.twig" %}
{% elseif cols_article == '4cols' %}
{% include base ~"/shop/_articles_4cols.html.twig" %}
{% else %}
{% include base ~"/shop/_articles_list.html.twig" %}
{% endif %}
</div><!-- End .col-lg-9 -->
<aside class="col-lg-3 order-lg-first">
<div class="widget widget-categories">
<h3 class="widget-title">{{ (route_name == 'articles_category')? app_name:'' }}</h3><!-- End .widget-title -->
<a href="{{ path('articles') }}" class="article-all{{ (route_name == 'articles')? '-active':'' }}">
{{'All'|trans}}
</a>
<div class="widget-body">
<div class="accordion" id="widget-cat-acc">
{% for category2 in categories.niveau2 %}
{% if category2.isActive %}
<div class="acc-item">
<h5>
<a role="button" data-toggle="collapse" href="#collapse-{{ category2.id }}" aria-expanded="false" aria-controls="collapse-{{ category2.id }}" class="collapsed">
{{ category2.title}}
</a>
</h5>
<div id="collapse-{{ category2.id }}" class="collapse {{ (app.request.get('category2_slug') == category2.slug ) ? 'show':'' }}" data-parent="#widget-cat-acc" style="">
<div class="collapse-wrap">
<ul>
{% for category in category2.categorys %}
{% if category.isActive %}
<li><a {{ categoryMacro.href_category(category)}} class=" categorie {{ (app.request.get('category') == category.slug ) ? 'active':'' }}">
{{ category.title }} ( {{ categoryCount(category2.title, category.title)}} )
</a></li>
{% endif %}
{% endfor %}
</ul>
</div><!-- End .collapse-wrap -->
</div><!-- End .collapse -->
</div><!-- End .acc-item -->
{% endif %}
{% endfor %}
</div><!-- End .accordion -->
<ul>
<li>
<a href="/boutique/reductions" class="cat-select {{ app.request.attributes.get('category3') == "reductions" ? 'active':'' }}">
Reductions
</a>
</li>
</ul>
</div><!-- End .widget-body -->
</div>
<div class="sidebar sidebar-shop">
<div class="widget widget-clean">
<label>Filters:</label>
<a href="{{ path('articles') }}" class="sidebar-filter-clear">Annuler les filtres</a>
{# <a href="#" class="">Clean All</a> #}
</div><!-- End .widget widget-clean -->
<div class="widget widget-collapsible">
<form method="get">
{% if app.request.get('mots') != '' %}
<input type="hidden" class="form-control" name="mots" value="{{app.request.get('mots')}}">
{% endif %}
<div class="form-row">
<div class="form-group col-md-12 col-12">
<input type="number" id="minPrice" value="{{ app.request.get('minPrice') }}"
width="100px" name="minPrice" placeholder="Prix Min" class="form-control">
</div>
<div class="form-group col-md-12 col-12">
<input type="number" id="maxPrice" value="{{ app.request.get('maxPrice') }}"
width="100px" name="maxPrice" placeholder="Prix Max" class="form-control">
</div>
{# <div class="form-group col-md-12 col-12">
<select class="custom-select select2" style="height:41px;font-size:14px"
name="brand" id="brand">
<option value="">Toutes les Marques</option>
{% for item in brands %}
<option {{ app.request.get('brand')==item.name ? 'selected' :'' }}
value="{{ item.name }}">{{ item.name }}</option>
{% endfor %}
</select>
</div> #}
{# <div class="form-group col-md-12 col-12">
<select class="custom-select" style="height:41px;font-size:14px" name="etat"
id="brand">
<option value="">Tous les états</option>
<option {{ app.request.get('etat')=='Neuf' ? 'selected' :'' }} value="Neuf">
Neuf</option>
<option {{ app.request.get('etat')=='Reconditionné' ? 'selected' :'' }}
value="Reconditionné">Reconditionné</option>
<option {{ app.request.get('etat')=='Occasion' ? 'selected' :'' }}
value="Occasion">Occasion</option>
</select>
</div> #}
<div class="form-group col-md-2 col-12">
<button type="submit" width="90px" class="btn btn-primary">Appliquer</button>
</div>
</div>
</form>
</div><!-- End .widget -->
</div><!-- End .sidebar sidebar-shop -->
</aside><!-- End .col-lg-3 -->
</div><!-- End .row -->
</div><!-- End .container -->
</div><!-- End .page-content -->
</main>
<!-- End .main -->
{% endblock %}