{% import "@SyliusShop/Common/Macro/money.html.twig" as money %}
{% if product %}
{% set variant = product|sylius_resolve_variant %}
{% set path_route = app.request.attributes.get('_route') %}
{% if variant is not null %}
{% set channelpricing = variant.getChannelPricingForChannel(sylius.channel) %}
{% set percentage = channelpricing.getDiscountedPercentage %}
{% endif %}
<div class="articleBit h-100" {{ sylius_test_html_attribute('product') }}>
<div class="bg-art-w h-100 d-flex flex-column">
<div class="articleBit-ima">
<a href="{{ path('sylius_shop_product_show', {'slug': product.slug, '_locale': product.translation.locale}) }}" title="{{ product.name }}">
{% include '@SyliusShop/Product/_mainImage.html.twig' with {'product': product, 'class': 'card-img-top'} %}
</a>
{% if product.callouts is not null and product.callouts|length > 0 %}
{% include "@SetonoSyliusCalloutPlugin/Shop/Product/Callout/_callouts.html.twig" with {'callouts' : product.callouts|setono_callouts} %}
{% endif %}
{% if variant is not null %}
{% if channelpricing.originalPrice > channelpricing.price %}
<div class="picto-promo">
<strong>
<span data-js-product-percentage >
-{{ percentage|round(0) }}%
</span>
</strong>
</div>
{% endif %}
{% endif %}
{% include '@Brille24SyliusTierPricePlugin/Shop/Product/Show/_tier_price_promoBis.html.twig' %}
<a href="{{ path('sylius_shop_product_show', {'slug': product.slug, '_locale': product.translation.locale}) }}" class="btn-link-hover hover-opacity-0"><div class="d-flex align-items-center justify-content-center h-100"><span class="btn-link transition-bgcolor minw-sm">{{'app.homepage.discover'|trans}}</span></div></a>
</div>
<div class="flex-grow-l position-relative h-100 d-flex flex-column">
<div class="max-art flex-grow-l">
<h3 class="articleBit-lib" {{ sylius_test_html_attribute('product-name', product.name) }}><a href="{{ path('sylius_shop_product_show', {'slug': product.slug, '_locale': product.translation.locale}) }}">{{ product.name }}</a></h3>
</div>
<div class="row no-gutters justify-content-between pb-md-3 py-2 align-items-end mt-md-1">
<div class="articleBit-price col">
{% set context = {"channel": sylius.channel} %}
{% if not product.variants.empty() %}
{% if product|sylius_resolve_variant %}
<strong class="price-promo" {{ sylius_test_html_attribute('product-price') }}> {{ money.calculatePriceWithTax(product|sylius_resolve_variant, context) }} </strong>
<span class="price-old" data-js-product-original-price {{ sylius_test_html_attribute('product-price', money.calculatePrice(product|sylius_resolve_variant)) }}>
{% set variant = product|sylius_resolve_variant %}
{% set channelpricing = variant.getChannelPricingForChannel(sylius.channel) %}
{% if channelpricing.originalPrice > channelpricing.price %}
{{ money.calculateOriginalPriceWithTax(product|sylius_resolve_variant, context) }}
{% endif %}
</span>
{% endif %}
{% endif %}
</div>
<div class="articleBit-state col-auto">
{% if not sylius_inventory_is_available(product.variants.first) and app_count_available_variants(product) < 1 %}
<div class="color-red hover-opacity-0"><i class="icon-cancel"></i> {{'app.product.not_available'|trans}}</div>
{% else %}
<div class="ok-state hover-opacity-0">{{'app.product.available'|trans}}</div>
{% endif %}
</div>
</div>
{% for option in product.options if option.code == "couleur" %}
<div class="articleBit-caract-color hover-opacity-0">
<div class="row no-gutters align-items-center ">
{% for value in option.values %}
{% if value.filePath %}
<div class="mb-1 mr-1"><a href="#" class="color-caract-bg"><img src="{{asset(value.filePath)}}"></a></div>
{% endif %}
{% endfor %}
</div>
</div>
{% endfor %}
</div>
</div>
</div>
{% endif %}