72b6879f4b
- Refactored max_bot from nested packages to flat module structure - Q2: Extended BotUser model (patronymic, email, org, address, vcf_raw, contact_hash, phone_verified, email_verified, last_interaction, total_conversations, total_tickets) - Q2: VCF parser (FN, N, TEL, EMAIL, ORG, ADR), upsert on re-contact, NLP history context (_get_user_history_context -> YandexGPT) - Q1: Broadcast preview modal with 10s confirmation timer - Q3: CSS var(--white)->var(--bg-card), var(--text)->var(--text-primary) - Q4: bot_settings showNotification(), editable max_bot_id - Q5: Webhook secret passthrough via X-Max-Bot-Api-Secret - Masking sensitive keys, dialog_cleared handler, migrate via _add_column_if_not_exists() - Rate limit (asyncio.sleep 0.5 per 10), dead code removed, conv.intent context in contact.py - Portal pages: bot_consent, bot_kb (edit), bot_settings, bot_test, bot_tickets, portal_settings - Tests: 21/21 passing, added test_yandex_gpt.py, test_email_sender.py - Deploy: deploy_full.sh, schema.sql, seed_knowledge_base.sql
73 lines
5.1 KiB
HTML
73 lines
5.1 KiB
HTML
{% extends "page.html" %}
|
|
{% block page_content %}
|
|
<div class="card">
|
|
<div class="card-header"><h2>Сотрудники</h2>
|
|
<button class="btn btn-primary btn-sm" onclick="document.getElementById('modal-user').classList.add('open')">+ Добавить</button>
|
|
</div>
|
|
<div class="table-wrap">
|
|
<table><thead><tr><th>Логин</th><th>ФИО</th><th>Роль</th><th>Телефон</th><th>Email</th><th>MAX ID</th><th>Статус</th><th>Создан</th><th class="actions"></th></tr></thead>
|
|
<tbody>{% for u in users %}<tr>
|
|
<td>{{ u.login }}</td><td>{{ u.full_name }}</td>
|
|
<td><span class="badge badge-{{ u.role }}">{{ {'owner':'Владелец','engineer':'Инженер','technician':'Техник'}[u.role] }}</span></td>
|
|
<td>{{ u.phone }}</td><td>{{ u.email }}</td>
|
|
<td>{{ u.max_user_id or '—' }}</td>
|
|
<td><span class="badge badge-{{ 'active' if u.is_active else 'inactive' }}">{{ 'Активен' if u.is_active else 'Неактивен' }}</span></td>
|
|
<td>{{ u.created_at.strftime('%d.%m.%Y') if u.created_at else '' }}</td>
|
|
<td class="actions">
|
|
<button class="btn btn-secondary btn-sm" onclick="editUser({{ u.id }},'{{ u.login }}','{{ u.full_name }}','{{ u.role }}','{{ u.phone }}','{{ u.email }}','{{ u.max_user_id or '' }}',{{ 'true' if u.is_active else 'false' }})">✎</button>
|
|
{% if u.role != 'owner' %}
|
|
<form method="post" action="/service/users/delete" style="display:inline" onsubmit="return confirm('Удалить пользователя?')">
|
|
<input type="hidden" name="id" value="{{ u.id }}">
|
|
<button type="submit" class="btn btn-danger btn-sm">✕</button>
|
|
</form>{% endif %}
|
|
</td>
|
|
</tr>{% endfor %}</tbody></table>
|
|
</div>
|
|
</div>
|
|
<div class="modal-overlay" id="modal-user">
|
|
<div class="modal">
|
|
<button type="button" class="modal-close" onclick="this.closest('.modal-overlay').classList.remove('open')">✕</button>
|
|
<h2 id="modal-user-title">Новый сотрудник</h2>
|
|
<form method="post" id="modal-user-form" action="/service/users/create">
|
|
<input type="hidden" name="id" id="user-id" value="">
|
|
<div class="form-row">
|
|
<div class="form-group"><label>Логин</label><input type="text" name="login" id="user-login" required></div>
|
|
<div class="form-group"><label>Пароль <small>(оставьте пустым при редактировании)</small></label><input type="password" name="password" id="user-password"></div>
|
|
</div>
|
|
<div class="form-row">
|
|
<div class="form-group"><label>ФИО</label><input type="text" name="full_name" id="user-full_name" required></div>
|
|
<div class="form-group"><label>Роль</label><select name="role" id="user-role"><option value="engineer">Инженер</option><option value="technician">Техник</option></select></div>
|
|
</div>
|
|
<div class="form-row">
|
|
<div class="form-group"><label>Телефон</label><input type="text" name="phone" id="user-phone"></div>
|
|
<div class="form-group"><label>Email</label><input type="email" name="email" id="user-email"></div>
|
|
</div>
|
|
<div class="form-row">
|
|
<div class="form-group"><label>MAX ID (мессенджер)</label><input type="number" name="max_user_id" id="user-max_id" placeholder="ID пользователя в MAX"></div>
|
|
</div>
|
|
<div class="form-check"><input type="checkbox" name="is_active" id="user-is_active" value="1" checked><label for="user-is_active">Активен</label></div>
|
|
<div class="form-actions">
|
|
<button type="submit" class="btn btn-primary">Сохранить</button>
|
|
<button type="button" class="btn btn-secondary" onclick="this.closest('.modal-overlay').classList.remove('open')">Отмена</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
function editUser(id,login,name,role,phone,email,maxId,active){
|
|
document.getElementById('modal-user').classList.add('open');
|
|
document.getElementById('modal-user-title').textContent = 'Редактировать сотрудника';
|
|
document.getElementById('modal-user-form').action = '/service/users/edit';
|
|
document.getElementById('user-id').value = id;
|
|
document.getElementById('user-login').value = login; document.getElementById('user-login').required = false;
|
|
document.getElementById('user-full_name').value = name;
|
|
document.getElementById('user-role').value = role;
|
|
document.getElementById('user-phone').value = phone; document.getElementById('user-email').value = email;
|
|
document.getElementById('user-max_id').value = maxId || '';
|
|
document.getElementById('user-is_active').checked = active;
|
|
document.getElementById('user-password').required = false;
|
|
}
|
|
document.querySelector('#modal-user .modal-close').addEventListener('click', function(){ this.closest('.modal-overlay').classList.remove('open'); });
|
|
</script>
|
|
{% endblock %}
|