{% import "@SyliusShop/Common/Macro/money.html.twig" as money %}
{% set variant = product|sylius_resolve_variant %}
{% set productIsInWishlist = false %}
{% if wishlist is not defined or wishlist is null %}
{% set wishlist = app_get_wishlist() %}
{% endif %}
{% if wishlist is defined and wishlist %}
{% set productIsInWishlist = wishlist.hasProduct(product) %}
{% endif %}
{% if variant is not null %}
{% set channelpricing = variant.getChannelPricingForChannel(sylius.channel) %}
{% set percentage = channelpricing.getDiscountedPercentage %}
{% endif %}
{% set stockAvailable = false %}
{% for productVariant in product.variants %}
{% if sylius_inventory_is_available(productVariant) %}
{% set stockAvailable = true %}
{% endif %}
{% endfor %}
<article 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, 'spot': "box"} %}
{% endif %}
{% if variant is not null %}
{% if channelpricing.discountedPrice and channelpricing.discountedPrice != channelpricing.price and channelpricing|app_check_promotion_price %}
<div class="picto-promo"><span data-js-product-percentage>-{{ percentage|round(0) }}%</span></div>
{% endif %}
{% endif %}
{% if product is defined and product.brand %}
{% if product.brand.images|first != false %}
{% set path = product.brand.images|first.path|imagine_filter(filter|default('sylius_shop_product_original')) %}
<div class="brand-logo"><img src="{{ path }}" {{ sylius_test_html_attribute('main-image') }} class="" /></div>
{% endif %}
{% endif %}
<a href="{{ path('sylius_shop_product_show', {'slug': product.slug, '_locale': product.translation.locale}) }}" class="btn-details-hover" title=""><span>{{'sylius.ui.details'|trans}}</span></a>
{% if app.user %}
<div class="eti-fav categ-fav" data-id="{{product.id}}">
{#<a data-remove-url="{{ path('bitbag_sylius_wishlist_plugin_shop_wishlist_remove_product_variant', { wishlistId: wishlist.id, variantId: variant.id}) }}" title="{{ 'app.ui.add_to_wishlist'|trans }}" {% if productIsInWishlist %}class="addfav toggle-fav myfavoris"{% else %}class="addfav toggle-fav addfav-link"{% endif %} data-option="{{ product.id }}" data-url="{{ path('bitbag_sylius_wishlist_plugin_shop_wishlist_add_product', {'productId': product.id}) }}"></a>#}
<a data-remove-url="{{ path('bitbag_sylius_wishlist_plugin_shop_wishlist_remove_product', {'productId': product.id}) }}" title="{{ 'app.ui.add_to_wishlist'|trans }}" {% if productIsInWishlist %}class="addfav toggle-fav myfavoris"{% else %}class="addfav toggle-fav addfav-link"{% endif %} data-option="{{ product.id }}" data-url="{{ path('bitbag_sylius_wishlist_plugin_shop_wishlist_add_product', {'productId': product.id}) }}"></a>
<span class="c1-a"><img src="{{ asset('images/icon_dejafav.svg', 'bootstrapTheme') }}"></span>
<span class="c2-a"><img src="{{ asset('images/icon_dejafav.svg', 'bootstrapTheme') }}"></span>
</div>
{% endif %}
</div>
<div class="flex-grow-l position-relative_ d-flex flex-column ">
<div class="max-art flex-grow-l d-flex flex-column justify-content-between ">
<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 class="articleBit-desc pt-1">
Ref: {{ product.code }}
</div>
{% if sylius_inventory_is_available(variant) %}
{% set stock_product = variant.OnHand - variant.OnHold %}
<div class="color-primary-s pt-1 text-lowercase font-14">
{{stock_product}} {{'app.product.in_stock'|trans}}
</div>
{% else %}
{% if not app.user %}
<div class="text-danger pt-1 ">{{ 'app.product.out_of_stock' | trans }}</div>
{% endif %}
{% endif %}
</div>
<div class="row no-gutters align-items-center pt-2 flex-md-nowrap">
<div class="articleBit-price col mb-md-0 d-block">
{% if app.user%}
{% if not product.variants.empty() %}
<div class="price-old" data-js-product-original-price {{ sylius_test_html_attribute('product-price', money.calculatePrice(product|sylius_resolve_variant)) }}>
{% if channelpricing.discountedPrice and channelpricing.discountedPrice != channelpricing.price and channelpricing|app_check_promotion_price %}
{{ money.convertAndFormat(channelpricing.price )}} <small>{{'app.ui.incl_tax'|trans}}</small>
{% endif %}
</div>
<strong class="price-promo" {{ sylius_test_html_attribute('product-price') }}> {{ money.calculatePrice(product|sylius_resolve_variant) }} <small>{{'app.ui.incl_tax'|trans}}</small></strong>
{% endif %}
{% endif %}
</div>
{% if app.user %}
<div class="col-lg-auto pt-lg-0 pt-3 col-12">
{% if variant is not null %}
{% if not sylius_inventory_is_available(variant) %}
<div class="text-danger">{{ 'app.product.out_of_stock' | trans }}</div>
{% else %}
{#{% if product.retired == false %}#}
{% include '@SyliusShop/Product/Show/_addToCartBox.html.twig' with {'product': product } %}
{#{% endif %}#}
{% endif %}
{% endif %}
</div>
{% endif %}
</div>
</div>
</div>
</article>