intra_max_chatbot/admin/templates/bot_users/list.html
2026-03-26 00:25:37 +03:00

74 lines
3.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.

{% extends "base.html" %}
{% block title %}Пользователи бота{% endblock %}
{% block content %}
<h1>Пользователи бота</h1>
<div class="card">
<div class="filter-bar">
<form method="get" style="display:flex;gap:8px;flex-wrap:wrap">
<select name="is_authorized" onchange="this.form.submit()">
<option value="">Все статусы</option>
<option value="1" {% if filter_authorized == 1 %}selected{% endif %}>Авторизованные</option>
<option value="0" {% if filter_authorized == 0 %}selected{% endif %}>Не авторизованные</option>
</select>
<select name="is_blocked" onchange="this.form.submit()">
<option value="">Блокировка: все</option>
<option value="1" {% if filter_blocked == 1 %}selected{% endif %}>Заблокированные</option>
<option value="0" {% if filter_blocked == 0 %}selected{% endif %}>Не заблокированные</option>
</select>
<select name="org_id" onchange="this.form.submit()">
<option value="">Все организации</option>
{% for org in orgs %}
<option value="{{ org.id }}" {% if filter_org_id == org.id %}selected{% endif %}>{{ org.name }}</option>
{% endfor %}
</select>
</form>
</div>
<table>
<thead>
<tr>
<th>#</th><th>MAX ID</th><th>Имя</th><th>Телефон</th>
<th>Организация</th><th>Статус</th><th>Дата</th><th>Разблокировать</th>
</tr>
</thead>
<tbody>
{% for u in users %}
<tr>
<td>{{ u.id }}</td>
<td>{{ u.max_user_id }}</td>
<td>{{ u.first_name or u.username or '—' }}</td>
<td>{{ u.phone or '—' }}</td>
<td>{{ u.org_name or '—' }}</td>
<td>
{% if u.is_blocked %}
<span class="badge badge-blocked">Заблокирован</span>
{% elif u.is_authorized %}
<span class="badge badge-auth">Авторизован</span>
{% else %}
<span class="badge badge-pending">Ожидает</span>
{% endif %}
</td>
<td>{{ u.created_at[:16] }}</td>
<td>
{% if u.is_blocked or not u.is_authorized %}
<form action="/admin/bot-users/{{ u.id }}/unblock" method="post"
style="display:flex;gap:6px;align-items:center">
<select name="org_id" required style="width:auto">
<option value="">орг</option>
{% for org in orgs %}
<option value="{{ org.id }}" {% if u.org_id == org.id %}selected{% endif %}>{{ org.name }}</option>
{% endfor %}
</select>
<button class="btn btn-primary" type="submit">Разблокировать</button>
</form>
{% else %}
{% endif %}
</td>
</tr>
{% else %}
<tr><td colspan="8" style="text-align:center;color:#999">Нет пользователей</td></tr>
{% endfor %}
</tbody>
</table>
</div>
{% endblock %}