{% extends 'base.html.twig' %}
{% block title %}Mon panier{% endblock %}
{% block body %}
<!-- Navbar Start -->
<div class="container-fluid position-relative p-0">
<div class="container-fluid bg-primary py-5 bg-header" style="margin-bottom: 90px;">
<div class="row py-5">
<div class="col-12 pt-lg-5 mt-lg-5 text-center">
<h1 class="display-4 text-white animated zoomIn">Mon Panier</h1>
<a href="{{ path('home') }}" class="h5 text-white">Accueil</a>
<i class="far fa-circle text-white px-2"></i>
<a href="" class="h5 text-white">Panier</a>
</div>
</div>
</div>
</div>
<!-- Navbar End -->
<!-- Cart Start -->
<div class="container-fluid pt-5">
<div class="row px-xl-5">
<div class="col-lg-8 table-responsive mb-5">
<table class="table table-bordered text-center mb-0">
<thead class="bg-secondary text-dark">
<tr>
<th>Articles</th>
<th>Prix</th>
<th>Quantité</th>
<th>Total</th>
<th>Remove</th>
</tr>
</thead>
<tbody class="align-middle">
{% for item in cart %}
<tr>
<td class="align-middle"><img height="60px" src="/uploads/{{ item.product.image }}" alt="{{ item.product.name }}">{{item.product.name}}</td>
<td class="align-middle">{{(item.product.price / 100)|number_format(2,',','.') }} Fr CFA</td>
<td class="align-middle">
<div class="input-group quantity mx-auto" style="width: 100px;">
<div class="input-group-btn">
<a title="Enlever 1 article" href="{{ path('decrease_item', {id:item.product.id}) }}">
<button class="btn btn-sm btn-primary btn-minus" >
<i class="fa fa-minus"></i>
</button>
</a>
</div>
<input type="text" class="form-control form-control-sm bg-secondary text-center" value=" {{ item.quantity }} ">
<div class="input-group-btn">
<a title="Ajouter 1 article" href="{{ path('add_to_cart', {id:item.product.id}) }}">
<button class="btn btn-sm btn-primary btn-plus">
<i class="fa fa-plus"></i>
</button>
</a>
</div>
</div>
</td>
<td class="align-middle">{{ (item.quantity * (item.product.price / 100))|number_format(2,',','.') }} Fr CFA</td>
<td class="align-middle"><button class="btn btn-sm btn-primary"><i class="fa fa-times"></i></button></td>
<td class="align-middle">
<a title="Supprimer tous les articles de cette ligne" href="{{ path('remove_cart_item', {id: item.product.id}) }}" >
<i class="bi bi-trash"></i>
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<div class="col-lg-4">
<form class="mb-5" action="">
<div class="input-group">
<div class="input-group-append">
{% if totalQuantity > 0 %}
<a title="Supprimer tous les articles de cette ligne" href="{{ path('remove_cart') }}" >
<button class="btn btn-primary">Réinitialiser le panier</button>
</a>
{% endif %}
</div>
</div>
</form>
<div class="card border-secondary mb-5">
<div class="card-header bg-secondary border-0">
<h4 class="font-weight-semi-bold m-0">Sommaire panier</h4>
</div>
<div class="card-body">
<div class="d-flex justify-content-between mb-3 pt-1">
<h6 class="font-weight-medium">Total Quantité</h6>
<h6 class="font-weight-medium">{{ totalQuantity }}</h6>
</div>
</div>
<div class="card-footer border-secondary bg-transparent">
<div class="d-flex justify-content-between mt-2">
<h5 class="font-weight-bold">Total</h5>
<h5 class="font-weight-bold">{{ (totalPrice / 100)|number_format(2,',','.') }} FCFA</h5>
</div>
<a class="mb-3 d-block" href="{{ path('product') }}">Continuez mes achats</a>
{% if totalQuantity > 0 %}
<a href="{{ path('order')}}"title="Valider puis passer au paiement" >
<button class="btn btn-block btn-primary my-3 py-3">Valider ma commande</button>
</a>
{% else %}
Votre panier est vide, remplissez le depuis la page <a href="{{ path('product') }}">produits</a>.
{% endif %}
</div>
</div>
</div>
</div>
</div>
{% endblock %}