Files
fotohost/app/templates/admin/users.html
T

80 lines
3.5 KiB
HTML

{% extends "base.html" %}
{% block title %}Пользователи — Админка{% endblock %}
{% block content %}
<section class="page-header page-header--admin">
<div class="container">
<h1 class="page-header__title">Пользователи</h1>
</div>
</section>
<section class="admin-section">
<div class="container">
{% include "admin/_nav.html" %}
{% include "partials/alerts.html" %}
<div class="admin-table-wrap">
<table class="admin-table">
<thead>
<tr>
<th>ID</th>
<th>Логин</th>
<th>Email</th>
<th>Фото</th>
<th>Роль</th>
<th>Статус</th>
<th>Дата</th>
<th>Действия</th>
</tr>
</thead>
<tbody>
{% for user in users %}
<tr>
<td>{{ user.id }}</td>
<td>{{ user.username }}</td>
<td>{{ user.email }}</td>
<td>{{ user.photo_count }}</td>
<td>
{% if user.is_admin %}
<span class="badge badge--admin">Админ</span>
{% else %}
<span class="badge">User</span>
{% endif %}
</td>
<td>
{% if user.is_active %}
<span class="badge badge--success">Активен</span>
{% else %}
<span class="badge badge--danger">Заблокирован</span>
{% endif %}
</td>
<td>{{ user.created_at.strftime('%d.%m.%Y') }}</td>
<td class="admin-actions">
{% if user.id != current_user.id %}
<form action="{{ url_for('admin.toggle_admin', user_id=user.id) }}" method="post">
<button type="submit" class="btn btn--ghost btn--sm">
{% if user.is_admin %}Снять admin{% else %}Сделать admin{% endif %}
</button>
</form>
<form action="{{ url_for('admin.toggle_active', user_id=user.id) }}" method="post">
<button type="submit" class="btn btn--ghost btn--sm">
{% if user.is_active %}Блок{% else %}Разблок{% endif %}
</button>
</form>
<form action="{{ url_for('admin.delete_user', user_id=user.id) }}" method="post" onsubmit="return confirm('Удалить пользователя и все его фото?');">
<button type="submit" class="btn btn--danger btn--sm">Удалить</button>
</form>
{% else %}
<span class="text-muted">Вы</span>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</section>
{% endblock %}