{% import "macros/article.html.twig" as articleMacro %}
<div class="products mb-3">
{% for item in articles %}
<div class="product product-list">
<div class="row">
<div class="col-6 col-lg-3">
<figure class="product-media">
{% if item.quantity <= 0 %} <span class="product-label label-out bg-danger">
{{'Out of Stock'|trans}}</span>
{% endif %}
{% import "macros/etats.html.twig" as etats %}
{{ etats.articleLabel(item.label) }}
{% if item.reduction > 0 %}
<span class="product-label mt-3 label-out bg-danger">-{{ item.reduction}}%</span>
{% endif %}
<a {{ articleMacro.href_show(item)}}>
{% set article_img = (item.images[0] is defined)? item.images[0]:'' %}
{% if article_img is not empty %}
<img src="{{ asset('img/article/' ~ article_img.name) }}" alt="..."
class="product-image">
{% else %}
<img src="{{ asset('img/vide.png') }}" alt="..." class="product-image">
{% endif %}
</a>
</figure><!-- End .product-media -->
</div><!-- End .col-sm-6 col-lg-3 -->
<div class="col-6 col-lg-3 order-lg-last">
<div class="product-list-action">
<div class="product-price">
{% if item.reduction > 0 %}
{{ item.newPrice|price_format ~ ' ' ~ site.current_name}}
<span class="old-price ml-1">
{{ item.price|price_format ~ ' ' ~ site.current_name}}
</span>
{% else %}
{{ item.newPrice|price_format ~ ' ' ~ site.current_name}}
{% endif %}
</div><!-- End .product-price -->
<div class="ratings-container">
<div class="ratings">
<div class="ratings-val" {{ ratingStyle(item) }}></div>
<!-- End .ratings-val -->
</div><!-- End .ratings -->
<span class="ratings-text">
({{ item.comments|length}} <i class="fas fa-comment"></i>)
</span>
</div><!-- End .rating-container -->
{% if item.quantity > 0 %}
<a class="btn-product btn-cart js-btn-add-qty" href="#" data-path="{{path('cart_add_qty_ajax',{id:item.id})}}">
<span>{{'add to cart'|trans}}</span>
</a>
{% endif %}
</div><!-- End .product-list-action -->
</div><!-- End .col-sm-6 col-lg-3 -->
<div class="col-lg-6 article-{{item.id }}">
<div class="product-body product-action-inner">
{% if app.user %}
{% if not isToFavoris(app.user, item) %}
<a href="{{ path('favoris_add',{id:item.id}) }}" data-id="{{ item.id }}"
class="btn-product-icon btn-wishlist js-favoris js-add-favoris" title="{{'Add to wishlist'|trans}}">
<span>{{'add to wishlist'|trans}}</span>
</a>
{% else %}
<a href="{{ path('favoris_remove',{id:item.id}) }}" data-id="{{ item.id }}"
class="btn-product-icon btn-wishlist js-favoris bg-danger js-remove-favoris">
<span class="bg-danger text-white">{{'remove to wishlist'|trans}}</span>
</a>
{% endif %}
{% else %}
<a href="#" class="btn-product-icon btn-wishlist js-favoris-login">
<span>{{'add to wishlist'|trans}}</span>
</a>
{% endif %}
<div class="product-cat">
<a {{ articleMacro.href_category(item)}} >
{{ item.category.category2.title }} | {{ item.category.title }}
</a>
</div><!-- End .product-cat -->
<h3 class="product-title"><a {{articleMacro.href_show(item)}}>
{{item.title}}
</a></h3><!-- End .product-title -->
<div class="product-content">
<p>
{{item.detail}}
</p>
</div><!-- End .product-content -->
<div class="product-nav product-nav-thumbs">
{% for item in item.images|slice(1,4) %}
<a type="button" href="#" {{ loop.index==0 ? 'class="active"' :'' }}>
<img src="{{ asset('img/article/' ~ item.name ) }}" alt="">
</a>
{% endfor %}
</div>
</div><!-- End .product-body -->
</div><!-- End .col-lg-6 -->
</div><!-- End .row -->
</div><!-- End .product -->
{% else %}
{% include base ~ "/shop/_articles_empty.html.twig" %}
{% endfor %}
</div><!-- End .products -->
{% include base ~ "/shop/_pagination.html.twig" %}