{% import "@SyliusShop/Common/Macro/money.html.twig" as money %}
{% if product.imagesByType('image_product_main') is not empty %}
{% set source_path = product.imagesByType('image_product_main').first.path %}
{% set path = source_path|imagine_filter('app_product_small_thumbnail_listing') %}
{% elseif product.images.first %}
{% set source_path = product.images.first.path %}
{% set path = source_path|imagine_filter('app_product_small_thumbnail_listing') %}
{% else %}
{% set path = asset('webapic-theme/images/icon-gmap.png') %}
{% endif %}
<div class="listing1-product-ctn card">
<a href="{{ path('app_product_variant_show', {'slug': product.slug, 'id': product.id}) }}" class="{% if is_mobile() %}mobile {% else %}desktop{% endif %}">
<div class="img-ctn">
<div class="flag">
{% include 'partials/block-callout.html.twig' with {'callout': product.badge} only %}
</div>
<div class="img-ctn-content">
<img src="{{ path }}" id="main-image" alt="{{ product.name }}" {{ sylius_test_html_attribute('main-image') }} />
{% set path = '' %}
{% if product.imagesByType('image_product_secondary') is not empty %}
{% set source_path = product.imagesByType('image_product_secondary').first.path %}
{% set path = source_path|imagine_filter('app_product_small_thumbnail_listing') %}
{% elseif product.imagesByType('image_product_main') is not empty %}
{% set source_path = product.imagesByType('image_product_main').first.path %}
{% set path = source_path|imagine_filter('app_product_small_thumbnail_listing') %}
{% endif %}
{% if path is not empty %}
<img class="hover" src="{{ path }}" id="main-image" alt="{{ product.name }}" {{ sylius_test_html_attribute('main-image') }} />
{% endif %}
{% if is_mobile() %}
<button class="mobile"><i class="chevron left icon"></i></button>
<button class="mobile right"><i class="chevron right icon"></i></button>
{% endif %}
</div>
</div>
<div class="name">{{ product.name }}</div>
{% set price = money.calculatePrice(product) %}
{% set originalPrice = money.calculateOriginalPrice(product) %}
{# {% if price != originalPrice %}
<div class="sylius-product-original-price price" {{ sylius_test_html_attribute('product-original-price') }}><del>{{ originalPrice }}</del></div>
{% endif %} #}
<div class="sylius-product-price price" {{ sylius_test_html_attribute('product-price') }}>{{ price }}</div>
<div class="add">
<div class="quantite-input">
<input class="js-add-to-cart-qty" name="quantity" value="1" data-idproduct="{{ product.id }}">
<div class="dec button btncadeau" data-qte="1">-</div>
<div class="inc button btncadeau" data-qte="1">+</div>
</div>
<button class="js-add-to-cart-cadeau addtocart" data-url="{{ path('app_cart_add_to_cart_ajax') }}" data-postdata="{{ '{"' ~ product.id ~ '":1}' }}">
{# <img src="{{ asset('webapic-theme/images/icon-panier.svg') }}" class="ui image" /> #}
<img src="{{ asset('webapic-theme/images/icon-panier-small.svg') }}" class="ui image" />
</button>
</div>
</a>
</div>