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

{% load django_bootstrap5 %}
{% load i18n %}

{% block page_title %}{% translate "Registration" %}{% endblock %}

{% block extra_include %}
    {% include 'bundles/bootstrap-css-bs5.html' %}
    {% include 'bundles/fontawesome.html' %}
    {% include 'bundles/bootstrap-js-bs5.html' %}
    {% include 'bundles/jquery-js.html' %}
{% endblock %}

{% block content %}
    <div class="row justify-content-center">
        <div class="col-md-6">
            <div class="card card-login border-secondary p-3">
                <div class="card-body">
                    <form method="POST">
                        {% csrf_token %}

                        {% if REGISTRATION_VERIFY_EMAIL %}
                            {% bootstrap_form form %}

                            <button class="btn btn-primary btn-block" type="submit">
                                {% translate "Register" %}
                            </button>
                        {% else %}
                            <input
                                type="hidden"
                                name="email"
                                maxlength="254"
                                class=" form-control"
                                required=""
                                id="id_email"
                                value="{{request.session.registration_uid}}@{{request.get_host}}"
                                readonly
                            >

                            <p class="text-center mb-0">
                                {% blocktranslate %}Redirecting to the {{ TNNT_TEMPLATE_ENTITY_NAME }} Auth system …{% endblocktranslate %}
                            </p>

                            <button class="d-none" type="submit">
                                {% translate "Register" %}
                            </button>

                            <script>
                                $(() => {
                                    $("button[type='submit']").click();
                                });
                            </script>
                        {% endif %}
                    </form>

                    {% if REGISTRATION_VERIFY_EMAIL %}
                        {% include 'public/lang_select.html' %}
                    {% endif %}
                </div>
            </div>
        </div>
    </div>
{% endblock %}
