61 lines
3.0 KiB
HTML
61 lines
3.0 KiB
HTML
{% extends "base.html" %}
|
|
|
|
{% block title %}Admin Panel{% endblock %}
|
|
|
|
{% block content %}
|
|
<div class="container mt-4">
|
|
<div class="card">
|
|
<div class="card-header bg-primary text-white">
|
|
<h4 class="mb-0">Admin Dashboard</h4>
|
|
</div>
|
|
<div class="card-body">
|
|
<h5>User Management</h5>
|
|
<div class="table-responsive">
|
|
<table class="table table-striped">
|
|
<thead>
|
|
<tr>
|
|
<th>ID</th>
|
|
<th>Email</th>
|
|
<th>Admin Status</th>
|
|
<th>Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for user in users %}
|
|
<tr>
|
|
<td>{{ user.id }}</td>
|
|
<td>{{ user.email }}</td>
|
|
<td>{% if user.admin %}Admin{% else %}User{% endif %}</td>
|
|
<td>
|
|
{% if user.admin %}
|
|
<form method="POST" action="{{ url_for('admin') }}" class="d-inline">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
|
|
<input type="hidden" name="user_id" value="{{ user.id }}">
|
|
<input type="hidden" name="action" value="demote">
|
|
<button type="submit" class="btn btn-sm btn-warning">Remove Admin</button>
|
|
</form>
|
|
{% else %}
|
|
<form method="POST" action="{{ url_for('admin') }}" class="d-inline">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
|
|
<input type="hidden" name="user_id" value="{{ user.id }}">
|
|
<input type="hidden" name="action" value="promote">
|
|
<button type="submit" class="btn btn-sm btn-success">Make Admin</button>
|
|
</form>
|
|
{% endif %}
|
|
<form method="POST" action="{{ url_for('admin') }}" class="d-inline" onsubmit="return confirm('Delete this user permanently?')">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
|
|
<input type="hidden" name="user_id" value="{{ user.id }}">
|
|
<input type="hidden" name="action" value="delete">
|
|
<button type="submit" class="btn btn-sm btn-danger">Delete</button>
|
|
</form>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endblock %}
|