diff --git a/web/templates/projects.html b/web/templates/projects.html index 051bf2f..0f0419f 100644 --- a/web/templates/projects.html +++ b/web/templates/projects.html @@ -97,6 +97,40 @@ function formatDateTime(value) { }); } +function formatDateParts(value) { + if (!value) return null; + const date = new Date(value); + if (Number.isNaN(date.getTime())) return null; + return { + date: date.toLocaleDateString('ru-RU', { + year: 'numeric', + month: '2-digit', + day: '2-digit' + }), + time: date.toLocaleTimeString('ru-RU', { + hour: '2-digit', + minute: '2-digit' + }) + }; +} + +function renderAuditCell(value, user) { + const parts = formatDateParts(value); + const safeUser = escapeHtml((user || '—').trim() || '—'); + if (!parts) { + return '
| Код | '; + html += 'Код | '; html += ''; html += ' | '; - html += 'Создан @ автор | '; - html += 'Изменен @ кто | '; - html += 'Варианты | '; - html += 'Действия | '; + html += 'Создан | '; + html += 'Изменен | '; + html += 'Варианты | '; + html += 'Действия | '; html += '|
|---|---|---|---|---|---|---|---|---|---|---|---|
| '; @@ -259,14 +293,12 @@ async function loadProjects() { const displayName = p.name || ''; const createdBy = p.owner_username || '—'; const updatedBy = '—'; - const createdLabel = formatDateTime(p.created_at) + ' @ ' + createdBy; - const updatedLabel = formatDateTime(p.updated_at) + ' @ ' + updatedBy; const variantChips = renderVariantChips(p.code, p.variant, p.uuid); - html += ' | ' + escapeHtml(p.code || '—') + ' | '; - html += '' + escapeHtml(displayName) + ' | '; - html += '' + escapeHtml(createdLabel) + ' | '; - html += '' + escapeHtml(updatedLabel) + ' | '; - html += '' + variantChips + ' | '; + html += '' + escapeHtml(p.code || '—') + ' | '; + html += '' + escapeHtml(displayName || '—') + ' | ';
+ html += '' + renderAuditCell(p.created_at, createdBy) + ' | '; + html += '' + renderAuditCell(p.updated_at, updatedBy) + ' | '; + html += '' + variantChips + ' | ';
html += '';
if (p.is_active) {
|