diff --git a/src/Entity/User.php b/src/Entity/User.php index 3a5ee84..3e67c34 100644 --- a/src/Entity/User.php +++ b/src/Entity/User.php @@ -90,6 +90,14 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface return array_unique($roles); } + public function getNomRole() : string { + return match ($this->getRoles()[0]) { + 'ROLE_ADMINISTRATEUR' => 'Administrateur', + 'ROLE_INSTRUCTEUR' => 'Instructeur', + default => 'Apprenti' + }; + } + public function setRoles(array $roles): self { $this->roles = $roles; diff --git a/templates/user/index.html.twig b/templates/user/index.html.twig index e2e3f7f..505c627 100644 --- a/templates/user/index.html.twig +++ b/templates/user/index.html.twig @@ -3,39 +3,42 @@ {% block title %}User index{% endblock %} {% block body %} -

User index

+
+
+

Liste des Utilisateurs

+
- - +
+
+ - - - - + + + - - - {% for user in users %} - - - - - - - - - {% else %} - - - - {% endfor %} - -
IdEmailRoles Nom PrenomactionsEmailRolesActions
{{ user.id }}{{ user.email }}{{ user.roles ? user.roles[0] : '' }}{{ user.nom }}{{ user.prenom }} - show - edit -
no records found
+ + + {% for user in users %} + + {{ user.nom }} + {{ user.prenom }} + {{ user.email }} + {{ user.nomRole }} + Voir + + {% else %} + + no records found + + {% endfor %} + + +
- Create new + + {% endblock %}