70 lines
2.6 KiB
HTML
70 lines
2.6 KiB
HTML
{% load i18n %}
|
|
<button
|
|
hx-on:click="htmx.toggleClass(htmx.find('#myCartDropdown1'), 'hidden'); htmx.addClass(htmx.find('#userDropdown1'), 'hidden')"
|
|
id="myCartDropdownButton1"
|
|
data-dropdown-toggle="myCartDropdown1" type="button"
|
|
class="icon-button">
|
|
{% include 'components/icons/cart.svg' %}
|
|
<span class="hidden sm:flex">
|
|
{% translate 'Carrito' %}</span>
|
|
<span class="ml-1">({{ cart.items.count }})</span>
|
|
</button>
|
|
|
|
<!-- Cart -->
|
|
<div id="myCartDropdown1"
|
|
class="cart-navbar-floating hidden"
|
|
>
|
|
<div>
|
|
{% if cart.items.count == 0 %}
|
|
<h2 class="text-sm font-medium ">No hay nada en el carrito</h2>
|
|
{% endif %}
|
|
|
|
{% for cart_item in cart.items.all %}
|
|
<div>
|
|
<a href="{% url 'web:product_detail' pk=cart_item.product.pk slug=cart_item.product.slug %}"
|
|
class="text-sm font-semibold leading-none hover:underline">
|
|
{{ cart_item.product.name }}
|
|
</a>
|
|
|
|
<div class="flex items-center justify-between gap-6">
|
|
<p
|
|
class="mt-0.5 truncate text-sm font-normal ">
|
|
{{ cart_item.product.price.price_with_tax }}€
|
|
</p>
|
|
|
|
<form hx-post="{% url 'web:delete_cart_item' pk=cart_item.pk %}"
|
|
hx-swap="none">
|
|
<span class="mt-0.5 truncate text-sm font-normal mr-2">
|
|
{% translate 'Cantidad' %}: {{ cart_item.quantity }}
|
|
|
|
</span>
|
|
<button data-tooltip-target="tooltipRemoveItem1a" type="submit"
|
|
class="text-red-600 hover:text-red-700 :text-red-600 cursor-pointer"
|
|
>
|
|
{% csrf_token %}
|
|
<span class="sr-only">{% translate 'Quitar' %}</span>
|
|
{% include 'components/icons/remove.svg' %}
|
|
</button>
|
|
</form>
|
|
|
|
<div id="tooltipRemoveItem1a" role="tooltip"
|
|
class="tooltip invisible absolute z-10 inline-block rounded-lg px-3 py-2 text-sm font-medium
|
|
text-white opacity-0 shadow-sm transition-opacity duration-300 "
|
|
>
|
|
{% translate 'Quitar del carrito' %}
|
|
<div class="tooltip-arrow" data-popper-arrow></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<hr class="h-px mx-4 my-2 " />
|
|
{% endfor %}
|
|
</div>
|
|
|
|
{% if cart.items.count > 0 %}
|
|
<a href="{% url 'web:cart_detail' %}"
|
|
class="btn btn-primary"
|
|
role="button"> {% translate 'Ver carrito' %}
|
|
</a>
|
|
{% endif %}
|
|
|
|
</div> |