86 lines
3.5 KiB
HTML
86 lines
3.5 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-2 hover:bg-gray-100 dark:hover:bg-gray-700 text-sm font-medium leading-none text-gray-900 dark:text-white">
|
|
<span class="sr-only">
|
|
{% blocktranslate %}
|
|
Carrito
|
|
{% endblocktranslate %}({{ cart.items.count }})
|
|
</span>
|
|
{% include 'components/icons/cart.svg' %}
|
|
<span class="sm:flex">
|
|
{% blocktranslate %}
|
|
Carrito
|
|
{% endblocktranslate %}({{ cart.items.count }})</span>
|
|
</button>
|
|
|
|
<!-- Cart -->
|
|
<div id="myCartDropdown1"
|
|
class="absolute top-10 z-10 mx-auto max-w-sm space-y-4 overflow-hidden rounded-lg bg-white p-4 antialiased shadow-lg dark:bg-gray-800 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="#"
|
|
class="truncate 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"
|
|
>
|
|
{% 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>
|
|
|
|
|
|
{% 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-gray-200 px-5 py-2.5 text-sm
|
|
font-medium dark:text-white hover:bg-gray-300 focus:outline-none focus:ring-4 focus:ring-gray-300
|
|
dark:bg-gray-600 dark:hover:bg-gray-700 dark:focus:ring-gray-800"
|
|
role="button"> {% translate 'Ver carrito' %}
|
|
</a>
|
|
<a href="#" title=""
|
|
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 'Ir a pagar' %}
|
|
</a>
|
|
{% endif %}
|
|
|
|
</div> |