51 lines
1.8 KiB
HTML
51 lines
1.8 KiB
HTML
{% extends "base.html" %}
|
||
{% block title %}Users – Location Management{% endblock %}
|
||
|
||
{% block content %}
|
||
<div class="d-flex align-items-center justify-content-between mb-4">
|
||
<h2 class="fw-bold mb-0"><i class="bi bi-people me-2 text-primary"></i>Users</h2>
|
||
<a href="{{ url_for('admin.add_user') }}" class="btn btn-primary">
|
||
<i class="bi bi-plus-circle me-1"></i> Add User
|
||
</a>
|
||
</div>
|
||
|
||
<div class="table-responsive">
|
||
<table class="table table-hover align-middle">
|
||
<thead class="table-dark">
|
||
<tr><th>Username</th><th>Role</th><th>Active</th><th></th></tr>
|
||
</thead>
|
||
<tbody>
|
||
{% for u in users %}
|
||
<tr>
|
||
<td class="fw-semibold">
|
||
{{ u.username }}
|
||
{% if u.id == current_user.id %}
|
||
<span class="badge text-bg-info ms-1">you</span>
|
||
{% endif %}
|
||
</td>
|
||
<td><span class="badge {% if u.role == 'admin' %}text-bg-primary{% else %}text-bg-secondary{% endif %}">{{ u.role }}</span></td>
|
||
<td>
|
||
{% if u.is_active %}
|
||
<i class="bi bi-check-circle-fill text-success"></i>
|
||
{% else %}
|
||
<i class="bi bi-x-circle-fill text-danger"></i>
|
||
{% endif %}
|
||
</td>
|
||
<td>
|
||
<a href="{{ url_for('admin.edit_user', user_id=u.id) }}" class="btn btn-sm btn-outline-secondary me-1">
|
||
<i class="bi bi-pencil"></i>
|
||
</a>
|
||
{% if u.id != current_user.id %}
|
||
<form method="POST" action="{{ url_for('admin.delete_user', user_id=u.id) }}" class="d-inline"
|
||
onsubmit="return confirm('Delete user {{ u.username }}?')">
|
||
<button class="btn btn-sm btn-outline-danger"><i class="bi bi-trash"></i></button>
|
||
</form>
|
||
{% endif %}
|
||
</td>
|
||
</tr>
|
||
{% endfor %}
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
{% endblock %}
|