{# Form theme personnalisé pour Sonata Admin Affiche automatiquement les entités avec icônes et badges colorés #} {# Block pour afficher une entité avec badge et icône #} {% block sonata_entity_with_badge %} {% set entity = value %} {% if entity is null %} N/A {% else %} {% set entityType = entity.__class|default('')|split('\\')|last %} {# Détection du type et affichage approprié #} {% if entityType == 'Adherent' %} {{ _self.render_adherent(entity) }} {% elseif entityType == 'Prestataire' %} {{ _self.render_prestataire(entity) }} {% elseif entityType == 'AccountAdherent' %} {{ _self.render_account_adherent(entity) }} {% elseif entityType == 'AccountPrestataire' %} {{ _self.render_account_prestataire(entity) }} {% elseif entityType == 'AccountGroupe' %} {{ _self.render_account_groupe(entity) }} {% elseif entityType == 'AccountComptoir' %} {{ _self.render_account_comptoir(entity) }} {% elseif entityType == 'AccountSiege' %} {{ _self.render_account_siege(entity) }} {% elseif entityType == 'Groupe' %} {{ _self.render_groupe(entity) }} {% elseif entityType == 'Comptoir' %} {{ _self.render_comptoir(entity) }} {% elseif entityType == 'Siege' %} {{ _self.render_siege(entity) }} {% else %} {# Fallback pour types non reconnus #} {{ entity }} {% endif %} {% endif %} {% endblock %} {# Macro pour rendre un adhérent #} {% macro render_adherent(entity) %} Adhérent {{ entity.user.firstname }} {{ entity.user.lastname }} {% endmacro %} {# Macro pour rendre un prestataire #} {% macro render_prestataire(entity) %} {% if entity.gestionnairesSsa is defined and entity.gestionnairesSsa|length > 0 %} Gestionnaire SSA {{ entity.raison }} {% else %} Prestataire {{ entity.raison }} {% endif %} {% endmacro %} {# Macro pour rendre un compte adhérent #} {% macro render_account_adherent(entity) %} Adhérent {{ entity.adherent.user.firstname }} {{ entity.adherent.user.lastname }} {% endmacro %} {# Macro pour rendre un compte prestataire #} {% macro render_account_prestataire(entity) %} {% if entity.prestataire.gestionnairesSsa is defined and entity.prestataire.gestionnairesSsa|length > 0 %} Gestionnaire SSA {{ entity.prestataire.raison }} {% else %} Prestataire {{ entity.prestataire.raison }} {% endif %} {% endmacro %} {# Macro pour rendre un compte groupe #} {% macro render_account_groupe(entity) %} Groupe Local {{ entity.groupe.name }} {% endmacro %} {# Macro pour rendre un groupe #} {% macro render_groupe(entity) %} Groupe Local {{ entity.name }} {% endmacro %} {# Macro pour rendre un compte comptoir #} {% macro render_account_comptoir(entity) %} Comptoir {{ entity.comptoir.name }} {% endmacro %} {# Macro pour rendre un comptoir #} {% macro render_comptoir(entity) %} Comptoir {{ entity.name }} {% endmacro %} {# Macro pour rendre un compte siège #} {% macro render_account_siege(entity) %} Siège {% endmacro %} {# Macro pour rendre un siège #} {% macro render_siege(entity) %} Siège {% endmacro %}