Rôles, tableau de bord et tests unitaires
This commit is contained in:
parent
f508a2fcb5
commit
1799035236
51 changed files with 4350 additions and 0 deletions
53
templates/admin/users.html.twig
Normal file
53
templates/admin/users.html.twig
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
{% extends 'base.html.twig' %}
|
||||
{% block title %}Users - ServerControl{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<h1 class="h3 mb-4">User Management</h1>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body p-0">
|
||||
<table class="table table-hover mb-0">
|
||||
<thead class="table-dark">
|
||||
<tr>
|
||||
<th>Pseudo</th><th>Email</th><th>Roles</th><th>Status</th><th>Registered</th><th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for user in users %}
|
||||
<tr class="{{ not user.active ? 'table-secondary text-muted' : '' }}">
|
||||
<td>{{ user.pseudo }}</td>
|
||||
<td>{{ user.email }}</td>
|
||||
<td>
|
||||
{% for role in user.roles %}
|
||||
{% if role != 'ROLE_USER' %}
|
||||
<span class="badge bg-{{ role == 'ROLE_ADMIN' ? 'danger' : 'primary' }}">{{ role }}</span>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</td>
|
||||
<td>
|
||||
<span class="badge bg-{{ user.active ? 'success' : 'secondary' }}">
|
||||
{{ user.active ? 'Active' : 'Disabled' }}
|
||||
</span>
|
||||
</td>
|
||||
<td>{{ user.createdAt|date('d/m/Y') }}</td>
|
||||
<td>
|
||||
<a href="{{ path('app_admin_user_edit', {id: user.id}) }}" class="btn btn-sm btn-outline-secondary">
|
||||
<i class="bi bi-pencil"></i>
|
||||
</a>
|
||||
{% if user != app.user %}
|
||||
<form method="post" action="{{ path('app_admin_user_toggle', {id: user.id}) }}" class="d-inline">
|
||||
<input type="hidden" name="_token" value="{{ csrf_token('toggle_user_' ~ user.id) }}">
|
||||
<button class="btn btn-sm btn-outline-{{ user.active ? 'warning' : 'success' }}"
|
||||
title="{{ user.active ? 'Disable' : 'Enable' }}">
|
||||
<i class="bi bi-{{ user.active ? 'person-x' : 'person-check' }}"></i>
|
||||
</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
Loading…
Add table
Add a link
Reference in a new issue