{% extends "@templates/"~template~"/view/base.html.twig" %}

{% block content %}
    <section class="register">
        <div class="grid-container">
            <div class="grid-x">
                <div class="cell">
                    <h1>Zarejestruj się</h1>
                </div>
            </div>
            {% for message in app.flashes('register.success') %}
                <div class="grid-x messageNewAcount">
                    <div class="cell">
                        <div class="success callout">
                            <div class="flash-notice">
                                {{ message }}
                            </div>
                        </div>
                    </div>
                </div>
            {% else %}
                <div class="grid-x align-center">
                    <div class="cell ">
                        {{ form_start(form) }}
                        {% if form_errors(form) is not empty %}
                            <div class="callout alert">
                                {{ form_errors(form) }}
                            </div>
                        {% endif %}
                        <div class="fieldLogin">
                            {% if form_errors(form.email) is not empty %}
                                <div class="callout alert">
                                    {{ form_errors(form.email) }}
                                </div>
                            {% endif %}
                            {{ form_widget(form.email, {'attr': {'class': 'float-center'}}) }}
                        </div>
                        <div class="fieldPassword">
                            {% if form_errors(form.password) is not empty %}
                                <div class="callout alert">
                                    {{ form_errors(form.password) }}
                                </div>
                            {% endif %}
                            {{ form_widget(form.password, {'attr': {'class': 'float-center'}}) }}
                        </div>
                        <div class="fieldConfirm text-center">
                            {% if form_errors(form.confirm) is not empty %}
                                <div class="callout alert">
                                    {{ form_errors(form.confirm) }}
                                </div>
                            {% endif %}
                            {{ form_widget(form.confirm) }}
                            <label for="{{ form.confirm.vars.id }}">akceptuję </label>
                            <span data-open="regulations">regulamin</span>
                            <div class="reveal" id="regulations" data-reveal>
                                <h3>{{ regulations.title }}</h3>
                                {{ regulations.content|raw }}
                                <button class="close-button" data-close aria-label="Close modal" type="button">
                                    <span aria-hidden="true">&times;</span>
                                </button>
                            </div>
                        </div>
                        <div class="formLoginButton text-center">
                            <button type="submit" class="button">
                                <span>ZAŁÓŻ KONTO</span>
                            </button>
                        </div>
                        {{ form_end(form) }}
                    </div>
                </div>
                <div class="grid-x forgotPassword">
                    <div class="cell text-center">
                        <a href="{{ path('wi_front_user_login') }}" title="zaloguj się">
                            <span>Masz już konto? <strong>Zaloguj się.</strong></span>
                        </a>
                    </div>
                </div>
            {% endfor  %}
        </div>
    </section>
{% endblock %}