{% import "@SyliusShop/Common/Macro/money.html.twig" as money %}
{% for product in products %}
{% set variant = product|sylius_resolve_variant %}
{% if variant is not null %}
{% set channelpricing = variant.getChannelPricingForChannel(sylius.channel) %}
{% set percentage = channelpricing.getDiscountedPercentage %}
{% endif %}
<div class="kit-item text-grey">
<div class="h-100 row no-gutters bg-kit">
<div class="img-kit col-md-12 col-3">
{% if product.images.first %}
{% set path = product.images.first.path|imagine_filter(filter|default('app_shop_product_kitsolar')) %}
{% else %}
{% set path = asset('images/produit_kit.jpg') %}
{% endif %}
<img src="{{ path }}" alt="{{ product.name }} "/>
</div>
<div class="col-md-12 col-9 d-flex flex-column flex-grow-l">
<div class="flex-grow-l py-md-3 pt-3 pb-1 px-3">
<h4 class="lib-kit text-uppercase text-md-center text-left color-orange mb-0">{{ product.name }}</h4>
</div>
<div class="details-kit px-xl-4 px-3">
<ul class="list-unstyled">
{% for attr in product.attributes %}
{% if attr.attribute.code != "type_produit" %}
<li>{{ attr.value }} {{ attr.attribute.translation.name }}</li>
{% endif %}
{% endfor %}
</ul>
</div>
<div class="row no-gutters align-items-center pb-md-0 pb-3">
<div class="price-kit text-md-center text-left px-md-4 pl-3 pr-2 col-md-12 col-6">
<span class="d-none d-md-block">{{'sylius.ui.grand_total'|trans}}:</span>
{% if not product.variants.empty() %}
{% set variant = product|sylius_resolve_variant %}
{% set channelpricing = variant.getChannelPricingForChannel(sylius.channel) %}
<span class="price-old d-block" data-js-product-original-price {{ sylius_test_html_attribute('product-price', money.calculatePrice(product|sylius_resolve_variant)) }}>
{% if channelpricing.originalPrice > channelpricing.price %}
{{ money.convertAndFormat(variant|app_calculate_original_price_with_tax)}}
{% endif %}
</span>
<strong class="d-block" {{ sylius_test_html_attribute('product-price') }}>{{ money.convertAndFormat(app_get_price_ttc_from_variant(product|sylius_resolve_variant, product|sylius_resolve_variant|sylius_calculate_price({'channel': sylius.channel}), false)) }} <small>{{'app.common.tax_included'|trans}}</small></strong>
{% endif %}
</div>
<div class="btn-kit px-lg-4 px-md-3 pr-3 pl-1 py-lg-4 py-md-2 py-0 col-md-12 col-6">
<a href="{{ path('sylius_shop_product_show', {'slug': product.slug, '_locale': product.translation.locale}) }}" class="btn-link d-block other-radius-btn bg-gradient-hover " title="{{'app.homepage.discover'|trans}}"><span>{{'app.homepage.discover'|trans}}</span></a>
</div>
</div>
</div>
</div>
</div>
{% endfor %}