Files
WhatIDo/public/shorts.html
T
dev 63ff20f3d1 feat(shorts): отметка использования сообщений и оценки работы ученика
- short_messages: флаги used/used_at, массовый ввод с суффиксами +1/0/-1
- POST /api/shorts разбирает суффиксы дельты, PUT принимает used/used_at/delta
- новая таблица student_work_marks (delta -1/0/1) + ensureStudentWorkMarksTable
- отметка used проставляется при отправке/правке/удалении отзыва, снятие — при возврате из корзины
- бэкап: student_work_marks в BACKUP_TABLES/SEQUENCE_TABLES, used/used_at/short_message_ids в normalizeRestoreData + кейсы в backup.selftest.js
- db/init.sql + db/migration.sql: колонки, таблица, индексы, backfill ложного used, сид short_messages_retention_days
- public/shorts.html/js: колонка «Использовано», delta-badge, сегмент дельты, inline-переключатель
- public/js/photos.js: источник entry_photo в агрегаторе фото
2026-10-13 00:44:34 +03:00

157 lines
8.4 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.
<!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">
</head>
<body data-page="shorts">
<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="addShortsBtn" type="button">
<span style="font-size:1.2rem">+</span> Новое сообщение
</button>
</div>
<div class="actions-row" style="margin-bottom:12px">
<input type="text" id="shortsSearch" class="settings-input" placeholder="Поиск по резиденту, теме, сообщению..." style="max-width:360px">
<button class="btn-primary ghost" id="shortsSearchBtn">Найти</button>
<button class="btn-primary ghost" id="shortsClearBtn">Сброс</button>
</div>
<div class="audit-wrap">
<table class="audit-table" id="shortsTable">
<thead>
<tr>
<th>Резидент</th>
<th>Дата занятия</th>
<th>Тема</th>
<th>Сообщение</th>
<th>Автор</th>
<th>Использовано</th>
<th>Действия</th>
</tr>
</thead>
<tbody></tbody>
</table>
<div class="empty" id="shortsEmpty" style="display:none">Сообщения не найдены</div>
</div>
<div id="shortsPager" class="pager"></div>
</div>
</div>
<div class="modal-overlay" id="shortsModal">
<div class="edit-modal" style="max-width:620px">
<h3 id="shortsModalTitle">Новое сообщение</h3>
<div class="settings-stack" style="gap:12px;max-width:none">
<div class="settings-row" style="gap:12px;align-items:flex-start">
<div class="settings-field" style="flex:0 0 175px">
<label>Дата занятия <span style="color:#ef4444">*</span></label>
<input type="date" id="shortsDate" class="settings-input">
</div>
<div class="settings-field" style="flex:1;min-width:0">
<label>Тема занятия</label>
<input type="text" id="shortsTopic" class="settings-input" placeholder="Например: Photoshop 3/5">
</div>
</div>
<div class="settings-field" id="shortsDeltaField" style="display:none">
<label>Уровень работы на занятии</label>
<div class="delta-seg" id="shortsDelta">
<button type="button" class="delta-seg-btn" data-delta="-1" title="Отстаёт от темы">−1</button>
<button type="button" class="delta-seg-btn" data-delta="0" title="Без оценки">0</button>
<button type="button" class="delta-seg-btn" data-delta="1" title="Опережает тему">+1</button>
</div>
<span style="font-size:.72rem;color:var(--muted);font-weight:400">Видно только тьюторам и админам</span>
</div>
<div class="settings-field">
<label>Список строк <span style="color:#ef4444">*</span>
<span id="shortsLinesHint" style="font-size:.7rem;color:var(--muted);font-weight:400"> (формат: ФИО - текст или ФИО — текст; опц. -1/+1)</span>
<button type="button" id="shortsAiBtn" class="ai-btn" title="Улучшить текст ИИ"><i data-lucide="sparkles" style="width:14px;height:14px"></i></button>
</label>
<textarea id="shortsLines" class="settings-input" rows="5" placeholder="Иванов И.И. - Отличная работа на занятии&#10;Петров П.П. — Продолжили изучение Photoshop"></textarea>
</div>
<div class="settings-field" id="shortsResidentField" style="display:none">
<label>Резидент (для добавления без разбора строк)</label>
<input type="text" id="shortsResident" class="settings-input" placeholder="Иванов И.И.">
</div>
<div class="settings-field" id="shortsUsedField" style="flex-direction:row;align-items:center;gap:8px;display:none">
<input type="checkbox" id="shortsUsed">
<label style="margin:0">Использовано</label>
</div>
<div class="settings-field" id="shortsUsedAtField" style="display:none">
<label>Дата использования</label>
<input type="date" id="shortsUsedAt" class="settings-input">
</div>
<div class="card-foot" style="justify-content:flex-end;border-top:none;padding-top:0">
<button type="button" class="btn-primary ghost" id="shortsCancel">Отмена</button>
<button type="button" class="btn-primary" id="shortsSave">Сохранить</button>
</div>
</div>
</div>
</div>
<div class="modal-overlay" id="aiCorrectModal">
<div class="edit-modal" style="max-width:560px">
<h3><i data-lucide="sparkles" style="width:18px;height:18px;vertical-align:-3px"></i> Улучшение текста ИИ</h3>
<div style="font-size:.85rem;color:var(--muted);margin-bottom:8px">Выберите профиль и нажмите «Улучшить»</div>
<div class="settings-field">
<label>Профиль</label>
<select id="aiModelSelect" class="settings-input">
</select>
</div>
<div class="settings-field">
<label>Текст</label>
<textarea id="aiSourceText" class="settings-input" rows="4" placeholder="Текст для улучшения..."></textarea>
</div>
<div class="settings-field">
<button type="button" class="btn-primary ghost" id="aiImproveBtn">Улучшить</button>
</div>
<div class="settings-field">
<label>Результат</label>
<div id="aiSuggestion" style="background:var(--bg);border:1px solid var(--border);border-radius:8px;padding:12px;min-height:60px;max-height:250px;overflow:auto;white-space:pre-wrap;font-family:inherit"></div>
</div>
<div class="card-foot" style="justify-content:flex-end;gap:8px;margin-top:12px">
<button type="button" class="btn-primary ghost" id="aiRejectBtn">Отклонить</button>
<button type="button" class="btn-primary" id="aiAcceptBtn">Применить</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/shorts.js"></script>
<style>
#shortsModal .settings-field label { font-weight:600 }
.used-toggle { padding:4px 6px;background:transparent;border-color:transparent }
.used-toggle:hover { background:var(--bg);border-color:transparent }
.ai-btn { background:none;border:1px solid var(--border);border-radius:6px;padding:4px 10px;cursor:pointer;font-size:.8rem;color:var(--muted) }
.delta-seg { display:inline-flex;align-self:flex-start;width:fit-content;border:1px solid var(--border);border-radius:10px;overflow:hidden;background:var(--bg) }
.delta-seg-btn { background:transparent;border:none;color:var(--muted);font-size:.9rem;font-weight:600;font-family:inherit;padding:8px 20px;cursor:pointer;transition:background .15s,color .15s }
.delta-seg-btn + .delta-seg-btn { border-left:1px solid var(--border) }
.delta-seg-btn:hover { color:var(--text) }
.delta-seg-btn.on { background:var(--accent);color:#fff }
.delta-seg-btn.on[data-delta="-1"] { background:#ef4444 }
.delta-seg-btn.on[data-delta="1"] { background:#16a34a }
.delta-badge { display:inline-block;min-width:22px;margin-left:6px;padding:1px 6px;border-radius:6px;font-size:.72rem;font-weight:700;text-align:center;vertical-align:1px }
.delta-badge.minus { background:rgba(239,68,68,.12);color:#ef4444 }
.delta-badge.plus { background:rgba(22,163,74,.12);color:#16a34a }
.ai-btn:hover { border-color:var(--accent);color:var(--accent) }
.ai-btn:disabled { opacity:.5;cursor:not-allowed }
.ai-status { font-size:.72rem;color:var(--muted);margin-top:4px }
.row-btn { background:none;border:none;color:var(--muted);cursor:pointer;font-size:.95rem;padding:4px 8px;border-radius:6px;margin-left:4px }
.row-btn:hover { background:var(--bg);color:var(--accent) }
.row-btn.del:hover { color:#ef4444 }
</style>
</body>
</html>