@ -5,6 +5,123 @@
{% block second_title %}Plein de goodies !{% endblock %}
{% block content %}
< style >
.cart-table {
display: block;
width: 100%;
}
.cart-table thead {
display: none; /* Hide header on small screens */
}
.cart-table tbody, .cart-table tr, .cart-table tfoot {
display: block;
width: 100%;
}
.cart-table tbody tr {
/* margin-bottom: 15px;
padding: 10px;
border-radius: 8px;
box-shadow: 0 1px 3px rgba(0,0,0,0.1); */
}
.cart-table td {
display: flex;
/* padding: 8px 5px;
text-align: right;
justify-content: space-between;
align-items: center; */
}
.cart-table .price-column,
.cart-table .text-left {
/* text-align: right !important; */
}
.cart-table td.product-name {
grid-column: 1 / span 2;
grid-row: 1;
font-weight: bold;
font-size: 1.1em;
}
.cart-table td.product-color {
grid-column: 1 / span 2;
grid-row: 2;
}
/* .cart-table td.product-size {
grid-column: 2;
grid-row: 2;
} */
.cart-table td.product-quantity {
grid-column: 1;
grid-row: 3;
}
.cart-table td.product-price {
grid-column: 3;
grid-row: 3;
justify-content: right;
}
.cart-table td.product-actions {
grid-column: 3;
grid-row: 1;
justify-content: right;
}
/* Make each product a grid container */
.cart-table tbody tr {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
}
/* Cart summary buttons */
.cart-summary {
flex-direction: column;
gap: 10px;
}
.checkout-button {
width: 100%;
text-align: center;
height: 44px; /* Fixed height */
line-height: 24px; /* Vertically center text */
display: flex;
align-items: center;
justify-content: center;
}
.cart-table tfoot tr {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
}
.cart-table tfoot td {
display: block;
width: 100%;
}
.cart-table tfoot td.total-quantity {
grid-column: 1;
grid-row: 1;
text-align: left;
}
.cart-table tfoot td.total-price {
grid-column: 3;
grid-row: 1;
text-align: right;
}
.cart-table tfoot td:empty {
display: none;
}
< / style >
< nav class = "margin10" >
< a href = "{% url 'shop:product_list' %}" > La Boutique< / a >
@ -18,12 +135,12 @@
{% endif %}
< / nav >
< div class = "grid-x" >
< div class = "cell medium-9 large-8 my-block" >
< div class = "small-12 medium-9 large-6 my-block" >
< h1 class = "club my-block topmargin20" > Votre panier< / h1 >
< div class = "bubble" >
{% if cart_items %}
< table class = "cart-table" >
< thead >
<!-- <thead >
< tr >
< th class = "text-left" > Produit< / th >
< th > Couleur< / th >
@ -32,14 +149,18 @@
< th class = "price-column" > Prix< / th >
< th > < / th >
< / tr >
< / thead >
< / thead > -->
< tbody >
{% for item in cart_items %}
< tr class = "{% cycle 'odd' 'even' %}" >
< td class = "text-left" > {{ item.product.title }}< / td >
< td > {{ item.color.name }}< / td >
< td > {{ item.size.name }}< / td >
< td >
< td class = "text-left product-name" data-label = "Produit" > {{ item.product.title }}< / td >
< td class = "product-color" data-label = "Couleur" >
< div class = "color-display" >
< div class = "color-sample-cart" style = "background-color: {{ item.color.colorHex }}" > < / div >
{{ item.color.name }} | {{ item.size.name }}
< / div >
< / td >
< td class = "product-quantity" data-label = "Quantité" >
< div class = "quantity-controls" >
< form method = "post" action = "{% url 'shop:update_cart_item' %}" class = "quantity-form" >
{% csrf_token %}
@ -50,8 +171,8 @@
< / form >
< / div >
< / td >
< td class = "price-column" > {{ item.get_total_price }} €< / td >
< td >
< td class = "price-column product-price" data-label = "Prix " > {{ item.get_total_price }} €< / td >
< td class = "product-actions" >
< form method = "post" action = "{% url 'shop:remove_from_cart' %}" class = "remove-form" >
{% csrf_token %}
< input type = "hidden" name = "item_id" value = "{{ item.id }}" >
@ -63,18 +184,16 @@
< / tbody >
< tfoot >
< tr >
< td colspan = "3" class = "total-label text-left" > Total:< / td >
< td class = "total-quantity" > {{ total_quantity }}< / td >
< td class = "price-column total-price" > {{ total }} €< / td >
< td > < / td >
< td class = "total-quantity" data-label = "total-quantity" > {{ total_quantity }} produit(s)< / td >
< td class = "total-label text-left" > < / td >
< td class = "total-label text-left" > < / td >
< td class = "price-column total-price" data-label = "total-price" > {{ total }} €< / td >
< td class = "total-label text-left" > < / td >
< / tr >
< / tfoot >
< / table >
< div class = "cart-summary" >
{% if cart_items %}
< a class = "cancel-nav-button checkout-button" href = "{% url 'shop:clear_cart' %}" > Vider le panier< / a >
{% endif %}
{% if user.is_authenticated %}
<!-- For authenticated users: Direct Stripe payment button -->
@ -87,6 +206,11 @@
< a class = "styled-link" href = "{% url 'login' %}?next={% url 'shop:view_cart' %}" > Se connecter< / a >
< / div >
{% endif %}
< hr >
{% if cart_items %}
< a class = "cancel-nav-button checkout-button" href = "{% url 'shop:clear_cart' %}" onclick = "return confirm('Êtes-vous sûr de vouloir supprimer votre panier ?');" > Vider le panier< / a >
{% endif %}
< / div >
{% else %}
< p > Votre panier est vide.< / p >