{% extends '/admin/menu_left_admin.html.twig' %}

{% block title %} Création d'un nouvel agent {% endblock %}

{% block main %}
    {#<div class="row mt-5">#}
        {#<div class="col-lg-5" style="margin:0 30%">#}
            {#<h2>Création d'un agent</h2>#}
            {#{% if errors|length > 1 %}#}
                {#<div class="alert alert-danger">#}
                    {#Erreurs :#}
                    {#<ul>#}
                        {#{% for flashMessage in errors %}#}
                            {#<li>{{ flashMessage }}</li>#}
                        {#{% endfor %}#}
                    {#</ul>#}
                {#</div>#}
            {#{% else %}#}
                {#{% for flashMessage in errors %}#}
                    {#<div class="alert alert-danger">#}
                        {#Erreur :  {{ flashMessage }}#}
                    {#</div>#}
                {#{% endfor %}#}
            {#{% endif %}#}


            {#{{ form_start(form) }}#}
            {#{{ form_row(form.nom) }}#}
            {#{{ form_row(form.prenom) }}#}
            {#{{ form_row(form.email) }}#}
            {#{{ form_row(form.telephone) }}#}
            {#{{ form_row(form.isAdmin) }}#}
            {#{{ form_row(form.isActif) }}#}
            {#<small class="display-block font-color-dark-grey mt-8">Minimum 8 caractères, une majuscule, une minuscule et un chiffre.</small>#}
            {#{{ form_row(form.password) }}#}
            {#{{ form_row(form.confirmation) }}#}

            {#<button type="submit" class="btn btn-success">Submit</button>#}
            {#{{ form_end(form) }}#}

        {#</div>#}
    {#</div>#}

    {% if errors|length > 1 %}
        <div class="alert alert-danger">
            Erreurs :
            <ul>
                {% for flashMessage in errors %}
                    <li>{{ flashMessage }}</li>
                {% endfor %}
            </ul>
        </div>
    {% else %}
        {% for flashMessage in errors %}
            <div class="alert alert-danger">
                Erreur :  {{ flashMessage }}
            </div>
        {% endfor %}
    {% endif %}

    <div class="bloc-title mb-16">
        <h2 class="align-middle">Création d'un agent</h2>
    </div>
    <div class="row m-0">
        <div class="col-xs-5 plr-16 pt-16 pb-16 background-white">

            {{ form_start(form, { 'attr': { 'novalidate': 'novalidate' }}) }}
            <div class="form-group mb-16">
                {{ form_label(form.nom) }}
                {{ form_widget(form.nom, { 'attr': { 'class': 'inscription plr-16' }}) }}
                {{ form_errors(form.nom) }}
            </div>
            <div class="form-group mb-16">
                {{ form_label(form.prenom) }}
                {{ form_widget(form.prenom, { 'attr': { 'class': 'inscription plr-16' }}) }}
                {{ form_errors(form.prenom) }}
            </div>
            <div class="form-group mb-16">
                {{ form_label(form.email) }}
                {{ form_widget(form.email, { 'attr': { 'class': 'inscription plr-16' }}) }}
                {{ form_errors(form.email) }}
            </div>
            <div class="form-group mb-16">
                {{ form_label(form.telephone) }}
                {{ form_widget(form.telephone, { 'attr': { 'class': 'inscription plr-16' }}) }}
                {{ form_errors(form.telephone) }}
            </div>
            <div class="form-group mb-16">
                {{ form_label(form.isAdmin) }}
                {{ form_widget(form.isAdmin, { 'attr': { 'class': 'inscription plr-16' }}) }}
                {{ form_errors(form.isAdmin) }}
            </div>
            <div class="form-group mb-16">
                {{ form_label(form.isActif) }}
                {{ form_widget(form.isActif, { 'attr': { 'class': 'inscription plr-16' }}) }}
                {{ form_errors(form.isActif) }}
            </div>
            <div class="form-group mb-16">
                {{ form_label(form.password) }}
                {{ form_widget(form.password, { 'attr': { 'class': 'inscription plr-16' }}) }}
                {{ form_errors(form.password) }}
                <p class="help-block">Minimum 8 caractères, une majuscule, une minuscule et un chiffre.</p>
            </div>
            <div class="form-group mb-24">
                {{ form_label(form.confirmation) }}
                {{ form_widget(form.confirmation, { 'attr': { 'class': 'inscription plr-16' }}) }}
                {{ form_errors(form.confirmation) }}
            </div>

            <div class="text-right">
                <a href="{{ path('agents_list') }}" class="button-square-prev">{{ "BACK"|trans }}</a>
                <button type="submit" class="button-square">Valider</button>
            </div>
            {{ form_end(form) }}

        </div>
    </div>


{% endblock %}