feat(project): meeting task table - pick an existing task to add a subtask; title opens task panel
- New "작업" column (migration 026 parent_task_id): empty = new task in the section, chosen task = register as its subtask (candidates = open main tasks of that section) - Server validates the task belongs to the project, clears it when the project changes, and rejects apply if the chosen task was deleted/moved - Removed the in-table subtask rows (hover button, Tab/Shift+Tab, right-click) from UI/API - Registered row title opens the task editor on the right (iframe ?embed=1, waits for the task window to save before switching/closing, like the inbox panel) - Help + docs (DEPLOYMENT 026); tests (real PostgreSQL, jsdom) 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=20261012f" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261012g" />
|
||||
<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=20261012i" defer></script>
|
||||
<script src="/static/project.js?v=20261012j" defer></script>
|
||||
<script src="/static/erp-notice-admin.js?v=20261012b" defer></script>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
+89
-70
@@ -3349,9 +3349,26 @@ class ProjectStore:
|
||||
conn.execute("UPDATE goal_meeting_items SET sort_order = %s WHERE id = %s", (n, x))
|
||||
|
||||
# ── 회의록 작업 등록 표(025) — 주차별 한 표, 모두가 같이 본다. [적용] 전 줄은 고치고, [적용]은 한 번만 ──
|
||||
_MT_COLS = ("id, week_start, parent_id, sort_order, title, assignee_email, project_id, stage_id, task_id, "
|
||||
# 026 — 작업 칸(parent_task_id): 고르면 [적용] 때 그 작업의 세부 작업으로(비우면 그 섹션에 새 작업).
|
||||
# 025 의 parent_id(표 안 줄끼리 세부 작업)는 화면에서 쓰지 않는다(열·값은 그대로, 읽기·쓰기 안 함).
|
||||
_MT_BASE = ("id, week_start, sort_order, title, assignee_email, project_id, stage_id, task_id, "
|
||||
"created_by, updated_by, created_at, updated_at")
|
||||
|
||||
def _mt_v26(self, conn: Any) -> bool:
|
||||
"""026(작업 칸 parent_task_id) 적용 여부 — 적용되면 한 번만 확인."""
|
||||
if getattr(self, "_mt_v26_ok", False):
|
||||
return True
|
||||
ok = self._column_exists(conn, "goal_meeting_tasks", "parent_task_id")
|
||||
if ok:
|
||||
self._mt_v26_ok = True
|
||||
return ok
|
||||
|
||||
def _mt_cols(self, conn: Any, prefix: str = "") -> str:
|
||||
cols = [prefix + c.strip() for c in self._MT_BASE.split(",")]
|
||||
if self._mt_v26(conn):
|
||||
cols.append(prefix + "parent_task_id")
|
||||
return ", ".join(cols)
|
||||
|
||||
def _mt_conn(self) -> Any:
|
||||
return self._pool.connection()
|
||||
|
||||
@@ -3364,22 +3381,24 @@ class ProjectStore:
|
||||
|
||||
@staticmethod
|
||||
def _mt_row(r: dict[str, Any]) -> dict[str, Any]:
|
||||
out = {k: r.get(k) for k in ("id", "parent_id", "sort_order", "title", "assignee_email", "project_id",
|
||||
"stage_id", "task_id", "created_by", "updated_by")}
|
||||
for k in ("id", "parent_id", "project_id", "stage_id", "task_id"):
|
||||
out = {k: r.get(k) for k in ("id", "sort_order", "title", "assignee_email", "project_id",
|
||||
"stage_id", "task_id", "parent_task_id", "created_by", "updated_by")}
|
||||
for k in ("id", "project_id", "stage_id", "task_id", "parent_task_id"):
|
||||
out[k] = int(out[k]) if out[k] is not None else None
|
||||
out["week_start"] = r["week_start"].isoformat()
|
||||
out["updated_at"] = r["updated_at"].astimezone(KST).isoformat(timespec="seconds") if r.get("updated_at") else ""
|
||||
for k in ("project_name", "project_status", "stage_name", "task_title", "task_project_id"):
|
||||
for k in ("project_name", "project_status", "stage_name", "task_title", "task_project_id", "parent_task_title"):
|
||||
if k in r:
|
||||
out[k] = r[k]
|
||||
if "task_exists" in r:
|
||||
out["task_exists"] = bool(r["task_exists"])
|
||||
return out
|
||||
|
||||
def _mt_clean(self, conn: Any, fields: dict[str, Any], *, project_id: Any = ...) -> dict[str, Any]:
|
||||
"""고칠 칸 정리 — title(200자)·assignee_email·project_id·stage_id(그 프로젝트 섹션). 프로젝트가 바뀌면 섹션을 비운다."""
|
||||
def _mt_clean(self, conn: Any, fields: dict[str, Any], *, project_id: Any = None) -> dict[str, Any]:
|
||||
"""고칠 칸 정리 — title(200자)·assignee_email·project_id·stage_id(그 프로젝트 섹션)·parent_task_id(그 프로젝트 작업, 026).
|
||||
프로젝트가 바뀌면 섹션·작업을 비운다."""
|
||||
clean: dict[str, Any] = {}
|
||||
v26 = self._mt_v26(conn)
|
||||
if "title" in fields:
|
||||
t = store.norm_str(fields.get("title"))
|
||||
if len(t) > 200:
|
||||
@@ -3397,44 +3416,68 @@ class ProjectStore:
|
||||
clean["project_id"] = pid
|
||||
if "stage_id" not in fields:
|
||||
clean["stage_id"] = None
|
||||
if v26 and "parent_task_id" not in fields:
|
||||
clean["parent_task_id"] = None
|
||||
if "stage_id" in fields:
|
||||
sid = fields.get("stage_id")
|
||||
if sid in (None, ""):
|
||||
clean["stage_id"] = None
|
||||
else:
|
||||
if pid in (None, ...):
|
||||
if pid is None:
|
||||
raise ValueError("프로젝트를 먼저 고르세요.")
|
||||
clean["stage_id"] = self._check_stage_in_project(conn, sid, int(pid))
|
||||
if "parent_task_id" in fields:
|
||||
if not v26:
|
||||
raise store.MeetingParentTaskMigrationNeeded()
|
||||
raw = fields.get("parent_task_id")
|
||||
if raw in (None, ""):
|
||||
clean["parent_task_id"] = None
|
||||
else:
|
||||
try:
|
||||
tid = int(raw)
|
||||
except (TypeError, ValueError):
|
||||
raise ValueError("작업 값이 올바르지 않습니다.")
|
||||
if pid is None:
|
||||
raise ValueError("프로젝트를 먼저 고르세요.")
|
||||
t = conn.execute("SELECT project_id FROM tasks WHERE id = %s", (tid,)).fetchone()
|
||||
if t is None or int(t["project_id"]) != int(pid):
|
||||
raise ValueError("이 프로젝트의 작업이 아닙니다.")
|
||||
clean["parent_task_id"] = tid
|
||||
return clean
|
||||
|
||||
def _mt_select(self, conn: Any, where: str, params: tuple[Any, ...]) -> list[dict[str, Any]]:
|
||||
"""줄 + 프로젝트·섹션·고른 작업 이름 + 만든 작업 존재 여부(목록·한 줄 응답 공용)."""
|
||||
v26 = self._mt_v26(conn)
|
||||
return conn.execute(
|
||||
f"SELECT {self._mt_cols(conn, 'm.')}, "
|
||||
" p.name AS project_name, p.status AS project_status, s.name AS stage_name, "
|
||||
" t.title AS task_title, t.project_id AS task_project_id, (t.id IS NOT NULL) AS task_exists"
|
||||
+ (", pt.title AS parent_task_title " if v26 else " ") +
|
||||
"FROM goal_meeting_tasks m "
|
||||
"LEFT JOIN projects p ON p.id = m.project_id "
|
||||
"LEFT JOIN project_stages s ON s.id = m.stage_id "
|
||||
"LEFT JOIN tasks t ON t.id = m.task_id "
|
||||
+ ("LEFT JOIN tasks pt ON pt.id = m.parent_task_id " if v26 else "") +
|
||||
f"WHERE {where} ORDER BY m.sort_order, m.id", params,
|
||||
).fetchall()
|
||||
|
||||
def list_meeting_tasks(self, *, week_start: date) -> list[dict[str, Any]]:
|
||||
"""그 주차 표 — 순서대로(세부 작업 줄은 부모 바로 뒤에 화면이 묶는다). 프로젝트·섹션 이름·만든 작업 존재 여부를 붙인다."""
|
||||
"""그 주차 표 — 순서대로. 프로젝트·섹션·고른 작업 이름, 만든 작업 존재 여부를 붙인다."""
|
||||
def run() -> list[dict[str, Any]]:
|
||||
with self._mt_conn() as conn:
|
||||
rows = conn.execute(
|
||||
"SELECT m.id, m.week_start, m.parent_id, m.sort_order, m.title, m.assignee_email, m.project_id, "
|
||||
" m.stage_id, m.task_id, m.created_by, m.updated_by, m.created_at, m.updated_at, "
|
||||
" p.name AS project_name, p.status AS project_status, s.name AS stage_name, "
|
||||
" t.title AS task_title, t.project_id AS task_project_id, (t.id IS NOT NULL) AS task_exists "
|
||||
"FROM goal_meeting_tasks m "
|
||||
"LEFT JOIN projects p ON p.id = m.project_id "
|
||||
"LEFT JOIN project_stages s ON s.id = m.stage_id "
|
||||
"LEFT JOIN tasks t ON t.id = m.task_id "
|
||||
"WHERE m.week_start = %s ORDER BY m.sort_order, m.id", (week_start,),
|
||||
).fetchall()
|
||||
return [self._mt_row(r) for r in rows]
|
||||
return [self._mt_row(r) for r in self._mt_select(conn, "m.week_start = %s", (week_start,))]
|
||||
return self._mt_call(run)
|
||||
|
||||
def get_meeting_task(self, *, item_id: int) -> dict[str, Any] | None:
|
||||
def run() -> dict[str, Any] | None:
|
||||
with self._mt_conn() as conn:
|
||||
r = conn.execute(f"SELECT {self._MT_COLS} FROM goal_meeting_tasks WHERE id = %s", (item_id,)).fetchone()
|
||||
return self._mt_row(r) if r else None
|
||||
rows = self._mt_select(conn, "m.id = %s", (item_id,))
|
||||
return self._mt_row(rows[0]) if rows else None
|
||||
return self._mt_call(run)
|
||||
|
||||
def add_meeting_task(self, *, week_start: date, fields: dict[str, Any], by: str = "",
|
||||
parent_id: int | None = None, task_id: int | None = None) -> dict[str, Any]:
|
||||
"""줄 추가(빈 줄도). parent_id = 세부 작업 줄(같은 주차 줄 밑). task_id = 예전 브라우저 표에서 옮겨 온 이미 등록된 줄."""
|
||||
task_id: int | None = None) -> dict[str, Any]:
|
||||
"""줄 추가(빈 줄도). task_id = 예전 브라우저 표에서 옮겨 온 이미 등록된 줄."""
|
||||
who = store.norm_str(by, lower=True)
|
||||
|
||||
def run() -> int:
|
||||
@@ -3442,21 +3485,18 @@ class ProjectStore:
|
||||
with conn.transaction():
|
||||
self._check_meeting_open(conn, week_start)
|
||||
clean = self._mt_clean(conn, fields)
|
||||
if parent_id is not None:
|
||||
par = conn.execute("SELECT week_start, parent_id FROM goal_meeting_tasks WHERE id = %s",
|
||||
(parent_id,)).fetchone()
|
||||
if par is None or par["week_start"] != week_start:
|
||||
raise ValueError("위 줄이 이 주차 표에 없습니다.")
|
||||
if par["parent_id"] is not None:
|
||||
raise ValueError("세부 작업 줄 밑으로는 넣을 수 없습니다(한 단계만).")
|
||||
nxt = conn.execute("SELECT COALESCE(MAX(sort_order), -1) + 1 AS n FROM goal_meeting_tasks "
|
||||
"WHERE week_start = %s", (week_start,)).fetchone()["n"]
|
||||
cols = ["week_start", "sort_order", "title", "assignee_email", "project_id", "stage_id", "task_id",
|
||||
"created_by", "updated_by"]
|
||||
vals = [week_start, int(nxt), clean.get("title", ""), clean.get("assignee_email", ""),
|
||||
clean.get("project_id"), clean.get("stage_id"), task_id, who, who]
|
||||
if clean.get("parent_task_id") is not None:
|
||||
cols.append("parent_task_id")
|
||||
vals.append(clean["parent_task_id"])
|
||||
return int(conn.execute(
|
||||
"INSERT INTO goal_meeting_tasks (week_start, parent_id, sort_order, title, assignee_email, "
|
||||
"project_id, stage_id, task_id, created_by, updated_by) VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s) "
|
||||
"RETURNING id",
|
||||
(week_start, parent_id, int(nxt), clean.get("title", ""), clean.get("assignee_email", ""),
|
||||
clean.get("project_id"), clean.get("stage_id"), task_id, who, who),
|
||||
f"INSERT INTO goal_meeting_tasks ({', '.join(cols)}) VALUES ({', '.join(['%s'] * len(cols))}) "
|
||||
"RETURNING id", vals,
|
||||
).fetchone()["id"])
|
||||
return self.get_meeting_task(item_id=self._mt_call(run)) # type: ignore[return-value]
|
||||
|
||||
@@ -3473,25 +3513,6 @@ class ProjectStore:
|
||||
if row["task_id"] is not None:
|
||||
raise store.GoalCellConflict("이미 [적용]해 작업으로 만든 줄입니다. 새로고침해 주세요.")
|
||||
clean = self._mt_clean(conn, fields, project_id=row["project_id"])
|
||||
if "parent_id" in fields:
|
||||
# 세부 작업 줄로(Tab)·위 단계로(Shift+Tab) — 한 단계만: 위 줄은 같은 주차의 맨 위 단계 줄,
|
||||
# 자기 밑에 세부 작업 줄이 있는 줄은 세부 작업 줄이 될 수 없다.
|
||||
raw = fields.get("parent_id")
|
||||
try:
|
||||
pid = int(raw) if raw not in (None, "") else None
|
||||
except (TypeError, ValueError):
|
||||
raise ValueError("위 줄 값이 올바르지 않습니다.")
|
||||
if pid is not None:
|
||||
par = conn.execute("SELECT week_start, parent_id FROM goal_meeting_tasks WHERE id = %s",
|
||||
(pid,)).fetchone()
|
||||
if pid == item_id or par is None or par["week_start"] != row["week_start"]:
|
||||
raise ValueError("위 줄이 이 주차 표에 없습니다.")
|
||||
if par["parent_id"] is not None:
|
||||
raise ValueError("세부 작업 줄 밑으로는 넣을 수 없습니다(한 단계만).")
|
||||
if conn.execute("SELECT 1 FROM goal_meeting_tasks WHERE parent_id = %s LIMIT 1",
|
||||
(item_id,)).fetchone():
|
||||
raise ValueError("세부 작업 줄이 딸린 줄은 세부 작업이 될 수 없습니다.")
|
||||
clean["parent_id"] = pid
|
||||
if not clean:
|
||||
return
|
||||
sets = ", ".join(f"{k} = %s" for k in clean)
|
||||
@@ -3501,11 +3522,11 @@ class ProjectStore:
|
||||
return self.get_meeting_task(item_id=item_id) # type: ignore[return-value]
|
||||
|
||||
def delete_meeting_task(self, *, item_id: int) -> dict[str, Any]:
|
||||
"""줄 지우기(세부 작업 줄도 함께). 만든 작업은 라우터·화면이 따로 지운다(휴지통)."""
|
||||
"""줄 지우기. 만든 작업은 라우터·화면이 따로 지운다(휴지통)."""
|
||||
def run() -> dict[str, Any]:
|
||||
with self._mt_conn() as conn:
|
||||
with conn.transaction():
|
||||
row = conn.execute(f"SELECT {self._MT_COLS} FROM goal_meeting_tasks WHERE id = %s FOR UPDATE",
|
||||
row = conn.execute(f"SELECT {self._mt_cols(conn)} FROM goal_meeting_tasks WHERE id = %s FOR UPDATE",
|
||||
(item_id,)).fetchone()
|
||||
if row is None:
|
||||
raise KeyError(item_id)
|
||||
@@ -3515,28 +3536,26 @@ class ProjectStore:
|
||||
return self._mt_call(run)
|
||||
|
||||
def apply_meeting_task(self, *, item_id: int, create: Any) -> tuple[dict[str, Any], bool]:
|
||||
"""[적용] — 줄을 잠그고 아직 작업이 없을 때만 create(줄) 로 작업을 만들어 task_id 를 남긴다.
|
||||
(줄, 이번에 만들었는가). 두 사람이 동시에 눌러도 작업은 하나. create 가 실패하면 줄은 그대로."""
|
||||
"""[적용] — 줄을 잠그고 아직 작업이 없을 때만 create(줄, 상위 작업 id) 로 작업을 만들어 task_id 를 남긴다.
|
||||
작업 칸(parent_task_id)을 골랐으면 그 작업의 세부 작업으로(섹션 없이). (줄, 이번에 만들었는가).
|
||||
두 사람이 동시에 눌러도 작업은 하나. create 가 실패하면 줄은 그대로."""
|
||||
def run() -> tuple[int, bool]:
|
||||
with self._mt_conn() as conn:
|
||||
with conn.transaction():
|
||||
row = conn.execute(f"SELECT {self._MT_COLS} FROM goal_meeting_tasks WHERE id = %s FOR UPDATE",
|
||||
row = conn.execute(f"SELECT {self._mt_cols(conn)} FROM goal_meeting_tasks WHERE id = %s FOR UPDATE",
|
||||
(item_id,)).fetchone()
|
||||
if row is None:
|
||||
raise KeyError(item_id)
|
||||
self._check_meeting_open(conn, row["week_start"])
|
||||
if row["task_id"] is not None:
|
||||
return item_id, False
|
||||
parent_task = None
|
||||
use = self._mt_row(row)
|
||||
if row["parent_id"] is not None:
|
||||
# 세부 작업 줄 — 위 줄이 만든 작업 밑에, 그 작업의 프로젝트로(줄의 프로젝트 칸은 쓰지 않는다)
|
||||
par = conn.execute("SELECT m.task_id, t.project_id FROM goal_meeting_tasks m "
|
||||
"LEFT JOIN tasks t ON t.id = m.task_id WHERE m.id = %s", (row["parent_id"],)).fetchone()
|
||||
parent_task = par["task_id"] if par else None
|
||||
if parent_task is None or par["project_id"] is None:
|
||||
raise ValueError("위 줄(상위 작업)을 먼저 [적용]하세요.")
|
||||
use = {**use, "project_id": int(par["project_id"]), "stage_id": None}
|
||||
parent_task = use.get("parent_task_id")
|
||||
if parent_task is not None:
|
||||
t = conn.execute("SELECT project_id FROM tasks WHERE id = %s", (parent_task,)).fetchone()
|
||||
if t is None or use["project_id"] is None or int(t["project_id"]) != int(use["project_id"]):
|
||||
raise ValueError("고른 작업이 없어졌거나 다른 프로젝트로 옮겨졌습니다. 작업 칸을 다시 고르세요.")
|
||||
use = {**use, "stage_id": None}
|
||||
task = create(use, parent_task)
|
||||
conn.execute("UPDATE goal_meeting_tasks SET task_id = %s, updated_at = now() WHERE id = %s",
|
||||
(int(task["id"]), item_id))
|
||||
|
||||
@@ -2956,6 +2956,8 @@ def _goal_call(fn: Any, *args: Any, **kwargs: Any) -> Any:
|
||||
raise HTTPException(status_code=409, detail="회의가 완료되어 수정할 수 없습니다. 관리자가 [완료 해제]하면 다시 고칠 수 있습니다.")
|
||||
except store.MeetingMigration022Needed:
|
||||
raise HTTPException(status_code=503, detail="회의 완료 기능은 project_db 마이그레이션 022 적용 후 사용할 수 있습니다.")
|
||||
except store.MeetingParentTaskMigrationNeeded:
|
||||
raise HTTPException(status_code=503, detail="작업 칸(이미 있는 작업의 세부 작업으로 등록)은 project_db 마이그레이션 026 적용 후 사용할 수 있습니다.")
|
||||
except store.MeetingTaskMigrationNeeded:
|
||||
raise HTTPException(status_code=503, detail="작업 등록 표(모두가 같이 보는 주차별 표)는 project_db 마이그레이션 025 적용 후 사용할 수 있습니다.")
|
||||
except store.MeetingMigration020Needed:
|
||||
@@ -3763,13 +3765,13 @@ def _quick_view(st: Any, user: dict[str, Any], rows: list[dict[str, Any]]) -> li
|
||||
r = dict(r, visible=ok, registered=r.get("task_id") is not None) # 등록됨 여부는 누구에게나(작업 내용은 멤버만)
|
||||
if not ok:
|
||||
r.update(project_name="(볼 수 없는 프로젝트)", stage_name="", task_title="", task_id=None,
|
||||
task_project_id=None)
|
||||
task_project_id=None, parent_task_id=None, parent_task_title="")
|
||||
out.append(r)
|
||||
return out
|
||||
|
||||
|
||||
def _quick_fields(st: Any, user: dict[str, Any], payload: dict[str, Any]) -> dict[str, Any]:
|
||||
fields = {k: payload[k] for k in ("title", "assignee_email", "project_id", "stage_id") if k in payload}
|
||||
fields = {k: payload[k] for k in ("title", "assignee_email", "project_id", "stage_id", "parent_task_id") if k in payload}
|
||||
pid = fields.get("project_id")
|
||||
if pid not in (None, ""):
|
||||
try:
|
||||
@@ -3792,16 +3794,12 @@ def api_list_quick_tasks(request: Request, week_start: str) -> JSONResponse:
|
||||
|
||||
@router.post("/api/goals/meetings/{week_start}/quick-tasks")
|
||||
def api_add_quick_task(request: Request, week_start: str, payload: dict[str, Any] = Body(default={})) -> JSONResponse:
|
||||
"""줄 추가 {title?, assignee_email?, project_id?, stage_id?, parent_id?(세부 작업 줄), task_id?(예전 브라우저 표의 등록된 줄)}."""
|
||||
"""줄 추가 {title?, assignee_email?, project_id?, stage_id?, parent_task_id?(작업 칸 — 그 작업의 세부 작업으로),
|
||||
task_id?(예전 브라우저 표의 등록된 줄)}."""
|
||||
user = _require_user(request)
|
||||
st = _db_or_503(request)
|
||||
ws = _goal_call(store.validate_week_start, week_start)
|
||||
fields = _quick_fields(st, user, payload)
|
||||
parent = payload.get("parent_id")
|
||||
try:
|
||||
parent_id = int(parent) if parent not in (None, "") else None
|
||||
except (TypeError, ValueError):
|
||||
raise HTTPException(status_code=400, detail="parent_id 가 올바르지 않습니다.")
|
||||
task_id = None
|
||||
if payload.get("task_id") not in (None, ""):
|
||||
# 옮겨 오는 등록된 줄 — 그 작업을 지금 내가 원 소속으로 다룰 수 있을 때만 이어 붙인다(남의 작업 id 를 끌어오지 못하게)
|
||||
@@ -3811,8 +3809,7 @@ def api_add_quick_task(request: Request, week_start: str, payload: dict[str, Any
|
||||
t = None
|
||||
if t is not None and access.task_access(st, user, t) == access.FULL:
|
||||
task_id = int(t["id"])
|
||||
row = _goal_call(st.add_meeting_task, week_start=ws, fields=fields, by=user["email"],
|
||||
parent_id=parent_id, task_id=task_id)
|
||||
row = _goal_call(st.add_meeting_task, week_start=ws, fields=fields, by=user["email"], task_id=task_id)
|
||||
return JSONResponse({"task": _quick_view(st, user, [row])[0]}, status_code=201)
|
||||
|
||||
|
||||
@@ -3821,8 +3818,6 @@ def api_update_quick_task(request: Request, item_id: int, payload: dict[str, Any
|
||||
user = _require_user(request)
|
||||
st = _db_or_503(request)
|
||||
fields = _quick_fields(st, user, payload)
|
||||
if "parent_id" in payload: # 세부 작업 줄로(Tab)·위 단계로(Shift+Tab) — 한 단계만(저장소가 검사)
|
||||
fields["parent_id"] = payload["parent_id"]
|
||||
row = _goal_call(st.update_meeting_task, item_id=item_id, fields=fields, by=user["email"])
|
||||
return JSONResponse({"task": _quick_view(st, user, [row])[0]})
|
||||
|
||||
@@ -3848,6 +3843,7 @@ def api_apply_quick_task(request: Request, item_id: int, bg: BackgroundTasks) ->
|
||||
if row["project_id"] is None:
|
||||
raise ValueError("프로젝트를 고르세요.")
|
||||
rec = access.default_user_lookup(row["assignee_email"]) if row["assignee_email"] else None
|
||||
# 작업 칸을 골랐으면 그 작업의 세부 작업(섹션 없음) — _create_task_for 가 프로젝트 멤버를, create_task 가 같은 프로젝트를 확인
|
||||
payload = {"title": row["title"].strip(), "stage_id": None if parent_task_id else row["stage_id"],
|
||||
"assignee_email": row["assignee_email"],
|
||||
"assignee_name": (rec or {}).get("name") or (row["assignee_email"].split("@")[0] if row["assignee_email"] else ""),
|
||||
|
||||
@@ -435,6 +435,10 @@ class MeetingTaskMigrationNeeded(RuntimeError):
|
||||
"""회의록 작업 등록 표(서버 저장)는 마이그레이션 025 뒤에만 된다."""
|
||||
|
||||
|
||||
class MeetingParentTaskMigrationNeeded(RuntimeError):
|
||||
"""작업 등록 표의 작업 칸(이미 있는 작업의 세부 작업으로)은 마이그레이션 026 뒤에만 된다."""
|
||||
|
||||
|
||||
class MeetingMigration020Needed(RuntimeError):
|
||||
"""새 주차(월요일이 아닌 시작일)·결과 글 칸·주차별 목표는 마이그레이션 020 뒤에만 된다."""
|
||||
|
||||
|
||||
@@ -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=20261012f" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261012g" />
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
{% endblock %}
|
||||
|
||||
@@ -119,11 +119,11 @@
|
||||
{# 작업 등록 — 주차마다 한 표를 서버에(025, 모두가 같은 표 — project.js initMeetQuickTasks). 제목 = "N주차 작업 등록", 회의 완료면 읽기 전용 #}
|
||||
{% set qw = weeks | selectattr("start", "equalto", week) | first %}
|
||||
<section class="pj-meet-area pj-meet-quick" id="pj-meet-quick" data-week="{{ week }}"{% if qw and qw.now %} data-now="1"{% endif %}{% if meeting and meeting.completed %} data-locked="1"{% endif %}>
|
||||
<h3>{% if week_n %}<span class="pj-meet-quick-week">{{ week_n }}주차</span> {% endif %}작업 등록 <small>제목 → 담당자·프로젝트·섹션 → [적용] · ↳ 또는 Tab = 세부 작업</small>
|
||||
<h3>{% if week_n %}<span class="pj-meet-quick-week">{{ week_n }}주차</span> {% endif %}작업 등록 <small title="작업 칸을 비우면 그 섹션에 새 작업, 작업을 고르면 그 작업의 세부 작업으로 등록. 등록된 줄의 제목을 누르면 오른쪽에 작업 창(편집).">제목 → 담당자·프로젝트·섹션·작업 → [적용]</small>
|
||||
<button type="button" class="pj-btn pj-btn-sm pj-meet-quick-expand" data-quick="expand" title="넓은 창에서 작업·세부 작업 등록(같은 표)"><span class="material-symbols-outlined">open_in_full</span>크게 열기</button></h3>
|
||||
<div class="pj-meet-area-body">
|
||||
<table class="pj-meet-quick-table">
|
||||
<thead><tr><th>제목</th><th>담당자</th><th>프로젝트</th><th>섹션</th><th></th></tr></thead>
|
||||
<thead><tr><th>제목</th><th>담당자</th><th>프로젝트</th><th>섹션</th><th title="고르면 그 작업의 세부 작업으로 등록(비우면 섹션에 새 작업)">작업</th><th></th></tr></thead>
|
||||
<tbody></tbody>
|
||||
</table>
|
||||
<button type="button" class="pj-meet-quick-add" data-quick="add">+ 줄 추가</button>
|
||||
@@ -295,5 +295,5 @@
|
||||
|
||||
<script src="/static/project-goal-text.js?v=20261003d" defer></script>
|
||||
<script src="/static/project-meeting-cells.js?v=20261007a" defer></script>
|
||||
<script src="/static/project.js?v=20261012i" defer></script>
|
||||
<script src="/static/project.js?v=20261012j" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261012f" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261012g" />
|
||||
<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=20261012i" defer></script>
|
||||
<script src="/static/project.js?v=20261012j" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261012f" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261012g" />
|
||||
<link rel="stylesheet" href="/static/project-help.css?v=20261003a" />
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
{% endblock %}
|
||||
@@ -637,7 +637,7 @@
|
||||
<p>제목 아래 세 칸은 표를 스크롤해도 그대로 보입니다. 왼쪽은 <b>월 계획</b>이고 그 머리 줄 오른쪽에 숫자 4개(월 목표 · 누적 목표 · 누적 실적 · 목표 대비)가 작게 한 줄로 나옵니다(목표 표 매출 단위, 예: 백만원 — 숫자에 마우스를 올리면 원 단위 금액과 뜻). 가운데는 <b>결정사항</b>(진행상황 수시 공유 및 완료 되어야 할 것), 오른쪽은 <b>작업 등록</b> 표입니다.</p>
|
||||
<ol class="pjh-steps">
|
||||
<li><b>작업 등록</b>(제목에 <b>N주차 작업 등록</b>) — 주차마다 한 표를 <b>모두가 같이</b> 봅니다(다른 사람이 적거나 등록한 줄도 보임, 30초마다·창을 다시 볼 때 새로 읽음). 내가 멤버가 아닌 프로젝트를 고른 남의 줄은 프로젝트 이름을 가립니다. 회의 완료면 읽기 전용입니다.
|
||||
<b>세부 작업</b> — 줄에 마우스를 올리면 나오는 <span class="pjh-ui">↳</span>(또는 우클릭 → 세부 작업 추가)로 바로 아래에 세부 작업 줄을 만듭니다. 제목 칸에서 <kbd>Tab</kbd> = 위 줄의 세부 작업으로, <kbd>Shift</kbd>+<kbd>Tab</kbd> = 다시 위 단계로(한 단계만). 세부 작업 줄은 위 줄의 프로젝트를 따르고 섹션이 없으며, 위 줄을 [적용]한 뒤 [적용]하면 그 작업의 세부 작업이 됩니다.
|
||||
<b>작업</b> 칸 — 비워 두면 고른 섹션에 새 작업으로, 작업을 고르면 <b>그 작업의 세부 작업</b>으로 등록합니다(목록 = 그 섹션의 진행 중인 메인 작업, 고르면 섹션 칸은 —). 등록된 줄의 <b>제목을 누르면 오른쪽에 작업 창</b>이 열려 바로 편집할 수 있습니다(작업 창에서 저장이 끝나야 닫히거나 다른 작업으로 바뀝니다).
|
||||
<span class="pjh-ui">크게 열기</span> — 같은 표를 넓은 창으로 열어 씁니다(줄·저장은 그대로, <kbd>Esc</kbd>·×로 닫기). 제목 칸에 작업 이름을 씁니다. 담당자·프로젝트·섹션 칸을 누르면 고를 수 있는 목록이 나옵니다(완료 프로젝트·완료 섹션은 목록에 나오지 않습니다). 목록 맨 위 <span class="pjh-ui">새 프로젝트</span>(Pro user 이상)·<span class="pjh-ui">새 섹션</span>(그 프로젝트 멤버)을 누르면 이름만 적어 바로 만들고 그 칸에 골라집니다. 새 프로젝트는 섹션 없이 시작하니 섹션 칸에서 <span class="pjh-ui">새 섹션</span>을 만들어 고르세요.</li>
|
||||
<li>프로젝트는 내가 멤버인 프로젝트만 나오고, 고르면 첫 섹션이 자동으로 들어갑니다. 담당자는 그 프로젝트의 멤버·소유자 중에서 고릅니다(프로젝트를 먼저 고르면 정확합니다).</li>
|
||||
<li>맨 오른쪽 <span class="pjh-ui">적용</span>을 누르면 그 프로젝트에 작업이 만들어지고, 줄에 <b>등록됨</b> 링크가 생깁니다. 줄은 이 브라우저에 남아 있어 새로고침해도 사라지지 않습니다. <span class="pjh-ui">+ 줄 추가</span>로 줄을 늘립니다.</li>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261012f" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261012g" />
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
{% endblock %}
|
||||
|
||||
@@ -101,5 +101,5 @@
|
||||
{% include "project/_side_modals.html" %}
|
||||
{% include "project/_member_tasks_modal.html" %}
|
||||
|
||||
<script src="/static/project.js?v=20261012i" defer></script>
|
||||
<script src="/static/project.js?v=20261012j" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261012f" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261012g" />
|
||||
<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=20261012i" defer></script>
|
||||
<script src="/static/project.js?v=20261012j" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261012f" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261012g" />
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
{% endblock %}
|
||||
|
||||
@@ -108,5 +108,5 @@
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
<script src="/static/project.js?v=20261012i" defer></script>
|
||||
<script src="/static/project.js?v=20261012j" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261012f" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261012g" />
|
||||
<!-- 구글 머티리얼 심볼(담당자 아이콘 등) — self-host -->
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
<!-- 타임라인 vis-timeline — self-host -->
|
||||
@@ -468,5 +468,5 @@
|
||||
</script>
|
||||
|
||||
<script src="/static/vendor/vis-timeline/vis-timeline-graph2d.min.js"></script>
|
||||
<script src="/static/project.js?v=20261012i" defer></script>
|
||||
<script src="/static/project.js?v=20261012j" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261012f" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261012g" />
|
||||
<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=20261012i" defer></script>
|
||||
<script src="/static/project.js?v=20261012j" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
+12
-16
@@ -2549,11 +2549,13 @@ html.pj-goal-selecting, html.pj-goal-selecting * { user-select: none !important;
|
||||
}
|
||||
.pj-ctxmenu-ic .pj-meet-quick-face { width: 20px; height: 20px; }
|
||||
.pj-member-pick.is-owner { opacity: .75; }
|
||||
.pj-meet-quick-table th:nth-child(1) { width: 30%; }
|
||||
.pj-meet-quick-table th:nth-child(2) { width: 17%; }
|
||||
.pj-meet-quick-table th:nth-child(3) { width: 19%; }
|
||||
.pj-meet-quick-table th:nth-child(4) { width: 15%; }
|
||||
.pj-meet-quick-table th:nth-child(5) { width: 19%; }
|
||||
/* 제목·담당자·프로젝트·섹션·작업(세부 작업으로 넣을 작업)·버튼 */
|
||||
.pj-meet-quick-table th:nth-child(1) { width: 24%; }
|
||||
.pj-meet-quick-table th:nth-child(2) { width: 15%; }
|
||||
.pj-meet-quick-table th:nth-child(3) { width: 15%; }
|
||||
.pj-meet-quick-table th:nth-child(4) { width: 12%; }
|
||||
.pj-meet-quick-table th:nth-child(5) { width: 15%; }
|
||||
.pj-meet-quick-table th:nth-child(6) { width: 19%; }
|
||||
.pj-meet-quick-acts { white-space: nowrap; text-align: right; }
|
||||
.pj-meet-quick-del {
|
||||
display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; margin-left: 4px; vertical-align: middle;
|
||||
@@ -3057,21 +3059,15 @@ html[data-pj-font="nanum-square-round"] { --pj-font: "NanumSquareRound", var(--p
|
||||
/* 회의록 작업 등록 — 제목 앞 주차(N주차 작업 등록, 주차마다 따로 기억) */
|
||||
.pj-meet-quick-week { color: var(--pj-accent); }
|
||||
.pj-meet-quick-note { padding: 10px 8px; color: #8a9099; font-size: 12.5px; }
|
||||
/* 작업 등록 — 세부 작업 줄(↳ 들여쓰기)·줄 위 ↳ 추가 버튼·[크게 열기] 창(같은 표를 옮겨 쓴다) */
|
||||
/* 작업 등록 — [크게 열기] 창(같은 표를 옮겨 쓴다)·등록된 제목(누르면 오른쪽 작업 창) */
|
||||
.pj-meet-quick h3 { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
|
||||
.pj-meet-quick-expand { margin-left: auto; order: 2; display: inline-flex; align-items: center; gap: 3px; }
|
||||
.pj-meet-quick h3 small { order: 3; flex-basis: 100%; margin-left: 0; } /* 한 줄: 제목 + [크게 열기], 그 아래 안내 */
|
||||
.pj-meet-quick-expand .material-symbols-outlined { font-size: 15px; }
|
||||
.pj-meet-quick-title { position: relative; }
|
||||
.pj-meet-quick-table tr.is-sub .pj-meet-quick-title { padding-left: 20px; }
|
||||
.pj-meet-quick-submark { position: absolute; left: 6px; top: 50%; transform: translateY(-50%); color: #9aa1a9; font-size: 13px; pointer-events: none; }
|
||||
.pj-meet-quick-addsub {
|
||||
position: absolute; right: 2px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; padding: 0;
|
||||
display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--pj-border, #e3e5e8); border-radius: 5px;
|
||||
background: #fff; color: var(--pj-ink-soft); cursor: pointer; opacity: 0; transition: opacity .12s;
|
||||
}
|
||||
.pj-meet-quick-addsub .material-symbols-outlined { font-size: 15px; }
|
||||
.pj-meet-quick-table tr:hover .pj-meet-quick-addsub, .pj-meet-quick-addsub:focus { opacity: 1; }
|
||||
.pj-meet-quick-open { display: block; width: 100%; padding: 2px 6px; border: none; background: none; text-align: left; font: inherit;
|
||||
color: var(--pj-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; border-radius: 5px; }
|
||||
button.pj-meet-quick-open:hover { background: #f1f3f5; color: var(--pj-accent-dark, #2f5bb7); text-decoration: underline; }
|
||||
.pj-meet-quick-open.is-plain { cursor: default; color: var(--pj-ink-soft); }
|
||||
.pj-meet-quick-inherit { display: block; padding: 0 4px; color: #9aa1a9; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; }
|
||||
.pj-meet-quick-modal { position: fixed; inset: 0; z-index: 2100; /* 고르기 메뉴(.pj-ctxmenu 2200)가 그 위에 */ display: flex; align-items: center; justify-content: center;
|
||||
padding: 16px; box-sizing: border-box; background: rgba(15, 17, 21, .4); }
|
||||
|
||||
+155
-144
@@ -10667,8 +10667,8 @@
|
||||
// · 등록된 줄의 [삭제] = 확인 뒤 그 작업도 삭제(휴지통 3개월), 적용 전 줄의 × = 줄만 지움.
|
||||
// · 30초마다·창을 다시 볼 때 다시 읽는다(입력 중·저장 중엔 건너뜀). 회의 완료면 읽기 전용.
|
||||
// · 이 브라우저에 남은 예전 표(pj_meet_quick:…)는 처음 열 때 서버로 한 번 옮기고 지운다.
|
||||
// · 세부 작업 줄(한 단계, 서버 parent_id) — ↳ 버튼·우클릭으로 추가, 제목 칸 Tab = 위 줄의 세부 작업으로, Shift+Tab = 위 단계로.
|
||||
// 프로젝트는 위 줄을 따르고 섹션은 없다. [적용]은 위 줄이 먼저(서버가 위 줄 작업 밑에 세부 작업으로 만든다).
|
||||
// · 작업 칸(026 parent_task_id) — 비우면 그 섹션에 새 작업, 이미 있는 작업을 고르면 [적용] 때 그 작업의 세부 작업으로(섹션 없음).
|
||||
// · 등록된 줄의 제목을 누르면 오른쪽에 작업 창(편집, 수신함과 같은 iframe·저장 대기).
|
||||
// · [크게 열기] — 같은 표를 넓은 창으로 옮겨 쓴다(줄·저장 그대로), 닫으면 제자리.
|
||||
function initMeetQuickTasks() {
|
||||
const box = el("pj-meet-quick");
|
||||
@@ -10693,41 +10693,26 @@
|
||||
return url ? '<img class="pj-avatar pj-meet-quick-face" src="' + escapeHtml(url) + '" alt="" referrerpolicy="no-referrer">'
|
||||
: '<span class="pj-meet-quick-face is-ini">' + escapeHtml(nameOf(email).slice(0, 1)) + "</span>";
|
||||
};
|
||||
const blank = function (parent) {
|
||||
const blank = function () {
|
||||
return { id: null, title: "", assignee: "", projectId: null, projectName: "", stageId: null, stageName: "",
|
||||
taskId: null, registered: false, visible: true, taskExists: true, chain: null,
|
||||
parentId: parent && parent.id ? parent.id : null, parentRef: parent || null };
|
||||
parentTaskId: null, parentTaskTitle: "", taskId: null, registered: false, visible: true, taskExists: true, chain: null };
|
||||
};
|
||||
function fromServer(t) {
|
||||
return { id: t.id, title: t.title || "", assignee: t.assignee_email || "", projectId: t.project_id,
|
||||
projectName: t.project_name || "", stageId: t.stage_id, stageName: t.stage_name || "", taskId: t.task_id,
|
||||
registered: !!t.registered, visible: t.visible !== false, taskExists: t.task_exists !== false, chain: null,
|
||||
parentId: t.parent_id || null, parentRef: null };
|
||||
projectName: t.project_name || "", stageId: t.stage_id, stageName: t.stage_name || "",
|
||||
parentTaskId: t.parent_task_id || null, parentTaskTitle: t.parent_task_title || "", taskId: t.task_id,
|
||||
registered: !!t.registered, visible: t.visible !== false, taskExists: t.task_exists !== false, chain: null };
|
||||
}
|
||||
let rows = [];
|
||||
let ready = false, unavailable = "";
|
||||
// 세부 작업 줄(한 단계) — 위 줄 = parentRef(아직 서버에 없는 줄) 또는 parentId
|
||||
function parentOf(r) {
|
||||
if (r.parentRef && rows.indexOf(r.parentRef) >= 0) return r.parentRef;
|
||||
if (r.parentId) return rows.find(function (x) { return x.id === r.parentId; }) || null;
|
||||
return null;
|
||||
}
|
||||
function childrenOf(p) { return rows.filter(function (x) { return parentOf(x) === p; }); }
|
||||
// 화면 순서 = 맨 위 단계 줄(지금 순서) 바로 뒤에 그 세부 작업 줄들
|
||||
function reorder() {
|
||||
const tops = rows.filter(function (r) { return !parentOf(r); });
|
||||
const out = [];
|
||||
tops.forEach(function (t) { out.push(t); childrenOf(t).forEach(function (c) { out.push(c); }); });
|
||||
rows = out;
|
||||
}
|
||||
function padBlank() {
|
||||
if (locked) return;
|
||||
const open = rows.filter(function (r) { return !r.registered && !parentOf(r); }).length;
|
||||
const open = rows.filter(function (r) { return !r.registered; }).length;
|
||||
for (let i = open; i < 3; i++) rows.push(blank());
|
||||
}
|
||||
|
||||
let projects = null;
|
||||
const memberCache = {}, stageCache = {};
|
||||
const memberCache = {}, stageCache = {}, taskCache = {};
|
||||
async function loadProjects() {
|
||||
if (projects) return projects;
|
||||
const res = await api("GET", "/project/api/projects");
|
||||
@@ -10750,26 +10735,27 @@
|
||||
stageCache[pid] = (res.stages || []).slice().sort(function (a, b) { return a.sort_order - b.sort_order; });
|
||||
return stageCache[pid];
|
||||
}
|
||||
// 작업 칸 후보 — 그 프로젝트의 (그 섹션) 미완료 메인 작업. 고르면 [적용] 때 그 작업의 세부 작업으로 만든다.
|
||||
async function tasksOf(pid) {
|
||||
if (taskCache[pid]) return taskCache[pid];
|
||||
const res = await api("GET", "/project/api/projects/" + pid + "/tasks");
|
||||
taskCache[pid] = (res.tasks || []).filter(function (t) { return t.project_id === pid && !t.completed_at && !t.parent_task_id; });
|
||||
return taskCache[pid];
|
||||
}
|
||||
|
||||
// ── 저장 — 줄마다 차례대로. 서버에 없는 줄은 처음 채울 때 만든다(지금 칸 전부 + 위 줄을 보낸다 — 위 줄도 없으면 먼저) ──
|
||||
// ── 저장 — 줄마다 차례대로. 서버에 없는 줄은 처음 채울 때 만든다(지금 칸 전부를 보낸다) ──
|
||||
let pendingSaves = 0;
|
||||
function persist(r, patch) {
|
||||
pendingSaves++;
|
||||
const run = async function () {
|
||||
const par = parentOf(r);
|
||||
if (par && !par.id) await persist(par, {});
|
||||
if (par && !par.id) throw new Error("위 줄을 저장하지 못했습니다");
|
||||
if (!r.id) {
|
||||
const res = await api("POST", listUrl, {
|
||||
title: r.title, assignee_email: r.assignee, project_id: par ? null : r.projectId,
|
||||
stage_id: par ? null : r.stageId, parent_id: par ? par.id : null,
|
||||
title: r.title, assignee_email: r.assignee, project_id: r.projectId, stage_id: r.stageId,
|
||||
parent_task_id: r.parentTaskId,
|
||||
});
|
||||
r.id = res.task.id;
|
||||
r.parentId = par ? par.id : null; r.parentRef = null;
|
||||
} else {
|
||||
if (patch && Object.prototype.hasOwnProperty.call(patch, "parent_id") && patch.parent_id === undefined) patch.parent_id = par ? par.id : null;
|
||||
await api("PUT", rowUrl(r.id), patch);
|
||||
if (patch && Object.prototype.hasOwnProperty.call(patch, "parent_id")) { r.parentId = patch.parent_id; r.parentRef = null; }
|
||||
}
|
||||
};
|
||||
r.chain = (r.chain || Promise.resolve()).then(run).catch(function (e) {
|
||||
@@ -10778,24 +10764,22 @@
|
||||
}).finally(function () { pendingSaves--; });
|
||||
return r.chain;
|
||||
}
|
||||
function cell(kind, text, placeholder, disabled, extra) {
|
||||
return '<button type="button" class="pj-meet-pick-cell' + (text ? "" : " is-empty") + (extra || "") + '" data-pick="' + kind + '"' +
|
||||
(disabled ? " disabled" : "") + ">" + escapeHtml(text || placeholder) + "</button>";
|
||||
function cell(kind, text, placeholder, disabled, title) {
|
||||
return '<button type="button" class="pj-meet-pick-cell' + (text ? "" : " is-empty") + '" data-pick="' + kind + '"' +
|
||||
(title ? ' title="' + escapeHtml(title) + '"' : "") + (disabled ? " disabled" : "") + ">" + escapeHtml(text || placeholder) + "</button>";
|
||||
}
|
||||
function render() {
|
||||
if (unavailable) {
|
||||
tbody.innerHTML = '<tr><td colspan="5" class="pj-meet-quick-note">' + escapeHtml(unavailable) + "</td></tr>";
|
||||
tbody.innerHTML = '<tr><td colspan="6" class="pj-meet-quick-note">' + escapeHtml(unavailable) + "</td></tr>";
|
||||
return;
|
||||
}
|
||||
reorder();
|
||||
tbody.innerHTML = rows.map(function (r, i) {
|
||||
const par = parentOf(r);
|
||||
const ro = locked || r.registered;
|
||||
let acts;
|
||||
if (r.registered) {
|
||||
const label = !r.taskExists ? "작업 삭제됨" : "등록됨";
|
||||
const link = r.visible && r.taskId && r.taskExists
|
||||
? '<a href="/project/t/' + r.taskId + '" target="_blank" rel="noopener">' + label + "</a>" : "<span>" + label + "</span>";
|
||||
? '<a href="/project/t/' + r.taskId + '" target="_blank" rel="noopener" title="새 탭에서 열기">' + label + "</a>" : "<span>" + label + "</span>";
|
||||
acts = '<span class="pj-meet-quick-done"><span class="material-symbols-outlined" style="font-size:16px">check_circle</span>' +
|
||||
link + "</span>" + (!locked && r.visible
|
||||
? '<button type="button" class="pj-meet-quick-del" data-quick="delete" title="' +
|
||||
@@ -10804,44 +10788,40 @@
|
||||
} else if (locked) {
|
||||
acts = "";
|
||||
} else {
|
||||
const wait = par && !par.registered;
|
||||
acts = '<button type="button" class="pj-meet-quick-apply" data-quick="apply"' +
|
||||
(wait ? ' disabled title="위 줄(상위 작업)을 먼저 [적용]하세요"' : "") + ">적용</button>" +
|
||||
acts = '<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>';
|
||||
}
|
||||
// 세부 작업 줄 — ↳ 들여쓰기, 프로젝트는 위 줄을 따르고 섹션은 없다(작업의 세부 작업)
|
||||
const projCell = par
|
||||
? '<span class="pj-meet-quick-inherit" title="위 줄의 프로젝트를 따릅니다">' + escapeHtml(par.projectName || "위 줄 따름") + "</span>"
|
||||
: cell("project", r.projectName, "프로젝트", ro);
|
||||
const stageCell = par ? '<span class="pj-meet-quick-inherit" title="세부 작업은 섹션이 없습니다">—</span>' : cell("stage", r.stageName, "섹션", ro);
|
||||
const addSub = !par && !locked && r.visible
|
||||
? '<button type="button" class="pj-meet-quick-addsub" data-quick="add-sub" title="세부 작업 추가(제목 칸에서 Tab = 위 줄의 세부 작업으로)">' +
|
||||
'<span class="material-symbols-outlined">subdirectory_arrow_right</span></button>' : "";
|
||||
return '<tr data-i="' + i + '" class="' + (r.registered ? "is-done " : "") + (par ? "is-sub" : "") + '">' +
|
||||
'<td class="pj-meet-quick-title">' + (par ? '<span class="pj-meet-quick-submark" aria-hidden="true">↳</span>' : "") +
|
||||
'<input type="text" data-field="title" maxlength="200" placeholder="' + (par ? "세부 작업 제목" : "작업 제목") + '" value="' + escapeHtml(r.title) + '"' +
|
||||
(ro ? " readonly" : "") + ">" + addSub + "</td>" +
|
||||
// 제목 — 등록된 줄은 누르면 오른쪽에 작업 창(편집), 아니면 입력칸
|
||||
const titleCell = r.registered
|
||||
? (r.visible && r.taskId && r.taskExists
|
||||
? '<button type="button" class="pj-meet-quick-open" data-quick="open" title="오른쪽에 작업 창 열기(편집)">' + escapeHtml(r.title || "(제목 없음)") + "</button>"
|
||||
: '<span class="pj-meet-quick-open is-plain">' + escapeHtml(r.title || "(제목 없음)") + "</span>")
|
||||
: '<input type="text" data-field="title" maxlength="200" placeholder="' + (r.parentTaskId ? "세부 작업 제목" : "작업 제목") + '" value="' +
|
||||
escapeHtml(r.title) + '"' + (ro ? " readonly" : "") + ">";
|
||||
// 작업 칸 — 비우면 그 섹션에 새 작업, 고르면 그 작업의 세부 작업(↳ 표시)
|
||||
const taskCell = r.parentTaskId
|
||||
? cell("task", "↳ " + (r.parentTaskTitle || "작업"), "", ro, "이 작업의 세부 작업으로 등록")
|
||||
: cell("task", "", r.registered ? "—" : "새 작업", ro || !r.projectId, r.projectId ? "고르면 그 작업의 세부 작업으로 등록(비우면 섹션에 새 작업)" : "프로젝트를 먼저 고르세요");
|
||||
return '<tr data-i="' + i + '"' + (r.registered ? ' class="is-done"' : "") + ">" +
|
||||
'<td class="pj-meet-quick-title">' + titleCell + "</td>" +
|
||||
"<td>" + (r.assignee
|
||||
? '<button type="button" class="pj-meet-pick-cell is-person" data-pick="assignee"' + (ro ? " disabled" : "") + ">" +
|
||||
faceHtml(r.assignee) + "<span>" + escapeHtml(nameOf(r.assignee)) + "</span></button>"
|
||||
: cell("assignee", "", "담당자", ro)) + "</td>" +
|
||||
"<td>" + projCell + "</td>" +
|
||||
"<td>" + stageCell + "</td>" +
|
||||
"<td>" + cell("project", r.projectName, "프로젝트", ro) + "</td>" +
|
||||
"<td>" + (r.parentTaskId ? '<span class="pj-meet-quick-inherit" title="세부 작업은 섹션이 없습니다(상위 작업을 따름)">—</span>'
|
||||
: cell("stage", r.stageName, "섹션", ro)) + "</td>" +
|
||||
"<td>" + taskCell + "</td>" +
|
||||
'<td class="pj-meet-quick-acts">' + acts + "</td></tr>";
|
||||
}).join("");
|
||||
}
|
||||
function focusTitle(r) {
|
||||
const i = rows.indexOf(r);
|
||||
const inp = i >= 0 ? tbody.querySelector('tr[data-i="' + i + '"] input[data-field="title"]') : null;
|
||||
if (inp) { inp.focus(); try { inp.setSelectionRange(inp.value.length, inp.value.length); } catch (_) {} }
|
||||
}
|
||||
function menuAt(btn, items) {
|
||||
const r = btn.getBoundingClientRect();
|
||||
showContextMenu(r.left, r.bottom + 2, items.length ? items : [{ label: "고를 항목이 없습니다", onClick: function () {} }]);
|
||||
}
|
||||
async function chooseProject(r, p) {
|
||||
if (r.projectId !== p.id) { r.stageId = null; r.stageName = ""; }
|
||||
if (r.projectId !== p.id) { r.stageId = null; r.stageName = ""; r.parentTaskId = null; r.parentTaskTitle = ""; }
|
||||
r.projectId = p.id; r.projectName = p.name;
|
||||
try {
|
||||
const [mem, stages] = await Promise.all([membersOf(p.id), stagesOf(p.id)]);
|
||||
@@ -10866,6 +10846,7 @@
|
||||
if (projects) projects.push(p);
|
||||
memberCache[p.id] = [String(p.owner_email || "").toLowerCase()].filter(Boolean);
|
||||
stageCache[p.id] = [];
|
||||
taskCache[p.id] = [];
|
||||
showToast("프로젝트 ‘" + p.name + "’를 만들었습니다.");
|
||||
await chooseProject(r, p);
|
||||
} catch (e) { showToast("프로젝트 만들기 실패: " + e.message, "error"); }
|
||||
@@ -10879,9 +10860,8 @@
|
||||
})));
|
||||
}
|
||||
async function pickAssignee(r, btn) {
|
||||
// 프로젝트(세부 작업 줄은 위 줄의 프로젝트)를 골랐으면 그 멤버·소유자만, 아니면 프로젝트 권한이 있는 전체 직원
|
||||
const par = parentOf(r), pid = par ? par.projectId : r.projectId;
|
||||
const emails = pid ? await membersOf(pid)
|
||||
// 프로젝트를 골랐으면 그 프로젝트 멤버·소유자만(작업을 볼 수 있는 사람), 아니면 프로젝트 권한이 있는 전체 직원
|
||||
const emails = r.projectId ? await membersOf(r.projectId)
|
||||
: (window.PJ_MEET_MEMBERS || []).map(function (m) { return String(m.email).toLowerCase(); });
|
||||
const set = function (e) { r.assignee = e; render(); persist(r, { assignee_email: e }); };
|
||||
menuAt(btn, [{ label: "담당자 없음", icon: menuIcon("person_off"), checked: !r.assignee, onClick: function () { set(""); } }, null]
|
||||
@@ -10893,7 +10873,12 @@
|
||||
if (!r.projectId) { showToast("프로젝트를 먼저 고르세요."); return; }
|
||||
const stages = await stagesOf(r.projectId);
|
||||
const pid = r.projectId;
|
||||
const set = function (st) { r.stageId = st.id; r.stageName = st.name; render(); persist(r, { project_id: pid, stage_id: st.id }); };
|
||||
const set = function (st) {
|
||||
r.stageId = st.id; r.stageName = st.name;
|
||||
const keepTask = r.parentTaskId && (taskCache[pid] || []).some(function (t) { return t.id === r.parentTaskId && t.stage_id === st.id; });
|
||||
if (!keepTask) { r.parentTaskId = null; r.parentTaskTitle = ""; }
|
||||
render(); persist(r, { project_id: pid, stage_id: st.id, parent_task_id: r.parentTaskId });
|
||||
};
|
||||
// 목록 맨 위 "+ 새 섹션" — 그 프로젝트 멤버 누구나(서버 POST …/stages). 만든 섹션을 바로 고른다.
|
||||
const head = [{ label: "새 섹션", icon: menuIcon("add"), onClick: async function () {
|
||||
const name = await prompt("‘" + r.projectName + "’에 만들 섹션 이름", "");
|
||||
@@ -10910,58 +10895,43 @@
|
||||
return { label: st.name, icon: menuIcon("view_column"), checked: r.stageId === st.id, onClick: function () { set(st); } };
|
||||
})));
|
||||
}
|
||||
|
||||
// ── 세부 작업 줄 — 추가(↳ 버튼·우클릭), 세부 작업으로(Tab)·위 단계로(Shift+Tab). 한 단계만 ──
|
||||
function addSub(p) {
|
||||
if (locked) return;
|
||||
const kids = childrenOf(p);
|
||||
const at = rows.indexOf(kids.length ? kids[kids.length - 1] : p);
|
||||
const c = blank(p);
|
||||
rows.splice(at + 1, 0, c);
|
||||
render();
|
||||
focusTitle(c);
|
||||
}
|
||||
function canIndent(r) {
|
||||
if (locked || r.registered || parentOf(r) || childrenOf(r).length) return null;
|
||||
const i = rows.indexOf(r);
|
||||
for (let k = i - 1; k >= 0; k--) { if (!parentOf(rows[k])) return rows[k].visible ? rows[k] : null; }
|
||||
return null;
|
||||
}
|
||||
function indent(r) {
|
||||
const p = canIndent(r);
|
||||
if (!p) return false;
|
||||
r.parentRef = p; r.parentId = p.id || null;
|
||||
render(); focusTitle(r);
|
||||
if (r.id || r.title || r.assignee) persist(r, { parent_id: undefined });
|
||||
return true;
|
||||
}
|
||||
function outdent(r) {
|
||||
const p = parentOf(r);
|
||||
if (locked || r.registered || !p) return false;
|
||||
const kids = childrenOf(p);
|
||||
rows.splice(rows.indexOf(r), 1);
|
||||
r.parentRef = null; r.parentId = null;
|
||||
rows.splice(rows.indexOf(kids[kids.length - 1] === r ? p : kids[kids.length - 1]) + 1, 0, r);
|
||||
render(); focusTitle(r);
|
||||
if (r.id) persist(r, { parent_id: null });
|
||||
return true;
|
||||
// 작업 칸 — 맨 위 "새 작업(섹션에)" + 그 섹션(섹션이 없으면 프로젝트 전체)의 미완료 메인 작업. 고르면 세부 작업으로 등록.
|
||||
async function pickTask(r, btn) {
|
||||
if (!r.projectId) { showToast("프로젝트를 먼저 고르세요."); return; }
|
||||
const pid = r.projectId;
|
||||
const all = await tasksOf(pid);
|
||||
const list = r.stageId ? all.filter(function (t) { return t.stage_id === r.stageId; }) : all;
|
||||
const set = function (t) {
|
||||
r.parentTaskId = t ? t.id : null; r.parentTaskTitle = t ? t.title : "";
|
||||
if (t && t.stage_id) {
|
||||
const st = (stageCache[pid] || []).find(function (x) { return x.id === t.stage_id; });
|
||||
if (st) { r.stageId = st.id; r.stageName = st.name; }
|
||||
}
|
||||
render(); persist(r, { parent_task_id: r.parentTaskId, stage_id: r.stageId });
|
||||
};
|
||||
menuAt(btn, [{ label: "새 작업" + (r.stageName ? " (‘" + r.stageName + "’ 섹션에)" : ""), icon: menuIcon("add_task"),
|
||||
checked: !r.parentTaskId, onClick: function () { set(null); } }, null]
|
||||
.concat(list.length ? list.map(function (t) {
|
||||
return { label: t.title, icon: menuIcon("subdirectory_arrow_right"), checked: r.parentTaskId === t.id, onClick: function () { set(t); } };
|
||||
}) : [{ label: r.stageName ? "이 섹션에 진행 중인 작업이 없습니다" : "진행 중인 작업이 없습니다", onClick: function () {} }]));
|
||||
}
|
||||
|
||||
async function apply(r, btn) {
|
||||
flushTitle(r);
|
||||
const par = parentOf(r);
|
||||
if (!r.title.trim()) { showToast("작업 제목을 쓰세요."); return; }
|
||||
if (par && !par.registered) { showToast("위 줄(상위 작업)을 먼저 [적용]하세요."); return; }
|
||||
if (!par && !r.projectId) { showToast("프로젝트를 고르세요."); return; }
|
||||
if (!r.projectId) { showToast("프로젝트를 고르세요."); return; }
|
||||
btn.disabled = true;
|
||||
try {
|
||||
await r.chain;
|
||||
if (!r.id) await persist(r, {});
|
||||
if (!r.id) throw new Error("줄을 저장하지 못했습니다");
|
||||
const res = await api("POST", rowUrl(r.id) + "/apply", {});
|
||||
const sub = !!r.parentTaskId;
|
||||
Object.assign(r, fromServer(res.task));
|
||||
showToast(res.created ? "‘" + ((par ? par.projectName : r.projectName) || "프로젝트") + "’에 " + (par ? "세부 작업을" : "작업을") + " 등록했습니다."
|
||||
if (sub && taskCache[r.projectId]) delete taskCache[r.projectId];
|
||||
showToast(res.created ? (sub ? "‘" + r.parentTaskTitle + "’의 세부 작업으로 등록했습니다." : "‘" + r.projectName + "’에 작업을 등록했습니다.")
|
||||
: "이미 등록된 줄입니다(다른 사람이 먼저 [적용]했습니다).");
|
||||
delete taskCache[r.projectId]; // 새 작업이 작업 칸 후보에 보이게
|
||||
padBlank(); render();
|
||||
} catch (e) {
|
||||
btn.disabled = false;
|
||||
@@ -10977,19 +10947,76 @@
|
||||
try { await api("DELETE", "/project/api/tasks/" + r.taskId); showToast("작업을 삭제했습니다."); }
|
||||
catch (e) { if (e.status !== 404) { btn.disabled = false; showToast("작업 삭제 실패: " + e.message, "error"); return; } }
|
||||
}
|
||||
dropRow(r, true);
|
||||
dropRow(r);
|
||||
}
|
||||
async function dropRow(r, asked) {
|
||||
const kids = childrenOf(r);
|
||||
if (!asked && kids.length && !(await confirm("세부 작업 줄 " + kids.length + "개도 함께 지울까요? (이미 [적용]해 만든 작업은 프로젝트에 남습니다)",
|
||||
{ okText: "지우기", cancelText: "취소" }))) return;
|
||||
async function dropRow(r) {
|
||||
try {
|
||||
await r.chain;
|
||||
if (r.id) await api("DELETE", rowUrl(r.id)); // 서버는 세부 작업 줄도 함께 지운다(CASCADE)
|
||||
if (r.id) await api("DELETE", rowUrl(r.id));
|
||||
} catch (e) { if (e.status !== 404) { showToast("줄을 지우지 못했습니다: " + e.message, "error"); return; } }
|
||||
rows = rows.filter(function (x) { return x !== r && kids.indexOf(x) < 0; });
|
||||
const i = rows.indexOf(r);
|
||||
if (i >= 0) rows.splice(i, 1);
|
||||
padBlank(); render();
|
||||
}
|
||||
|
||||
// ── 오른쪽 작업 창 — 등록된 줄의 제목을 누르면 그 작업 편집 창(프로젝트 화면 ?embed=1 을 iframe 에, 수신함과 같은 방식).
|
||||
// 다른 작업으로 바꾸거나 닫기 전에 작업 창 안의 저장을 기다린다(__pjEmbedSettle — 실패면 "버리고 넘어가기 / 계속 편집").
|
||||
let panel = null, panelTask = null, switching = null, wanted;
|
||||
function panelOpen() { return !!panel && panel.classList.contains("is-open"); }
|
||||
async function settleFrame() {
|
||||
if (!panelOpen()) 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 showPanel(taskId) {
|
||||
if (taskId == null) {
|
||||
if (!panelOpen()) return;
|
||||
panel.classList.remove("is-open");
|
||||
panelTask = null;
|
||||
const p = panel;
|
||||
setTimeout(function () { if (!p.classList.contains("is-open")) p.querySelector("iframe").src = "about:blank"; }, 250);
|
||||
load(true); // 작업 창에서 제목 등을 바꿨을 수 있다
|
||||
return;
|
||||
}
|
||||
if (!panel) {
|
||||
panel = document.createElement("div");
|
||||
panel.className = "pj-inbox-panel pj-meet-task-panel";
|
||||
panel.innerHTML = '<iframe title="작업"></iframe>';
|
||||
document.body.appendChild(panel); // 화면 배율(.pj-ui-scale) 밖 — body 에
|
||||
}
|
||||
panelTask = taskId;
|
||||
panel.querySelector("iframe").src = "/project/t/" + taskId + "?embed=1";
|
||||
void panel.offsetWidth;
|
||||
panel.classList.add("is-open");
|
||||
}
|
||||
function requestPanel(taskId) {
|
||||
wanted = taskId;
|
||||
if (switching) return switching;
|
||||
switching = (async function () {
|
||||
while (wanted !== undefined) {
|
||||
const t = wanted;
|
||||
if ((t === null && !panelOpen()) || (t !== null && panelOpen() && panelTask === t)) { wanted = undefined; break; }
|
||||
const ok = await settleFrame();
|
||||
if (!ok) { wanted = undefined; break; }
|
||||
if (wanted !== t) continue;
|
||||
wanted = undefined;
|
||||
showPanel(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" && panelOpen()) requestPanel(null);
|
||||
});
|
||||
document.addEventListener("keydown", function (e) { if (e.key === "Escape" && panelOpen() && !modal) requestPanel(null); });
|
||||
document.addEventListener("mousedown", function (e) {
|
||||
if (!panelOpen() || panel.contains(e.target)) return;
|
||||
if (e.target.closest && e.target.closest('[data-quick="open"], .pj-ctxmenu, .pj-modal, .erp-dialog')) return;
|
||||
requestPanel(null);
|
||||
});
|
||||
|
||||
// 제목 — 치는 동안 0.6초 멈추면, 칸을 떠나면 저장
|
||||
const titleTimers = new Map();
|
||||
function flushTitle(r) {
|
||||
@@ -11013,17 +11040,9 @@
|
||||
});
|
||||
tbody.addEventListener("keydown", function (e) {
|
||||
const inp = e.target.closest("input[data-field=title]");
|
||||
if (!inp || inp.readOnly || isImeEnter(e)) return;
|
||||
const r = rowOf(inp);
|
||||
if (e.key === "Tab") {
|
||||
// 아사나처럼 — Tab = 위 줄의 세부 작업으로, Shift+Tab = 위 단계로. 할 수 없으면 원래 Tab(다음 칸)
|
||||
flushTitle(r);
|
||||
if (e.shiftKey ? outdent(r) : indent(r)) e.preventDefault();
|
||||
return;
|
||||
}
|
||||
if (e.key === "Enter") {
|
||||
if (inp && !inp.readOnly && e.key === "Enter" && !isImeEnter(e)) {
|
||||
e.preventDefault();
|
||||
flushTitle(r);
|
||||
flushTitle(rowOf(inp));
|
||||
inp.closest("tr").querySelector('[data-pick="assignee"]').click();
|
||||
}
|
||||
});
|
||||
@@ -11033,31 +11052,22 @@
|
||||
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 (e.target.closest('[data-quick="add-sub"]')) { addSub(r); return; }
|
||||
if (e.target.closest('[data-quick="open"]')) { if (modal) closeBig(); requestPanel(r.taskId); return; }
|
||||
if (r.registered || locked) return;
|
||||
const fail = function (err) { showToast("목록을 읽지 못했습니다: " + err.message, "error"); };
|
||||
if (pick) {
|
||||
e.stopPropagation();
|
||||
({ project: pickProject, assignee: pickAssignee, stage: pickStage })[pick.dataset.pick](r, pick).catch(fail);
|
||||
({ project: pickProject, assignee: pickAssignee, stage: pickStage, task: pickTask })[pick.dataset.pick](r, pick).catch(fail);
|
||||
} else if (e.target.closest('[data-quick="apply"]')) apply(r, e.target.closest('[data-quick="apply"]'));
|
||||
});
|
||||
// 우클릭 — 세부 작업 추가 · 세부 작업으로 · 위 단계로 · 줄 지우기
|
||||
tbody.addEventListener("contextmenu", function (e) {
|
||||
const r = rowOf(e.target);
|
||||
if (!r || locked) return;
|
||||
e.preventDefault();
|
||||
const par = parentOf(r);
|
||||
const items = [];
|
||||
if (!par && r.visible) items.push({ label: "세부 작업 추가", icon: menuIcon("subdirectory_arrow_right"), onClick: function () { addSub(r); } });
|
||||
if (canIndent(r)) items.push({ label: "위 줄의 세부 작업으로 (Tab)", icon: menuIcon("format_indent_increase"), onClick: function () { indent(r); } });
|
||||
if (par && !r.registered) items.push({ label: "위 단계로 (Shift+Tab)", icon: menuIcon("format_indent_decrease"), onClick: function () { outdent(r); } });
|
||||
if (!r.registered) { if (items.length) items.push(null); items.push({ label: "줄 지우기", danger: true, icon: menuIcon("close"), onClick: function () { dropRow(r); } }); }
|
||||
if (items.length) showContextMenu(e.clientX, e.clientY, items);
|
||||
});
|
||||
const addBtn = box.querySelector('[data-quick="add"]');
|
||||
if (addBtn) {
|
||||
if (locked) addBtn.hidden = true;
|
||||
else addBtn.addEventListener("click", function () { const b = blank(); rows.push(b); render(); focusTitle(b); });
|
||||
else addBtn.addEventListener("click", function () {
|
||||
const b = blank(); rows.push(b); render();
|
||||
const inp = tbody.querySelector('tr[data-i="' + rows.indexOf(b) + '"] input[data-field="title"]');
|
||||
if (inp) inp.focus();
|
||||
});
|
||||
}
|
||||
|
||||
// ── 크게 열기 — 같은 표(같은 줄·같은 저장)를 넓은 창으로 옮겨 쓴다. 닫으면 제자리로 ──
|
||||
@@ -11072,7 +11082,7 @@
|
||||
if (expandBtn) expandBtn.focus();
|
||||
}
|
||||
function onBigKey(e) {
|
||||
if (e.key === "Escape" && modal && !document.querySelector(".pj-ctxmenu, .pj-modal:not([hidden])")) { e.preventDefault(); closeBig(); }
|
||||
if (e.key === "Escape" && modal && !document.querySelector(".pj-ctxmenu, .pj-modal:not([hidden])")) { e.preventDefault(); e.stopPropagation(); closeBig(); }
|
||||
}
|
||||
function openBig() {
|
||||
if (modal) return;
|
||||
@@ -11101,7 +11111,7 @@
|
||||
if (!force && busy()) return;
|
||||
try {
|
||||
const res = await api("GET", listUrl);
|
||||
const blanks = rows.filter(function (r) { return !r.id && !parentOf(r) && !r.title && !r.projectId && !r.assignee; }).length;
|
||||
const blanks = rows.filter(function (r) { return !r.id && !r.title && !r.projectId && !r.assignee; }).length;
|
||||
rows = (res.tasks || []).map(fromServer);
|
||||
for (let i = 0; i < blanks; i++) rows.push(blank());
|
||||
padBlank();
|
||||
@@ -11143,9 +11153,10 @@
|
||||
await load(true);
|
||||
if (!unavailable && !locked) { await migrateLocal(); await load(true); }
|
||||
})();
|
||||
setInterval(function () { if (!document.hidden && ready) load(false); }, 30000);
|
||||
document.addEventListener("visibilitychange", function () { if (!document.hidden && ready) load(false); });
|
||||
if (window.__PJ_TEST__) window.__pjMeetQuick = { load: load, rows: function () { return rows; }, openBig: openBig, closeBig: closeBig };
|
||||
setInterval(function () { if (!document.hidden && ready && !panelOpen()) load(false); }, 30000);
|
||||
document.addEventListener("visibilitychange", function () { if (!document.hidden && ready && !panelOpen()) load(false); });
|
||||
if (window.__PJ_TEST__) window.__pjMeetQuick = { load: load, rows: function () { return rows; }, openBig: openBig, closeBig: closeBig,
|
||||
settling: function () { return switching || Promise.resolve(); } };
|
||||
}
|
||||
|
||||
function initGoalMeeting() {
|
||||
|
||||
@@ -125,6 +125,17 @@ docker exec postgres-db psql -U postgres -d project_db -c "SELECT to_regclass('g
|
||||
|
||||
설정이 없거나 권한이 모자라면 버튼을 눌렀을 때 사유가 안내되고(503), 회의록 다른 기능은 그대로 동작한다.
|
||||
|
||||
## 회의록 작업 등록 표 — 작업 칸 마이그레이션 (026)
|
||||
|
||||
026은 `goal_meeting_tasks.parent_task_id` 열만 추가한다(기존 값 그대로, 다시 실행 가능). 025 뒤에 적용한다. 미적용이면 작업 칸을 고를 때만 503 안내.
|
||||
|
||||
```bash
|
||||
cd /opt/www/main
|
||||
docker exec postgres-db pg_dump -U postgres project_db > ~/project_db_before_026_$(date +%Y%m%d%H%M).sql
|
||||
docker exec -i postgres-db psql -v ON_ERROR_STOP=1 -U postgres -d project_db < scripts/sql/project_db_026_meeting_quick_parent_task.sql
|
||||
docker exec postgres-db psql -U postgres -d project_db -c "SELECT column_name FROM information_schema.columns WHERE table_name='goal_meeting_tasks' AND column_name='parent_task_id';"
|
||||
```
|
||||
|
||||
## 회의록 작업 등록 표 마이그레이션 (025)
|
||||
|
||||
025는 `goal_meeting_tasks` 테이블만 추가한다(기존 값 그대로, 다시 실행 가능). 작업 등록 표를 주차별로 서버에 두어 모두가 같이 본다.
|
||||
|
||||
@@ -1206,9 +1206,12 @@ Windows 트레이 프로그램 **DBX 알림**(`desktop/notifier/`, C# .NET Frame
|
||||
`POST …/{id}/apply`(줄을 FOR UPDATE 로 잠그고 task_id 가 없을 때만 `_create_task_for` — 작업 창과 같은 권한·알림, 동시에 눌러도 하나).
|
||||
보기·고치기 = 회의록을 볼 수 있는 사람 누구나(회의 완료면 409), 줄에 고를 수 있는 프로젝트 = 내가 멤버인 것만(403),
|
||||
내가 멤버가 아닌 프로젝트를 가리키는 남의 줄은 프로젝트·섹션 이름·작업 링크를 가린다(`registered` 만). [적용] 뒤 줄은 고칠 수 없다.
|
||||
**세부 작업 줄**(`parent_id`, 한 단계만): ↳ 버튼·우클릭 → 바로 아래 세부 작업 줄, 제목 칸 Tab = 위 줄의 세부 작업으로 · Shift+Tab = 위 단계로
|
||||
(`PUT … {parent_id}` — 세부 작업 줄 밑·자식 딸린 줄은 400). 세부 작업 줄은 위 줄의 프로젝트를 따르고 섹션이 없다 — [적용]은 위 줄이 먼저,
|
||||
서버가 위 줄이 만든 작업 밑에(그 작업의 프로젝트로) 세부 작업을 만든다. 위 줄을 지우면 세부 작업 줄도(CASCADE, 이미 만든 작업은 남음).
|
||||
**작업 칸**(마이그레이션 026 `parent_task_id`): 프로젝트 → 섹션 → **작업** — 비우면 그 섹션에 새 작업, 이미 있는 작업을 고르면 [적용] 때
|
||||
그 작업의 세부 작업으로(섹션 없음). 후보 = 그 섹션(섹션이 없으면 프로젝트)의 미완료 메인 작업(`GET /api/projects/{id}/tasks`).
|
||||
서버는 고른 작업이 그 프로젝트 것인지 확인(400), 프로젝트를 바꾸면 섹션·작업을 비우고, [적용] 때 그 작업이 없어졌거나 옮겨졌으면 400.
|
||||
026 미적용이면 작업 칸 저장만 503(나머지 그대로). (025 의 `parent_id` — 잠깐 있던 '표 안 줄끼리 세부 작업' — 는 화면·API 에서 뺐다, 열은 남김.)
|
||||
**등록된 줄 제목 = 오른쪽 작업 창**: `/project/t/{id}?embed=1` 을 iframe 패널(`.pj-inbox-panel.pj-meet-task-panel`)에 — 수신함과 같이
|
||||
바꾸기·닫기(Esc·바깥 클릭·작업 창 닫기) 전에 `__pjEmbedSettle`(저장 대기 → 실패면 버리기/계속 편집), 닫으면 표를 다시 읽는다.
|
||||
**[크게 열기]** = 같은 표(DOM 그대로)를 넓은 창(`.pj-meet-quick-modal`, body 에, 고르기 메뉴 아래 z-index)으로 옮겨 쓰고 Esc·×로 제자리.
|
||||
화면은 빈 줄 3개를 화면에만 두고
|
||||
처음 채우는 순간 POST, 그 뒤 칸마다 PUT(줄마다 차례대로), 30초마다·창을 다시 볼 때 다시 읽는다(입력·저장 중엔 건너뜀).
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
-- =====================================================================
|
||||
-- project_db 마이그레이션 026 — 회의록 작업 등록 표: "작업" 칸(이미 있는 작업의 세부 작업으로 등록)
|
||||
-- =====================================================================
|
||||
-- 멱등(idempotent). 열 하나만 추가한다(기존 값 변경·삭제 없음). 운영: /opt/www/main 에서 기존 project_db 에 적용.
|
||||
--
|
||||
-- 왜(2026-10-12 사용자 요청): 작업 등록 표에서 프로젝트 → 섹션 → **작업** 까지 고를 수 있게 — 작업을 고르면 [적용] 때
|
||||
-- 그 작업의 세부 작업으로 만든다(비우면 예전처럼 그 섹션에 새 작업). 025 의 parent_id(표 안 줄끼리의 세부 작업)는
|
||||
-- 화면에서 쓰지 않는다(열·값은 그대로 둔다).
|
||||
-- =====================================================================
|
||||
BEGIN;
|
||||
|
||||
ALTER TABLE goal_meeting_tasks ADD COLUMN IF NOT EXISTS parent_task_id BIGINT NULL; -- 고른 상위 작업(tasks.id, FK 없음 — 작업이 지워져도 줄은 남는다)
|
||||
COMMENT ON COLUMN goal_meeting_tasks.parent_task_id IS '작업 칸 — [적용] 때 이 작업의 세부 작업으로 만든다(NULL = 그 섹션에 새 작업)';
|
||||
|
||||
COMMIT;
|
||||
SELECT 'project_db 026 meeting quick parent task ready' AS status;
|
||||
@@ -523,7 +523,7 @@ function meetServer(env, st) {
|
||||
const out = function (r) {
|
||||
return { id: r.id, title: r.title || "", assignee_email: r.assignee_email || "", project_id: r.project_id || null,
|
||||
project_name: r.project_name || "", stage_id: r.stage_id || null, stage_name: r.stage_name || "", task_id: r.task_id,
|
||||
parent_id: r.parent_id || null,
|
||||
parent_task_id: r.parent_task_id || null, parent_task_title: r.parent_task_id ? (r.parent_task_title || "상세페이지 리뉴얼") : "",
|
||||
registered: r.task_id != null, visible: r.visible !== false, task_exists: true };
|
||||
};
|
||||
env.route("GET", /\/goals\/meetings\/([\d-]+)\/quick-tasks$/, function (u) {
|
||||
@@ -660,7 +660,9 @@ function meetServer(env, st) {
|
||||
|
||||
// ════════════════════ [2g3] 작업 등록 = 주차별 서버 표 · 다른 사람 줄도 보임 · 제목 "N주차 작업 등록" · 브라우저 예전 표는 서버로 ════════════════════
|
||||
await section(async function () {
|
||||
const titles = function (d) { return Array.from(d.querySelectorAll('#pj-meet-quick tbody input[data-field="title"]')).map(function (i) { return i.value; }); };
|
||||
// 제목 — 입력칸(등록 전) 또는 등록된 줄의 제목 버튼·글자
|
||||
const titleOf = function (tr) { const i = tr.querySelector('input[data-field="title"]'); return i ? i.value : (tr.querySelector(".pj-meet-quick-open") || {}).textContent || ""; };
|
||||
const titles = function (d) { return Array.from(d.querySelectorAll("#pj-meet-quick tbody tr")).map(titleOf); };
|
||||
const env = makeEnv(PAGE.meeting_admin, MEET_URL);
|
||||
meetServer(env);
|
||||
quickServer(env, { rows: [
|
||||
@@ -674,9 +676,9 @@ function meetServer(env, st) {
|
||||
const ts = titles(d);
|
||||
check("[2g3] 다른 사람이 적은·등록한 줄도 보임(이 주차만)", ts.indexOf("다른 사람이 적은 줄") >= 0 && ts.indexOf("다른 사람이 등록한 줄") >= 0 &&
|
||||
ts.indexOf("다른 주차 줄") < 0, ts);
|
||||
const hidden = Array.from(d.querySelectorAll("#pj-meet-quick tbody tr")).find(function (tr) { return tr.querySelector("input").value === "남의 프로젝트 줄"; });
|
||||
const hidden = Array.from(d.querySelectorAll("#pj-meet-quick tbody tr")).find(function (tr) { return titleOf(tr) === "남의 프로젝트 줄"; });
|
||||
check("[2g3] 내가 멤버가 아닌 프로젝트 줄 — 이름 가림·작업 링크·삭제 없음", /볼 수 없는 프로젝트/.test(hidden.textContent) && /등록됨/.test(hidden.textContent) &&
|
||||
!hidden.querySelector("a") && !hidden.querySelector('[data-quick="delete"]'));
|
||||
!hidden.querySelector("a") && !hidden.querySelector('[data-quick="delete"]') && !hidden.querySelector('[data-quick="open"]'));
|
||||
// 이 브라우저에만 있던 예전 표(이 주차 키 · 이번 주면 주차 없는 예전 키) → 서버로 옮기고 지움
|
||||
for (const isNow of [false, true]) {
|
||||
const e2 = makeEnv(PAGE.meeting_admin, MEET_URL);
|
||||
@@ -693,50 +695,52 @@ function meetServer(env, st) {
|
||||
}
|
||||
});
|
||||
|
||||
// ════════════════════ [2g4] 세부 작업 줄(↳·Tab·Shift+Tab) · [크게 열기] ════════════════════
|
||||
// ════════════════════ [2g4] 작업 칸(이미 있는 작업의 세부 작업으로) · 등록된 제목 = 오른쪽 작업 창 · [크게 열기] ════════════════════
|
||||
await section(async function () {
|
||||
const env = makeEnv(PAGE.meeting_admin, MEET_URL);
|
||||
meetServer(env);
|
||||
const q = quickServer(env, { rows: [{ id: 1, title: "부모 작업", project_id: 7, project_name: "브랜드" }] });
|
||||
const q = quickServer(env, { rows: [{ id: 1, title: "배너 시안", project_id: 7, project_name: "브랜드", stage_id: 71, stage_name: "할 일" }] });
|
||||
env.route("GET", /\/project\/api\/projects\/7\/tasks$/, function () { return { body: { tasks: [
|
||||
{ id: 300, title: "상세페이지 리뉴얼", project_id: 7, stage_id: 71 },
|
||||
{ id: 301, title: "다른 섹션 작업", project_id: 7, stage_id: 72 },
|
||||
{ id: 302, title: "끝난 작업", project_id: 7, stage_id: 71, completed_at: "2026-09-01T00:00:00+09:00" },
|
||||
{ id: 303, title: "이미 세부 작업", project_id: 7, stage_id: null, parent_task_id: 300 }] } }; });
|
||||
await boot(env); await settle(); await wait(5); await settle();
|
||||
const d = env.d;
|
||||
const trs = function () { return Array.from(d.querySelectorAll("#pj-meet-quick tbody tr")); };
|
||||
const inputOf = function (tr) { return tr.querySelector('input[data-field="title"]'); };
|
||||
const type = async function (inp, v) {
|
||||
inp.value = v; inp.dispatchEvent(new env.w.Event("input", { bubbles: true }));
|
||||
inp.dispatchEvent(new env.w.Event("focusout", { bubbles: true })); await settle(); await wait(5); await settle();
|
||||
};
|
||||
trs()[0].querySelector('[data-quick="add-sub"]').click(); await settle();
|
||||
const sub = trs()[1];
|
||||
check("[2g4] ↳ → 바로 아래 세부 작업 줄(들여쓰기·프로젝트는 위 줄·섹션 없음)", sub.classList.contains("is-sub") &&
|
||||
inputOf(sub).placeholder === "세부 작업 제목" && /브랜드/.test(sub.querySelector(".pj-meet-quick-inherit").textContent) &&
|
||||
d.activeElement === inputOf(sub));
|
||||
await type(inputOf(sub), "세부 하나");
|
||||
const saved = Object.values(q.rows).find(function (r) { return r.title === "세부 하나"; });
|
||||
check("[2g4] 세부 작업 줄 저장 = parent_id(위 줄), 프로젝트 칸 없이", !!saved && saved.parent_id === 1 && !saved.project_id, saved);
|
||||
check("[2g4] 위 줄 [적용] 전에는 세부 작업 [적용] 못 함", trs()[1].querySelector('[data-quick="apply"]').disabled);
|
||||
// 아래 빈 맨 위 단계 줄 — 제목을 쓰고 Tab = 위 줄(부모 작업)의 세부 작업으로, Shift+Tab = 다시 위 단계로
|
||||
const top = trs().find(function (tr) { return !tr.classList.contains("is-sub") && !inputOf(tr).value; });
|
||||
await type(inputOf(top), "둘째");
|
||||
const key = function (inp, shift) {
|
||||
const e = new env.w.KeyboardEvent("keydown", { key: "Tab", shiftKey: !!shift, bubbles: true, cancelable: true });
|
||||
inp.dispatchEvent(e); return e.defaultPrevented;
|
||||
};
|
||||
const tabbed = key(inputOf(trs().find(function (tr) { return inputOf(tr).value === "둘째"; })));
|
||||
const row = function () { return d.querySelector("#pj-meet-quick tbody tr"); };
|
||||
check("[2g4] 표 머리에 '작업' 칸, 예전 ↳(줄 세부 작업) 버튼 없음",
|
||||
Array.from(d.querySelectorAll("#pj-meet-quick thead th")).map(function (t) { return t.textContent; }).indexOf("작업") === 4 &&
|
||||
!d.querySelector('[data-quick="add-sub"]'));
|
||||
row().querySelector('[data-pick="task"]').click(); await settle(); await wait(5); await settle();
|
||||
const labels = Array.from(d.querySelectorAll(".pj-ctxmenu-item")).map(itemLabel);
|
||||
check("[2g4] 작업 칸 목록 = '새 작업(섹션에)' + 그 섹션의 진행 중 메인 작업만", labels[0] === "새 작업 (‘할 일’ 섹션에)" &&
|
||||
labels.indexOf("상세페이지 리뉴얼") >= 0 && labels.indexOf("다른 섹션 작업") < 0 && labels.indexOf("끝난 작업") < 0 && labels.indexOf("이미 세부 작업") < 0, labels);
|
||||
Array.from(d.querySelectorAll(".pj-ctxmenu-item")).find(function (n) { return itemLabel(n) === "상세페이지 리뉴얼"; }).click();
|
||||
await settle(); await wait(5); await settle();
|
||||
const second = Object.values(q.rows).find(function (r) { return r.title === "둘째"; });
|
||||
check("[2g4] Tab = 위 줄의 세부 작업으로(저장)", tabbed && second.parent_id === 1 &&
|
||||
trs().find(function (tr) { return inputOf(tr).value === "둘째"; }).classList.contains("is-sub"), second);
|
||||
key(inputOf(trs().find(function (tr) { return inputOf(tr).value === "둘째"; })), true);
|
||||
await settle(); await wait(5); await settle();
|
||||
check("[2g4] Shift+Tab = 위 단계로(저장)", second.parent_id === null &&
|
||||
!trs().find(function (tr) { return inputOf(tr).value === "둘째"; }).classList.contains("is-sub"), second);
|
||||
check("[2g4] 작업을 고르면 ↳ 표시·섹션 '—'·제목 칸 '세부 작업 제목'·서버 줄에 parent_task_id",
|
||||
/↳ 상세페이지 리뉴얼/.test(row().querySelector('[data-pick="task"]').textContent) && /—/.test(row().children[3].textContent) &&
|
||||
row().querySelector('input[data-field="title"]').placeholder === "세부 작업 제목" && q.rows[1].parent_task_id === 300, q.rows[1]);
|
||||
row().querySelector('[data-quick="apply"]').click(); await settle(); await wait(5); await settle();
|
||||
check("[2g4] 적용 → 서버 [적용](고른 작업 밑 세부 작업)", q.applied.length === 1 && q.applied[0].parent_task_id === 300, q.applied);
|
||||
// 등록된 줄 — 제목을 누르면 오른쪽 작업 창(iframe, embed). 저장 확인이 '계속 편집'이면 닫히지 않음
|
||||
const open = row().querySelector('[data-quick="open"]');
|
||||
check("[2g4] 등록된 줄 제목 = 작업 창 열기 버튼", !!open && open.textContent === "배너 시안");
|
||||
open.click(); await settle();
|
||||
const panel = d.body.querySelector(".pj-meet-task-panel");
|
||||
check("[2g4] 오른쪽 작업 창(body 에) = /project/t/{id}?embed=1", !!panel && panel.classList.contains("is-open") &&
|
||||
panel.querySelector("iframe").getAttribute("src") === "/project/t/555?embed=1");
|
||||
let answer = false;
|
||||
panel.querySelector("iframe").contentWindow.__pjEmbedSettle = function () { return Promise.resolve(answer); };
|
||||
d.dispatchEvent(new env.w.KeyboardEvent("keydown", { key: "Escape", bubbles: true })); await settle();
|
||||
check("[2g4] 작업 창 저장 실패에 '계속 편집' → 창 그대로", panel.classList.contains("is-open"));
|
||||
answer = true;
|
||||
d.dispatchEvent(new env.w.KeyboardEvent("keydown", { key: "Escape", bubbles: true })); await settle();
|
||||
check("[2g4] 저장이 끝나면 Esc 로 닫힘", !panel.classList.contains("is-open"));
|
||||
// 크게 열기 — 같은 표가 넓은 창으로(줄 그대로), Esc 로 제자리
|
||||
const nRows = trs().length;
|
||||
const nRows = d.querySelectorAll("#pj-meet-quick tbody tr").length;
|
||||
d.querySelector('#pj-meet-quick [data-quick="expand"]').click(); await settle();
|
||||
const modal = d.body.querySelector(".pj-meet-quick-modal");
|
||||
check("[2g4] 크게 열기 → 같은 표를 넓은 창으로(body 에, 제목 'N주차 작업 등록')", !!modal && !!modal.querySelector("table.pj-meet-quick-table") &&
|
||||
!d.querySelector("#pj-meet-quick table") && /4주차 작업 등록/.test(modal.querySelector("h3").textContent) &&
|
||||
check("[2g4] 크게 열기 → 같은 표를 넓은 창으로(제목 'N주차 작업 등록')", !!modal && /4주차 작업 등록/.test(modal.querySelector("h3").textContent) &&
|
||||
modal.querySelectorAll("tbody tr").length === nRows && nRows > 0);
|
||||
d.dispatchEvent(new env.w.KeyboardEvent("keydown", { key: "Escape", bubbles: true, cancelable: true })); await settle();
|
||||
check("[2g4] Esc → 닫히고 표는 제자리", !d.body.querySelector(".pj-meet-quick-modal") && !!d.querySelector("#pj-meet-quick table.pj-meet-quick-table"));
|
||||
|
||||
@@ -1196,12 +1196,19 @@ def test_review_meeting_section_move():
|
||||
_drop_meetings([w1, w2])
|
||||
|
||||
|
||||
def _clear_quick(*weeks) -> None:
|
||||
"""작업 등록 표 테스트 주차 비우기(로컬 테스트 DB — 앞선 실패한 실행의 줄이 남지 않게)."""
|
||||
with ST._pool.connection() as conn: # noqa: SLF001
|
||||
conn.execute("DELETE FROM goal_meeting_tasks WHERE week_start = ANY(%s)", (list(weeks),))
|
||||
|
||||
|
||||
def test_review_meeting_quick_tasks_shared():
|
||||
"""작업 등록 표(025) — 주차별 한 표를 모두가 같이 본다. 남의 프로젝트 이름은 가리고, [적용]은 동시에 눌러도 작업 하나."""
|
||||
from app.modules.project import store
|
||||
|
||||
w = store.month_weeks(2031, 12)[1][0]
|
||||
other = store.month_weeks(2031, 12)[2][0]
|
||||
_clear_quick(w, other)
|
||||
p = _project("P-quick", ADMIN, (BOB,))
|
||||
s = _stage(p["id"], by=ADMIN)
|
||||
done = _stage(p["id"], name="완료", done=True, by=ADMIN)
|
||||
@@ -1229,9 +1236,10 @@ def test_review_meeting_quick_tasks_shared():
|
||||
assert t["stage_id"] == s["id"] and t["assignee_email"] == BOB
|
||||
# 등록된 줄은 더 못 고침(409), 다시 [적용]해도 그대로
|
||||
assert req("PUT", f"/project/api/goals/meeting-quick-tasks/{row['id']}", BOB, json={"title": "x"}).status_code == 409
|
||||
# 세부 작업 줄 — 위 줄의 작업 밑에 만든다(섹션 없음)
|
||||
r = req("POST", url, BOB, json={"title": "세부 하나", "project_id": p["id"], "parent_id": row["id"]})
|
||||
# 작업 칸 — 방금 만든 작업을 고르면 그 작업의 세부 작업으로(섹션 없음)
|
||||
r = req("POST", url, BOB, json={"title": "세부 하나", "project_id": p["id"], "parent_task_id": tid})
|
||||
sub = r.json()["task"]
|
||||
assert sub["parent_task_id"] == tid and sub["parent_task_title"] == "상세페이지 수정2"
|
||||
r = req("POST", f"/project/api/goals/meeting-quick-tasks/{sub['id']}/apply", BOB)
|
||||
assert r.status_code == 201, r.text
|
||||
st_ = ST.get_task(task_id=r.json()["task"]["task_id"])
|
||||
@@ -1246,39 +1254,35 @@ def test_review_meeting_quick_tasks_shared():
|
||||
finally:
|
||||
_drop_meetings([w])
|
||||
assert req("DELETE", f"/project/api/goals/meeting-quick-tasks/{row['id']}", BOB).status_code == 200
|
||||
assert req("GET", url, BOB).json()["tasks"] == [] # 세부 작업 줄도 함께
|
||||
assert req("DELETE", f"/project/api/goals/meeting-quick-tasks/{sub['id']}", BOB).status_code == 200
|
||||
assert req("GET", url, BOB).json()["tasks"] == []
|
||||
_ = done
|
||||
|
||||
|
||||
def test_review_meeting_quick_subtask_rows():
|
||||
"""세부 작업 줄 — 한 단계만, Tab(위 줄 밑으로)·Shift+Tab, [적용]은 위 줄 작업 밑에(위 줄 프로젝트)."""
|
||||
def test_review_meeting_quick_parent_task_column():
|
||||
"""작업 칸(026) — 그 프로젝트의 작업만, 프로젝트를 바꾸면 비움, 고른 작업이 사라지면 [적용] 400."""
|
||||
from app.modules.project import store
|
||||
|
||||
w = store.month_weeks(2032, 1)[1][0]
|
||||
p = _project("P-quick-sub", ADMIN, (BOB,))
|
||||
_clear_quick(w)
|
||||
p = _project("P-quick-pt", ADMIN, (BOB,))
|
||||
q = _project("P-quick-pt2", ADMIN, (BOB,))
|
||||
s = _stage(p["id"], by=ADMIN)
|
||||
base = ST.create_task(project_id=p["id"], title="기존 작업", stage_id=s["id"], created_by=ADMIN)
|
||||
other = ST.create_task(project_id=q["id"], title="다른 프로젝트 작업", created_by=ADMIN)
|
||||
url = f"/project/api/goals/meetings/{w}/quick-tasks"
|
||||
put = lambda i, body: req("PUT", f"/project/api/goals/meeting-quick-tasks/{i}", BOB, json=body)
|
||||
top = req("POST", url, BOB, json={"title": "부모", "project_id": p["id"], "stage_id": s["id"]}).json()["task"]
|
||||
sub = req("POST", url, BOB, json={"title": "자식", "parent_id": top["id"]}).json()["task"]
|
||||
other = req("POST", url, BOB, json={"title": "다른 줄"}).json()["task"]
|
||||
assert req("POST", url, BOB, json={"title": "손자", "parent_id": sub["id"]}).status_code == 400 # 한 단계만
|
||||
assert put(other["id"], {"parent_id": sub["id"]}).status_code == 400 # 세부 작업 줄 밑 X
|
||||
assert put(top["id"], {"parent_id": other["id"]}).status_code == 400 # 자식 딸린 줄은 세부 작업 X
|
||||
assert put(other["id"], {"parent_id": other["id"]}).status_code == 400
|
||||
assert put(other["id"], {"parent_id": top["id"]}).json()["task"]["parent_id"] == top["id"] # Tab
|
||||
assert put(other["id"], {"parent_id": None}).json()["task"]["parent_id"] is None # Shift+Tab
|
||||
# 위 줄 전에는 세부 작업 [적용] 불가 → 위 줄 [적용] 뒤 세부 작업은 위 줄 작업 밑(섹션 없음)
|
||||
assert req("POST", f"/project/api/goals/meeting-quick-tasks/{sub['id']}/apply", BOB).status_code == 400
|
||||
r = req("POST", f"/project/api/goals/meeting-quick-tasks/{top['id']}/apply", BOB)
|
||||
parent_task = r.json()["task"]["task_id"]
|
||||
r = req("POST", f"/project/api/goals/meeting-quick-tasks/{sub['id']}/apply", BOB)
|
||||
assert r.status_code == 201, r.text
|
||||
t = ST.get_task(task_id=r.json()["task"]["task_id"])
|
||||
assert (t["parent_task_id"], t["project_id"], t["stage_id"]) == (parent_task, p["id"], None)
|
||||
for row in (top, other):
|
||||
req("DELETE", f"/project/api/goals/meeting-quick-tasks/{row['id']}", BOB)
|
||||
assert req("GET", url, BOB).json()["tasks"] == []
|
||||
assert req("POST", url, BOB, json={"title": "x", "project_id": p["id"], "parent_task_id": other["id"]}).status_code == 400
|
||||
row = req("POST", url, BOB, json={"title": "세부", "project_id": p["id"], "parent_task_id": base["id"]}).json()["task"]
|
||||
assert row["parent_task_id"] == base["id"]
|
||||
moved = put(row["id"], {"project_id": q["id"]}).json()["task"]
|
||||
assert moved["parent_task_id"] is None and moved["stage_id"] is None # 프로젝트가 바뀌면 작업·섹션을 비움
|
||||
assert put(row["id"], {"project_id": p["id"], "parent_task_id": base["id"]}).json()["task"]["parent_task_id"] == base["id"]
|
||||
# 고른 작업이 지워지면 [적용]은 400(줄은 그대로)
|
||||
ST.delete_task(task_id=base["id"], deleted_by=ADMIN)
|
||||
assert req("POST", f"/project/api/goals/meeting-quick-tasks/{row['id']}/apply", BOB).status_code == 400
|
||||
assert req("GET", url, BOB).json()["tasks"][0]["task_id"] is None
|
||||
req("DELETE", f"/project/api/goals/meeting-quick-tasks/{row['id']}", BOB)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user