{% import 'App/checkout/currency_macros.html.twig' as currencyPosition %}
{% if product.upsells %}
{% for upsell in product.upsells%}
{% if not upsell.productDetail.outOfStock %}
{% set choosedUpsellQuantity = choosedUpsells[upsell.id] is defined ? choosedUpsells[upsell.id]['quantity'] : 0 %}
<div class="upsell-list">
<div class="upsell-product">
<div class="row">
<div class="col-5 pr-3 pt-0">
{% if upsell.imagePath %}
{% if discountPercentage is defined and discountPercentage > 0%}
<div class="product-offer-badge">{{ discountPercentage }}% {{ 'extraDiscount'| trans }}</div>
{% endif %}
<img class="w-100" src="{{ asset('assets/uploads/'~upsell.imagePath) }}" alt="{{ upsell.title }}" >
{% endif %}
</div>
<div class="col-7 pt-0 product-info">
<h3 class="product-title">{{ upsell.title }}</h3>
<div class="product-pricing">
{% if upsell.productDetail.recommendRetailPrice != upsell.variants | first.totalPrice %}
<span class="original-price">
{{ currencyPosition.smallNumbers(convertEURToAnotherCurrency(currency, upsell.productDetail.recommendRetailPrice), currency|currency_symbol, 'small-upsell-unit' ) }}
</span>
{% endif %}
<span class="discounted-price dl-price dl-upsell-price">
<dd>
{{ currencyPosition.smallNumbers(upsell.variants | first.totalPrice, currency|currency_symbol ) }}
</dd>
</span>
</div>
<div class="upsell-product__description text-left">
{{ upsell.description | raw }}
</div>
<div class="upsell-product__manage mt-2 d-flex justify-content-between align-items-center">
<div class="upsell-counter-container">
<span role="button" class="btn add-to-card-btn add-upsell-to-card-btn change-quantity {% if choosedUpsellQuantity %}d-none{% endif %}" data-operation="+">{{ 'addToCard'| trans }}</span>
<div class="input-group upsell-counter {% if not choosedUpsellQuantity %}d-none{% endif %}">
<div class="input-group-append decrement-btn">
<span role="button" class="input-group-text change-quantity" data-operation="-">-</span>
</div>
<span class="form-control text-center upsell-quantity" data-product-id="{{ upsell.id }}" data-value="{{ choosedUpsellQuantity }}" data-max-qty="{{ upsell.maxQuantity }}">{{ choosedUpsellQuantity }}</span>
<div class="input-group-append increment-btn">
<span role="button" class="input-group-text change-quantity {% if upsell.maxQuantity and upsell.maxQuantity <= choosedUpsellQuantity %} invisible {% endif %}" data-operation="+">+</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{% endif %}
{% endfor %}
<hr>
{% endif %}