{% extends '@default/base.html.twig' %}
{% form_theme registrationForm _self %}

{% block title %}Register{% endblock %}


{% block form_row %}
    {%- set widget_attr = {} -%}
    {%- if help is not empty -%}
        {%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%}
    {%- endif -%}

    {{- form_label(form, null, {
        label_attr: { class: 'sr-only' }
    }) -}}
    {{- form_errors(form) -}}
    {{- form_widget(form, widget_attr) -}}
    {{- form_help(form) -}}
{% endblock %}


{% block body %}
    {% for flash_error in app.flashes('verify_email_error') %}
        <div class="alert alert-danger" role="alert">{{ flash_error }}</div>
    {% endfor %}

    <div class="container rounded">
        <div class="row">
            <div class="login-form bg-dark mt-4 p-4">
                <h1 class="h3 mb-3 font-weight-normal">Register</h1>

                {{ form_start(registrationForm, {
                    attr: { class: 'form-signin' }
                }) }}
                <input type="hidden" name="_csrf_token" value="{{ csrf_token('authenticate') }}">
                {{ form_row(registrationForm.username, {
                    attr: { placeholder: 'User name' }
                }) }}
                {{ form_row(registrationForm.email, {
                    attr: { placeholder: 'eMail' }
                }) }}
                {{ form_row(registrationForm.password.first, {
                    attr: { placeholder: 'Password'}
                }) }}
                {{ form_row(registrationForm.password.second, {
                    attr: { placeholder: 'Confirm password'}
                }) }}

                {{ form_row(registrationForm.agreeTerms) }}

                <button type="submit" class="btn btn-primary float-end">Register</button>
                {{ form_end(registrationForm) }}

            </div>
        </div>
    </div>

{% endblock %}


