{% if not form.vars.valid %}
    <div class="alert alert-danger alert-dismissible" role="alert">
        <h5>Les erreurs a corriger !</h5>
        {% if not form.vars.valid %}
            <ul class="list-error">
                {% for error in form.vars.errors %}
                    {% set error_label = error.origin.vars.label|default(error.origin.config.name|humanize) %}
                    <span class="title-error">
                        {{ error_label is same as(false) ? error.origin.config.name|humanize : error_label|trans(error.origin.vars.label_translation_parameters|default([]), error.origin.vars.translation_domain) }}
                    </span>
                    <li>{{ error.message }}</li>
                {% endfor %}
            </ul>
        {% endif %}
        {% for children in form.children %}
            {% if not children.vars.valid %}
                {% set child_label = children.vars.label|default(children.vars.name|humanize) %}
                <span class="title-error">
                    {{ child_label is same as(false) ? children.vars.name|humanize : child_label|trans(children.vars.label_translation_parameters|default([]), children.vars.translation_domain) }}
                </span>
                <ul>
                    {% for error in children.vars.errors.form.getErrors(true) %}
                        <li>{{ error.message }}</li>
                    {% endfor %}
                </ul>
            {% endif %}
        {% endfor %}
    </div>
{% endif %}

<div class="row">
    <div class="col-md-6">
        <div class="panel panel-info">
            <div class="panel-heading">
                Compte client
            </div>
            <div class="panel-body">
                {{ form_row(form.email) }}
                {{ form_row(form.plainPassword) }}
                {{ form_row(form.group) }}
                {{ form_row(form.marketingOptIn) }}
                {{ form_row(form.verified) }}
            </div>
        </div>
    </div>
</div>

<div class="row">
    <div class="col-md-6">
        <div class="panel panel-info">
            <div class="panel-heading">
                Adresse de facturation
            </div>
            <div class="panel-body">
                {{ form_row(form.invoiceAddress.differentAddress) }}
                {{ form_row(form.invoiceAddress.email) }}
                {{ form_row(form.invoiceAddress.company) }}
                {{ form_row(form.invoiceAddress.siret) }}
                {{ form_row(form.invoiceAddress.vatId) }}
                {{ form_row(form.invoiceAddress.firstname) }}
                {{ form_row(form.invoiceAddress.lastname) }}
                {{ form_row(form.invoiceAddress.street) }}
                {{ form_row(form.invoiceAddress.postal) }}
                {{ form_row(form.invoiceAddress.city) }}
                {{ form_row(form.invoiceAddress.country) }}
                {{ form_row(form.invoiceAddress.phone) }}
            </div>
        </div>
    </div>

    <div class="col-md-6">
        <div class="panel panel-info">
            <div class="panel-heading">
                Adresse de livraison
            </div>
            <div class="panel-body">
                {{ form_row(form.deliveryAddress.company) }}
                {{ form_row(form.deliveryAddress.siret) }}
                {{ form_row(form.deliveryAddress.vatId) }}
                {{ form_row(form.deliveryAddress.firstname) }}
                {{ form_row(form.deliveryAddress.lastname) }}
                {{ form_row(form.deliveryAddress.street) }}
                {{ form_row(form.deliveryAddress.postal) }}
                {{ form_row(form.deliveryAddress.city) }}
                {{ form_row(form.deliveryAddress.country) }}
                {{ form_row(form.deliveryAddress.phone) }}
            </div>
        </div>
    </div>
</div>

{{ form_rest(form) }}
