73 lines
3.4 KiB
HTML
73 lines
3.4 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="inline-flex items-center rounded-lg justify-center p-4 hover:bg-gray-100 dark:hover:bg-gray-700 text-sm font-medium leading-none text-gray-900 dark:text-white cursor-pointer">
|
|
{% 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="absolute top-12 z-10 w-68 divide-y divide-gray-100 overflow-hidden overflow-y-auto rounded-lg bg-white
|
|
antialiased shadow dark:divide-gray-600 dark:bg-gray-700 right-0 p-4 hidden"
|
|
>
|
|
<div>
|
|
{% if cart.items.count == 0 %}
|
|
<h2 class="text-sm font-medium text-gray-900 dark:text-white">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 text-gray-900 dark:text-white 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 text-gray-500 dark:text-gray-400">
|
|
{{ 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 text-gray-500 dark:text-gray-400 mr-2">
|
|
{% translate 'Cantidad' %}: {{ cart_item.quantity }}
|
|
|
|
</span>
|
|
<button data-tooltip-target="tooltipRemoveItem1a" type="submit"
|
|
class="text-red-600 hover:text-red-700 dark:text-red-500 dark:hover: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 bg-gray-900 px-3 py-2 text-sm font-medium
|
|
text-white opacity-0 shadow-sm transition-opacity duration-300 dark:bg-gray-700"
|
|
>
|
|
{% translate 'Quitar del carrito' %}
|
|
<div class="tooltip-arrow" data-popper-arrow></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<hr class="h-px mx-4 my-2 bg-gray-200 border-0 dark:bg-gray-700" />
|
|
{% endfor %}
|
|
</div>
|
|
|
|
{% if cart.items.count > 0 %}
|
|
<a href="{% url 'web:cart_detail' %}"
|
|
class="mb-2 me-2 inline-flex w-full items-center justify-center rounded-lg bg-primary-700 px-5 py-2.5 text-sm
|
|
font-medium text-white hover:bg-primary-800 focus:outline-none focus:ring-4 focus:ring-primary-300
|
|
dark:bg-primary-600 dark:hover:bg-primary-700 dark:focus:ring-primary-800"
|
|
role="button"> {% translate 'Ver carrito' %}
|
|
</a>
|
|
{% endif %}
|
|
|
|
</div> |