feat(project): 아사나식 날짜 팝업 + 마감일 어제/오늘/내일 표기
- openDatePopover: '+ 시작일'/마감일 칸(직접 입력 가능), 월 달력(오늘 테두리, 선택 파란 원, 기간 음영, 주말·다른 달 흐리게), 오늘/지우기, 앵커를 가리키는 꼬리. 카드 마감일·카드 하위 업무·업무 팝업 마감일에 적용(브라우저 기본 date 달력 대체). 카드·하위 업무는 시작일도 함께 저장. - dueInfo: 어제(빨강)·오늘/내일(초록)·그 밖 mm/dd(요일), 지남 빨강 — 보드 카드·하위 업무·업무 팝업·리스트·내 업무 표에 적용. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+80
-5
@@ -1134,12 +1134,87 @@ img.pj-person-ic { width: 22px; height: 22px; }
|
||||
.pj-card-meta .is-empty { opacity: 0; transition: opacity .12s; color: #9aa1a9; }
|
||||
.pj-card:hover .pj-card-meta .is-empty { opacity: .8; }
|
||||
.pj-card-due.is-overdue { color: #c22b10; }
|
||||
.pj-inline-date {
|
||||
position: absolute; z-index: 1200; background: #fff; border: 1px solid #d8dce2;
|
||||
border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.14); padding: 8px;
|
||||
display: flex; align-items: center; gap: 6px;
|
||||
/* ── 아사나식 날짜 팝업(openDatePopover) — 시작일/마감일 칸 + 월 달력 + 지우기.
|
||||
앵커 아래(자리 없으면 위)에 뜨고 꼬리가 앵커를 가리킨다(--pj-dp-tail). ── */
|
||||
.pj-datepop {
|
||||
position: fixed; z-index: 2300; width: 300px; box-sizing: border-box;
|
||||
background: #fff; border: 1px solid #e3e5e8; border-radius: 12px;
|
||||
box-shadow: 0 8px 28px rgba(15,23,42,.16), 0 1px 3px rgba(15,23,42,.08);
|
||||
padding: 14px 14px 8px; font-size: 13px; color: var(--pj-ink);
|
||||
animation: pj-dp-in .12s ease-out;
|
||||
}
|
||||
.pj-inline-date input[type="date"] { border: 1px solid #d8dce2; border-radius: 7px; padding: 5px 7px; font-size: 13px; }
|
||||
@keyframes pj-dp-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
|
||||
.pj-datepop::before, .pj-datepop::after {
|
||||
content: ""; position: absolute; left: var(--pj-dp-tail, 50%); transform: translateX(-50%);
|
||||
border: 8px solid transparent;
|
||||
}
|
||||
/* 아래에 뜸 → 위쪽 꼬리 */
|
||||
.pj-datepop::before { bottom: 100%; border-bottom-color: #e3e5e8; }
|
||||
.pj-datepop::after { bottom: calc(100% - 1px); border-bottom-color: #fff; }
|
||||
/* 위에 뜸 → 아래쪽 꼬리 */
|
||||
.pj-datepop.is-above::before { bottom: auto; top: 100%; border-bottom-color: transparent; border-top-color: #e3e5e8; }
|
||||
.pj-datepop.is-above::after { bottom: auto; top: calc(100% - 1px); border-bottom-color: transparent; border-top-color: #fff; }
|
||||
|
||||
.pj-dp-fields { display: flex; gap: 8px; margin-bottom: 10px; }
|
||||
.pj-dp-field, .pj-dp-addstart {
|
||||
flex: 1 1 0; min-width: 0; height: 36px; box-sizing: border-box;
|
||||
border: 1px solid #d8dce2; border-radius: 8px; padding: 0 10px;
|
||||
font: inherit; font-size: 13.5px; color: var(--pj-ink); background: #fff;
|
||||
}
|
||||
.pj-dp-field:focus, .pj-dp-field.is-active { outline: none; border: 2px solid #4573d2; padding: 0 9px; }
|
||||
.pj-dp-field::placeholder { color: #9aa1a9; }
|
||||
.pj-dp-addstart {
|
||||
border-color: transparent; background: transparent; cursor: pointer; font-weight: 600; color: #525860; text-align: left;
|
||||
}
|
||||
.pj-dp-addstart:hover { background: #f1f2f4; }
|
||||
|
||||
.pj-dp-nav { display: flex; align-items: center; justify-content: space-between; margin: 2px 0 6px; }
|
||||
.pj-dp-title { font-size: 14px; font-weight: 500; color: var(--pj-ink); }
|
||||
.pj-dp-navbtn {
|
||||
width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center;
|
||||
border: 0; background: transparent; border-radius: 6px; color: #525860; cursor: pointer;
|
||||
}
|
||||
.pj-dp-navbtn:hover { background: #f1f2f4; color: var(--pj-ink); }
|
||||
.pj-dp-navbtn .material-symbols-outlined { font-size: 22px; }
|
||||
|
||||
.pj-dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); row-gap: 2px; }
|
||||
.pj-dp-wd { text-align: center; font-size: 12px; font-weight: 600; color: #6d6e6f; padding: 4px 0 6px; }
|
||||
.pj-dp-day {
|
||||
position: relative; height: 34px; border: 0; background: transparent; cursor: pointer;
|
||||
font: inherit; font-size: 13.5px; color: var(--pj-ink); display: flex; align-items: center; justify-content: center;
|
||||
}
|
||||
.pj-dp-day::before {
|
||||
content: ""; position: absolute; width: 30px; height: 30px; border-radius: 50%; z-index: 0;
|
||||
left: 50%; top: 50%; transform: translate(-50%, -50%);
|
||||
}
|
||||
.pj-dp-day { z-index: 0; }
|
||||
.pj-dp-day > * { position: relative; }
|
||||
.pj-dp-day:hover::before { background: #f1f2f4; }
|
||||
.pj-dp-day.is-weekend, .pj-dp-day.is-out { color: #8b929b; }
|
||||
.pj-dp-day.is-out { color: #b3b8bf; }
|
||||
/* 오늘 = 파란 테두리 원 + 굵게 */
|
||||
.pj-dp-day.is-today { font-weight: 800; }
|
||||
.pj-dp-day.is-today::before { border: 1.5px solid #4573d2; }
|
||||
/* 선택 = 파란 원 + 흰 글자 (숫자가 원 위에 보이도록 글자는 z 위로) */
|
||||
.pj-dp-day.is-selected { color: #fff; font-weight: 600; }
|
||||
.pj-dp-day.is-selected::before { background: #4573d2; border: 0; }
|
||||
.pj-dp-day.is-inrange { background: #e8effb; }
|
||||
.pj-dp-day { isolation: isolate; }
|
||||
.pj-dp-day::before { z-index: -1; }
|
||||
|
||||
.pj-dp-foot {
|
||||
display: flex; justify-content: space-between; align-items: center;
|
||||
margin-top: 8px; padding-top: 8px; border-top: 1px solid #eef0f2;
|
||||
}
|
||||
.pj-dp-link {
|
||||
border: 0; background: transparent; cursor: pointer; font: inherit; font-size: 13px; font-weight: 600;
|
||||
color: #525860; padding: 6px 8px; border-radius: 6px;
|
||||
}
|
||||
.pj-dp-link:hover { background: #f1f2f4; color: var(--pj-ink); }
|
||||
|
||||
/* 마감일 표기 색 — 오늘·내일 초록, 어제·지남 빨강(아사나) */
|
||||
.pj-card-due.is-soon, .pj-card-sub-due.is-soon, .pj-due-label.is-soon, .pj-due-btn.is-soon { color: #3f8f6b; }
|
||||
.pj-card-due.is-overdue, .pj-card-sub-due.is-overdue, .pj-due-label.is-overdue { color: #c22b10; }
|
||||
|
||||
/* ── 멘션(@태그) ── */
|
||||
.pj-mention {
|
||||
|
||||
+250
-56
@@ -180,6 +180,219 @@
|
||||
return mm + "/" + dd + "(" + wd + ")";
|
||||
}
|
||||
|
||||
// ── 마감일 표기(아사나처럼) — 어제(빨강) / 오늘·내일(초록) / 그 밖엔 mm/dd(요일),
|
||||
// 지난 날짜는 빨강. 완료된 업무는 색 없이. 반환 {text, cls}.
|
||||
function isoOf(d) {
|
||||
return d.getFullYear() + "-" + String(d.getMonth() + 1).padStart(2, "0") + "-" + String(d.getDate()).padStart(2, "0");
|
||||
}
|
||||
function isoToday() { return isoOf(new Date()); }
|
||||
function dayDiff(iso, baseIso) {
|
||||
const a = new Date(String(iso).slice(0, 10) + "T00:00:00"), b = new Date(baseIso + "T00:00:00");
|
||||
return Math.round((a - b) / 86400000);
|
||||
}
|
||||
function dueInfo(iso, done) {
|
||||
if (!iso) return null;
|
||||
const diff = dayDiff(iso, isoToday());
|
||||
let text, cls = "";
|
||||
if (diff === 0) { text = "오늘"; cls = "is-soon"; }
|
||||
else if (diff === 1) { text = "내일"; cls = "is-soon"; }
|
||||
else if (diff === -1) { text = "어제"; cls = "is-overdue"; }
|
||||
else { text = fmtDateKr(iso); if (diff < 0) cls = "is-overdue"; }
|
||||
if (done) cls = "";
|
||||
return { text: text, cls: cls };
|
||||
}
|
||||
|
||||
// ── 아사나식 날짜 팝업 — 마감일(과 선택적으로 시작일)을 월 달력에서 고른다.
|
||||
// opts: { start, due, allowStart, onChange(patch) }. 날짜를 누를 때마다
|
||||
// onChange({due_date[, start_date]}) 로 바로 저장하고 팝업은 열어 둔다(아사나와
|
||||
// 같음). 바깥 클릭·Esc 로 닫힘. "지우기" = 둘 다 비우고 닫기. 앵커 아래(자리가
|
||||
// 없으면 위)에 뜨고 꼬리가 앵커를 가리킨다. 한 번에 하나만.
|
||||
let datePopEl = null, datePopCleanup = null;
|
||||
function closeDatePopover() {
|
||||
if (datePopCleanup) datePopCleanup();
|
||||
datePopCleanup = null;
|
||||
if (datePopEl) { datePopEl.remove(); datePopEl = null; }
|
||||
}
|
||||
// 직접 입력 해석 — 2026-09-30 / 2026.9.30 / 9/30 / 9월 30일 / 0930.
|
||||
// 빈 값 = "" (지우기), 해석 불가 = null.
|
||||
function parseTypedDate(text, baseIso) {
|
||||
const v = String(text || "").trim().replace(/\s+/g, "");
|
||||
if (!v) return "";
|
||||
let m = v.match(/^(\d{4})[-./년](\d{1,2})[-./월](\d{1,2})[.일]?$/);
|
||||
let y, mo, d;
|
||||
if (m) { y = +m[1]; mo = +m[2]; d = +m[3]; }
|
||||
else if ((m = v.match(/^(\d{1,2})[-./월](\d{1,2})[.일]?$/))) { y = +baseIso.slice(0, 4); mo = +m[1]; d = +m[2]; }
|
||||
else if ((m = v.match(/^(\d{2})(\d{2})$/))) { y = +baseIso.slice(0, 4); mo = +m[1]; d = +m[2]; }
|
||||
else return null;
|
||||
const dt = new Date(y, mo - 1, d);
|
||||
if (dt.getFullYear() !== y || dt.getMonth() !== mo - 1 || dt.getDate() !== d) return null;
|
||||
return isoOf(dt);
|
||||
}
|
||||
function fmtFieldDate(iso) {
|
||||
if (!iso) return "";
|
||||
const d = new Date(iso + "T00:00:00");
|
||||
const same = d.getFullYear() === new Date().getFullYear();
|
||||
return (same ? "" : d.getFullYear() + "년 ") + (d.getMonth() + 1) + "월 " + d.getDate() + "일";
|
||||
}
|
||||
function openDatePopover(anchor, opts) {
|
||||
closeDatePopover();
|
||||
const today = isoToday();
|
||||
let start = opts.start ? String(opts.start).slice(0, 10) : "";
|
||||
let due = opts.due ? String(opts.due).slice(0, 10) : "";
|
||||
let showStart = !!(opts.allowStart && start);
|
||||
let active = "due";
|
||||
const base = new Date((due || start || today) + "T00:00:00");
|
||||
let viewY = base.getFullYear(), viewM = base.getMonth();
|
||||
|
||||
const pop = document.createElement("div");
|
||||
pop.className = "pj-datepop";
|
||||
document.body.appendChild(pop);
|
||||
datePopEl = pop;
|
||||
|
||||
function emit() {
|
||||
const patch = { due_date: due || null };
|
||||
if (opts.allowStart) patch.start_date = start || null;
|
||||
if (opts.onChange) opts.onChange(patch);
|
||||
}
|
||||
function field(kind, val, ph) {
|
||||
return '<input type="text" class="pj-dp-field' + (active === kind ? " is-active" : "") +
|
||||
'" data-kind="' + kind + '" placeholder="' + ph + '" value="' + escapeHtml(fmtFieldDate(val)) + '" autocomplete="off" />';
|
||||
}
|
||||
function render() {
|
||||
const first = new Date(viewY, viewM, 1);
|
||||
const gridStart = new Date(viewY, viewM, 1 - first.getDay());
|
||||
let days = "";
|
||||
for (let i = 0; i < 42; i++) {
|
||||
const d = new Date(gridStart.getFullYear(), gridStart.getMonth(), gridStart.getDate() + i);
|
||||
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");
|
||||
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>";
|
||||
}
|
||||
pop.innerHTML =
|
||||
'<div class="pj-dp-fields">' +
|
||||
(opts.allowStart
|
||||
? (showStart ? field("start", start, "시작일") : '<button type="button" class="pj-dp-addstart">+ 시작일</button>')
|
||||
: "") +
|
||||
field("due", due, "마감일") +
|
||||
"</div>" +
|
||||
'<div class="pj-dp-nav">' +
|
||||
'<button type="button" class="pj-dp-navbtn" data-nav="-1" title="이전 달"><span class="material-symbols-outlined">chevron_left</span></button>' +
|
||||
'<span class="pj-dp-title">' + viewY + "년 " + (viewM + 1) + "월</span>" +
|
||||
'<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("") +
|
||||
days +
|
||||
"</div>" +
|
||||
'<div class="pj-dp-foot">' +
|
||||
'<button type="button" class="pj-dp-link pj-dp-today">오늘</button>' +
|
||||
'<button type="button" class="pj-dp-link pj-dp-clear">지우기</button>' +
|
||||
"</div>";
|
||||
wire();
|
||||
}
|
||||
// 날짜 하나 고르기 — 시작일 칸이 활성이면 시작일(그 뒤 마감일로 넘어감),
|
||||
// 아니면 마감일. 시작일 > 마감일이 되지 않게 맞춘다.
|
||||
function pick(iso) {
|
||||
if (active === "start") {
|
||||
start = iso;
|
||||
if (due && due < iso) due = iso;
|
||||
active = "due";
|
||||
} else {
|
||||
due = iso;
|
||||
if (start && start > iso) start = iso;
|
||||
}
|
||||
render();
|
||||
emit();
|
||||
}
|
||||
function wire() {
|
||||
pop.querySelectorAll(".pj-dp-day").forEach(function (b) {
|
||||
b.addEventListener("click", function () { pick(b.dataset.iso); });
|
||||
});
|
||||
pop.querySelectorAll(".pj-dp-navbtn").forEach(function (b) {
|
||||
b.addEventListener("click", function () {
|
||||
viewM += +b.dataset.nav;
|
||||
if (viewM < 0) { viewM = 11; viewY--; } else if (viewM > 11) { viewM = 0; viewY++; }
|
||||
render();
|
||||
});
|
||||
});
|
||||
const add = pop.querySelector(".pj-dp-addstart");
|
||||
if (add) add.addEventListener("click", function () {
|
||||
showStart = true; active = "start"; render(); focusActive();
|
||||
});
|
||||
pop.querySelectorAll(".pj-dp-field").forEach(function (inp) {
|
||||
inp.addEventListener("focus", function () {
|
||||
active = inp.dataset.kind;
|
||||
pop.querySelectorAll(".pj-dp-field").forEach(function (x) { x.classList.toggle("is-active", x === inp); });
|
||||
});
|
||||
function commit() {
|
||||
const kind = inp.dataset.kind;
|
||||
const cur = kind === "start" ? start : due;
|
||||
const parsed = parseTypedDate(inp.value, today);
|
||||
if (parsed === null || parsed === cur) { inp.value = fmtFieldDate(cur); return; }
|
||||
if (!parsed) {
|
||||
if (kind === "start") { start = ""; showStart = false; } else due = "";
|
||||
render(); emit(); return;
|
||||
}
|
||||
active = kind;
|
||||
const d = new Date(parsed + "T00:00:00");
|
||||
viewY = d.getFullYear(); viewM = d.getMonth();
|
||||
pick(parsed);
|
||||
}
|
||||
inp.addEventListener("keydown", function (e) {
|
||||
if (e.isComposing) return;
|
||||
if (e.key === "Enter") { e.preventDefault(); commit(); }
|
||||
});
|
||||
inp.addEventListener("change", commit);
|
||||
});
|
||||
pop.querySelector(".pj-dp-today").addEventListener("click", function () {
|
||||
const d = new Date(); viewY = d.getFullYear(); viewM = d.getMonth();
|
||||
pick(today);
|
||||
});
|
||||
pop.querySelector(".pj-dp-clear").addEventListener("click", function () {
|
||||
start = ""; due = ""; emit(); closeDatePopover();
|
||||
});
|
||||
}
|
||||
function focusActive() {
|
||||
const f = pop.querySelector('.pj-dp-field[data-kind="' + active + '"]');
|
||||
if (f) f.focus();
|
||||
}
|
||||
function place() {
|
||||
const r = anchor.getBoundingClientRect();
|
||||
const vw = document.documentElement.clientWidth, vh = document.documentElement.clientHeight;
|
||||
const w = pop.offsetWidth, h = pop.offsetHeight;
|
||||
const ax = r.left + r.width / 2;
|
||||
const left = Math.min(Math.max(8, ax - w / 2), vw - w - 8);
|
||||
const below = r.bottom + 10 + h <= vh - 8 || r.top - 10 - h < 8;
|
||||
pop.classList.toggle("is-above", !below);
|
||||
pop.style.left = left + "px";
|
||||
pop.style.top = (below ? r.bottom + 10 : r.top - 10 - h) + "px";
|
||||
pop.style.setProperty("--pj-dp-tail", Math.min(Math.max(ax - left, 16), w - 16) + "px");
|
||||
}
|
||||
function onDown(e) {
|
||||
if (pop.contains(e.target) || anchor.contains(e.target)) return;
|
||||
closeDatePopover();
|
||||
}
|
||||
function onKey(e) { if (e.key === "Escape") { e.stopPropagation(); closeDatePopover(); } }
|
||||
render();
|
||||
place();
|
||||
setTimeout(function () {
|
||||
document.addEventListener("mousedown", onDown, true);
|
||||
document.addEventListener("keydown", onKey, true);
|
||||
}, 0);
|
||||
window.addEventListener("resize", closeDatePopover);
|
||||
datePopCleanup = function () {
|
||||
document.removeEventListener("mousedown", onDown, true);
|
||||
document.removeEventListener("keydown", onKey, true);
|
||||
window.removeEventListener("resize", closeDatePopover);
|
||||
};
|
||||
focusActive();
|
||||
}
|
||||
|
||||
// ── 탭 그룹(뷰 탭/스코프 토글, 둘 다 .pj-view-tabs 마크업 공유)에 슬라이드
|
||||
// 하이라이트를 붙인다 — is-active 를 단순 배경색 대신, 실제 위치가 움직이는
|
||||
// 절대배치 요소 하나로 표현한다. 탭 클릭·초기 렌더·리사이즈마다 위치 재계산.
|
||||
@@ -1208,8 +1421,9 @@
|
||||
key: "due", label: "마감", cls: "pj-mtk-date",
|
||||
html: function (t) {
|
||||
if (!t.due_date) return "-";
|
||||
const overdue = !t.completed_at && t.due_date.slice(0, 10) < today;
|
||||
return '<span class="' + (overdue ? "pj-mtk-overdue" : "") + '">' + fmtDateKr(t.due_date) + "</span>";
|
||||
const di = dueInfo(t.due_date, !!t.completed_at);
|
||||
return '<span class="pj-due-label ' + di.cls + (di.cls === "is-overdue" ? " pj-mtk-overdue" : "") + '">' +
|
||||
escapeHtml(di.text) + "</span>";
|
||||
},
|
||||
sort: function (t) { return t.due_date || "9999-99-99"; },
|
||||
},
|
||||
@@ -2638,48 +2852,12 @@
|
||||
));
|
||||
}
|
||||
|
||||
// 마감일 — 카드 위에 작은 날짜 입력칸을 띄운다. 값이 바뀌면 바로 저장하고,
|
||||
// "지우기"로 마감일을 없앨 수 있다. 바깥을 누르면 닫힌다.
|
||||
let inlineDateEl = null;
|
||||
function closeInlineDate() {
|
||||
if (inlineDateEl) { inlineDateEl.remove(); inlineDateEl = null; }
|
||||
document.removeEventListener("mousedown", onInlineDateDown, true);
|
||||
}
|
||||
function onInlineDateDown(e) {
|
||||
if (inlineDateEl && !inlineDateEl.contains(e.target)) closeInlineDate();
|
||||
}
|
||||
// onPick(v) 를 주면 저장을 그쪽에 맡긴다(카드의 하위 업무 줄 — 보드 전체가
|
||||
// 아니라 그 목록만 다시 그림). 없으면 applyTaskPatch 로 업무에 저장.
|
||||
// 마감일(+시작일) — 아사나식 날짜 팝업(openDatePopover). onPick(patch) 를
|
||||
// 주면 저장을 그쪽에 맡긴다(카드의 하위 업무 줄 — 그 목록만 다시 그림).
|
||||
// 없으면 applyTaskPatch 로 업무에 저장.
|
||||
function openDuePicker(t, anchorEl, onPick) {
|
||||
closeInlineDate();
|
||||
const save = onPick || function (v) { applyTaskPatch(t, { due_date: v }, "마감일 변경 실패"); };
|
||||
const box = document.createElement("div");
|
||||
box.className = "pj-inline-date";
|
||||
box.innerHTML = '<input type="date" value="' + (t.due_date || "") + '" />' +
|
||||
'<button type="button" class="pj-btn">지우기</button>';
|
||||
document.body.appendChild(box);
|
||||
const r = anchorEl.getBoundingClientRect();
|
||||
let left = window.scrollX + r.left;
|
||||
left = Math.min(left, window.scrollX + document.documentElement.clientWidth - box.offsetWidth - 8);
|
||||
box.style.left = Math.max(8, left) + "px";
|
||||
box.style.top = (window.scrollY + r.bottom + 4) + "px";
|
||||
inlineDateEl = box;
|
||||
const input = box.querySelector("input");
|
||||
input.addEventListener("change", function () {
|
||||
const v = input.value || null;
|
||||
closeInlineDate();
|
||||
if (v === (t.due_date || null)) return;
|
||||
save(v);
|
||||
});
|
||||
box.querySelector("button").addEventListener("click", function () {
|
||||
closeInlineDate();
|
||||
if (!t.due_date) return;
|
||||
save(null);
|
||||
});
|
||||
setTimeout(function () {
|
||||
document.addEventListener("mousedown", onInlineDateDown, true);
|
||||
try { input.focus(); if (input.showPicker) input.showPicker(); } catch (_) {}
|
||||
}, 0);
|
||||
const save = onPick || function (patch) { applyTaskPatch(t, patch, "마감일 변경 실패"); };
|
||||
openDatePopover(anchorEl, { start: t.start_date, due: t.due_date, allowStart: true, onChange: save });
|
||||
}
|
||||
|
||||
// ── 카드 하위 업무 펼치기(아사나처럼) — 카드의 "N ⤷ ▾" 버튼을 누르면 카드
|
||||
@@ -2699,7 +2877,7 @@
|
||||
'<circle cx="11.2" cy="12.5" r="1.7"/>' +
|
||||
"</svg>";
|
||||
function cardSubRowHtml(sub) {
|
||||
const overdue = sub.due_date && !sub.completed_at && sub.due_date < todayIso;
|
||||
const di = dueInfo(sub.due_date, !!sub.completed_at);
|
||||
return '<div class="pj-card-sub' + (sub.completed_at ? " is-done" : "") + '" data-sub-id="' + sub.id + '">' +
|
||||
'<button type="button" class="pj-card-sub-check" title="' + (sub.completed_at ? "완료 취소" : "완료로 표시") + '">' +
|
||||
'<span class="material-symbols-outlined">check_circle</span></button>' +
|
||||
@@ -2707,8 +2885,7 @@
|
||||
// 마감일 — 있으면 날짜, 없으면 아사나처럼 점선 원 달력 아이콘(줄에 마우스를
|
||||
// 올리면 보임). 둘 다 누르면 날짜 선택.
|
||||
(sub.due_date
|
||||
? '<span class="pj-card-sub-due' + (overdue ? " is-overdue" : "") + '" data-tip="마감일 변경">' +
|
||||
escapeHtml(fmtDateKr(sub.due_date)) + "</span>"
|
||||
? '<span class="pj-card-sub-due ' + di.cls + '" data-tip="마감일 변경">' + escapeHtml(di.text) + "</span>"
|
||||
: '<span class="pj-card-sub-due is-empty" data-tip="마감일 추가">' + DUE_EMPTY_ICON_SVG + "</span>") +
|
||||
// 담당자 — 있으면 아바타, 없으면 아사나처럼 점선 원 사람 아이콘(줄에
|
||||
// 마우스를 올리면 보임). 누르면 멤버 선택, 말풍선은 data-tip(initHoverTips).
|
||||
@@ -2786,10 +2963,10 @@
|
||||
const due = row.querySelector(".pj-card-sub-due");
|
||||
if (due && canManage) due.addEventListener("click", function (e) {
|
||||
e.stopPropagation();
|
||||
openDuePicker(sub, due, async function (v) {
|
||||
openDuePicker(sub, due, async function (patch) {
|
||||
try {
|
||||
await api("PUT", "/project/api/tasks/" + sub.id, { due_date: v });
|
||||
sub.due_date = v;
|
||||
await api("PUT", "/project/api/tasks/" + sub.id, patch);
|
||||
Object.assign(sub, patch);
|
||||
if (box.isConnected) fillCardSubs(box, t);
|
||||
} catch (err) { showToast("마감일 변경 실패: " + err.message, "error"); }
|
||||
});
|
||||
@@ -2879,8 +3056,12 @@
|
||||
(t.assignee_email ? '' : ' is-empty') + '" title="담당자 변경">' +
|
||||
avatarHtml(t.assignee_email, "pj-gicon-sm") +
|
||||
escapeHtml(t.assignee_email ? idOf(t.assignee_email) : "담당자") + "</span>" +
|
||||
'<span class="pj-card-due pj-card-edit-hit' + (t.due_date ? '' : ' is-empty') +
|
||||
'" title="마감일 변경">' + (t.due_date ? escapeHtml(t.due_date) : "마감일") + "</span>" +
|
||||
(function () {
|
||||
const di = dueInfo(t.due_date, !!t.completed_at);
|
||||
return '<span class="pj-card-due pj-card-edit-hit' + (di ? " " + di.cls : " is-empty") +
|
||||
'" title="' + (t.due_date ? "마감일 변경 (" + t.due_date + ")" : "마감일 추가") + '">' +
|
||||
(di ? escapeHtml(di.text) : "마감일") + "</span>";
|
||||
})() +
|
||||
// 하위 업무 — 아사나처럼 "개수 + 하위 업무 아이콘 + ▾", 누르면 카드 아래로 펼침.
|
||||
(t.subtask_total
|
||||
? '<button type="button" class="pj-card-subtoggle' + (expandedSubs.has(t.id) ? " is-open" : "") +
|
||||
@@ -2945,7 +3126,7 @@
|
||||
{ key: "stage", label: "세션", text: function (t) { return t.stage_name || "-"; }, sort: function (t) { return t.stage_name || ""; } },
|
||||
{ key: "priority", label: "우선순위", text: function (t) { return priorityLabels[t.priority] || t.priority || "-"; }, sort: function (t) { return ({ low: 0, normal: 1, high: 2 })[t.priority]; } },
|
||||
{ key: "start", label: "시작", text: function (t) { return t.start_date || "-"; }, sort: function (t) { return t.start_date || ""; } },
|
||||
{ key: "due", label: "마감", text: function (t) { return t.due_date || "-"; }, sort: function (t) { return t.due_date || ""; } },
|
||||
{ key: "due", label: "마감", text: function (t) { const di = dueInfo(t.due_date, !!t.completed_at); return di ? di.text : "-"; }, sort: function (t) { return t.due_date || ""; } },
|
||||
];
|
||||
// "이 프로젝트" 스코프 — 아사나 리스트 뷰처럼 세션이 컬럼이 아니라 그룹
|
||||
// 구분선이 된다(renderListGrouped). 그래서 세션 컬럼은 뺀다.
|
||||
@@ -3018,6 +3199,10 @@
|
||||
tr.innerHTML = cols.map(function (c) {
|
||||
let inner = escapeHtml(String(c.text(t)));
|
||||
if (c.key === "title") inner += cmtBadge(t);
|
||||
if (c.key === "due" && t.due_date) {
|
||||
const di = dueInfo(t.due_date, !!t.completed_at);
|
||||
inner = '<span class="pj-due-label ' + di.cls + '" title="' + t.due_date + '">' + escapeHtml(di.text) + "</span>";
|
||||
}
|
||||
if (c.key === "assignee" && t.assignee_email) {
|
||||
inner = '<span class="pj-assignee">' + avatarHtml(t.assignee_email, "pj-gicon-sm") + escapeHtml(idOf(t.assignee_email)) + "</span>";
|
||||
}
|
||||
@@ -3633,16 +3818,25 @@
|
||||
const v = el("pj-t-due").value;
|
||||
const btn = el("pj-t-due-btn");
|
||||
if (!btn) return;
|
||||
el("pj-t-due-text").textContent = v ? fmtDateKr(v) : "";
|
||||
const di = dueInfo(v, !!(currentTaskData && currentTaskData.completed_at));
|
||||
el("pj-t-due-text").textContent = di ? di.text : "";
|
||||
btn.classList.toggle("has-date", !!v);
|
||||
btn.classList.toggle("is-overdue", !!v && v < todayIso && !(currentTaskData && currentTaskData.completed_at));
|
||||
btn.classList.toggle("is-overdue", !!di && di.cls === "is-overdue");
|
||||
btn.classList.toggle("is-soon", !!di && di.cls === "is-soon");
|
||||
btn.title = v ? "마감일 " + v + " (눌러서 변경)" : "마감일 지정";
|
||||
}
|
||||
if (el("pj-t-due-btn")) {
|
||||
// 아사나식 날짜 팝업 — 업무 팝업은 "저장" 버튼으로 저장하므로 여기선
|
||||
// 숨긴 #pj-t-due 값만 바꾼다(시작일은 이 폼에 없어 마감일만).
|
||||
el("pj-t-due-btn").addEventListener("click", function () {
|
||||
const inp = el("pj-t-due");
|
||||
try { inp.showPicker(); } // 크롬·엣지·파이어폭스·사파리 최신
|
||||
catch (_) { inp.focus(); inp.click(); } // 구형 브라우저 폴백
|
||||
openDatePopover(el("pj-t-due-btn"), {
|
||||
due: inp.value, allowStart: false,
|
||||
onChange: function (patch) {
|
||||
inp.value = patch.due_date || "";
|
||||
inp.dispatchEvent(new Event("change", { bubbles: true }));
|
||||
},
|
||||
});
|
||||
});
|
||||
el("pj-t-due").addEventListener("change", syncDueBtn);
|
||||
el("pj-t-due").addEventListener("input", syncDueBtn);
|
||||
|
||||
Reference in New Issue
Block a user