{% import "@SyliusShop/Common/Macro/money.html.twig" as money %}
{% set variant = product|sylius_resolve_variant %}
{% if variant is not null %}
{% set channelpricing = variant.getChannelPricingForChannel(sylius.channel) %}
{% set percentage = channelpricing.getDiscountedPercentage %}
{% endif %}
<div class="articleBit" {{ sylius_test_html_attribute('product') }}>
<div class="bg-art-w">
<div class="articleBit-ima">
<a href="{{ path('sylius_shop_product_show', {'slug': product.slug, '_locale': product.translation.locale}) }}">
{% include '@SyliusShop/Product/_mainImage.html.twig' with {'product': product, 'class': 'card-img-top'} %}
</a>
{% if product.callouts is not null %}
{% include "@SetonoSyliusCalloutPlugin/Shop/Product/Callout/_callouts.html.twig" with {'callouts' : product.callouts|setono_callouts} %}
{% endif %}
{% if variant is not null %}
{% if channelpricing.discountedPrice and channelpricing.price > channelpricing.discountedPrice %}
<div class="picto-promo">
<strong>
<span data-js-product-percentage >
-{{ percentage|round(0) }}%
</span>
</strong>
</div>
{% endif %}
{% endif %}
</div>
<div class="max-art">
<h3 class="articleBit-lib" {{ sylius_test_html_attribute('product-name', product.name) }}><div class="table-lib"><a href="{{ path('sylius_shop_product_show', {'slug': product.slug, '_locale': product.translation.locale}) }}">{{ product.name }}</a></div></h3>
{% if not product.variants.empty() %}
<div class="articleBit-prix">
<span class="prix-old" data-js-product-discounted-price {{ sylius_test_html_attribute('product-price', money.calculatePrice(product|sylius_resolve_variant)) }}>
{% if channelpricing.discountedPrice and channelpricing.price > channelpricing.discountedPrice %}
{{ money.convertAndFormat(channelpricing.price)}}
{% endif %}
</span>
<strong class="prix-promo" {{ sylius_test_html_attribute('product-price') }}> {{ money.calculatePrice(variant) }} </strong>
</div>
{% endif %}
</div>
<div class="articlebit-detail">
{% if product.variants.empty() or product.simple and not sylius_inventory_is_available(product.variants.first) %}
{% include '@SyliusShop/Product/Show/_outOfStock.html.twig' %}
{% else %}
{{ render(url('sylius_shop_partial_cart_add_item', {'template': '@SyliusShop/Product/Show/_addToCart.html.twig', 'productId': product.id})) }}
{% endif %}
</div>
</div>
</div>