Merge pull request #20 in WFCC/cc34 from 18-utilisateurs to master
* commit 'ba7e2a60c62a212c46efaddc8a3704bf116fbfca': Modification style page pour ajouter un utilisateur Modification style page pour modifier un utilisateur Modification style page pour voir un utilisateur Ammelioration de la vue de la liste des utilisateurs
This commit is contained in:
commit
5e3f300359
|
@ -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;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<form method="post" action="{{ path('app_user_delete', {'id': user.id}) }}" onsubmit="return confirm('Are you sure you want to delete this item?');">
|
<form style="display:inline-block;" method="post" action="{{ path('app_user_delete', {'id': user.id}) }}" onsubmit="return confirm('Are you sure you want to delete this item?');">
|
||||||
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ user.id) }}">
|
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ user.id) }}">
|
||||||
<button class="btn">Delete</button>
|
<button class="btn btn-outline-danger">Supprimer</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -1,4 +1,20 @@
|
||||||
{{ form_start(form) }}
|
{{ form_start(form) }}
|
||||||
{{ form_widget(form) }}
|
{{ form_row(form.email) }}
|
||||||
<button class="btn">{{ button_label|default('Save') }}</button>
|
<div class="row">
|
||||||
|
<div class="col">
|
||||||
|
{{ form_row(form.nom) }}
|
||||||
|
</div>
|
||||||
|
<div class="col">
|
||||||
|
{{ form_row(form.prenom) }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% if form.plainPassword is defined %}
|
||||||
|
{{ form_row(form.plainPassword) }}
|
||||||
|
{% endif %}
|
||||||
|
{{ form_row(form.roles) }}
|
||||||
|
|
||||||
|
<div class="text-end">
|
||||||
|
<button class="btn btn-primary">{{ button_label|default('Ajouter') }}</button>
|
||||||
|
</div>
|
||||||
{{ form_end(form) }}
|
{{ form_end(form) }}
|
||||||
|
|
|
@ -3,11 +3,20 @@
|
||||||
{% block title %}Edit User{% endblock %}
|
{% block title %}Edit User{% endblock %}
|
||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<h1>Edit User</h1>
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<h1>Modifier l'utilisateur</h1>
|
||||||
|
</div>
|
||||||
|
|
||||||
{{ include('user/_form.html.twig', {'button_label': 'Update'}) }}
|
<div class="card-body">
|
||||||
|
{{ include('user/_form.html.twig', {'button_label': 'Mettre à jour'}) }}
|
||||||
|
</div>
|
||||||
|
|
||||||
<a href="{{ path('app_user_index') }}">back to list</a>
|
<div class="card-footer">
|
||||||
|
<a class="btn btn-outline-primary" href="{{ path('app_user_index') }}">Retour à la liste des
|
||||||
|
utilisateurs</a>
|
||||||
|
|
||||||
{{ include('user/_delete_form.html.twig') }}
|
{{ include('user/_delete_form.html.twig') }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -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 %}
|
||||||
|
|
|
@ -3,9 +3,19 @@
|
||||||
{% block title %}New User{% endblock %}
|
{% block title %}New User{% endblock %}
|
||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<h1>Create new User</h1>
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<h1 class="card-title">Ajouter un utilisateur</h1>
|
||||||
|
</div>
|
||||||
|
|
||||||
{{ include('user/_form.html.twig') }}
|
|
||||||
|
|
||||||
<a href="{{ path('app_user_index') }}">back to list</a>
|
<div class="card-body">
|
||||||
|
{{ include('user/_form.html.twig') }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card-footer">
|
||||||
|
<a class="btn btn-outline-primary" href="{{ path('app_user_index') }}">Retour à la liste des
|
||||||
|
utilisateurs</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -3,36 +3,45 @@
|
||||||
{% block title %}User{% endblock %}
|
{% block title %}User{% endblock %}
|
||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<h1>User</h1>
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<h1>Utilisateur</h1>
|
||||||
|
</div>
|
||||||
|
|
||||||
<table class="table">
|
<div class="card-body">
|
||||||
<tbody>
|
<table class="table">
|
||||||
<tr>
|
<tbody>
|
||||||
<th>Id</th>
|
<tr>
|
||||||
<td>{{ user.id }}</td>
|
<th>Id</th>
|
||||||
</tr>
|
<td>{{ user.id }}</td>
|
||||||
<tr>
|
</tr>
|
||||||
<th>Email</th>
|
<tr>
|
||||||
<td>{{ user.email }}</td>
|
<th>Email</th>
|
||||||
</tr>
|
<td>{{ user.email }}</td>
|
||||||
<tr>
|
</tr>
|
||||||
<th>Roles</th>
|
<tr>
|
||||||
<td>{{ user.roles ? user.roles[0] : '' }}</td>
|
<th>Roles</th>
|
||||||
</tr>
|
<td>{{ user.roles ? user.roles[0] : '' }}</td>
|
||||||
<tr>
|
</tr>
|
||||||
<th>Nom</th>
|
<tr>
|
||||||
<td>{{ user.nom }}</td>
|
<th>Nom</th>
|
||||||
</tr>
|
<td>{{ user.nom }}</td>
|
||||||
<tr>
|
</tr>
|
||||||
<th>Prenom</th>
|
<tr>
|
||||||
<td>{{ user.prenom }}</td>
|
<th>Prenom</th>
|
||||||
</tr>
|
<td>{{ user.prenom }}</td>
|
||||||
</tbody>
|
</tr>
|
||||||
</table>
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
<a href="{{ path('app_user_index') }}">back to list</a>
|
<div class="card-footer">
|
||||||
|
<a class="btn btn-outline-primary" href="{{ path('app_user_edit', {'id': user.id}) }}">Modifier</a>
|
||||||
|
|
||||||
<a href="{{ path('app_user_edit', {'id': user.id}) }}">edit</a>
|
<a class="btn btn-outline-primary" href="{{ path('app_user_index') }}">Retour à la liste des
|
||||||
|
utilisateurs</a>
|
||||||
|
|
||||||
{{ include('user/_delete_form.html.twig') }}
|
{{ include('user/_delete_form.html.twig') }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
Loading…
Reference in New Issue