feat(project): delete registered tasks from the meeting task table
Registered rows get a delete button that, after confirmation, deletes the task from its project (trash). Unapplied rows get an x to drop the row. Registered rows now stay in the browser list so they can be deleted later. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+32
-6
@@ -10272,7 +10272,8 @@
|
||||
// ── 회의록 머리 ③ 작업 등록 표 — 제목 입력, 담당자·프로젝트·섹션 칸을 누르면 목록(showContextMenu — body 에 붙음),
|
||||
// [적용] = 그 프로젝트에 작업 만들기(POST /project/api/projects/{id}/tasks, 담당자는 그 프로젝트 멤버·소유자만 —
|
||||
// 서버 _check_assignee). 프로젝트 목록은 내가 멤버인 최상위 프로젝트(GET /project/api/projects).
|
||||
// 아직 적용 안 한 줄은 이 브라우저에 보관(localStorage pj_meet_quick:{이메일}) — 새로고침해도 남는다.
|
||||
// 줄은 이 브라우저에 보관(localStorage pj_meet_quick:{이메일}) — 새로고침해도 남는다(등록된 줄도 — 나중에 삭제할 수 있게).
|
||||
// 등록된 줄의 [삭제] = 확인 뒤 그 작업을 프로젝트에서도 삭제(DELETE /project/api/tasks/{id}, 휴지통 3개월), 적용 전 줄의 × = 줄만 지움.
|
||||
function initMeetQuickTasks() {
|
||||
const box = el("pj-meet-quick");
|
||||
if (!box) return;
|
||||
@@ -10293,10 +10294,10 @@
|
||||
};
|
||||
const blank = function () { return { title: "", assignee: "", projectId: null, projectName: "", stageId: null, stageName: "" }; };
|
||||
let rows = [];
|
||||
try { rows = (JSON.parse(localStorage.getItem(KEY) || "[]") || []).filter(function (r) { return r && !r.done; }); } catch (_) { rows = []; }
|
||||
try { rows = (JSON.parse(localStorage.getItem(KEY) || "[]") || []).filter(function (r) { return r && typeof r === "object"; }); } catch (_) { rows = []; }
|
||||
while (rows.length < 3) rows.push(blank());
|
||||
const save = function () {
|
||||
try { localStorage.setItem(KEY, JSON.stringify(rows.filter(function (r) { return !r.done && (r.title || r.projectId || r.assignee); }))); } catch (_) {}
|
||||
try { localStorage.setItem(KEY, JSON.stringify(rows.filter(function (r) { return r.done || r.title || r.projectId || r.assignee; }))); } catch (_) {}
|
||||
};
|
||||
let projects = null;
|
||||
const memberCache = {}, stageCache = {};
|
||||
@@ -10335,10 +10336,14 @@
|
||||
: cell("assignee", "", "담당자")) + "</td>" +
|
||||
"<td>" + cell("project", r.projectName, "프로젝트") + "</td>" +
|
||||
"<td>" + cell("stage", r.stageName, "섹션") + "</td>" +
|
||||
"<td>" + (r.done
|
||||
'<td class="pj-meet-quick-acts">' + (r.done
|
||||
? '<span class="pj-meet-quick-done"><span class="material-symbols-outlined" style="font-size:16px">check_circle</span>' +
|
||||
'<a href="/project/p/' + r.done.pid + "?task=" + r.done.id + '" target="_blank" rel="noopener">등록됨</a></span>'
|
||||
: '<button type="button" class="pj-meet-quick-apply" data-quick="apply">적용</button>') + "</td></tr>";
|
||||
'<a href="/project/p/' + r.done.pid + "?task=" + r.done.id + '" target="_blank" rel="noopener">등록됨</a></span>' +
|
||||
'<button type="button" class="pj-meet-quick-del" data-quick="delete" title="이 작업을 프로젝트에서도 삭제(휴지통에 3개월 보관)">' +
|
||||
'<span class="material-symbols-outlined">delete</span></button>'
|
||||
: '<button type="button" class="pj-meet-quick-apply" data-quick="apply">적용</button>' +
|
||||
'<button type="button" class="pj-meet-quick-del" data-quick="remove" title="이 줄 지우기(아직 등록 전)">' +
|
||||
'<span class="material-symbols-outlined">close</span></button>') + "</td></tr>";
|
||||
}).join("");
|
||||
}
|
||||
function menuAt(btn, items) {
|
||||
@@ -10397,6 +10402,25 @@
|
||||
showToast("작업 등록 실패: " + e.message, "error");
|
||||
}
|
||||
}
|
||||
// 등록된 작업 삭제 — 프로젝트에서도 지운다(휴지통). 이미 없으면(다른 곳에서 삭제) 줄만 지운다.
|
||||
async function removeTask(r, btn) {
|
||||
if (!(await confirm("‘" + (r.title || "작업") + "’ 작업을 ‘" + (r.projectName || "프로젝트") + "’에서도 삭제할까요? 삭제한 작업은 휴지통에 3개월 보관됩니다.",
|
||||
{ okText: "삭제", cancelText: "취소" }))) return;
|
||||
btn.disabled = true;
|
||||
try {
|
||||
await api("DELETE", "/project/api/tasks/" + r.done.id);
|
||||
showToast("작업을 삭제했습니다.");
|
||||
} catch (e) {
|
||||
if (e.status !== 404) { btn.disabled = false; showToast("작업 삭제 실패: " + e.message, "error"); return; }
|
||||
}
|
||||
dropRow(r);
|
||||
}
|
||||
function dropRow(r) {
|
||||
const i = rows.indexOf(r);
|
||||
if (i >= 0) rows.splice(i, 1);
|
||||
if (!rows.some(function (x) { return !x.done; })) rows.push(blank());
|
||||
save(); render();
|
||||
}
|
||||
tbody.addEventListener("input", function (e) {
|
||||
const inp = e.target.closest("input[data-field=title]");
|
||||
if (!inp) return;
|
||||
@@ -10411,6 +10435,8 @@
|
||||
const tr = e.target.closest("tr");
|
||||
if (!tr) return;
|
||||
const r = rows[+tr.dataset.i], pick = e.target.closest("[data-pick]");
|
||||
const del = e.target.closest('[data-quick="delete"], [data-quick="remove"]');
|
||||
if (del) { if (del.dataset.quick === "delete") removeTask(r, del); else dropRow(r); return; }
|
||||
if (r.done) return;
|
||||
const fail = function (err) { showToast("목록을 읽지 못했습니다: " + err.message, "error"); };
|
||||
if (pick) {
|
||||
|
||||
Reference in New Issue
Block a user