feat(project): 날짜 팝업에 일요일·공휴일 빨강, 토요일 파랑
KR_HOLIDAYS 를 Jinja 전역(pj_kr_holidays)으로 두고 공용 사이드바에서 window.PJ_HOLIDAYS 로 넘겨, 프로젝트 관리 모든 화면의 마감일/시작일 팝업(openDatePopover)이 국경일·공휴일·대체공휴일을 빨강으로 칠한다. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+14
-3
@@ -256,6 +256,9 @@
|
||||
const same = d.getFullYear() === new Date().getFullYear();
|
||||
return (same ? "" : d.getFullYear() + "년 ") + (d.getMonth() + 1) + "월 " + d.getDate() + "일";
|
||||
}
|
||||
function pageHolidays() {
|
||||
try { return JSON.parse((el("pj-data") || {}).textContent || "{}").holidays || {}; } catch (_) { return {}; }
|
||||
}
|
||||
function openDatePopover(anchor, opts) {
|
||||
closeDatePopover();
|
||||
const today = isoToday();
|
||||
@@ -265,6 +268,8 @@
|
||||
let active = "due";
|
||||
const base = new Date((due || start || today) + "T00:00:00");
|
||||
let viewY = base.getFullYear(), viewM = base.getMonth();
|
||||
// 공휴일 표 — 공용 사이드바가 넘긴 것(모든 프로젝트 화면), 없으면 프로젝트 화면 데이터.
|
||||
const holidays = window.PJ_HOLIDAYS || pageHolidays();
|
||||
|
||||
const pop = document.createElement("div");
|
||||
pop.className = "pj-datepop";
|
||||
@@ -289,11 +294,15 @@
|
||||
const iso = isoOf(d);
|
||||
const cls = ["pj-dp-day"];
|
||||
if (d.getMonth() !== viewM) cls.push("is-out");
|
||||
if (d.getDay() === 0 || d.getDay() === 6) cls.push("is-weekend");
|
||||
// 일요일·공휴일(국경일·대체공휴일 포함) = 빨강, 토요일 = 파랑. 공휴일 이름은 말풍선.
|
||||
const holName = holidays[iso] || "";
|
||||
if (d.getDay() === 0 || holName) cls.push("is-sun");
|
||||
else if (d.getDay() === 6) cls.push("is-sat");
|
||||
if (iso === today) cls.push("is-today");
|
||||
if (iso === due || (showStart && iso === start)) cls.push("is-selected");
|
||||
if (showStart && start && due && iso > start && iso < due) cls.push("is-inrange");
|
||||
days += '<button type="button" class="' + cls.join(" ") + '" data-iso="' + iso + '">' + d.getDate() + "</button>";
|
||||
days += '<button type="button" class="' + cls.join(" ") + '" data-iso="' + iso + '"' +
|
||||
(holName ? ' data-tip="' + escapeHtml(holName) + '"' : "") + ">" + d.getDate() + "</button>";
|
||||
}
|
||||
pop.innerHTML =
|
||||
'<div class="pj-dp-fields">' +
|
||||
@@ -308,7 +317,9 @@
|
||||
'<button type="button" class="pj-dp-navbtn" data-nav="1" title="다음 달"><span class="material-symbols-outlined">chevron_right</span></button>' +
|
||||
"</div>" +
|
||||
'<div class="pj-dp-grid">' +
|
||||
["일", "월", "화", "수", "목", "금", "토"].map(function (w) { return '<span class="pj-dp-wd">' + w + "</span>"; }).join("") +
|
||||
["일", "월", "화", "수", "목", "금", "토"].map(function (w, i) {
|
||||
return '<span class="pj-dp-wd' + (i === 0 ? " is-sun" : i === 6 ? " is-sat" : "") + '">' + w + "</span>";
|
||||
}).join("") +
|
||||
days +
|
||||
"</div>" +
|
||||
'<div class="pj-dp-foot">' +
|
||||
|
||||
Reference in New Issue
Block a user