<template x-if="currentIsInStock()">
<div class="flex flex-row items-center justify-center gap-3 mb-0 max-w-lg">
{% if quantity|default %}
<div>
<div class="group relative w-fit flex border border-gray-300 rounded-none items-center p-1 h-12 text-black">
<button @click="remove()" :disabled="amount === 1" aria-label="Decrement"
class="appearance-none bg-transparent rounded-none border-0 hover:bg-gray-50 disabled:opacity-30 active:bg-gray-100 disabled:hover:bg-transparent disabled:cursor-not-allowed motion-safe:transition-all p-3">
{% include 'assets/minus.svg' %}
</button>
<input class="!w-10 h-full text-center outline-none border-none {% if unit|default %} !pt-0 {% endif %}"
min="1" name="quantity" value="1" type="text" x-model="amount">
{% if unit|default %}
<div class="absolute bottom-1 start-1/2 -translate-x-1/2 flex items-center text-xs space-x-1 user-select-none -z-1 text-black">
<span x-text="amount > 1 ? '{{ unit }}' + 's' : '{{ unit }}'">{{ unit }}</span>
</div>
{% endif %}
<button @click="add()" aria-label="Increment"
class="appearance-none bg-transparent rounded-none border-0 hover:bg-gray-50 disabled:opacity-30 active:bg-gray-100 disabled:hover:bg-transparent disabled:cursor-not-allowed motion-safe:transition-all p-3">
{% include 'assets/plus.svg' %}
</button>
</div>
</div>
{% endif %}
<button id="addToCart"
data-redirect-to-cart="{{ cart_url }}"
class="w-full flex flex-row justify-center items-center gap-3 rounded-none bg-primary p-3 text-white text-center"
@click="addToCart()">
<svg id="loading_buy" class="hidden animate-spin h-5 w-5 text-white"
xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor"
stroke-width="4"></circle>
<path class="opacity-75" fill="currentColor"
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
</svg>
<span id="loading_buy_text">AƱadir a la cesta</span>
</button>
</div>
</template>
<template x-if="!currentIsInStock()">
<div class="flex flex-row items-center gap-3 mt-6">
<button id="addToCart"
class="no-stock w-full flex flex-row justify-center items-center gap-3 rounded-none bg-black p-3 text-white text-center">
<span>Producto agotado</span>
</button>
</div>
</template>