|
|
|
@@ -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);
|
|
|
|
|