{% set label_raw = label_raw ?? false %}
{% set show_description = show_description ?? false %}
{% set price_prefix = price_prefix ?? 'FCFA' %}
{% set price_separator = price_separator is defined ? price_separator : ' ' %}
{% set price_format = price_format ?? true %}
{% set product_images = Produit.images|default([]) %}
{% set main_image = product_images|first %}
{% set main_image_url = main_image ? main_image.url : ('uploads/brochures/' ~ Produit.getIMAGE()) %}
{% set main_image_src = main_image_url matches '/^https?:\\/\\//i' ? main_image_url : asset(main_image_url) %}
{% set gallery_id = 'productGallery' ~ Produit.getid() %}
{% set carousel_id = gallery_id ~ 'Carousel' %}
<div class="featured__item product-card">
<div class="product-card__media">
<button type="button" class="product-card__image-button" data-toggle="modal" data-target="#{{ gallery_id }}" aria-label="Voir les images de {{ Produit.getLIBELLE()|striptags }}">
<img class="product-card__img" src="{{ main_image_src }}" alt="{{ Produit.getLIBELLE()|striptags }}">
{% if product_images|length > 1 %}
<span class="product-card__image-count">{{ product_images|length > 4 ? 4 : product_images|length }} images</span>
{% endif %}
</button>
<div class="product-card__overlay">
<a class="product-card__icon" href="{{ path('trcoeur_add', {'id': Produit.getid()}) }}" aria-label="Ajouter aux favoris">
<i class="fa fa-heart"></i>
</a>
<a class="product-card__icon" href="{{ path('TrPanier_Addition', {'id': Produit.getid()}) }}" aria-label="Ajouter au panier">
<i class="fa fa-shopping-cart"></i>
</a>
</div>
</div>
<div class="featured__item__text product-card__content">
<h6 class="product-card__title">
<a href="#">
{% if label_raw %}
{{ Produit.getLIBELLE()|raw }}
{% else %}
{{ Produit.getLIBELLE()|e }}
{% endif %}
</a>
</h6>
{% if show_description %}
<p class="product-card__subtitle">{{ Produit.getDescription()|raw }}</p>
{% endif %}
<div class="product-card__price{% if Produit.hasPromotion() %} product-card__price--promo{% endif %}">
{% if Produit.hasPromotion() %}
<div class="product-card__promo-top">
<span class="product-card__badge">Promo</span>
{% if Produit.pourcentageReduction is not null %}
<span class="product-card__discount">-{{ Produit.pourcentageReduction }}%</span>
{% endif %}
</div>
<span class="product-card__price-current">
{{ price_prefix }}{{ price_separator }}{% if price_format %}{{ Produit.getPrixActuel()|number_format(0, ',', ' ') }}{% else %}{{ Produit.getPrixActuel() }}{% endif %}
</span>
<span class="product-card__price-old">
{{ price_prefix }}{{ price_separator }}{% if price_format %}{{ Produit.getPRIX()|number_format(0, ',', ' ') }}{% else %}{{ Produit.getPRIX() }}{% endif %}
</span>
{% else %}
<span class="product-card__price-current">
{{ price_prefix }}{{ price_separator }}{% if price_format %}{{ Produit.getPrixActuel()|number_format(0, ',', ' ') }}{% else %}{{ Produit.getPrixActuel() }}{% endif %}
</span>
{% endif %}
</div>
</div>
</div>
<div class="modal fade product-gallery-modal" id="{{ gallery_id }}" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">{{ Produit.getLIBELLE()|striptags }}</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Fermer">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div id="{{ carousel_id }}" class="carousel slide product-gallery" data-ride="false" data-interval="false">
<div class="carousel-inner">
{% for image in product_images|slice(0, 4) %}
{% set image_url = image.url %}
{% set image_src = image_url matches '/^https?:\\/\\//i' ? image_url : asset(image_url) %}
<div class="carousel-item {% if loop.first %}active{% endif %}">
<img src="{{ image_src }}" class="product-gallery__image" alt="{{ Produit.getLIBELLE()|striptags }} image {{ loop.index }}">
<div class="product-gallery__counter">{{ loop.index }}/{{ product_images|length > 4 ? 4 : product_images|length }}</div>
</div>
{% endfor %}
</div>
{% if product_images|length > 1 %}
<a class="carousel-control-prev" href="#{{ carousel_id }}" role="button" data-slide="prev" aria-label="Image precedente">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
</a>
<a class="carousel-control-next" href="#{{ carousel_id }}" role="button" data-slide="next" aria-label="Image suivante">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
</a>
{% endif %}
</div>
<div class="product-gallery__details">
{% if show_description and Produit.getDescription() %}
<p>{{ Produit.getDescription()|raw }}</p>
{% endif %}
<div class="product-gallery__price">
{% if Produit.hasPromotion() %}
<span>{{ price_prefix }}{{ price_separator }}{% if price_format %}{{ Produit.getPrixActuel()|number_format(0, ',', ' ') }}{% else %}{{ Produit.getPrixActuel() }}{% endif %}</span>
<del>{{ price_prefix }}{{ price_separator }}{% if price_format %}{{ Produit.getPRIX()|number_format(0, ',', ' ') }}{% else %}{{ Produit.getPRIX() }}{% endif %}</del>
{% else %}
<span>{{ price_prefix }}{{ price_separator }}{% if price_format %}{{ Produit.getPrixActuel()|number_format(0, ',', ' ') }}{% else %}{{ Produit.getPrixActuel() }}{% endif %}</span>
{% endif %}
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-light" data-dismiss="modal">Fermer</button>
<a class="btn btn-success" href="{{ path('TrPanier_Addition', {'id': Produit.getid()}) }}">Ajouter au panier</a>
</div>
</div>
</div>
</div>