morozovka-portal/app/templates/admin_users.html

83 lines
4.1 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<title>Админка — Morozovka Portal</title>
<style>
body { background: #0d1117; color: #e6edf3; font-family: sans-serif; padding: 40px; }
h2 { color: #58a6ff; }
table { width: 100%; border-collapse: collapse; margin-top: 20px; background: #161b22; }
th, td { padding: 12px; text-align: left; border-bottom: 1px solid #30363d; }
th { background: #21262d; color: #8b949e; font-size: 0.85rem; text-transform: uppercase; }
tr:hover { background: #21262d; }
.badge { padding: 4px 8px; border-radius: 4px; font-size: 0.8rem; font-weight: bold; }
.role-admin { background: #da3633; color: white; }
.role-professor { background: #f0883e; color: white; }
.role-lead { background: #d29922; color: white; }
.role-member { background: #238636; color: white; }
.role-student { background: #1f6feb; color: white; }
.role-guest { background: #30363d; color: white; }
select { padding: 6px; border-radius: 4px; background: #0d1117; color: white; border: 1px solid #30363d; }
button { padding: 6px 12px; background: #238636; color: white; border: none; border-radius: 4px; cursor: pointer; }
button:hover { background: #2ea043; }
button.danger { background: #da3633; }
button.danger:hover { background: #f85149; }
a { color: #58a6ff; text-decoration: none; }
.actions-cell { display: flex; gap: 10px; align-items: center; }
</style>
</head>
<body>
<h2>Управление пользователями</h2>
<p><a href="/">← На главную</a></p>
<table>
<thead>
<tr>
<th>ID</th>
<th>Логин</th>
<th>ФИО</th>
<th>Email</th>
<th>Роль</th>
<th>Действия</th>
</tr>
</thead>
<tbody>
{% for u in users %}
<tr>
<td>{{ u.id }}</td>
<td><strong>{{ u.username }}</strong></td>
<td>{{ u.full_name or '—' }}</td>
<td>{{ u.email or '—' }}</td>
<td>
<span class="badge role-{{ u.role }}">{{ u.role }}</span>
</td>
<td>
<div class="actions-cell">
<!-- Форма смены роли -->
<form action="/admin/users/{{ u.id }}/role" method="POST" style="display:flex; gap: 5px;">
<select name="role">
<option value="admin" {% if u.role == 'admin' %}selected{% endif %}>admin</option>
<option value="professor" {% if u.role == 'professor' %}selected{% endif %}>professor</option>
<option value="lead" {% if u.role == 'lead' %}selected{% endif %}>lead</option>
<option value="member" {% if u.role == 'member' %}selected{% endif %}>member</option>
<option value="student" {% if u.role == 'student' %}selected{% endif %}>student</option>
<option value="guest" {% if u.role == 'guest' %}selected{% endif %}>guest</option>
</select>
<button type="submit">Сменить</button>
</form>
<!-- Форма удаления (нельзя удалить себя) -->
{% if u.id != session.get('user_id') %}
<form action="/admin/users/{{ u.id }}/delete" method="POST" onsubmit="return confirm('Вы уверены, что хотите удалить пользователя {{ u.username }}?');">
<button type="submit" class="danger">Удалить</button>
</form>
{% endif %}
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</body>
</html>