{% form_theme form 'bootstrap_5_layout.html.twig' %} {{ form_start(form, {'attr': {'class': 'needs-validation', 'novalidate': 'novalidate'}}) }} {# Message d'alerte global #} {% if not form.vars.valid %} {% endif %}
{# --- PHOTO DE PROFIL --- #}
{% if user.photo %} {% else %} {% endif %}
{{ form_widget(form.photo, { 'attr': { 'class': 'form-control form-control-sm', 'onchange': 'handleImagePreview(this)' } }) }} {# CORRECTION CASE SUPPRIMER PHOTO #} {% if form.delete_photo is defined %}
{{ form_widget(form.delete_photo, { 'attr': {'class': 'form-check-input'} }) }} {{ form_label(form.delete_photo, null, { 'label_attr': {'class': 'form-check-label small text-danger fw-bold'} }) }}
{% endif %}
{{ form_errors(form.photo) }}
{# --- IDENTITÉ --- #}
{{ form_row(form.civilite) }}
{{ form_row(form.nom) }}
{{ form_row(form.prenoms) }}
{# --- CONTACT --- #}
{{ form_row(form.email) }}
{{ form_row(form.telephone) }}
{# --- INFOS COMPLÉMENTAIRES --- #}
{{ form_row(form.adresse) }}
{# --- SÉCURITÉ (PASSWORD AVEC TOGGLE) --- #}
{# CORRECTION CASE CHANGER MOT DE PASSE (Switch) #} {% if form.change_password is defined %}
{{ form_widget(form.change_password, { 'attr': { 'class': 'form-check-input', 'onchange': 'togglePasswordFields(this)' } }) }}
{% endif %}
{# Correction du style inline initial selon l'état de la checkbox #} {% set displayStyle = (form.change_password is defined and not form.change_password.vars.checked) ? 'none' : 'block' %} {% if form.change_password is not defined %}{% set displayStyle = 'block' %}{% endif %}
{{ form_row(form.password.first, {'label': 'Nouveau mot de passe'}) }}
{{ form_row(form.password.second, {'label': 'Confirmer le mot de passe'}) }}
Le mot de passe doit contenir au moins 6 caractères.
{% if form.change_password is not defined %} Par défaut : Luxim2026 {% endif %}
{# --- ADMINISTRATION --- #} {% if form.roles is defined or form.poste is defined %}
{% if form.poste is defined %}
{{ form_row(form.poste) }}
{% endif %} {% if form.responsable is defined %}
{{ form_row(form.responsable) }}
{% endif %} {% if form.roles is defined %}
{{ form_row(form.roles) }}
{% endif %} {% if form.isActive is defined %}
{{ form_row(form.isActive) }}
{% endif %}
{% endif %}
{{ form_row(form.typePieceIdentite) }}
{{ form_row(form.numeroPieceIdentite) }}
{{ form_rest(form) }} {{ form_end(form) }}