119 lines
5.7 KiB
HTML
119 lines
5.7 KiB
HTML
|
|
{% extends "base.html" %}
|
|||
|
|
{% block title %}Пользователи — Администрирование — ЭВОСИНК{% endblock %}
|
|||
|
|
|
|||
|
|
{% block content %}
|
|||
|
|
<div class="d-flex justify-between align-center mb-3">
|
|||
|
|
<h1 style="font-size:1.3rem; margin:0;"><i class="bi bi-people me-2"></i>Пользователи</h1>
|
|||
|
|
<span class="text-muted small">Всего: {{ total }}</span>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<article class="card mb-3">
|
|||
|
|
<div class="card-body">
|
|||
|
|
<form method="get" action="/admin/users" class="d-flex gap-2 flex-wrap align-center">
|
|||
|
|
<input type="text" name="search" value="{{ search }}" placeholder="Поиск по имени, email, телефону" style="flex:1; min-width:200px; margin:0;">
|
|||
|
|
<select name="status" style="width:auto; margin:0;">
|
|||
|
|
<option value="">Все статусы</option>
|
|||
|
|
<option value="pending" {% if status_filter == 'pending' %}selected{% endif %}>Ожидает</option>
|
|||
|
|
<option value="active" {% if status_filter == 'active' %}selected{% endif %}>Активен</option>
|
|||
|
|
<option value="suspended" {% if status_filter == 'suspended' %}selected{% endif %}>Заблокирован</option>
|
|||
|
|
</select>
|
|||
|
|
<select name="role" style="width:auto; margin:0;">
|
|||
|
|
<option value="">Все роли</option>
|
|||
|
|
<option value="user" {% if role_filter == 'user' %}selected{% endif %}>Пользователь</option>
|
|||
|
|
<option value="admin" {% if role_filter == 'admin' %}selected{% endif %}>Администратор</option>
|
|||
|
|
<option value="system" {% if role_filter == 'system' %}selected{% endif %}>Системный</option>
|
|||
|
|
</select>
|
|||
|
|
<button type="submit" class="sm">Найти</button>
|
|||
|
|
{% if search or status_filter or role_filter %}
|
|||
|
|
<a href="/admin/users" role="button" class="outline secondary sm">Сбросить</a>
|
|||
|
|
{% endif %}
|
|||
|
|
</form>
|
|||
|
|
</div>
|
|||
|
|
</article>
|
|||
|
|
|
|||
|
|
<article class="card">
|
|||
|
|
<div class="table-scroll">
|
|||
|
|
<table class="align-middle">
|
|||
|
|
<thead>
|
|||
|
|
<tr>
|
|||
|
|
<th>ID</th>
|
|||
|
|
<th>Имя</th>
|
|||
|
|
<th>Email</th>
|
|||
|
|
<th>Телефон</th>
|
|||
|
|
<th>Роль</th>
|
|||
|
|
<th>Статус</th>
|
|||
|
|
<th>Эвотор</th>
|
|||
|
|
<th>Регистрация</th>
|
|||
|
|
<th></th>
|
|||
|
|
</tr>
|
|||
|
|
</thead>
|
|||
|
|
<tbody>
|
|||
|
|
{% for u in users %}
|
|||
|
|
<tr>
|
|||
|
|
<td class="text-muted small">{{ u.id }}</td>
|
|||
|
|
<td>{{ u.first_name }} {{ u.last_name }}</td>
|
|||
|
|
<td>
|
|||
|
|
{{ u.email }}
|
|||
|
|
{% if not u.is_email_confirmed %}
|
|||
|
|
<span class="badge badge-warning ms-1" title="Email не подтверждён"><i class="bi bi-exclamation-circle"></i></span>
|
|||
|
|
{% endif %}
|
|||
|
|
</td>
|
|||
|
|
<td>{{ u.phone }}</td>
|
|||
|
|
<td>
|
|||
|
|
{% if u.role == 'system' %}<span class="badge badge-danger">Системный</span>
|
|||
|
|
{% elif u.role == 'admin' %}<span class="badge badge-warning">Админ</span>
|
|||
|
|
{% else %}<span class="badge badge-secondary">Польз.</span>
|
|||
|
|
{% endif %}
|
|||
|
|
</td>
|
|||
|
|
<td>
|
|||
|
|
{% if u.status == 'active' %}<span class="badge badge-success">Активен</span>
|
|||
|
|
{% elif u.status == 'pending' %}<span class="badge badge-warning">Ожидает</span>
|
|||
|
|
{% else %}<span class="badge badge-danger">Заблок.</span>
|
|||
|
|
{% endif %}
|
|||
|
|
</td>
|
|||
|
|
<td>
|
|||
|
|
{% if u.evotor_user_id %}
|
|||
|
|
<i class="bi bi-check-circle text-success" title="{{ u.evotor_user_id }}"></i>
|
|||
|
|
{% else %}
|
|||
|
|
<span class="text-muted">—</span>
|
|||
|
|
{% endif %}
|
|||
|
|
</td>
|
|||
|
|
<td class="text-muted small">{{ u.created_at | datefmt }}</td>
|
|||
|
|
<td>
|
|||
|
|
<a href="/admin/users/{{ u.id }}" role="button" class="outline sm">
|
|||
|
|
<i class="bi bi-eye"></i>
|
|||
|
|
</a>
|
|||
|
|
</td>
|
|||
|
|
</tr>
|
|||
|
|
{% else %}
|
|||
|
|
<tr>
|
|||
|
|
<td colspan="9" class="text-center text-muted py-4">Пользователи не найдены</td>
|
|||
|
|
</tr>
|
|||
|
|
{% endfor %}
|
|||
|
|
</tbody>
|
|||
|
|
</table>
|
|||
|
|
</div>
|
|||
|
|
{% if total_pages > 1 %}
|
|||
|
|
<footer>
|
|||
|
|
<div class="d-flex gap-2 justify-center align-center">
|
|||
|
|
{% if page > 1 %}
|
|||
|
|
<a href="?page={{ page - 1 }}&search={{ search }}&status={{ status_filter }}&role={{ role_filter }}" role="button" class="outline sm">«</a>
|
|||
|
|
{% endif %}
|
|||
|
|
<span class="text-muted small">Стр. {{ page }} из {{ total_pages }}</span>
|
|||
|
|
{% if page < total_pages %}
|
|||
|
|
<a href="?page={{ page + 1 }}&search={{ search }}&status={{ status_filter }}&role={{ role_filter }}" role="button" class="outline sm">»</a>
|
|||
|
|
{% endif %}
|
|||
|
|
</div>
|
|||
|
|
</footer>
|
|||
|
|
{% endif %}
|
|||
|
|
</article>
|
|||
|
|
|
|||
|
|
{% if user.role == 'system' %}
|
|||
|
|
<div class="mt-3 text-end">
|
|||
|
|
<a href="/admin/roles" role="button" class="outline secondary sm">
|
|||
|
|
<i class="bi bi-shield-lock me-1"></i>Управление ролями
|
|||
|
|
</a>
|
|||
|
|
</div>
|
|||
|
|
{% endif %}
|
|||
|
|
{% endblock %}
|