{% import "@SyliusShop/Common/Macro/money.html.twig" as money %}
<div class="produits">
{% if app.request.isXmlHttpRequest() and app.request.pathInfo == '/cart/ajax/add-to-cart' %}
<span class="confirm-add">
<i class="icon check"></i>{{ 'app.front.panier.confirm'|trans }}
</span>
{% endif %}
<span class="confirm-nostock">
<i class="icon close"></i>Ce produit n'est plus en stock
</span>
{% for key, item in cart.items %}
{% set product_variant = item.variant %}
{# {{ dump(product_variant.product.conditioning) }} #}
<div class="produits-item" {{ sylius_test_html_attribute('cart-product-row', item.productName) }}>
<div class="left">
{# {% if product_variant.hasImages %}
{% include '@SyliusShop/Product/_mainImage.html.twig' with {'product': product_variant, 'filter': 'app_product_small_thumbnail_listing'} %}
{% else %}
{% include '@SyliusShop/Product/_mainImage.html.twig' with {'product': product_variant.product, 'filter': 'app_product_small_thumbnail_listing'} %}
{% endif %} #}
{% if product_variant.hasImages %}
{% if product_variant.imagesByType('image_product_main') is not empty %}
{% set path = product_variant.imagesByType('image_product_main').first.path|imagine_filter(filter|default('app_product_small_thumbnail_listing')) %}
{% elseif product_variant.images.first %}
{% set path = product_variant.images.first.path|imagine_filter(filter|default('app_product_small_thumbnail_listing')) %}
{% else %}
{% set path = asset('assets/shop/img/200x200.png') %}
{% endif %}
{% else %}
{% if product_variant.product.imagesByType('image_product_main') is not empty %}
{% set path = product_variant.product.imagesByType('image_product_main').first.path|imagine_filter(filter|default('app_product_small_thumbnail_listing')) %}
{% elseif product_variant.product.images.first %}
{% set path = product_variant.product.images.first.path|imagine_filter(filter|default('app_product_small_thumbnail_listing')) %}
{% else %}
{% set path = asset('assets/shop/img/200x200.png') %}
{% endif %}
{% endif %}
<img src="{{ path }}" {{ sylius_test_html_attribute('main-image') }} alt="{{ product_variant.name }}" class="ui bordered image" />
{% if product_variant.pricePerTwo > 0 %}
<div class="codepromo">
{{ money.convertAndFormat(product_variant.pricePerTwo) }}
<br />
{{ 'app.front.produit.lesdeux'|trans }}
</div>
{% endif %}
</div>
<div class="middle">
<a href="{{ path('app_product_variant_show', {'id': product_variant.id, 'slug': product_variant.slug}) }}">
<div class="sylius-product-name" {{ sylius_test_html_attribute('product-name', item.productName) }}>
{% if item.variantName %}
{{ item.variantName }}
{% else %}
{{ item.productName }}
{% endif %}
</div>
</a>
<span class="sylius-unit-price" {{ sylius_test_html_attribute('cart-product-unit-price', item.productName) }}>
{# {{ money.convertAndFormat(item.discountedUnitPrice) }} #}
{{ money.convertAndFormat(item.total) }}
{% if item.adjustmentsTotal < 0 %}
<span class="original-price"> {{ money.convertAndFormat(item.unitsTotal) }}</span>
{% endif %}
</span>
{% if product_variant.product.conditioning == 'card_kdo_per_euros_each_10_euros' %}
<br><span class="panierpopup-destination">A destination de {{item.kdoLastname}} {{item.kdoFirstname}} ({{item.kdoEmail}}) <br/>
Message: {{item.kdoMessage}}</span>
{% endif %}
</div>
<div class="right">
<div class="quantite-ctn">
<div class="lds-roller-ctn">
<div class="lds-roller"><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div></div>
</div>
<div class="ui red label bottom pointing hidden sylius-validation-error" id="sylius-cart-validation-error" {{ sylius_test_html_attribute('cart-validation-error') }}></div>
<div class="quantite-input">
{% if product_variant.product.conditioning != 'per_meter_each_0_5_meter' and product_variant.product.conditioning != 'card_kdo_per_euros_each_10_euros' %}
<input name="quantity" value="{{ item.quantity }}" {% if is_mobile() %}{% else %}readonly{% endif %} autocomplete="off">
<div class="dec button" data-url="{{ path('app_cart_update', {id: item.id}) }}" data-qte="{{ item.quantity }}">-</div>
{% if item.quantity != 10 and item.canAddItem() %}
<div class="inc button" data-url="{{ path('app_cart_update', {id: item.id}) }}" data-qte="{{ item.quantity }}">+</div>
{% endif %}
{% else %}
<div class="dec button" data-url="{{ path('app_cart_update', {id: item.id}) }}" data-qte="{{ item.quantity }}" data-tissu='1'> <i class="icon trash"></i></div>
{% endif %}
</div>
</div>
</div>
</div>
{% endfor %}
</div>