Files
dev 56f160165f feat(users): модалка статистики пользователя
Добавлена модалка статистики на страницу users.html:
- GET /api/users/:id/stats возвращает список групп тьютора (group_list)
- Кнопка 'Статистика' в строке каждого пользователя
- Модалка с карточками: записи в журнале, короткие сообщения, отзывы,
  отчёты о занятиях, группы + список групп с расписанием и филиалом
- Исправлена ссылка на список пользователей (allUsers вместо локальной users)
2026-12-01 15:43:55 +03:00

132 lines
6.2 KiB
HTML

<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Пользователи — Админ-панель</title>
<link rel="stylesheet" href="admin.css">
<link rel="stylesheet" href="/admin-dark.css" disabled id="themeCss">
<script src="js/theme.js"></script>
</head>
<body data-page="users">
<div class="layout">
<div class="sidebar" id="sidebar"></div>
<div class="main">
<div class="page-head">
<h2>Пользователи</h2>
<p class="page-sub">Управление доступом и ролями</p>
</div>
<div class="actions-row" style="margin-bottom:16px">
<button class="btn-primary" id="addUserBtn" type="button">
<span style="font-size:1.2rem">+</span> Добавить пользователя
</button>
</div>
<div class="audit-wrap">
<table class="audit-table" id="usersTable">
<thead>
<tr>
<th>ID</th>
<th>Цвет</th>
<th>Логин</th>
<th>Имя</th>
<th>Роль</th>
<th>Филиалы</th>
<th>Статус</th>
<th></th>
</tr>
</thead>
<tbody></tbody>
</table>
<div class="empty" id="usersEmpty" style="display:none">Пользователи не найдены</div>
</div>
</div>
</div>
<div class="modal-overlay" id="userModal">
<div class="edit-modal" style="max-width:480px">
<h3 id="userModalTitle">Новый пользователь</h3>
<div class="settings-stack" style="gap:12px;max-width:none">
<div class="settings-field">
<label>Логин <span style="color:#ef4444">*</span></label>
<input type="text" id="uUsername" class="settings-input" placeholder="login" autocomplete="off">
</div>
<div class="settings-field">
<label>Имя</label>
<input type="text" id="uName" class="settings-input" placeholder="Имя Фамилия">
</div>
<div class="settings-field">
<label>Цвет</label>
<div style="display:flex;align-items:center;gap:8px">
<input type="color" id="uColor" class="settings-input user-color-input" value="#2563eb">
<button type="button" class="btn-primary ghost" id="uColorRandom" style="padding:6px 10px">Случайный</button>
</div>
</div>
<div class="settings-field">
<label>Роль</label>
<select id="uRole" class="settings-input">
<option value="admin">Администратор</option>
<option value="tutor">Тутор</option>
</select>
</div>
<div class="settings-field" id="uBranchesField">
<label>Филиалы (мультивыбор)</label>
<select id="uBranches" class="settings-input" multiple size="4"></select>
<span class="hint" style="font-size:.75rem">Тутор видит только свои филиалы. Выбор: Ctrl/Cmd+клик.</span>
</div>
<div class="settings-field">
<label>Пароль <small id="pwdHint" style="font-weight:400;color:var(--muted)"></small></label>
<input type="password" id="uPassword" class="settings-input" placeholder="••••••••">
</div>
<div class="settings-field" style="flex-direction:row;align-items:center;gap:8px">
<input type="checkbox" id="uActive" checked>
<label style="margin:0">Активен</label>
</div>
<div class="card-foot" style="justify-content:flex-end;border-top:none;padding-top:0">
<button type="button" class="btn-primary ghost" id="uCancel">Отмена</button>
<button type="button" class="btn-primary" id="uSave">Сохранить</button>
</div>
</div>
</div>
</div>
<div class="modal-overlay" id="userStatsModal">
<div class="edit-modal" style="max-width:620px;width:92vw">
<h3 id="statsModalTitle">Статистика пользователя</h3>
<div id="statsModalBody" style="display:flex;flex-direction:column;gap:16px">
<div class="stats-grid" id="statsGrid" style="display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:10px"></div>
<div class="stats-groups" style="border-top:1px solid var(--border);padding-top:12px">
<h4 style="font-size:.85rem;color:var(--muted);margin:0 0 8px">Группы</h4>
<div id="statsGroupsList" style="display:flex;flex-direction:column;gap:6px"></div>
</div>
</div>
<div class="card-foot" style="justify-content:flex-end;border-top:none;padding-top:0">
<button type="button" class="btn-primary" id="statsCloseBtn">Закрыть</button>
</div>
</div>
</div>
<div class="toast" id="toast"></div>
<script src="vendor/lucide.min.js"></script>
<script src="js/datetime.js"></script>
<script src="admin.js"></script>
<script src="js/users.js"></script>
<style>
.badge-admin,.badge-tutor{font-size:.7rem;font-weight:600;padding:2px 10px;border-radius:999px;white-space:nowrap}
.badge-admin{color:#7c3aed;background:rgba(124,58,237,.12)}
.badge-tutor{color:var(--accent);background:rgba(37,99,235,.1)}
.status-ok{font-size:.72rem;font-weight:600;color:#16a34a;background:rgba(22,163,74,.12);border-radius:999px;padding:2px 10px;white-space:nowrap}
.status-off{font-size:.72rem;font-weight:600;color:#ef4444;background:rgba(239,68,68,.12);border-radius:999px;padding:2px 10px;white-space:nowrap}
.row-btn{background:none;border:none;color:var(--muted);cursor:pointer;font-size:1.05rem;padding:4px 8px;border-radius:6px}
.row-btn:hover{background:var(--bg);color:var(--accent)}
.row-btn.del:hover{color:#ef4444;background:rgba(239,68,68,.1)}
.user-branches{max-width:220px;color:var(--muted);font-size:.78rem}
.user-color-input{width:72px;height:34px;padding:2px;cursor:pointer}
.user-color-swatch{display:inline-block;width:18px;height:18px;border-radius:50%;border:1px solid rgba(127,127,127,.4);vertical-align:middle}
.stat-card{background:var(--card);border:1px solid var(--border);border-radius:10px;padding:10px 8px;text-align:center}
.stat-value{font-size:1.25rem;font-weight:700;color:var(--text)}
.stat-label{font-size:.72rem;color:var(--muted);margin-top:4px}
</style>
</body>
</html>