{% extends 'base_front.html.twig' %}
{% block meta %}
<title>Les produits disponibles pour votre mariage</title>
<meta name="description" content="Les produits disponibles. Actuellement, {{ countProducts }} produits disponibles.">
{% endblock %}
{% block body %}
<div class="page-header" style="
{% if categoryBackground is defined and categoryBackground is not null and categoryBackground.image is not null %}
background: url({{ asset(constant('App\\Services\\File::IMAGE_CATEGORY_DIR') ~ categoryBackground.image) }})
{% else %}
background: url({{ asset('images/vacance_article.jpg') }})
{% endif %}
no-repeat center;background-size: cover">
<div class="container">
<div class="row">
<!-- page caption -->
<div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12 ">
<div class="page-caption">
<h1 class="page-title">Articles</h1>
</div>
</div>
<!-- /.page caption -->
</div>
</div>
<!-- page caption -->
<div class="page-breadcrumb">
<div class="container">
<div class="row">
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="{{ path('front_home') }}" class="breadcrumb-link">Accueil</a></li>
<li class="breadcrumb-item active text-white" aria-current="page">Recherche {% if app.session.get('categoryName') %}{{ app.session.get('categoryName') }}{% endif %} {% if app.session.get('departmentName') %}- {{ app.session.get('departmentName') }}{% endif %} {% if app.session.get('weddingdate') %}- {{ app.session.get('weddingdate') }}{% endif %}</li>
</ol>
</nav>
</div>
</div>
</div>
<!-- page breadcrumb -->
</div>
<!-- /.page-header -->
<!-- vendor-section -->
<div class="content">
<div class="container">
<div class="row">
<div class="col-xl-8 col-lg-8 col-md-7 col-sm-12 col-12">
<div class="row">
{% for product in products %}
<div class="col-lg-6 col-sm-12 col-12">
<div class="container-block-Pcompanies mb-3">
<div class="container-imageP zoomimg">
{% if product.photos is not empty %}
<img src="{{ asset(constant('App\\Services\\File::IMAGE_PRODUCT_DIR') ~ product.photos.first.url) }}" alt="default image" class="img-fluid" style="height: 213px;object-fit: cover; border-radius: .5rem .5rem 0 0;">
{% else %}
<img src="{{ asset('images/vecteezy_vector-gear-logo-design-with-multi-colors-range_6172776.jpg') }}" alt="default image" class="img-fluid" style="height: 213px;object-fit: cover; border-radius: .5rem .5rem 0 0;">
{% endif %}
</div>
<div class="container-info-presta" style="padding-bottom: 80px;">
<h2 class="vendor-title">
<a href="{{ path('front_product_single', {'slug': product.subCategories[0].categories[0].slug, 'subCategorySlug': product.subCategories[0].subCategorySlug, 'product_id': product.id, 'productSlug': product.productSlug}) }}" class="title">{{ product.name }}</a>
</h2>
<p class="vendor-address">
{% for department in product.departments %}
{{ department.name }}
{% if not loop.last %},
{% endif %}
{% else %}
Toute la France
{% endfor %}
</p>
<p>
<i class="fas fa-money-bill-wave"></i>
Prix
<strong>{{ product.price|number_format(2, '.') }}</strong>
€</p>
<p>
<i class="fa fa-star rated"></i>
{% set notes = 0 %}
{% for avi in product.avis %}
{% set notes = notes + avi.globalNote %}
{% endfor %}
{% set noteTotal = (notes > 0) ? notes / product.avis|length : 0 %}
{{ product.avis|length }} Avis</p>
<p>{{ product.quantity }}
Quantité restante</p>
</div>
<div class="wishlist-sign">
<a href="#" class="btn-wishlist">
<i class="fa fa-heart"></i>
</a>
</div>
<a href="{{ path('front_product_single', {'slug': product.subCategories[0].categories[0].slug, 'subCategorySlug': product.subCategories[0].subCategorySlug, 'product_id': product.id, 'productSlug': product.productSlug}) }}" class="title">
<button class="btnVoirP btn">Voir le produit</button>
</a>
</div>
</div>
{% else %}
<div class="vendor-thumbnail list-view p-4">Aucun service correspondant</div>
{% endfor %}
</div>
{# {% for product in products %}
<div class="vendor-thumbnail list-view">
<!-- Vendor thumbnail -->
<div class="row">
<div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 border-right pr-0 zoom-img">
<div class="vendor-img" style="background:url({% if product.photos is not empty %}{{ asset(constant('App\\Services\\File::IMAGE_PRODUCT_DIR') ~ product.photos.first.url) }}{% else %}{{ asset('images/illustration-default.jpg') }}{% endif %})no-repeat center;background-size:cover;height:100%">
<!-- Vendor img -->
<a href="{{ path('front_product_single', {'slug': product.subCategories[0].categories[0].slug, 'subCategorySlug': product.subCategories[0].subCategorySlug, 'product_id': product.id, 'productSlug': product.productSlug}) }}">
<div style="height:100%;width:100%">
</div>
</a>
<div class="wishlist-sign">
{% if app.user and app.user.roles == ['ROLE_USER'] %}
{% set isWish = filter_service.getIfIsWish(app.user, product) %}
{% if isWish %}
<a href="#" class="btn-wishlist" style="background-color:#ff4d4d;"><i class="fa fa-heart" style="color:#fff"></i></a>
{% else %}
<a href="#" class="btn-wishlist"><i class="fa fa-heart"></i></a>
{% endif %}
{% endif %}
</div>
</div>
</div>
<!-- /.Vendor img -->
<div class="col-xl-8 col-lg-8 col-md-12 col-sm-12 col-12 pl-0">
<div class="vendor-content">
<!-- Vendor Content -->
<h2 class="vendor-title"><a href="{{ path('front_product_single', {'slug': product.subCategories[0].categories[0].slug, 'subCategorySlug': product.subCategories[0].subCategorySlug, 'product_id': product.id, 'productSlug': product.productSlug}) }}" class="title">{{ product.name }}</a></h2>
<p class="vendor-address">
{% for department in product.departments %}
{{ department.name }}{% if not loop.last %},{% endif %}
{% else %}
Toute la France
{% endfor %}
</p>
<!-- /.Vendor meta -->
</div>
<div class="vendor-meta m-0">
<div class="vendor-meta-item vendor-meta-item-bordered">
<span class="vendor-price">
{{ product.price|number_format(2, '.') }}€
</span>
<span class="vendor-text">Prix</span></div>
<div class="vendor-meta-item vendor-meta-item-bordered">
<span class="vendor-guest">
{{ product.quantity }}
</span>
<span class="vendor-text">Quantité restante</span>
</div>
{% set notes = 0 %}
{% for avi in product.avis %}
{% set notes = notes + avi.globalNote %}
{% endfor %}
{% set noteTotal = (notes > 0) ? notes / product.avis|length : 0 %}
<div class="vendor-meta-item vendor-meta-item-bordered">
<span class="rating-star">
{% for i in 1..5 %}
{% if i < noteTotal %}
<i class="fa fa-star rated"></i>
{% else %}
<i class="fa fa-star rate-mute"></i>
{% endif %}
{% endfor %}
</span>
<span class="rating-count vendor-text">({{ product.avis|length }})</span></div>
</div>
<!-- /.Vendor Content -->
</div>
</div>
</div>
{% else %}
<div class="vendor-thumbnail list-view p-4">Aucun article correspondant</div>
{% endfor %} #}
<div class="pagination">
<nav aria-label="Page navigation example">
{{ knp_pagination_render(products) }}
</nav>
</div>
<!-- /.paginations -->
</div>
<!-- sidebar-section -->
{{ include('front/inc/filter_sidebar.html.twig') }}
<!-- /.sidebar-section -->
</div>
</div>
</div>
{% endblock %}
{% block javascript %}
<script src="{{ asset('js/getCommune.js') }}"></script>
{% endblock %}