|
|
|
@ -25,47 +25,66 @@ |
|
|
|
<table class="cart-table"> |
|
|
|
<table class="cart-table"> |
|
|
|
<thead> |
|
|
|
<thead> |
|
|
|
<tr> |
|
|
|
<tr> |
|
|
|
<th>Produit</th> |
|
|
|
<th class="text-left">Produit</th> |
|
|
|
<th>Couleur</th> |
|
|
|
<th>Couleur</th> |
|
|
|
<th>Taille</th> |
|
|
|
<th>Taille</th> |
|
|
|
<th>Quantité</th> |
|
|
|
<th>Quantité</th> |
|
|
|
<th class="price-column">Prix</th> |
|
|
|
<th class="price-column">Prix</th> |
|
|
|
|
|
|
|
<th>Actions</th> |
|
|
|
</tr> |
|
|
|
</tr> |
|
|
|
</thead> |
|
|
|
</thead> |
|
|
|
<tbody> |
|
|
|
<tbody> |
|
|
|
{% for item in cart_items %} |
|
|
|
{% for item in cart_items %} |
|
|
|
<tr class="{% cycle 'odd' 'even' %}"> |
|
|
|
<tr class="{% cycle 'odd' 'even' %}"> |
|
|
|
<td>{{ item.product.title }}</td> |
|
|
|
<td class="text-left">{{ item.product.title }}</td> |
|
|
|
<td>{{ item.color.name }}</td> |
|
|
|
<td>{{ item.color.name }}</td> |
|
|
|
<td>{{ item.size.name }}</td> |
|
|
|
<td>{{ item.size.name }}</td> |
|
|
|
<td>{{ item.quantity }}</td> |
|
|
|
<td> |
|
|
|
|
|
|
|
<div class="quantity-controls"> |
|
|
|
|
|
|
|
<form method="post" action="{% url 'shop:update_cart_item' %}" class="quantity-form"> |
|
|
|
|
|
|
|
{% csrf_token %} |
|
|
|
|
|
|
|
<input type="hidden" name="item_id" value="{{ item.id }}"> |
|
|
|
|
|
|
|
<button type="submit" name="action" value="decrease" class="quantity-btn" {% if item.quantity <= 1 %}disabled{% endif %}>-</button> |
|
|
|
|
|
|
|
<span class="quantity-value">{{ item.quantity }}</span> |
|
|
|
|
|
|
|
<button type="submit" name="action" value="increase" class="quantity-btn">+</button> |
|
|
|
|
|
|
|
</form> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</td> |
|
|
|
<td class="price-column">{{ item.get_total_price }} €</td> |
|
|
|
<td class="price-column">{{ item.get_total_price }} €</td> |
|
|
|
|
|
|
|
<td> |
|
|
|
|
|
|
|
<form method="post" action="{% url 'shop:remove_from_cart' %}" class="remove-form"> |
|
|
|
|
|
|
|
{% csrf_token %} |
|
|
|
|
|
|
|
<input type="hidden" name="item_id" value="{{ item.id }}"> |
|
|
|
|
|
|
|
<button type="submit" class="remove-btn">Supprimer</button> |
|
|
|
|
|
|
|
</form> |
|
|
|
|
|
|
|
</td> |
|
|
|
</tr> |
|
|
|
</tr> |
|
|
|
{% endfor %} |
|
|
|
{% endfor %} |
|
|
|
</tbody> |
|
|
|
</tbody> |
|
|
|
<tfoot> |
|
|
|
<tfoot> |
|
|
|
<tr> |
|
|
|
<tr> |
|
|
|
<td colspan="3" class="total-label">Total:</td> |
|
|
|
<td colspan="3" class="total-label text-left">Total:</td> |
|
|
|
<td class="total-quantity">{{ cart_items.total_quantity }}</td> |
|
|
|
<td class="total-quantity">{{ total_quantity }}</td> |
|
|
|
<td class="price-column total-price">{{ total }} €</td> |
|
|
|
<td class="price-column total-price">{{ total }} €</td> |
|
|
|
|
|
|
|
<td></td> |
|
|
|
</tr> |
|
|
|
</tr> |
|
|
|
</tfoot> |
|
|
|
</tfoot> |
|
|
|
</table> |
|
|
|
</table> |
|
|
|
|
|
|
|
|
|
|
|
<div class="cart-summary"> |
|
|
|
<div class="cart-summary"> |
|
|
|
{% if cart_items %} |
|
|
|
{% if cart_items %} |
|
|
|
<a class="cancel-nav-button" href="{% url 'shop:clear_cart' %}">Vider le panier</a> |
|
|
|
<a class="cancel-nav-button checkout-button" href="{% url 'shop:clear_cart' %}">Vider le panier</a> |
|
|
|
{% endif %} |
|
|
|
{% endif %} |
|
|
|
|
|
|
|
|
|
|
|
{% if user.is_authenticated %} |
|
|
|
{% if user.is_authenticated %} |
|
|
|
<!-- For authenticated users: Direct Stripe payment button --> |
|
|
|
<!-- For authenticated users: Direct Stripe payment button --> |
|
|
|
<button id="checkout-button" class="confirm-nav-button">Procéder au paiement</button> |
|
|
|
<button id="checkout-button" class="confirm-nav-button checkout-button">Procéder au paiement</button> |
|
|
|
{% else %} |
|
|
|
{% else %} |
|
|
|
<!-- For guest users: Regular checkout path --> |
|
|
|
<!-- For guest users: Regular checkout path --> |
|
|
|
<a class="confirm-nav-button" href="{% url 'shop:checkout' %}">Passer la commande</a> |
|
|
|
<a class="confirm-nav-button checkout-button" href="{% url 'shop:checkout' %}">Passer la commande</a> |
|
|
|
<div class="guest-checkout-notice"> |
|
|
|
<div class="guest-checkout-notice"> |
|
|
|
<p>Connectez-vous pour un paiement plus rapide.</p> |
|
|
|
<p>Connectez-vous pour un paiement plus rapide.</p> |
|
|
|
<a href="{% url 'login' %}?next={% url 'shop:view_cart' %}">Se connecter</a> |
|
|
|
<a class="styled-link" href="{% url 'login' %}?next={% url 'shop:view_cart' %}">Se connecter</a> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
{% endif %} |
|
|
|
{% endif %} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|