{% set detailLink = app_product_detaillink(item) %}
<article class="product product--row">
<div class="product__img">
<favorite-button
product-id="{{ item.id }}"
:is-current-favorite="{{ item.id in favoriteIds ? 'true' : 'false' }}"
></favorite-button>
</div>
<div class="product__info">
<div class="product__text">
<p class="title"><a href="{{ detailLink }}">{{ item.name }}</a></p>
{% if item.onOrder %}
<span class="d-inline-flex align-items-center mb-1">
<span class="badge bg-danger">{{ 'Op bestelling!'|trans }}</span>
{% set orderMessage = product_order_message(item) %}
{% if orderMessage %}
<ranking-info-button :message="{{ orderMessage|json_encode }}"></ranking-info-button>
{% endif %}
</span>
{% endif %}
<p>{{ 'Code'|trans }}: {{ item.code }} — {{ 'Merk'|trans }}: {{ item.brand }}</p>
{% if item.categoryTypes %}
<p>{{ 'Categorietype'|trans }}: {{ item.categoryTypes|map(t => t.name)|join(', ') }}</p>
{% endif %}
</div>
</div>
<div class="product__price">
{% if not item.OSPrice.getAmount.isZero %}
<div class="price {% if item.promoDate1 and item.promoDate2 and date(item.promoDate1) < date() and date(item.promoDate2) > date() %}
price--promo
{% endif %}">{{ item.OSPrice }}<small class="price-unit">/{{ item.unit }}</small></div>
{% if( item.discount ) %}
{% if( item.OSPrice != item.OSDefaultPrice ) %}
<p class="old-price">{{ item.OSDefaultPrice }}</p>
{% endif %}
<div class="promo">-{{ item.discount }}%</div>
{% endif %}
{% endif %}
{% if
item.promoDate1 and item.promoDate2 and
date(item.promoDate1) < date() and date(item.promoDate2) > date()
%}
{# Show promo price even when prices should not show #}
{% if item.OSPrice.getAmount.isZero %}
{% if item.promoPrice %}
<div class="price price--promo">{{ item.promoPrice | currency }}<small class="price-unit">/{{ item.unit }}</small></div>
{% endif %}
{% if( item.promoPercentage ) %}
<div class="promo">-{{ item.promoPercentage }}%</div>
{% endif %}
{% endif %}
<p class="date">({{ 'Promotie vanaf'|trans}} {{ item.promoDate1|date('d/m/Y') }} {{'tot'|trans}} {{ item.promoDate2|date('d/m/Y') }})</p>
{% endif %}
</div>
<div class="product__controls">
{% if cartList is defined and cartList %}
<change-cartitem-quantity
product-id="{{ item.id }}"
:current-quantity="{{ cartItem.count }}"
unit="{{ item.unit }}"
minimum-unit="{{ item.unitMinimum }}"
></change-cartitem-quantity>
<remove-cart-item-button
product-id="{{ item.id }}"
></remove-cart-item-button>
{% else %}
<add-to-cart
product-id="{{ item.id }}"
unit="{{ item.unit }}"
minimum-unit="{{ item.unitMinimum }}"
amount-in-cart="{{ cartItems[item.id] ?? 0 }}"
></add-to-cart>
{% endif %}
</div>
</article>