Fix schedule weekday dates and wire Today button
This commit is contained in:
parent
a869af2012
commit
541cdc7714
@ -146,7 +146,7 @@
|
||||
</div>
|
||||
<div class="cal" id="cal">
|
||||
<div class="cal-head">
|
||||
<span class="cal-title" id="calTitle"></span>
|
||||
<span class="cal-title" id="calTitle"></span> <button class="kt-ai-btn" id="todayBtn" data-variant="primary" data-size="sm">Сегодня</button>
|
||||
<div class="cal-nav">
|
||||
<button type="button" id="calPrev" title="Предыдущий месяц"><svg class="kt-icon" style="width:14px;height:14px;"><use href="#chevronLeft"/></svg></button>
|
||||
<button type="button" id="calNext" title="Следующий месяц"><svg class="kt-icon" style="width:14px;height:14px;"><use href="#chevronRight"/></svg></button>
|
||||
|
||||
15
script.js
15
script.js
@ -195,9 +195,9 @@ function renderSchedule(){
|
||||
const tasks = tasksByDay[d];
|
||||
const dayName = dayNames[d];
|
||||
const date = new Date(weekStart);
|
||||
date.setDate(weekStart.getDate() + i);
|
||||
date.setDate(weekStart.getDate() + (d - 1));
|
||||
const dateStr = fmtDateShort(date.toISOString().slice(0,10));
|
||||
html += `<details class="schedule-day" style="margin-bottom:var(--kt-ai-space-6);"><summary style="cursor:pointer;padding:4px 0;">${dayName}</summary>`;
|
||||
html += `<details class="schedule-day" style="margin-bottom:var(--kt-ai-space-6);"><summary style="cursor:pointer;padding:4px 0;">${dayName} ${dateStr}</summary>`;
|
||||
if (!tasks || tasks.length === 0) {
|
||||
html += '<div class="empty">Нет задач</div>';
|
||||
} else {
|
||||
@ -310,6 +310,17 @@ document.addEventListener("DOMContentLoaded", async () => {
|
||||
setupForms();
|
||||
setupRows();
|
||||
setupGdLink();
|
||||
const todayBtn = $1("#todayBtn");
|
||||
if (todayBtn) {
|
||||
todayBtn.addEventListener("click", () => {
|
||||
weekStart = new Date(_todayD);
|
||||
weekStart.setDate(_todayD.getDate() - _dow0);
|
||||
selDate = TODAY_ISO;
|
||||
renderCalendar();
|
||||
renderBoard("gdplan");
|
||||
renderSchedule();
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
await Promise.all(BOARD_KEYS.map(loadBoard));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user