Ammelioration de la vue de la liste des utilisateurs
This commit is contained in:
parent
3dba806953
commit
897b9130c1
|
@ -90,6 +90,14 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
|
||||||
return array_unique($roles);
|
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
|
public function setRoles(array $roles): self
|
||||||
{
|
{
|
||||||
$this->roles = $roles;
|
$this->roles = $roles;
|
||||||
|
|
|
@ -3,39 +3,42 @@
|
||||||
{% block title %}User index{% endblock %}
|
{% block title %}User index{% endblock %}
|
||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<h1>User index</h1>
|
<div class="card mb-4">
|
||||||
|
<div class="card-header">
|
||||||
|
<h1 class="card-title">Liste des Utilisateurs</h1>
|
||||||
|
</div>
|
||||||
|
|
||||||
<table class="table">
|
<div class="card-body table-responsive">
|
||||||
<thead>
|
<table class="table align-middle">
|
||||||
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Id</th>
|
|
||||||
<th>Email</th>
|
|
||||||
<th>Roles</th>
|
|
||||||
<th>Nom</th>
|
<th>Nom</th>
|
||||||
<th>Prenom</th>
|
<th>Prenom</th>
|
||||||
<th>actions</th>
|
<th>Email</th>
|
||||||
|
<th>Roles</th>
|
||||||
|
<th style="text-align: center;">Actions</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for user in users %}
|
{% for user in users %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ user.id }}</td>
|
<td>{{ user.nom }}</td>
|
||||||
<td>{{ user.email }}</td>
|
<td>{{ user.prenom }}</td>
|
||||||
<td>{{ user.roles ? user.roles[0] : '' }}</td>
|
<td>{{ user.email }}</td>
|
||||||
<td>{{ user.nom }}</td>
|
<td>{{ user.nomRole }}</td>
|
||||||
<td>{{ user.prenom }}</td>
|
<td style="text-align: center;"><a class="btn btn-primary" href="{{ path('app_user_show', {'id': user.id}) }}">Voir</a></td>
|
||||||
<td>
|
</tr>
|
||||||
<a href="{{ path('app_user_show', {'id': user.id}) }}">show</a>
|
{% else %}
|
||||||
<a href="{{ path('app_user_edit', {'id': user.id}) }}">edit</a>
|
<tr>
|
||||||
</td>
|
<td colspan="7">no records found</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% else %}
|
{% endfor %}
|
||||||
<tr>
|
</tbody>
|
||||||
<td colspan="7">no records found</td>
|
</table>
|
||||||
</tr>
|
</div>
|
||||||
{% endfor %}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<a href="{{ path('app_user_new') }}">Create new</a>
|
<div class="card-footer">
|
||||||
|
<a class="btn btn-primary" href="{{ path('app_user_new') }}">Créer un Utilisateur</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
Loading…
Reference in New Issue