77 lines
2.7 KiB
Plaintext
77 lines
2.7 KiB
Plaintext
<!DOCTYPE html>
|
||
<html lang="ru">
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<title>История изменений — Справки</title>
|
||
<link rel="stylesheet" href="/style.css">
|
||
</head>
|
||
<body>
|
||
<div class="container">
|
||
<nav class="nav">
|
||
<a href="/" class="btn">← К списку</a>
|
||
<span class="user-bar"><%= user ? user.name : '' %></span>
|
||
<button id="logout-btn" class="btn btn-logout">Выйти</button>
|
||
</nav>
|
||
|
||
<h1>История изменений</h1>
|
||
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th>Дата</th>
|
||
<th>Ученик</th>
|
||
<th>Класс</th>
|
||
<th>Предмет</th>
|
||
<th>Поле</th>
|
||
<th>Было</th>
|
||
<th>Стало</th>
|
||
<th>Пользователь</th>
|
||
<th>Источник</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<% rows.forEach(r => { %>
|
||
<tr>
|
||
<td style="font-size:12px;white-space:nowrap"><%= r.changed_at %></td>
|
||
<td><a href="/student/<%= r.student_id %>"><%= r.last_name %> <%= r.first_name %> <%= r.patronymic %></a></td>
|
||
<td><%= r.class %></td>
|
||
<td><%= r.subject_name || r.subject_code %></td>
|
||
<td><%= r.field_name === 'primary_score' ? 'балл' : 'оценка' %></td>
|
||
<td style="color:#999"><%= r.old_value !== null ? r.old_value : '—' %></td>
|
||
<td><strong><%= r.new_value !== null ? r.new_value : '—' %></strong></td>
|
||
<td style="font-size:12px"><%= r.changed_by || '—' %></td>
|
||
<td style="font-size:12px">
|
||
<% if (r.source === 'import') { %>импорт
|
||
<% } else if (r.source === 'manual') { %>вручную
|
||
<% } else { %><%= r.source %><% } %>
|
||
</td>
|
||
</tr>
|
||
<% }) %>
|
||
<% if (rows.length === 0) { %>
|
||
<tr><td colspan="9" style="text-align:center;color:#999;padding:20px">Нет записей</td></tr>
|
||
<% } %>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
|
||
<script>
|
||
window.__CSRF_TOKEN = '<%= csrfToken %>';
|
||
const _origFetch = window.fetch.bind(window);
|
||
window.fetch = function(input, init = {}) {
|
||
init.credentials = 'include';
|
||
const method = (init.method || 'GET').toUpperCase();
|
||
if (['POST','PUT','PATCH','DELETE'].includes(method)) {
|
||
if (!init.headers) init.headers = {};
|
||
init.headers['X-CSRF-Token'] = window.__CSRF_TOKEN || '';
|
||
}
|
||
return _origFetch(input, init);
|
||
};
|
||
document.getElementById('logout-btn').addEventListener('click', async () => {
|
||
await fetch('/api/logout', { method: 'POST' });
|
||
window.location.href = '/login';
|
||
});
|
||
</script>
|
||
</body>
|
||
</html>
|