157 lines
5.5 KiB
HTML
157 lines
5.5 KiB
HTML
{% extends "dashboard/base.html" %}
|
|
|
|
{% block title %}Gestione Utenti - Dashboard{% endblock %}
|
|
|
|
{% block dashboard_content %}
|
|
<div class="dashboard-header">
|
|
<h1 class="dashboard-title">
|
|
<i class="fas fa-users"></i>
|
|
Gestione Utenti
|
|
</h1>
|
|
<div class="dashboard-actions">
|
|
<span class="badge badge-info">{{ pagination.total_items if pagination else 0 }} utenti totali</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="dashboard-content">
|
|
{% if users %}
|
|
<div class="table-responsive">
|
|
<table class="table table-striped table-hover">
|
|
<thead class="table-dark">
|
|
<tr>
|
|
<th>ID</th>
|
|
<th>Username</th>
|
|
<th>Nome Completo</th>
|
|
<th>Email</th>
|
|
<th>Ruolo</th>
|
|
<th>Stato</th>
|
|
<th>Registrato</th>
|
|
<th>Ultimo Accesso</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for user in users %}
|
|
<tr>
|
|
<td>{{ user.id }}</td>
|
|
<td>
|
|
<strong>{{ user.username }}</strong>
|
|
{% if user.is_admin %}
|
|
<span class="badge badge-danger ms-1">Admin</span>
|
|
{% endif %}
|
|
</td>
|
|
<td>{{ user.full_name or '-' }}</td>
|
|
<td>{{ user.email }}</td>
|
|
<td>
|
|
<span class="badge {% if user.role == 'admin' %}badge-danger{% else %}badge-secondary{% endif %}">
|
|
{{ user.role.title() }}
|
|
</span>
|
|
</td>
|
|
<td>
|
|
<span class="badge {% if user.is_active %}badge-success{% else %}badge-warning{% endif %}">
|
|
{% if user.is_active %}Attivo{% else %}Inattivo{% endif %}
|
|
</span>
|
|
</td>
|
|
<td>
|
|
{% if user.created_at %}
|
|
<small>{{ user.created_at.strftime('%d/%m/%Y %H:%M') }}</small>
|
|
{% else %}
|
|
-
|
|
{% endif %}
|
|
</td>
|
|
<td>
|
|
{% if user.last_login %}
|
|
<small>{{ user.last_login.strftime('%d/%m/%Y %H:%M') }}</small>
|
|
{% else %}
|
|
<span class="text-muted">Mai</span>
|
|
{% endif %}
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<!-- Pagination -->
|
|
{% if pagination and pagination.total_pages > 1 %}
|
|
<nav aria-label="User pagination" class="mt-4">
|
|
<ul class="pagination justify-content-center">
|
|
{% if pagination.has_prev %}
|
|
<li class="page-item">
|
|
<a class="page-link" href="{{ url_for('dashboard.users', page=pagination.prev_num) }}">
|
|
<i class="fas fa-chevron-left"></i> Precedente
|
|
</a>
|
|
</li>
|
|
{% endif %}
|
|
|
|
{% for page_num in pagination.iter_pages() %}
|
|
{% if page_num %}
|
|
{% if page_num != pagination.page %}
|
|
<li class="page-item">
|
|
<a class="page-link" href="{{ url_for('dashboard.users', page=page_num) }}">{{ page_num }}</a>
|
|
</li>
|
|
{% else %}
|
|
<li class="page-item active">
|
|
<span class="page-link">{{ page_num }}</span>
|
|
</li>
|
|
{% endif %}
|
|
{% else %}
|
|
<li class="page-item disabled">
|
|
<span class="page-link">…</span>
|
|
</li>
|
|
{% endif %}
|
|
{% endfor %}
|
|
|
|
{% if pagination.has_next %}
|
|
<li class="page-item">
|
|
<a class="page-link" href="{{ url_for('dashboard.users', page=pagination.next_num) }}">
|
|
Successivo <i class="fas fa-chevron-right"></i>
|
|
</a>
|
|
</li>
|
|
{% endif %}
|
|
</ul>
|
|
</nav>
|
|
{% endif %}
|
|
{% else %}
|
|
<div class="alert alert-info text-center">
|
|
<i class="fas fa-info-circle fa-2x mb-3"></i>
|
|
<h4>Nessun utente trovato</h4>
|
|
<p class="mb-0">Non ci sono utenti registrati nel sistema.</p>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<style>
|
|
.dashboard-header {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
margin-bottom: 2rem;
|
|
padding-bottom: 1rem;
|
|
border-bottom: 2px solid #e9ecef;
|
|
}
|
|
|
|
.dashboard-title {
|
|
color: #495057;
|
|
margin: 0;
|
|
font-weight: 600;
|
|
}
|
|
|
|
.dashboard-title i {
|
|
color: #6c757d;
|
|
margin-right: 0.5rem;
|
|
}
|
|
|
|
.table th {
|
|
font-weight: 600;
|
|
border-top: none;
|
|
}
|
|
|
|
.badge {
|
|
font-size: 0.75em;
|
|
}
|
|
|
|
.alert i {
|
|
color: #0dcaf0;
|
|
}
|
|
</style>
|
|
{% endblock %} |