68 lines
3.0 KiB
HTML
68 lines
3.0 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>Admin Panel</title>
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
</head>
|
|
<body>
|
|
<div class="container py-5">
|
|
<h1 class="text-center mb-4">Admin Panel</h1>
|
|
<h2>Manage Users</h2>
|
|
<table class="table">
|
|
<thead>
|
|
<tr>
|
|
<th>Username</th>
|
|
<th>Role</th>
|
|
<th>Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for user in users %}
|
|
<tr>
|
|
<td>{{ user.username }}</td>
|
|
<td>{{ user.role }}</td>
|
|
<td>
|
|
<form action="{{ url_for('change_role', user_id=user.id) }}" method="post" class="d-inline">
|
|
<select name="role" class="form-select d-inline-block" style="width: auto;">
|
|
<option value="user" {% if user.role == 'user' %}selected{% endif %}>User</option>
|
|
<option value="admin" {% if user.role == 'admin' %}selected{% endif %}>Admin</option>
|
|
</select>
|
|
<button type="submit" class="btn btn-sm btn-primary">Change Role</button>
|
|
</form>
|
|
<form action="{{ url_for('delete_user', user_id=user.id) }}" method="post" class="d-inline">
|
|
<button type="submit" class="btn btn-sm btn-danger" onclick="return confirm('Are you sure you want to delete this user?');">Delete</button>
|
|
</form>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
|
|
<h2>Create New User</h2>
|
|
<form action="{{ url_for('create_user') }}" method="post">
|
|
<div class="mb-3">
|
|
<label for="username" class="form-label">Username</label>
|
|
<input type="text" class="form-control" id="username" name="username" required>
|
|
</div>
|
|
<div class="mb-3">
|
|
<label for="password" class="form-label">Password</label>
|
|
<input type="password" class="form-control" id="password" name="password" required>
|
|
</div>
|
|
<div class="mb-3">
|
|
<label for="role" class="form-label">Role</label>
|
|
<select class="form-select" id="role" name="role" required>
|
|
<option value="user">User</option>
|
|
<option value="admin">Admin</option>
|
|
</select>
|
|
</div>
|
|
<button type="submit" class="btn btn-success">Create User</button>
|
|
</form>
|
|
|
|
<div class="mt-4">
|
|
<a href="{{ url_for('dashboard') }}" class="btn btn-secondary">Back to Dashboard</a>
|
|
</div>
|
|
</div>
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/js/bootstrap.bundle.min.js"></script>
|
|
</body>
|
|
</html> |