diff --git a/public/js/postlesson.js b/public/js/postlesson.js index e42aa9f..bdc13fe 100644 --- a/public/js/postlesson.js +++ b/public/js/postlesson.js @@ -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 ` -
+
-
-
${esc(t.group_name)} · ${esc(t.lesson_date)}
-
${esc(t.lesson_time)}${t.tutor_name ? ' · ' + esc(t.tutor_name) : ''}${t.overdue && !allDone ? ' · долг' : ''}${isDismissed ? ' · закрыта' : ''}
+
+
${esc(t.group_name)} · ${esc(t.lesson_date)}
+
${esc(t.lesson_time)}${t.tutor_name ? ' · ' + esc(t.tutor_name) : ''}
- ${completed}/${steps2.length} + ${badgeText} +
+
+
+ ${completed}/${steps2.length}
${steps2.map((s, i) => { @@ -130,11 +140,11 @@ function renderPostLessonTasks() { return `${s.done ? '✓' : (related.length ? '⚠' : '○')} ${esc(s.label)}${related.length ? ' (' + related.length + ')' : ''}`; }).join('')}
- ${t.shorts_related && t.shorts_related.length && !(overrides[t.key] && overrides[t.key].shorts) ? `
⚠ Короткие сообщения найдены (${t.shorts_related.length}), но не засчитаны: ${t.shorts_related.map(r => esc(r.resident) + ' — ' + esc(r.lesson_date) + (r.reason === 'date' ? ' (другая дата)' : ' (другой автор)')).join(', ')}. Проверьте дату и автора.
` : ''} + ${t.shorts_related && t.shorts_related.length && !(overrides[t.key] && overrides[t.key].shorts) ? `
Короткие сообщения найдены (${t.shorts_related.length}), но не засчитаны: ${t.shorts_related.map(r => esc(r.resident) + ' — ' + esc(r.lesson_date) + (r.reason === 'date' ? ' (другая дата)' : ' (другой автор)')).join(', ')}. Проверьте дату и автора.
` : ''}
${isDismissed - ? `` - : ``} + ? `` + : ``}
`; @@ -238,7 +248,7 @@ function openPostTaskDetail(taskKey) { html += `
`; html += `${completed}/${steps.length}`; html += `${esc(t.lesson_time)}${t.tutor_name ? ' · ' + esc(t.tutor_name) : ''}`; - html += `${esc(statusBadge)}`; + html += `${esc(statusBadge)}`; html += `
`; html += `
`; diff --git a/public/postlesson.html b/public/postlesson.html index 90dd97d..2efe192 100644 --- a/public/postlesson.html +++ b/public/postlesson.html @@ -7,29 +7,65 @@