{% set total = totalBrut %}
{% set hasAction = action ?? true %}
<div class="mt-5 mb-3 mb-lg-0">
<div class="row mt-3">
<div class="col-12 col-lg-8 mb-5 mb-lg-0">
<div class="row border-top border-bottom py-2">
<div class="col-0 col-lg-3"></div>
<div class="col-4 col-lg-3">
<h6>{{ "Description" | trans }}</h6>
</div>
<div class="col-2 col-lg-2">
<h6 class="text-center">{{ "Quantité" | trans }}</h6>
</div>
<div class="col-3 col-lg-2">
<h6 class="text-center">{{ "Prix unitaire" | trans }}</h6>
</div>
<div class="col-3 col-lg-2">
<h6 class="text-center">{{ "Total" | trans }}</h6>
</div>
</div>
{% for itemCart in cart %}
{% set translated = itemCart['product']|translate %}
<div class="row mt-2 border-bottom align-items-center py-3" id="product-{{ itemCart['product'].id }}">
<div class="col-0 col-lg-3">
<img src="{{ vich_uploader_asset(translated) | imagine_filter('product_list') }}"
alt="{{ translated.name }}" class="img-fluid d-none d-lg-block">
</div>
<div class="col-4 col-lg-3">
{# {% dump(itemCart) %} #}
<a href="{{ path('product_detail', {id: itemCart['product'].id, brand: itemCart['product'].brand.name | urlSanitizer, slug: translated.slug}) }}"
class="text-black fw-bold">
{{ translated.name }}
</a>
<div class="pt-2">
{% if itemCart['attribut'] is not null %}
{% set attributTranslated = itemCart['attribut'].attributTerms|translate %}
<div>
{{ itemCart['attribut'].attributTerms.attributTitles.translate(app.request.locale).name }}
: <span class="fw-bold">{{ attributTranslated.name }}</span>
</div>
{% endif %}
<div>
{{ "PHARMACODE" | trans }}:
<span class="fw-bold">{{ itemCart['product'].pharmacode }}</span>
</div>
<div>
{{ "Marque" | trans }}:
<span class="fw-bold">{{ itemCart['product'].brand.name }}</span>
</div>
</div>
</div>
<div class="col-2 col-lg-2 d-flex align-items-center justify-content-start flex-column">
<div class="d-flex align-items-center py-1">
{% if hasAction %}
<div class="qt-item" data-cart-qt-down
data-product="{{ itemCart['product'].id }}"
data-attribut="{{ itemCart['attribut'] ? itemCart['attribut'].id : 0 }}"
>
<i class="fas fa-minus"></i>
</div>
{% endif %}
<div class="qt-count" data-cart-qt-count="{{ itemCart['product'].id }}"
style="user-select: none">{{ itemCart['quantity'] }}</div>
{% if hasAction %}
<div class="qt-item" data-cart-qt-up
data-product="{{ itemCart['product'].id }}"
data-attribut="{{ itemCart['attribut'] ? itemCart['attribut'].id : 0 }}"
>
<i class="fas fa-plus"></i>
</div>
{% endif %}
</div>
{% if hasAction %}
<a href="#!" class="text-danger text-decoration-underline d-block mt-3" data-cart-delete
data-product="{{ itemCart['product'].id }}"
data-attribut="{{ itemCart['attribut'] ? itemCart['attribut'].id : 0 }}">
{{ "Supprimer" | trans }}
</a>
{% endif %}
</div>
<div class="col-3 col-lg-2">
<p class="text-center">{{ itemCart['price']|format_currency("CHF") }}</p>
</div>
<div class="col-3 col-lg-2">
<p class="text-center"
data-item-total="{{ itemCart['product'].id }}">{{ itemCart['total']|format_currency("CHF") }}</p>
</div>
<div class="col-12">
<div app-product-gift data-id="{{ itemCart['product'].id }}"></div>
</div>
{% if hasAction %}
{% set productPrestatations = itemCart['product'].productsPrestations %}
{% if productPrestatations|length > 0 %}
{% set formatedPrestation = [] %}
{% for service in productPrestatations %}
{% set formatedPrestation = formatedPrestation|merge([{
'id': service.prestation.id,
"icon": service.prestation.icon,
"name": service.prestation.name,
"description": service.prestation.description}
]) %}
{% endfor %}
<div class="row d-flex justify-content-end mb-2">
<div
app-service-cart
class="col-sm-12 col-lg-6"
data-prestations="{{ formatedPrestation|json_encode }}"
data-form-id="{{ itemCart['product'].id }}"
></div>
</div>
{% endif %}
{% endif %}
</div>
{% endfor %}
{% for prestation in prestations %}
<div class="row py-3 border-bottom align-items-center"
data-prestation="{{ prestation.pharmacyPrestation.id }}"
id="prestation-{{ prestation.pharmacyPrestation.id }}">
<div class="col-lg-3 d-flex justify-content-center">
<img src="{{ prestation.productPrestation.prestation.icon }}" width="50"
alt="{{ prestation.productPrestation.prestation.name }}" class="img-fluid">
</div>
<div class="col-lg-3">
<p class="text-black m-0">
{{ prestation.productPrestation.prestation.name }}
</p>
</div>
<div class="col-lg-2 d-flex align-items-center justify-content-start flex-column">
<div class="d-flex align-items-center py-1">
{% if hasAction %}
<a href="{{ path('order_step_prestation') }}">{{ "Gérer" }}</a>
{% endif %}
</div>
</div>
<div class="col-lg-2">
</div>
<div class="col-lg-2">
<p class="text-center m-0">{{ prestation.price|format_currency("CHF") }}</p>
</div>
</div>
{% endfor %}
<div class="mt-2">
<div app-product-gift data-id="{{ null }}"></div>
</div>
<div class="py-3 text-center {{ cart|length >= 1 ? "d-none" : "" }}" id="cart-no-product">
<h4 class="text-muted">
<span class="fas fa-shopping-cart"></span>
{{ "Votre panier est vide" | trans }}
</h4>
<a
href="{{ path('app_shop') }}"
class="text-decoration-underline text-muted">
{{ "Faire mes achats" | trans }}
</a>
</div>
</div>
<div class="col-12 col-lg-4 px-2 ps-lg-5">
<div class="px-5 py-3" style="background-color: #EEEEEE">
<h4 class="text-center">{{ "COMMANDE" | trans }}</h4>
<hr>
<div>
<div class="row">
<div class="col-7">{{ "Produit(s)" | trans }}: <span
class="cart-product-count">{{ cart|length }}</span></div>
<div class="col-5 fw-bold text-end"
id="cart-total-no-coupon">{{ total|format_currency("CHF") }}</div>
</div>
<hr>
{% if hasAction %}
<div class="row my-4">
<div class="col-7">
<label for="" class="fw-bold">{{ "CODE PROMO" | trans }}</label>
<input type="text" class="form-control bg-white" placeholder="{{ "Code promo"|trans }}"
id="promo-code">
<input type="hidden" name="token" value="{{ csrf_token('promo-code-csrf') }}"
id="promo-code-csrf"/>
</div>
<div class="col-5 align-self-end">
<button class="btn btn-primary" id="promo-code-submit">{{ "Appliquer"|trans }}</button>
</div>
<div class="col-12 small d-none" id="promo-code-result"></div>
</div>
{% else %}
<div class="row">
<div class="col-12">
{# <span class="fw-bold">{{ "MODE DE TRANSPORT:" | trans }}</span> {{ (transport|translate).name }} #}
<span class="fw-bold">{{ "MODE DE TRANSPORT:" | trans }}</span> {{ "Click and collect" | trans }}
</div>
<div class="col-12">
<span class="fw-bold">{{ "PAIEMENT LORS DU RETRAIT" | trans }}</span>
</div>
</div>
{% endif %}
<div class="row">
<div class="col-12 fw-bold my-2">
{{ "REDUCTION" | trans }}:
<ul class="m-0" id="coupon_list">
{% for coupon in coupons %}
<li>
{{ include('elements/products/_product_promocode_type.html.twig', {
reference: coupon['ref'],
type: coupon['type'],
discount: coupon['discount']
}) }}
</li>
{% if coupon['type'] == "AMOUNT" %}
{% set total = total - coupon['discount'] %}
{% else %}
{% set total = total - (total * coupon['discount'] / 100) %}
{% endif %}
{% endfor %}
</ul>
</div>
</div>
<div class="row">
<div class="col-6 fw-bold">{{ "TOTAL" | trans }}:</div>
<div class="col-6 text-end"
id="cart-total-coupon">{{ total|format_currency("CHF") }}</div>
</div>
</div>
</div>
</div>
</div>
</div>