Update post-lesson page and logic
This commit is contained in:
+19
-9
@@ -111,14 +111,24 @@ function renderPostLessonTasks() {
|
||||
const nextIdx = steps2.findIndex(s => !s.done);
|
||||
const link = steps2[nextIdx >= 0 ? nextIdx : 0].link;
|
||||
const isDismissed = dismissed.has(t.key);
|
||||
const isOverdue = t.overdue && !allDone;
|
||||
const pct = steps2.length ? Math.round((completed / steps2.length) * 100) : 0;
|
||||
let badgeCls = 'pending', badgeText = 'В работе', barColor = '#f59e0b';
|
||||
if (isDismissed) { badgeCls = 'dismissed'; badgeText = 'Закрыта'; barColor = '#94a3b8'; }
|
||||
else if (allDone) { badgeCls = 'done'; badgeText = 'Выполнена'; barColor = '#22c55e'; }
|
||||
else if (t.overdue) { badgeCls = 'overdue'; badgeText = 'Просрочена'; barColor = '#ef4444'; }
|
||||
return `
|
||||
<div class="post-task ${allDone ? 'all-done' : ''} ${t.overdue && !allDone ? 'overdue' : ''} ${isDismissed ? 'dismissed' : ''}" data-task-key="${esc(t.key)}" data-task-link="${esc(link)}" style="cursor:pointer">
|
||||
<div class="post-task ${allDone ? 'all-done' : ''} ${isOverdue ? 'overdue' : ''} ${isDismissed ? 'dismissed' : ''}" data-task-key="${esc(t.key)}" data-task-link="${esc(link)}">
|
||||
<div class="post-task-head">
|
||||
<div>
|
||||
<div class="post-task-title">${esc(t.group_name)} · ${esc(t.lesson_date)}</div>
|
||||
<div class="post-task-meta">${esc(t.lesson_time)}${t.tutor_name ? ' · ' + esc(t.tutor_name) : ''}${t.overdue && !allDone ? ' · долг' : ''}${isDismissed ? ' · закрыта' : ''}</div>
|
||||
<div class="post-task-main">
|
||||
<div class="post-task-title">${esc(t.group_name)}<span class="post-task-date"> · ${esc(t.lesson_date)}</span></div>
|
||||
<div class="post-task-meta">${esc(t.lesson_time)}${t.tutor_name ? ' · ' + esc(t.tutor_name) : ''}</div>
|
||||
</div>
|
||||
<span class="top-count">${completed}/${steps2.length}</span>
|
||||
<span class="post-task-badge ${badgeCls}">${badgeText}</span>
|
||||
</div>
|
||||
<div class="post-task-progress">
|
||||
<div class="post-task-progress-track"><div class="post-task-progress-bar" style="width:${pct}%;background:${barColor}"></div></div>
|
||||
<span class="post-task-progress-count">${completed}/${steps2.length}</span>
|
||||
</div>
|
||||
<div class="post-task-steps">
|
||||
${steps2.map((s, i) => {
|
||||
@@ -130,11 +140,11 @@ function renderPostLessonTasks() {
|
||||
return `<span class="post-task-step ${s.done ? 'done' : ''} ${i === nextIdx ? 'next' : ''} ${s.manual ? 'manual' : ''} ${warn}" data-task-key="${esc(t.key)}" data-step-key="${esc(s.key)}" title="${esc(title)}">${s.done ? '✓' : (related.length ? '⚠' : '○')} ${esc(s.label)}${related.length ? ' (' + related.length + ')' : ''}</span>`;
|
||||
}).join('')}
|
||||
</div>
|
||||
${t.shorts_related && t.shorts_related.length && !(overrides[t.key] && overrides[t.key].shorts) ? `<div class="post-task-hint">⚠ Короткие сообщения найдены (${t.shorts_related.length}), но не засчитаны: ${t.shorts_related.map(r => esc(r.resident) + ' — ' + esc(r.lesson_date) + (r.reason === 'date' ? ' (другая дата)' : ' (другой автор)')).join(', ')}. Проверьте дату и автора.</div>` : ''}
|
||||
${t.shorts_related && t.shorts_related.length && !(overrides[t.key] && overrides[t.key].shorts) ? `<div class="post-task-hint">Короткие сообщения найдены (${t.shorts_related.length}), но не засчитаны: ${t.shorts_related.map(r => esc(r.resident) + ' — ' + esc(r.lesson_date) + (r.reason === 'date' ? ' (другая дата)' : ' (другой автор)')).join(', ')}. Проверьте дату и автора.</div>` : ''}
|
||||
<div class="post-task-actions">
|
||||
${isDismissed
|
||||
? `<button type="button" class="btn-xs post-task-restore" data-restore-task="${esc(t.key)}" title="Вернуть задачу">Вернуть</button>`
|
||||
: `<button type="button" class="btn-xs post-task-close" data-close-task="${esc(t.key)}" title="Закрыть задачу">Закрыть</button>`}
|
||||
? `<button type="button" class="btn-xs post-task-restore" data-restore-task="${esc(t.key)}" title="Вернуть задачу">Вернуть в работу</button>`
|
||||
: `<button type="button" class="btn-xs post-task-close" data-close-task="${esc(t.key)}" title="Закрыть задачу">Закрыть задачу</button>`}
|
||||
<button type="button" class="btn-xs post-task-detail" data-detail-task="${esc(t.key)}" title="Подробнее">Подробнее</button>
|
||||
</div>
|
||||
</div>`;
|
||||
@@ -238,7 +248,7 @@ function openPostTaskDetail(taskKey) {
|
||||
html += `<div style="display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin-bottom:12px">`;
|
||||
html += `<span class="top-count">${completed}/${steps.length}</span>`;
|
||||
html += `<span class="post-task-meta">${esc(t.lesson_time)}${t.tutor_name ? ' · ' + esc(t.tutor_name) : ''}</span>`;
|
||||
html += `<span class="post-task-step ${statusCls}" style="pointer-events:none">${esc(statusBadge)}</span>`;
|
||||
html += `<span class="post-task-badge ${statusCls}" style="pointer-events:none">${esc(statusBadge)}</span>`;
|
||||
html += `</div>`;
|
||||
|
||||
html += `<div style="display:flex;flex-direction:column;gap:10px">`;
|
||||
|
||||
Reference in New Issue
Block a user