{% block stylesheets %}
{{ encore_entry_link_tags('react/partials/wishlist') }}
{% endblock %}
{% block javascripts %}
{{ encore_entry_script_tags('react/partials/wishlist') }}
{{ encore_entry_script_tags('empathy') }}
{% endblock %}
{% set translations = {
"wishlist_popup.title": ('wishlist_popup.title'|trans),
"wishlist_popup.details": ('wishlist_popup.details'|trans),
"wishlist_popup.button_cancel": ('wishlist_popup.button_cancel'|trans),
"wishlist_popup.button_save": ('wishlist_popup.button_save'|trans),
"wishlist_popup.create_list": ('wishlist_popup.create_list'|trans),
"wishlist_popup.name_list": ('wishlist_popup.name_list'|trans),
"wishlist_popup.name_list_placeholder": ('wishlist_popup.name_list_placeholder'|trans),
"wishlist_popup.select_placeholder": ('wishlist_popup.select_placeholder'|trans),
"wishlist_popup.required_field": ('wishlist_popup.required_field'|trans),
"wishlist_popup.save_changes_ok": ('wishlist_popup.save_changes_ok'|trans),
"wishlist_popup.list_validation_name": ('wishlist_popup.list_validation_name'|trans),
"wishlist_popup.list_validation_duplicated": ('wishlist_popup.list_validation_duplicated'|trans),
"wishlist_popup.list_validation_alphanumeric": ('wishlist_popup.list_validation_alphanumeric'|trans),
"wishlist_popup.list_validation_max_list": ('wishlist_popup.list_validation_max_list'|trans),
} %}
<div id="empathy" data-layout="{{ layout|json_encode }}" data-iso-code="{{ app.session.get('lang') }}" data-session-id="{{ app.session.getId() }}" ></div>
<div id="wishlist-translations" data-translations="{{ translations|json_encode }}"> </div>
{% for product in parameters.products %}
<div class="productList-item">
{% set classStock = '' %}
{% if app.session.get('is_wholesaler') == app.session.get('customerGroup') %}
{% if product.quantity <= 0 %}
{% set classStock = ((product.quantity_venideros > 0) or (product.quantity_supplier_to_show > 0) ) ? 'productCard--soon' : 'productCard--noStock' %}
{% else %}
{% set classStock = (product.quantity > 0) ? 'productCard--soon' : 'productCard--noStock' %}
{% endif %}
{% endif %}
<article data-js-product-card="product-card" data-js-idProduct="{{ product.id_product }}"
data-js-idAttribute="0"
data-js-ga-reference="{{ product.reference[0] }}" data-js-ga-name="{{ product.name }}"
data-js-ga-category="0" data-js-ga-list="Categoria" class="productCard productCard--shoppable {{ product.ribbon_class }}">
<figure class="productCard-content">
{% if app.session.get('id_customer') == true %}
<div
id="bb-wishlist-{{loop.index}}"
class="bb-wishlist-counter"
data-product="{{ product|json_encode }}"
>
</div>
{% endif %}
<a class="productCard-link productCard-imgCont productCard-imgCont--threeImgs"
href="{{ base_url }}{{ app.session.get('lang') }}/{{ product.link_rewrite }}.html"
onClick="window.productCardEmpathy('{{ product.name|raw }}', {{ product.id }}, '{{ base_url }}{{ app.session.get('lang') }}/{{ product.link_rewrite }}.html')"
{% if product.translations == false %}rel="nofollow"{% endif %}>
{% set typeImage = (product.is_gif) ? '.gif' : '.jpg' %}
<img data-js-product-card-imgtodetail="imgtodetail"
class="productCard-img {% if product.name_image != false %}lazy{% else %}u-hide{% endif %}"
src="{{ base_url_img }}public/img/Loading.gif"
data-original="{{ base_url }}{{ product.id_image }}-home/{{ product.name_image }}{{ typeImage }}"
alt="{{ product.name|raw }}" title="{{ product.name|raw }}">
</a>
<figcaption class="productCard-properties">
<div class="productCard-title">
<a data-js-product-card-atodetail="atodetail" class="productCard-link"
onClick="window.productCardEmpathy('{{ product.name|raw }}', {{ product.id }}, '{{ base_url }}{{ app.session.get('lang') }}/{{ product.link_rewrite }}.html')"
href="{{ base_url }}{{ app.session.get('lang') }}/{{ product.link_rewrite }}.html"
title="{{ product.name|raw }}"
{% if product.translations == false %}rel="nofollow"{% endif %}>{{ product.name }}</a>
{% if app.session.get('is_wholesaler') %}
<aside class="productCard-sizes">
<div class="productCard-sizesItem">
<svg role="img" class="icon icon--inline icon--xs">
<use xmlns:xlink="http://www.w3.org/1999/xlink"
xlink:href="{{ base_url }}public/img/icons/svg-defs.svg#icon-bbcode"></use>
</svg>
{{ legacy_trans('Ref.', 'product-card-list') }} {{ product.reference|last }}</div>
<div class="productCard-sizesItem">
<svg role="img" class="icon icon--inline icon--xs">
<use xmlns:xlink="http://www.w3.org/1999/xlink"
xlink:href="{{ base_url }}public/img/icons/svg-defs.svg#icon-caja_alt"></use>
</svg>
{{ legacy_trans('Caja (uds.)', 'product-card-list') }}: {{ product.box }}</div>
<div class="productCard-sizesItem">
<svg role="img" class="icon icon--inline icon--xs">
<use xmlns:xlink="http://www.w3.org/1999/xlink"
xlink:href="{{ base_url }}public/img/icons/svg-defs.svg#icon-pallet3"></use>
</svg>
{{ legacy_trans('Pallet (uds.)', 'product-card-list') }}: {{ product.palet }}</div>
</aside>
{% endif %}
</div>
{% if app.session.get('is_wholesaler') %}
<div class="stockAvailability stockAvailability--vertical">
<p class="stockAvailability-title stockAvailability-title--{{ product.quantity > 0 ? 'success' : 'error' }}">
{% if product.quantity <= 0 and product.quantity_future <= 0 and product.quantity_venideros <= 0 and (0 <= (product.quantity_supplier - product.quantity_extern)) %}
{{ legacy_trans('No disponible', 'product-card-list') }}
{% elseif product.quantity > 0 or product.quantity_future > 0 %}
{{ legacy_trans('Disponible', 'product-card-list') }} ({{ product.quantity }})
{% else %}
{{ legacy_trans('Próximamente', 'product-card-list') }}
{% endif %}
</p>
<ul class="stockAvailability-list">
{% if product.quantity_immediate > 0 %}
<li class="stockAvailability-item">
{{ 'stock.units_immediate' | trans({}, 'messages', app.session.get('lang')) | format(product.quantity_immediate) }}
</li>
{% endif %}
{% if product.quantity_supplier - product.quantity_extern > 0 %}
<li class="stockAvailability-item">
{{ 'stock.units_jit_24_48' | trans({}, 'messages', app.session.get('lang')) | format((product.quantity_supplier - product.quantity_extern)) }}
</li>
{% endif %}
{% if (product.quantity_supplier_2_5 - product.quantity_extern_2_5) > 0 %}
<li class="stockAvailability-item">
{{ 'stock.units_days' | trans({}, 'messages', app.session.get('lang')) | format(product.quantity_supplier_2_5 - product.quantity_extern_2_5, '2-5') }}
</li>
{% endif %}
{% if (product.quantity_future) > 0 %}
<li class="stockAvailability-item">
{{ 'stock.units_days' | trans({}, 'messages', app.session.get('lang')) | format(product.quantity_future, '5-30') }}
</li>
{% endif %}
</ul>
</div>
{% endif %}
<div class="productCard-prices">
<div class="productCard-pvp productCard-pvp--now">
<div class="productCard-pvp-name productCard-pvp--relevant">
{% if app.session.get('is_wholesaler') %}
{{ legacy_trans('PVD', 'product-card-list') }}
{% else %}
{{ legacy_trans('PVR', 'product-card-list') }}
{% endif %}
</div>
<div class="productCard-pvp-amount productCard-pvp--relevant">
{{ display_price(product.price_after) }}
</div>
</div>
<div class="productCard-pvp productCard-pvp--before">
<div class="productCard-pvp-name">
{% if app.session.get('is_wholesaler') %}
{{ legacy_trans('PVR', 'product-card-list') }}
{% else %}
{{ legacy_trans('PVP', 'product-card-list') }}
{% endif %}
</div>
<div class="productCard-pvp-amount productCard-pvp-amount--before">
{{ display_price(product.price_before) }}
</div>
</div>
<div class="productCard-pvp productCard-pvp--discount">
-{{ product.descuento|number_format(0) }}%
</div>
</div>
{% if app.session.get('is_wholesaler') %}
<div class="productCard-prices productCard-prices--alt">
<p class="productCard-priceitem">
<span>
{{ legacy_trans('New', 'product-card-list') }}
{{ legacy_trans('PVD', 'product-card-list') }}
</span>
<span>
{{ display_price(product.price_after) }}
</span>
</p>
<p class="productCard-priceitem u-op-50">
<span>
{{ legacy_trans('Old', 'product-card-list') }}
{{ legacy_trans('PVD', 'product-card-list') }}
</span>
<strike>
{{ display_price(product.price_after_old) }}
</strike>
</p>
<p class="productCard-priceitem">
<span>
{{ legacy_trans('New', 'product-card-list') }}
{{ legacy_trans('PVR', 'product-card-list') }}
</span>
<span>
{{ display_price(product.price_before) }}
</span>
</p>
<p class="productCard-priceitem u-op-50">
<span>
{{ legacy_trans('Old', 'product-card-list') }}
{{ legacy_trans('PVR', 'product-card-list') }}
</span>
<strike>
{{ display_price(product.price_before_old) }}
</strike>
</p>
<div class="productCard-discount">
-{{ product.descuento_old|number_format(0) }}%
</div>
</div>
{% endif %}
</figcaption>
</figure>
{% if product.ribbon_name != false %}
{% set ribbon_name = product.ribbon_name %}
{% if product.ribbon_name|upper == 'OPENBOX' %}
{% set ribbon_name = 'Renewed' %}
{% endif %}
<div class="productCard-ribbon">
{{ ribbon_name }}
</div>
{% endif %}
{% if product.video != false %}
<div class="productCard-play"></div>
{% endif %}
<div class="productCard-buy">
{% if product.quantity_supplier_to_show > 0 and product.quantity <= 0 and app.session.get('is_wholesaler') %}
<div class="productCard-caption">
{{ legacy_trans('Bajo pedido', 'product-card-list') }}
</div>
{% elseif product.quantity_venideros > 0 and product.quantity <= 0 and app.session.get('is_wholesaler') %}
<div class="productCard-caption">
{{ legacy_trans('Próximamente', 'product-card-list') }}
</div>
{% elseif product.quantity <= 0 %}
<div class="productCard-caption">
{{ legacy_trans('Sin stock', 'product-card-list') }}
</div>
{% else %}
<div data-js-product-card-container-addToCart class="productCard-caption">
<div class="unitControl">
<input data-js-product-card-unitcontrolinput="unitcontrolinput"
class="form-input form-input--postfix unitControl-input" type="text"
maxlength="10" value="1">
<span class="form-postfix unitControl-groupBtns">
<button data-js-product-card-unitcontrolplus="unitcontrolPlus"
class="button button--icon unitControl-button unitControl-button--plus"></button>
<button data-js-product-card-unitcontrolminus="unitcontrolMinus"
class="button button--icon unitControl-button unitControl-button--minus"></button>
</span>
</div>
{% if product.id_product_attribute is defined and product.id_product_attribute is not null or product.quantity_dif != 0 and app.session.get('is_wholesaler') %}
<div class="productCard-action u-pdt--half">
<a data-js-product-card-options="options" class="productCard-link"
href="{{ base_url }}{{ app.session.get('lang') }}/{{ product.link_rewrite }}.html">
{{ legacy_trans('Opciones', 'product-card-list') }}
<i data-js-product-card-options="options"
class="form-action-icon productCard-action-icon fa fa-chevron-right"></i>
</a>
</div>
{% else %}
{% if (
(
app.session.get('customerPack') == 0 or
(
app.session.get('customerDateCsv')|date("Y-m-d") < "now"|date("Y-m-d") and app.session.get('customerPack') >1
) or
app.session.get('id_customer') == false
)
)
and product.only_pack %}
<button class="button productCard-ctaButton" disabled
title="{{ legacy_trans('Añadir al carrito', 'product-card-list') }}">
<svg role="img" class="icon icon--xs">
<use xlink:href="{{ base_url }}public/img/icons/svg-defs.svg#icon-cart"></use>
</svg>
</button>
{% else %}
<button data-js-product-card-addToCart="addToCart"
class="button button--primary productCard-ctaButton"
title="{{ legacy_trans('Añadir al carrito', 'product-card-list') }}">
<svg role="img" class="icon icon--xs">
<use xlink:href="{{ base_url }}public/img/icons/svg-defs.svg#icon-cart"></use>
</svg>
</button>
{% endif %}
{% endif %}
</div>
{% endif %}
</div>
</article>
</div>
{% endfor %}