{% extends 'tournaments/base.html' %}

{% block head_title %}La Boutique{% endblock %}
{% block first_title %}Padel Club{% endblock %}
{% block second_title %}La Boutique{% endblock %}

{% block content %}

<nav class="margin10">
    <a href="{% url 'shop:product_list' %}">La Boutique</a>
    <a href="{% url 'index' %}" class="orange">Accueil</a>
    <a href="{% url 'clubs' %}" class="orange">Clubs</a>
    {% if user.is_authenticated %}
        <a href="{% url 'my-tournaments' %}" class="orange">Mes tournois</a>
        <a href="{% url 'profile' %}">Mon compte</a>
    {% else %}
        <a href="{% url 'login' %}">Se connecter</a>
    {% endif %}
</nav>
<h1 class="club my-block topmargin20">Validation de la commande</h1>
<div class="grid-x">
    <div class="small-12 medium-6 large-6 my-block">
        <div class="bubble checkout-container">
            {% if request.user.is_authenticated %}
                <div class="checkout-section">
                    <p>Vous êtes déjà connecté en tant que <strong>{{ request.user.email }}</strong>.</p>
                    <a href="{% url 'shop:checkout' %}" class="checkout-button confirm-nav-button">Passer à la commande</a>
                </div>
            {% else %}
                <div class="checkout-section">
                    <h3 class="checkout-title">Finaliser votre commande</h3>
                    <p class="checkout-description">Vous n'êtes pas connecté. Veuillez choisir une option :</p>
                </div>

                <div class="checkout-section">
                    <form method="post" class="guest-checkout-form">
                        {% csrf_token %}
                        <div class="form-fields">
                            {{ form.as_p }}
                        </div>
                        <div class="button-container">
                            <button class="checkout-button confirm-nav-button" type="submit" name="guest_checkout">Continuer sans créer de compte</button>
                        </div>
                    </form>
                </div>

                <div class="checkout-section checkout-options">
                    <p>Ou <a class="styled-link" href="{% url 'login' %}?next={% url 'shop:checkout' %}">connectez-vous</a> si vous avez déjà un compte.</p>
                    <p>Pas encore de compte ? <a class="styled-link" href="{% url 'signup' %}?next={% url 'shop:checkout' %}">Créez-en un maintenant</a></p>
                </div>
            {% endif %}
        </div>
    </div>
</div>
{% endblock %}
