60 lines
2.4 KiB
HTML
60 lines
2.4 KiB
HTML
{% extends "base.html" %}
|
|
|
|
{% block title %}User Management{% endblock %}
|
|
|
|
{% block content %}
|
|
<div class="row mb-4">
|
|
<div class="col-md-6">
|
|
<h2><i class="bi bi-people-fill"></i> User Management</h2>
|
|
</div>
|
|
<div class="col-md-6 text-end">
|
|
<a href="{{ url_for('auth.create_user') }}" class="btn btn-primary">
|
|
<i class="bi bi-plus-circle"></i> Add User
|
|
</a>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card shadow-sm">
|
|
<div class="card-body">
|
|
<div class="table-responsive">
|
|
<table class="table table-hover">
|
|
<thead class="table-light">
|
|
<tr>
|
|
<th>Username</th>
|
|
<th>Email</th>
|
|
<th>Role</th>
|
|
<th>Created</th>
|
|
<th width="150">Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for user in users %}
|
|
<tr>
|
|
<td><strong>{{ user.username }}</strong></td>
|
|
<td>{{ user.email }}</td>
|
|
<td>
|
|
<span class="badge bg-{% if user.role == 'admin' %}danger{% elif user.role == 'supervisor' %}warning{% else %}info{% endif %}">
|
|
{{ user.role|title }}
|
|
</span>
|
|
</td>
|
|
<td>{{ user.created_at.strftime('%Y-%m-%d') }}</td>
|
|
<td>
|
|
<a href="{{ url_for('auth.edit_user', user_id=user.id) }}" class="btn btn-sm btn-outline-primary">
|
|
<i class="bi bi-pencil"></i>
|
|
</a>
|
|
{% if user.id != current_user.id %}
|
|
<form method="POST" action="{{ url_for('auth.delete_user', user_id=user.id) }}" class="d-inline" onsubmit="return confirm('Delete this user?');">
|
|
<button type="submit" class="btn btn-sm btn-outline-danger">
|
|
<i class="bi bi-trash"></i>
|
|
</button>
|
|
</form>
|
|
{% endif %}
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endblock %} |