<div class="quickAddToBasket">

    <button class="close">
        <i class="far fa-times"></i>
    </button>

    <form action="/shop/addtobasket.php" method="post" class="addtobasket">

        {% if settings.DIRECT_TO_BASKET != true %}
            <div class="success addedToBasket hideme">
                Item(-s) added to bag. <a href="/shop/checkout/basket.php">Click here to view bag.</a>
            </div>

            <div class="error errorAddingToBasket hideme">
                Please select a size to proceed
            </div>

            <div class="error errorAddingToBasketQuantity hideme">
                Please select a quantity to proceed
            </div>

            <div class="error errorAddingToBasketNHS hideme">
                There are NHS prescriptions in your basket. Please complete the order first or remove NHS prescriptions from the basket.
            </div>
        {% endif %}

        {% if item.sizes|length > 0 %}

            {% if item.sizes|length < 4 %}

                <div class="rowsWrap rowsFourWrap">

                    {% for size in item.sizes %}

                        {% if (size.stock > 0 and size.hide != 1) %}

                            <div class="row">

                                <label for="size[{{ size.id }}]" class="sizeLabel">
                                    <span class="sizeName">{{ size.size }}</span>
                                    {# Calculate price #}
                                    {% if size.display_price > 0 %}
                                        {% if size.sale_price > 0 %}
                                            {% set size_price = size.sale_price %}
                                            <span class="priceWas">{{ size.price|multi_currency|raw }}</span>
                                            <span class="priceNow">{{ size.sale_price|multi_currency|raw }}</span>
                                        {% else %}
                                            {% set size_price = size.price %}
                                            <span class="priceNow">{{ size.price|multi_currency|raw }}</span>
                                        {% endif %}
                                    {% else %}
                                        {% if item.sale_price > 0 %}
                                            {% set size_price = item.sale_price %}
                                            <span class="priceNow">{{ item.sale_price|multi_currency|raw }}</span>
                                        {% else %}
                                            {% set size_price = item.price %}
                                            <span class="priceNow">{{ item.price|multi_currency|raw }}</span>
                                        {% endif %}
                                    {% endif %}
                                </label>

                                <div class="inputWrap">
                                    <input type="tel"
                                        class="numberArrows"
                                        id="size[{{ size.id }}]"
                                        name="size[{{ size.id }}]"
                                        value="0"
                                        data-price="{{ size_price }}"
                                        data-min="0"
                                        data-max="999"
                                    />
                                </div>

                            </div>

                        {% endif %}

                    {% endfor %}

                </div> <!-- .rowsFourWrap -->

            {% else %}

                <div class="rowsWrap rowsSingleWrap">

                    {{ include ('shop/item/sizes.twig') }}

                    <div class="row">

                        <label for="quantity_{{ item.id }}">Quantity</label>

                        <div class="inputWrap">
                            <input type="tel"
                                id="quantity_{{ item.id }}"
                                name="quantity"
                                value="0"
                                data-min="0"
                                data-max="999"
                            />
                        </div>

                    </div>

                </div> <!-- .rowsSingleWrap -->

            {% endif %}

        {% else %}

            <div class="rowsWrap rowsFourWrap">
                <div class="row">

                    <label for="size[{{ size.id }}]" class="sizeLabel">
                        <span class="sizeName">{{ size.size }}</span>
                        {# Calculate price #}
                        {% if size.display_price > 0 %}
                            {% if size.sale_price > 0 %}
                                {% set size_price = size.sale_price %}
                                <span class="priceWas">{{ size.price|multi_currency|raw }}</span>
                                <span class="priceNow">{{ size.sale_price|multi_currency|raw }}</span>
                            {% else %}
                                {% set size_price = size.price %}
                                <span class="priceNow">{{ size.price|multi_currency|raw }}</span>
                            {% endif %}
                        {% else %}
                            {% if item.sale_price > 0 %}
                                {% set size_price = item.sale_price %}
                                <span class="priceNow">{{ item.sale_price|multi_currency|raw }}</span>
                            {% else %}
                                {% set size_price = item.price %}
                                <span class="priceNow">{{ item.price|multi_currency|raw }}</span>
                            {% endif %}
                        {% endif %}
                    </label>

                    <div class="inputWrap">
                        <input type="tel"
                            class="numberArrows"
                            id="size[{{ size.id }}]"
                            name="size[{{ size.id }}]"
                            value="0"
                            data-price="{{ size_price }}"
                            data-min="0"
                            data-max="999"
                        />
                    </div>

                </div>

            </div>

        {% endif %}

        <input type="hidden" name="action" value="addtobasket" />
        <input type="hidden" name="id" value="{{ item.id }}" />

        <div class="bottomWrap">
            {% if item.sizes|length < 5 %}
                <div class="totalWrap">
                    <span class="title">Total:</span>
                    <span class="total">&pound;<span class="amount">0.00</span></span>
                </div>
            {% endif %}
            <div class="buttonWrap">
                 <button type="submit" class="button js_addToBasketButton">Add to bag</button>
            </div>
        </div>


    </form>

</div><!-- .quickAddToBasket -->
