feat(project): 담당자는 협업자에서 제외·세부 업무 추가 칸 아이콘·내 업무 오른쪽 창
- 협업자 = 담당자 외의 멤버: add_followers 가 담당자를 거르고, 담당자 지정 시 같은 트랜잭션에서 협업자에서 뺌, 담당자 협업자 추가는 400 - 마이그레이션 028: 이미 겹친 task_followers 행 정리(스키마 변경 없음, 멱등) - 업무 창 세부 업무 추가 칸: 담당자·협업자·마감일을 동그라미 아이콘 버튼으로, 제목 칸을 넓게 - 내 업무 화면: 줄 클릭 시 화면 이동 없이 오른쪽 업무 창(iframe), 닫으면 목록 다시 받기 - 대시보드 "미완료 업무 합계(섹션별)" 카드 삭제 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
{% block head_extra %}
|
||||
{# 프로젝트 화면 부품(설명 편집기·날짜 팝업·멤버 고르기)을 그대로 쓴다 — project.js 는 PJ_LIB_ONLY 로 부품만 #}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013c" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013d" />
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
<script>window.PJ_LIB_ONLY = true; window.PJ_HOLIDAYS = {{ (pj_kr_holidays or {}) | tojson }};</script>
|
||||
{% endblock %}
|
||||
@@ -64,7 +64,7 @@
|
||||
</section>
|
||||
</div>
|
||||
<script>window.NTC_PEOPLE = {{ people | tojson }};</script>
|
||||
<script src="/static/project.js?v=20261013c" defer></script>
|
||||
<script src="/static/project.js?v=20261013d" defer></script>
|
||||
<script src="/static/erp-notice-admin.js?v=20261012b" defer></script>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
@@ -918,6 +918,8 @@ class ProjectStore:
|
||||
store.validate_date_range(final("start_date"), final("due_date"),
|
||||
final("start_time"), final("due_time"))
|
||||
conn.execute(f"UPDATE tasks SET {', '.join(sets)} WHERE id = %s", (*params, task_id))
|
||||
if "assignee_email" in assignee_fields:
|
||||
self._drop_assignee_follower(conn, task_id, assignee_fields["assignee_email"])
|
||||
if newly_assigned:
|
||||
self._log(conn, project_id=prev["project_id"], task_id=task_id,
|
||||
actor=actor, action=store.ACTION_ASSIGNED,
|
||||
@@ -986,6 +988,8 @@ class ProjectStore:
|
||||
params.append(now_kst())
|
||||
newly_completed = True
|
||||
conn.execute(f"UPDATE tasks SET {', '.join(sets)} WHERE id = %s", (*params, task_id))
|
||||
if newly_assigned:
|
||||
self._drop_assignee_follower(conn, task_id, newly_assigned)
|
||||
conn.execute(
|
||||
"DELETE FROM task_project_links WHERE task_id = ANY(%s) AND project_id = %s", (ids, target))
|
||||
conn.execute("UPDATE project_activity SET project_id = %s WHERE task_id = ANY(%s)", (target, ids))
|
||||
@@ -1993,7 +1997,8 @@ class ProjectStore:
|
||||
return out
|
||||
|
||||
def add_followers(self, *, task_id: int, emails: list[str]) -> list[str]:
|
||||
"""팔로워 추가(이미 있으면 무시). 새로 추가된 이메일만 돌려준다."""
|
||||
"""팔로워 추가(이미 있으면 무시). 새로 추가된 이메일만 돌려준다.
|
||||
그 업무의 담당자는 넣지 않는다 — 협업자는 담당자 외의 멤버(2026-10-13)."""
|
||||
targets = store.normalize_emails(emails)
|
||||
if not targets:
|
||||
return []
|
||||
@@ -2001,11 +2006,18 @@ class ProjectStore:
|
||||
rows = conn.execute(
|
||||
"INSERT INTO task_followers (task_id, user_email) "
|
||||
"SELECT %s, e FROM unnest(%s::text[]) AS e "
|
||||
"WHERE e <> COALESCE((SELECT lower(assignee_email) FROM tasks WHERE id = %s), '') "
|
||||
"ON CONFLICT DO NOTHING RETURNING user_email",
|
||||
(task_id, targets),
|
||||
(task_id, targets, task_id),
|
||||
).fetchall()
|
||||
return [r["user_email"] for r in rows]
|
||||
|
||||
def _drop_assignee_follower(self, conn: Any, task_id: int, email: str) -> None:
|
||||
"""새 담당자는 협업자에서 뺀다(같은 트랜잭션). 008 미적용이면 건너뜀."""
|
||||
if email and self._table_exists(conn, "task_followers"):
|
||||
conn.execute("DELETE FROM task_followers WHERE task_id = %s AND user_email = %s",
|
||||
(task_id, store.norm_str(email, lower=True)))
|
||||
|
||||
def remove_follower(self, *, task_id: int, user_email: str) -> None:
|
||||
with self._pool.connection() as conn:
|
||||
conn.execute(
|
||||
|
||||
@@ -1514,8 +1514,9 @@ def _create_task_for(
|
||||
raise HTTPException(status_code=400, detail=str(exc))
|
||||
except KeyError as exc:
|
||||
raise HTTPException(status_code=404, detail=str(exc))
|
||||
# 만든 사람·담당자는 자동 팔로워(아사나와 같은 규칙) + 만들 때 고른 협업자(세부 업무 추가 칸 등)
|
||||
_follow(st, task["id"], [user["email"], task.get("assignee_email") or ""] + followers)
|
||||
# 만든 사람은 자동 협업자 + 만들 때 고른 협업자(세부 업무 추가 칸 등). 담당자는 협업자가 아니다(2026-10-13,
|
||||
# db.add_followers 가 담당자를 거른다 — 만든 사람이 담당자여도 빠진다).
|
||||
_follow(st, task["id"], [user["email"]] + followers)
|
||||
# 생성과 동시에 담당자 지정 시 관리자 메일 + 담당자 인앱 알림
|
||||
if task.get("assignee_email"):
|
||||
_notify(
|
||||
@@ -1603,8 +1604,7 @@ def api_update_task(
|
||||
|
||||
project_name = task.get("project_name") or ""
|
||||
project = st.get_project(project_id=existing["project_id"]) or {"id": existing["project_id"], "name": project_name}
|
||||
if task.get("_newly_assigned"):
|
||||
_follow(st, task_id, [task["_newly_assigned"]])
|
||||
if task.get("_newly_assigned"): # 담당자는 협업자가 아니다 — db.update_task 가 협업자에서 뺐다(2026-10-13)
|
||||
_notify(
|
||||
bg, request,
|
||||
subject=store.build_subject_assigned(
|
||||
@@ -1775,8 +1775,7 @@ def api_move_task_project(
|
||||
raise HTTPException(status_code=404, detail=str(exc))
|
||||
task.pop("_moved_ids", None)
|
||||
newly_assigned = task.pop("_newly_assigned", None)
|
||||
if newly_assigned: # 대상 섹션 기본 담당자가 자동 배정됨 — 일반 배정과 같은 알림
|
||||
_follow(st, task["id"], [newly_assigned])
|
||||
if newly_assigned: # 대상 섹션 기본 담당자가 자동 배정됨 — 일반 배정과 같은 알림(담당자는 협업자가 아님)
|
||||
_inbox(
|
||||
st, recipients=[newly_assigned], actor=user["email"], project_id=target, task_id=task["id"],
|
||||
ntype="assigned", title=f"업무 배정: {task['title']}",
|
||||
@@ -1829,6 +1828,8 @@ def api_add_follower(
|
||||
st = _db_or_503(request)
|
||||
task = _task_for_followers(request, st, user, task_id)
|
||||
email = store.norm_str(payload.get("email") or user["email"], lower=True)
|
||||
if email and email == store.norm_str(task.get("assignee_email") or "", lower=True):
|
||||
raise HTTPException(status_code=400, detail="담당자는 협업자로 지정할 수 없습니다(협업자는 담당자 외의 멤버).")
|
||||
if email != store.norm_str(user["email"], lower=True):
|
||||
if not access.can_assign(st, email, task["project_id"]):
|
||||
raise HTTPException(status_code=400, detail="이 프로젝트 멤버만 협업자로 추가할 수 있습니다.")
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "project/_meeting_content_base.html" if meeting_embedded else "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013c" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013d" />
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
{% endblock %}
|
||||
|
||||
@@ -298,5 +298,5 @@
|
||||
|
||||
<script src="/static/project-goal-text.js?v=20261003d" defer></script>
|
||||
<script src="/static/project-meeting-cells.js?v=20261012a" defer></script>
|
||||
<script src="/static/project.js?v=20261013c" defer></script>
|
||||
<script src="/static/project.js?v=20261013d" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013c" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013d" />
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
{% endblock %}
|
||||
|
||||
@@ -207,5 +207,5 @@
|
||||
{% include "project/_member_tasks_modal.html" %}
|
||||
|
||||
<script src="/static/project-goal-text.js?v=20261003d" defer></script>
|
||||
<script src="/static/project.js?v=20261013c" defer></script>
|
||||
<script src="/static/project.js?v=20261013d" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013c" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013d" />
|
||||
<link rel="stylesheet" href="/static/project-help.css?v=20261003a" />
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013c" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013d" />
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
{% endblock %}
|
||||
|
||||
@@ -102,5 +102,5 @@
|
||||
{% include "project/_side_modals.html" %}
|
||||
{% include "project/_member_tasks_modal.html" %}
|
||||
|
||||
<script src="/static/project.js?v=20261013c" defer></script>
|
||||
<script src="/static/project.js?v=20261013d" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013c" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013d" />
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
{% endblock %}
|
||||
|
||||
@@ -100,5 +100,5 @@
|
||||
"today": {{ today | tojson }}
|
||||
}
|
||||
</script>
|
||||
<script src="/static/project.js?v=20261013c" defer></script>
|
||||
<script src="/static/project.js?v=20261013d" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013c" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013d" />
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
{% endblock %}
|
||||
|
||||
@@ -108,5 +108,5 @@
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
<script src="/static/project.js?v=20261013c" defer></script>
|
||||
<script src="/static/project.js?v=20261013d" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013c" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013d" />
|
||||
<!-- 구글 머티리얼 심볼(담당자 아이콘 등) — self-host -->
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
<!-- 타임라인 vis-timeline — self-host -->
|
||||
@@ -469,5 +469,5 @@
|
||||
</script>
|
||||
|
||||
<script src="/static/vendor/vis-timeline/vis-timeline-graph2d.min.js"></script>
|
||||
<script src="/static/project.js?v=20261013c" defer></script>
|
||||
<script src="/static/project.js?v=20261013d" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013c" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013d" />
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
{% endblock %}
|
||||
|
||||
@@ -70,5 +70,5 @@
|
||||
{% include "project/_side_modals.html" %}
|
||||
{% include "project/_member_tasks_modal.html" %}
|
||||
|
||||
<script src="/static/project.js?v=20261013c" defer></script>
|
||||
<script src="/static/project.js?v=20261013d" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1594,6 +1594,25 @@ img.pj-person-ic { width: 22px; height: 22px; }
|
||||
.pj-assignee-btn.pj-subtask-add-fol .pj-person-ic svg,
|
||||
.pj-assignee-btn.pj-subtask-add-fol > svg { width: 18px; height: 18px; flex: 0 0 auto; }
|
||||
.pj-assignee-btn.pj-subtask-add-fol .pj-subtask-fol-n { margin-left: -2px; }
|
||||
/* 세부 업무 추가 칸(2026-10-13) — 담당자·협업자·마감일은 글자 없는 동그라미 아이콘 버튼, 남는 폭은 제목 칸이 다 쓴다.
|
||||
(말풍선 = 담당자 이름·협업자 목록·날짜, 날짜를 고르면 아이콘 + 날짜) */
|
||||
.pj-subtask-form { flex-wrap: nowrap; align-items: center; gap: 4px; }
|
||||
.pj-subtask-form input[type="text"] { flex: 1 1 auto; min-width: 0; }
|
||||
.pj-subtask-form .pj-assignee-btn[data-for="pj-subtask-add-assignee"],
|
||||
.pj-subtask-form .pj-assignee-btn.pj-subtask-add-fol {
|
||||
width: auto; min-width: 32px; height: 32px; padding: 0 3px; gap: 1px; justify-content: center;
|
||||
border: none; border-radius: 16px; background: transparent; color: #6d6e6f;
|
||||
}
|
||||
.pj-subtask-form .pj-assignee-btn[data-for="pj-subtask-add-assignee"]:hover,
|
||||
.pj-subtask-form .pj-assignee-btn.pj-subtask-add-fol:hover { background: #eceef0; color: #1e1f21; }
|
||||
.pj-subtask-form .pj-assignee-btn .pj-assignee-btn-name { display: none; }
|
||||
.pj-subtask-form .pj-assignee-btn img.pj-person-ic { width: 24px; height: 24px; border-radius: 50%; }
|
||||
.pj-subtask-form .pj-assignee-btn .pj-person-ic svg,
|
||||
.pj-subtask-form .pj-assignee-btn.pj-subtask-add-fol > svg { width: 24px; height: 24px; }
|
||||
.pj-subtask-form .pj-date-btn:not(.is-icon-only) { height: 32px; padding: 0 8px; border: none; border-radius: 16px; background: #f3f4f6; }
|
||||
.pj-subtask-form .pj-date-btn:not(.is-icon-only) .material-symbols-outlined { font-size: 17px; }
|
||||
.pj-subtask-form #pj-subtask-add { flex: 0 0 auto; }
|
||||
.pj-subtask-form .pj-date-btn.is-icon-only { flex: 0 0 auto; width: 32px; padding: 0; }
|
||||
.pj-assignee-btn.pj-subtask-assignee img.pj-person-ic,
|
||||
.pj-assignee-btn[data-for="pj-subtask-add-assignee"] img.pj-person-ic { width: 18px; height: 18px; }
|
||||
.pj-assignee-btn.pj-subtask-assignee .pj-person-ic svg,
|
||||
@@ -1996,6 +2015,8 @@ html.pj-embed .pj-btn-goto-project { display: inline-flex; align-items: center;
|
||||
transform: translateX(100%); transition: transform .22s ease;
|
||||
}
|
||||
.pj-inbox-panel.is-open { transform: translateX(0); }
|
||||
/* 내 업무 — 오른쪽 업무 창에 연 줄 */
|
||||
.pj-mtk-row.is-panel-selected > td { background: var(--pj-accent-tint); }
|
||||
.pj-inbox-panel iframe { display: block; width: 100%; height: 100%; border: 0; }
|
||||
.pj-inbox-item.is-selected { border-color: var(--pj-accent, #4573d2); box-shadow: 0 0 0 1px var(--pj-accent, #4573d2) inset; }
|
||||
|
||||
|
||||
+156
-48
@@ -973,11 +973,13 @@
|
||||
}
|
||||
// 협업자 고르기 메뉴 — 후보 멤버(지금 협업자는 ✓). 고르면 onToggle(email, 켜기?) 를 기다린 뒤 같은 자리에 메뉴를
|
||||
// 다시 열어 여러 명을 이어서 고른다(Esc·바깥 클릭으로 닫힘). current() = 지금 협업자 목록.
|
||||
function openFollowerMenu(anchor, emails, current, onToggle) {
|
||||
// assignee = 그 업무 담당자(함수 가능) — 담당자는 협업자가 아니라 후보에서 뺀다(2026-10-13).
|
||||
function openFollowerMenu(anchor, emails, current, onToggle, assignee) {
|
||||
const lower = function (x) { return String(x || "").toLowerCase(); };
|
||||
const who = lower(typeof assignee === "function" ? assignee() : assignee);
|
||||
const cur = (current() || []).map(lower);
|
||||
const cands = [];
|
||||
(emails || []).concat(cur).forEach(function (e) { e = lower(e); if (e && cands.indexOf(e) < 0) cands.push(e); });
|
||||
(emails || []).concat(cur).forEach(function (e) { e = lower(e); if (e && e !== who && cands.indexOf(e) < 0) cands.push(e); });
|
||||
if (!cands.length) { showToast("지정할 수 있는 멤버가 없습니다."); return; }
|
||||
const r = anchor.getBoundingClientRect();
|
||||
showContextMenu(r.left, r.bottom + 4, cands.map(function (em) {
|
||||
@@ -986,7 +988,7 @@
|
||||
label: idOf(em), icon: personIconHtml(em), checked: on,
|
||||
onClick: async function () {
|
||||
const ok = await onToggle(em, !on);
|
||||
if (ok !== false && anchor.isConnected) openFollowerMenu(anchor, emails, current, onToggle);
|
||||
if (ok !== false && anchor.isConnected) openFollowerMenu(anchor, emails, current, onToggle, assignee);
|
||||
},
|
||||
};
|
||||
}), { label: "협업자 지정" });
|
||||
@@ -1005,6 +1007,15 @@
|
||||
: await api("DELETE", "/project/api/tasks/" + taskId + "/followers/" + encodeURIComponent(email));
|
||||
return res.followers || [];
|
||||
}
|
||||
// 새로 만든 업무의 협업자 = 만든 사람 + 고른 사람(담당자는 빼고) — 서버 _follow·db.add_followers 와 같은 규칙.
|
||||
function newTaskFollowers(chosen, assignee) {
|
||||
const who = String(assignee || "").toLowerCase();
|
||||
const out = [];
|
||||
[pageMeEmail()].concat(chosen || []).forEach(function (x) {
|
||||
x = String(x || "").toLowerCase(); if (x && x !== who && out.indexOf(x) < 0) out.push(x);
|
||||
});
|
||||
return out;
|
||||
}
|
||||
function pageMeEmail() {
|
||||
const w = document.querySelector(".pj-wrap");
|
||||
return ((w && w.dataset.me) || "").toLowerCase();
|
||||
@@ -1033,7 +1044,7 @@
|
||||
btn.querySelector(".pj-assignee-btn-name").textContent = v ? (opt ? opt.textContent : idOf(v)) : "담당자 없음";
|
||||
btn.classList.toggle("is-empty", !v);
|
||||
btn.disabled = sel.disabled;
|
||||
btn.dataset.tip = v ? "담당자 변경" : "이 업무 배정";
|
||||
btn.dataset.tip = v ? "담당자: " + (opt ? opt.textContent : idOf(v)) : "담당자 지정";
|
||||
}
|
||||
const desc = Object.getOwnPropertyDescriptor(HTMLSelectElement.prototype, "value");
|
||||
Object.defineProperty(sel, "value", {
|
||||
@@ -2935,6 +2946,74 @@
|
||||
// 모아 보여주고, 완료 체크·정렬·필터를 그 자리에서 처리한다. 업무를
|
||||
// 누르면 그 프로젝트 화면이 열리면서 편집 팝업이 뜬다(?task=).
|
||||
// ════════════════════════════════════════════════════════════
|
||||
// 오른쪽 업무 창 — /project/t/{id}?embed=1 을 iframe 패널(.pj-inbox-panel, body 에)로. 수신함·회의록과 같은 방식:
|
||||
// 다른 업무로 바꾸거나 닫기 전에 창 안 저장을 기다린다(__pjEmbedSettle — 실패면 "버리고 넘어가기 / 계속 편집").
|
||||
// opts.onOpen(id)·opts.onClose() — 목록 줄 표시·목록 다시 받기.
|
||||
function createEmbedTaskPanel(opts) {
|
||||
opts = opts || {};
|
||||
let panel = null, shown = null, switching = null, wanted;
|
||||
function isOpen() { return !!panel && panel.classList.contains("is-open"); }
|
||||
async function settleFrame() {
|
||||
if (!isOpen()) return true;
|
||||
let fn = null;
|
||||
try { fn = panel.querySelector("iframe").contentWindow.__pjEmbedSettle; } catch (_) { fn = null; }
|
||||
if (typeof fn !== "function") return true;
|
||||
try { return !!(await fn()); } catch (_) { return false; }
|
||||
}
|
||||
function apply(id) {
|
||||
if (id == null) {
|
||||
if (!isOpen()) return;
|
||||
panel.classList.remove("is-open");
|
||||
shown = null;
|
||||
const p = panel;
|
||||
setTimeout(function () { if (!p.classList.contains("is-open")) p.querySelector("iframe").src = "about:blank"; }, 250);
|
||||
if (opts.onClose) opts.onClose();
|
||||
return;
|
||||
}
|
||||
if (!panel) {
|
||||
panel = document.createElement("div");
|
||||
panel.className = "pj-inbox-panel";
|
||||
panel.innerHTML = '<iframe title="업무"></iframe>';
|
||||
document.body.appendChild(panel); // 화면 배율(.pj-ui-scale) 밖 — body 에
|
||||
try {
|
||||
const w = parseInt(localStorage.getItem("pj_task_panel_w") || "", 10);
|
||||
if (w) panel.style.width = "min(" + Math.round(w * uiZoom()) + "px, 92vw)";
|
||||
} catch (_) {}
|
||||
}
|
||||
shown = id;
|
||||
panel.querySelector("iframe").src = "/project/t/" + encodeURIComponent(id) + "?embed=1";
|
||||
void panel.offsetWidth;
|
||||
panel.classList.add("is-open");
|
||||
if (opts.onOpen) opts.onOpen(id);
|
||||
}
|
||||
function request(id) {
|
||||
wanted = id;
|
||||
if (switching) return switching;
|
||||
switching = (async function () {
|
||||
while (wanted !== undefined) {
|
||||
const t = wanted;
|
||||
if ((t == null && !isOpen()) || (t != null && isOpen() && shown === t)) { wanted = undefined; break; }
|
||||
const ok = await settleFrame();
|
||||
if (!ok) { wanted = undefined; break; } // 계속 편집 — 창·입력 그대로
|
||||
if (wanted !== t) continue;
|
||||
wanted = undefined;
|
||||
apply(t);
|
||||
}
|
||||
})().finally(function () { switching = null; });
|
||||
return switching;
|
||||
}
|
||||
window.addEventListener("message", function (e) {
|
||||
if (e.origin === location.origin && e.data && e.data.type === "pj-embed-close" && isOpen()) request(null);
|
||||
});
|
||||
return {
|
||||
open: function (id) { return request(id); },
|
||||
close: function () { return request(null); },
|
||||
isOpen: isOpen,
|
||||
shownId: function () { return isOpen() ? shown : null; },
|
||||
contains: function (n) { return !!panel && panel.contains(n); },
|
||||
};
|
||||
}
|
||||
|
||||
function initMyTasks() {
|
||||
const root = document.querySelector(".pj-mytasks-view");
|
||||
if (!root) return;
|
||||
@@ -2945,6 +3024,32 @@
|
||||
// 오늘 = 한국시간 날짜를 그때그때(화면을 밤새 열어 두어도 자정이 지나면 바뀐다).
|
||||
const todayNow = kstTodayIso;
|
||||
const me = (root.dataset.me || "").toLowerCase();
|
||||
// 줄을 누르면 화면은 그대로, 오른쪽에 업무 창(2026-10-13). 닫으면 목록을 다시 받는다(창에서 고친 내용 반영).
|
||||
// Ctrl·가운데 클릭은 예전처럼 새 탭에서 그 프로젝트 화면.
|
||||
function markPanelRow(id) {
|
||||
root.querySelectorAll("tr.is-panel-selected").forEach(function (r) { r.classList.remove("is-panel-selected"); });
|
||||
if (id != null) {
|
||||
const tr = root.querySelector('tr.pj-mtk-row[data-task-id="' + id + '"]');
|
||||
if (tr) tr.classList.add("is-panel-selected");
|
||||
}
|
||||
}
|
||||
const taskPanel = createEmbedTaskPanel({
|
||||
onOpen: markPanelRow,
|
||||
onClose: function () { markPanelRow(null); if (softSyncProjectRef) softSyncProjectRef(); },
|
||||
});
|
||||
function openTaskHere(id, projectId, e) {
|
||||
if (e && (e.ctrlKey || e.metaKey || e.button === 1)) {
|
||||
window.open("/project/p/" + projectId + "?task=" + id, "_blank");
|
||||
return;
|
||||
}
|
||||
taskPanel.open(id);
|
||||
}
|
||||
document.addEventListener("keydown", function (e) { if (e.key === "Escape" && taskPanel.isOpen()) taskPanel.close(); });
|
||||
document.addEventListener("mousedown", function (e) {
|
||||
if (!taskPanel.isOpen() || taskPanel.contains(e.target)) return;
|
||||
if (e.target.closest && e.target.closest("tr.pj-mtk-row, .pj-ctxmenu, .pj-modal, .erp-dialog, .pj-alert-pop, .erp-overdue")) return;
|
||||
taskPanel.close();
|
||||
});
|
||||
|
||||
const table = el("pj-mytasks-table");
|
||||
const emptyEl = el("pj-mytasks-empty");
|
||||
@@ -3079,7 +3184,8 @@
|
||||
|
||||
function rowContextItems(t) {
|
||||
return [
|
||||
{ label: "열기", onClick: function () { location.href = "/project/p/" + t.project_id + "?task=" + t.id; } },
|
||||
{ label: "열기", onClick: function () { openTaskHere(t.id, t.project_id); } },
|
||||
{ label: "프로젝트 화면에서 열기", onClick: function () { location.href = "/project/p/" + t.project_id + "?task=" + t.id; } },
|
||||
{ label: "업무 링크 복사", onClick: function () { shareTaskLink(t.id); } },
|
||||
{
|
||||
label: t.completed_at ? "완료 취소" : "완료로 표시",
|
||||
@@ -3120,10 +3226,12 @@
|
||||
const chk = tr.querySelector('input[type="checkbox"]');
|
||||
chk.addEventListener("click", function (e) { e.stopPropagation(); });
|
||||
chk.addEventListener("change", function () { toggleDone(t, chk.checked); });
|
||||
if (taskPanel.shownId() === t.id) tr.classList.add("is-panel-selected");
|
||||
tr.addEventListener("click", function (e) {
|
||||
if (e.target.closest(".pj-cmt-badge")) return; // 말풍선은 댓글 팝업 담당
|
||||
location.href = "/project/p/" + t.project_id + "?task=" + t.id;
|
||||
openTaskHere(t.id, t.project_id, e);
|
||||
});
|
||||
tr.addEventListener("auxclick", function (e) { if (e.button === 1) openTaskHere(t.id, t.project_id, e); });
|
||||
tr.addEventListener("contextmenu", function (e) {
|
||||
e.preventDefault();
|
||||
showContextMenu(e.clientX, e.clientY, rowContextItems(t));
|
||||
@@ -3147,9 +3255,8 @@
|
||||
'<span class="pj-mtk-parent-name">' + escapeHtml(subtask.parent_title || "(상위 업무)") + "</span>" +
|
||||
'<span class="pj-mtk-parent-hint">' + (parentIsMine ? "상위 업무" : "다른 담당자의 상위 업무") + "</span>" +
|
||||
"</td>";
|
||||
tr.addEventListener("click", function () {
|
||||
location.href = "/project/p/" + subtask.project_id + "?task=" + subtask.parent_task_id;
|
||||
});
|
||||
tr.dataset.taskId = subtask.parent_task_id;
|
||||
tr.addEventListener("click", function (e) { openTaskHere(subtask.parent_task_id, subtask.project_id, e); });
|
||||
tbody.appendChild(tr);
|
||||
}
|
||||
|
||||
@@ -5237,6 +5344,9 @@
|
||||
await api("PUT", "/project/api/tasks/" + sub.id,
|
||||
{ assignee_email: email, assignee_name: email ? idOf(email) : "" });
|
||||
sub.assignee_email = email;
|
||||
if (email && Array.isArray(sub.followers)) { // 담당자는 협업자가 아니다
|
||||
sub.followers = sub.followers.filter(function (x) { return String(x).toLowerCase() !== String(email).toLowerCase(); });
|
||||
}
|
||||
if (box.isConnected) fillCardSubs(box, t);
|
||||
} catch (e) { showToast("담당자 변경 실패: " + e.message, "error"); }
|
||||
}
|
||||
@@ -5407,7 +5517,7 @@
|
||||
fol.dataset.tip = followerTip(sub.followers);
|
||||
return true;
|
||||
} catch (err) { showToast("협업자 변경 실패: " + err.message, "error"); return false; }
|
||||
});
|
||||
}, function () { return sub.assignee_email; });
|
||||
});
|
||||
const check = row.querySelector(".pj-card-sub-check");
|
||||
check.addEventListener("click", async function (e) {
|
||||
@@ -5541,7 +5651,11 @@
|
||||
const r = avEl.getBoundingClientRect();
|
||||
showContextMenu(r.left, r.bottom + 4, assigneeMenuItems(
|
||||
list.map(function (m) { return m.user_email; }), draft.assignee,
|
||||
function (email) { draft.assignee = email || ""; paintAv(); refocus(); }
|
||||
function (email) {
|
||||
draft.assignee = email || "";
|
||||
if (draft.assignee) draft.followers = draft.followers.filter(function (x) { return x !== draft.assignee.toLowerCase(); });
|
||||
paintAv(); paintFol(); refocus();
|
||||
}
|
||||
));
|
||||
});
|
||||
// 협업자 — 고른 사람은 만들 때 followers 로 같이 보낸다(메뉴는 고를 때마다 다시 열려 여러 명).
|
||||
@@ -5554,7 +5668,7 @@
|
||||
draft.followers = on ? draft.followers.concat([em]) : draft.followers.filter(function (x) { return x !== em; });
|
||||
paintFol();
|
||||
return true;
|
||||
});
|
||||
}, function () { return draft.assignee; });
|
||||
});
|
||||
function closeDraft() {
|
||||
delete subDrafts[t.id];
|
||||
@@ -5576,13 +5690,7 @@
|
||||
});
|
||||
const subs = subsCache[t.id] || (subsCache[t.id] = []);
|
||||
// 새 줄 협업자 아이콘 — 서버 자동 협업자와 같은 규칙(만든 사람·담당자·고른 협업자)
|
||||
if (res.task && !Array.isArray(res.task.followers)) {
|
||||
const fl = [];
|
||||
[me, res.task.assignee_email].concat(draft.followers).forEach(function (x) {
|
||||
x = String(x || "").toLowerCase(); if (x && fl.indexOf(x) < 0) fl.push(x);
|
||||
});
|
||||
res.task.followers = fl;
|
||||
}
|
||||
if (res.task && !Array.isArray(res.task.followers)) res.task.followers = newTaskFollowers(draft.followers, res.task.assignee_email);
|
||||
subs.push(res.task);
|
||||
adjustSubCounts(t.id, 1, 0);
|
||||
// Enter — 다음 세부 작업을 이어서 입력(아사나): 이름만 비우고 줄은 열어 둔다.
|
||||
@@ -6200,21 +6308,7 @@
|
||||
const charts = document.createElement("div");
|
||||
charts.className = "pj-dash-charts";
|
||||
|
||||
// 섹션별 미완료 — "이 프로젝트" 스코프면 보드 컬럼과 같은 순서로.
|
||||
const sectionOrder = viewScope === "project"
|
||||
? (stagesByProject[projectId] || []).slice().sort(function (a, b) { return a.sort_order - b.sort_order; }).map(function (s) { return s.name; })
|
||||
: boardStages.slice();
|
||||
const bySection = {};
|
||||
incomplete.forEach(function (t) { const k = t.stage_name || "미지정"; bySection[k] = (bySection[k] || 0) + 1; });
|
||||
const sectionNames = sectionOrder.filter(function (n) { return bySection[n]; });
|
||||
Object.keys(bySection).forEach(function (n) { if (sectionNames.indexOf(n) < 0) sectionNames.push(n); });
|
||||
const sectionData = sectionNames.map(function (n) { return { label: n, value: bySection[n] }; });
|
||||
const sectionCard = document.createElement("div");
|
||||
sectionCard.className = "pj-dash-card";
|
||||
sectionCard.innerHTML = '<div class="pj-dash-card-title">미완료 업무 합계(섹션별)</div>';
|
||||
sectionCard.appendChild(dashBarChart(sectionData));
|
||||
charts.appendChild(sectionCard);
|
||||
|
||||
// "미완료 업무 합계(섹션별)" 카드는 2026-10-13 요청으로 없앴다(dashBarChart 는 남겨 둔다).
|
||||
// 프로젝트별(2026-10-13) — 업무가 속한 프로젝트마다 완료/전체·완료율 막대. 완료 상태별 카드 바로 왼쪽.
|
||||
const projectCard = document.createElement("div");
|
||||
projectCard.className = "pj-dash-card";
|
||||
@@ -6744,7 +6838,12 @@
|
||||
}
|
||||
// 완료 섹션으로 옮기거나 빼면 완료 이력 줄이 생기거나 사라진다.
|
||||
if (wasDone !== !!res.task.completed_at) loadComments(id);
|
||||
if (res.task._newly_assigned) loadTaskExtras(res.task); // 새 담당자가 협업자로 들어온다
|
||||
if (key === "assignee" && followersTask && followersTask.id === id) {
|
||||
// 담당자는 협업자가 아니다 — 서버가 뺀 것과 맞추고, 참여 버튼도 다시
|
||||
const a = String(res.task.assignee_email || "").toLowerCase();
|
||||
followers = followers.filter(function (x) { return x !== a; });
|
||||
renderFollowers();
|
||||
}
|
||||
if (res.mention_skipped && res.mention_skipped.length) warnMentionSkipped(res.mention_skipped);
|
||||
setAutoState(failedFields.size ? "error" : "saved");
|
||||
}
|
||||
@@ -6918,6 +7017,8 @@
|
||||
const tog = el("pj-follow-toggle");
|
||||
tog.textContent = followingMe ? "협업자에서 나가기" : "협업자로 참여";
|
||||
tog.classList.toggle("is-on", followingMe);
|
||||
// 내가 담당자면 협업자로 참여할 수 없다(담당자는 협업자가 아니다)
|
||||
tog.hidden = !followingMe && String((el("pj-t-assignee") && el("pj-t-assignee").value) || "").toLowerCase() === me;
|
||||
}
|
||||
async function setFollower(email, on) {
|
||||
if (!followersTask) return;
|
||||
@@ -6951,8 +7052,9 @@
|
||||
const r = e.currentTarget.getBoundingClientRect();
|
||||
let list = [];
|
||||
try { list = await membersOfProject(followersTask.project_id); } catch (_) {}
|
||||
const assignee = String((el("pj-t-assignee") && el("pj-t-assignee").value) || "").toLowerCase();
|
||||
const cands = list.map(function (m) { return (m.user_email || "").toLowerCase(); })
|
||||
.filter(function (em) { return em && followers.indexOf(em) < 0; });
|
||||
.filter(function (em) { return em && em !== assignee && followers.indexOf(em) < 0; }); // 담당자는 협업자가 아니다
|
||||
if (!cands.length) { showToast("추가할 수 있는 멤버가 없습니다."); return; }
|
||||
showContextMenu(r.left, r.bottom + 4, cands.map(function (em) {
|
||||
return { label: idOf(em), icon: personIconHtml(em), onClick: function () { setFollower(em, true); } };
|
||||
@@ -8393,8 +8495,14 @@
|
||||
'<span class="pj-assignee-btn-name"></span>';
|
||||
addFolBtn.querySelector(".pj-assignee-btn-name").textContent =
|
||||
addFollowers.length ? "협업자 " + addFollowers.length + "명" : "협업자 없음";
|
||||
addFolBtn.title = followerTip(addFollowers);
|
||||
addFolBtn.removeAttribute("title");
|
||||
addFolBtn.dataset.tip = followerTip(addFollowers);
|
||||
}
|
||||
// 추가 칸 담당자를 고르면 그 사람은 협업자에서 뺀다(담당자는 협업자가 아니다)
|
||||
if (addAssignee) addAssignee.addEventListener("change", function () {
|
||||
const a = String(addAssignee.value || "").toLowerCase();
|
||||
if (a && addFollowers.indexOf(a) >= 0) { addFollowers = addFollowers.filter(function (x) { return x !== a; }); paintAddFol(); }
|
||||
});
|
||||
paintAddFol();
|
||||
if (addFolBtn) addFolBtn.addEventListener("click", async function () {
|
||||
if (!projectId || readOnly) return;
|
||||
@@ -8405,10 +8513,11 @@
|
||||
addFollowers = on ? addFollowers.concat([em]) : addFollowers.filter(function (x) { return x !== em; });
|
||||
paintAddFol();
|
||||
return true;
|
||||
});
|
||||
}, function () { return addAssignee ? addAssignee.value : ""; });
|
||||
});
|
||||
const addDue = el("pj-subtask-add-due");
|
||||
enhanceDateInput(addDue, { placeholder: "마감일" }); // 아사나식 날짜 팝업
|
||||
// 아사나식 날짜 팝업 — 추가 칸은 동그라미 아이콘 버튼(날짜가 있으면 아이콘 + 날짜, 2026-10-13)
|
||||
enhanceDateInput(addDue, { placeholder: "마감일", iconOnly: true });
|
||||
const addBtn = el("pj-subtask-add");
|
||||
const formEl = listEl.parentNode ? listEl.parentNode.querySelector(".pj-subtask-form") : null;
|
||||
let taskId = null, projectId = null, canDeleteFn = function () { return false; }, onChange = null, onOpen = null;
|
||||
@@ -8550,7 +8659,12 @@
|
||||
const prev = sub.assignee_email;
|
||||
sub.assignee_email = v;
|
||||
renderAv();
|
||||
if (!(await patch({ assignee_email: v, assignee_name: v ? idOf(v) : "" }))) { sub.assignee_email = prev; renderAv(); }
|
||||
if (!(await patch({ assignee_email: v, assignee_name: v ? idOf(v) : "" }))) { sub.assignee_email = prev; renderAv(); return; }
|
||||
// 담당자는 협업자가 아니다 — 서버가 뺀 것과 화면을 맞춘다
|
||||
if (v && Array.isArray(sub.followers)) {
|
||||
sub.followers = sub.followers.filter(function (x) { return String(x).toLowerCase() !== String(v).toLowerCase(); });
|
||||
renderFol();
|
||||
}
|
||||
}));
|
||||
});
|
||||
// 협업자 — 누르면 멤버 목록(협업자는 ✓). 고르면 넣고/빼고, 메뉴를 다시 열어 여러 명 지정.
|
||||
@@ -8562,7 +8676,7 @@
|
||||
renderFol();
|
||||
return true;
|
||||
} catch (err) { showToast("협업자 변경 실패: " + err.message, "error"); return false; }
|
||||
});
|
||||
}, function () { return sub.assignee_email; });
|
||||
});
|
||||
function open() { if (onOpen) onOpen(sub); }
|
||||
li.querySelector(".pj-subtask-open").addEventListener("click", function (e) { e.stopPropagation(); open(); });
|
||||
@@ -8688,13 +8802,7 @@
|
||||
if (addAssignee) addAssignee.value = "";
|
||||
if (addDue) addDue.value = "";
|
||||
// 새 줄의 협업자 아이콘 — 만든 사람·담당자·고른 협업자(서버 자동 협업자와 같은 규칙)
|
||||
if (res.task && !Array.isArray(res.task.followers)) {
|
||||
const fl = [];
|
||||
[pageMeEmail(), res.task.assignee_email].concat(addFollowers).forEach(function (x) {
|
||||
x = String(x || "").toLowerCase(); if (x && fl.indexOf(x) < 0) fl.push(x);
|
||||
});
|
||||
res.task.followers = fl;
|
||||
}
|
||||
if (res.task && !Array.isArray(res.task.followers)) res.task.followers = newTaskFollowers(addFollowers, res.task.assignee_email);
|
||||
addFollowers = []; paintAddFol();
|
||||
const emails = await memberEmails(pid);
|
||||
if (seq !== ctxSeq) return;
|
||||
|
||||
Reference in New Issue
Block a user