feat(project): 세부 업무 협업자 등록·대시보드 프로젝트별·마감 지난 업무 알림
- 세부 업무를 만들 때 협업자도 같이(업무 창 추가 칸·보드 카드 새 줄) — POST tasks 의 followers, 비멤버면 400 - 보드 카드 세부 업무 줄에도 협업자 아이콘, 업무 창 줄의 빈 협업자 아이콘은 늘 보이게 - 협업자 메뉴는 고를 때마다 다시 열려 여러 명을 이어서 지정(openFollowerMenu 공용) - 대시보드 "업무 합계(프로젝트별)" 카드 — 완료 상태별 카드 왼쪽, 프로젝트별 완료/전체·완료율 - 마감 지난 내 업무 위쪽 알림(ERP 모든 화면, erp-overdue.js, GET /project/api/my-overdue) — 닫으면 1시간 뒤 다시, 새로 지난 업무는 바로 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=20261013a" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013b" />
|
||||
<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=20261013a" defer></script>
|
||||
<script src="/static/project.js?v=20261013b" defer></script>
|
||||
<script src="/static/erp-notice-admin.js?v=20261012b" defer></script>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
@@ -1835,6 +1835,21 @@ class ProjectStore:
|
||||
).fetchall()
|
||||
return [dict(r) for r in rows]
|
||||
|
||||
def list_my_overdue(self, *, assignee_email: str, today: Any, limit: int = 200) -> list[dict[str, Any]]:
|
||||
"""내가 담당인 미완료 업무 중 마감일이 오늘 이전인 것(세부 업무 포함, 마감 오래된 것부터)."""
|
||||
with self._pool.connection() as conn:
|
||||
rows = conn.execute(
|
||||
"SELECT t.id, t.title, t.due_date, t.project_id, t.parent_task_id, "
|
||||
" p.name AS project_name, p.color AS project_color, pt.title AS parent_title "
|
||||
"FROM tasks t JOIN projects p ON p.id = t.project_id "
|
||||
"LEFT JOIN tasks pt ON pt.id = t.parent_task_id "
|
||||
"WHERE t.assignee_email = %s AND t.completed_at IS NULL "
|
||||
" AND t.due_date IS NOT NULL AND t.due_date < %s "
|
||||
"ORDER BY t.due_date ASC, t.id ASC LIMIT %s",
|
||||
(store.norm_str(assignee_email, lower=True), today, int(limit)),
|
||||
).fetchall()
|
||||
return [self._serialize(r) for r in rows]
|
||||
|
||||
def list_my_open_refs(self, *, assignee_email: str) -> list[dict[str, Any]]:
|
||||
"""내가 담당인 미완료 작업 전부의 (id, project_id) — "내 작업" 배지를 제한 없이 정확히 센다."""
|
||||
with self._pool.connection() as conn:
|
||||
|
||||
@@ -1448,6 +1448,18 @@ def api_my_tasks(request: Request) -> JSONResponse:
|
||||
return JSONResponse({"tasks": _my_visible_tasks(st, user)})
|
||||
|
||||
|
||||
@router.get("/api/my-overdue")
|
||||
def api_my_overdue(request: Request) -> JSONResponse:
|
||||
"""마감이 지난 내 미완료 업무(마감일이 오늘(한국시간) 이전) — ERP 모든 화면 위쪽 알림(static/erp-overdue.js)이 쓴다.
|
||||
지금 볼 수 있는 업무만, 마감이 오래된 것부터."""
|
||||
user = _require_user(request)
|
||||
st = _db_or_503(request)
|
||||
today = today_kst()
|
||||
rows = access.filter_visible_tasks(st, user, st.list_my_overdue(assignee_email=user["email"], today=today))
|
||||
keys = ("id", "title", "due_date", "project_id", "project_name", "project_color", "parent_task_id", "parent_title")
|
||||
return JSONResponse({"today": today.isoformat(), "tasks": [{k: t.get(k) for k in keys} for t in rows]})
|
||||
|
||||
|
||||
@router.get("/api/my-tasks/open-count")
|
||||
def api_my_open_count(request: Request) -> JSONResponse:
|
||||
"""사이드바 "내 업무" 배지 숫자만 — 목록 전체를 받지 않는다."""
|
||||
@@ -1480,6 +1492,7 @@ def _create_task_for(
|
||||
if project is None:
|
||||
raise HTTPException(status_code=404, detail="프로젝트를 찾을 수 없습니다.")
|
||||
_check_assignee(st, payload.get("assignee_email"), project_id)
|
||||
followers = _check_followers(st, payload.get("followers"), project_id)
|
||||
try:
|
||||
task = st.create_task(
|
||||
project_id=project_id,
|
||||
@@ -1501,8 +1514,8 @@ 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 ""])
|
||||
# 만든 사람·담당자는 자동 팔로워(아사나와 같은 규칙) + 만들 때 고른 협업자(세부 업무 추가 칸 등)
|
||||
_follow(st, task["id"], [user["email"], task.get("assignee_email") or ""] + followers)
|
||||
# 생성과 동시에 담당자 지정 시 관리자 메일 + 담당자 인앱 알림
|
||||
if task.get("assignee_email"):
|
||||
_notify(
|
||||
@@ -1541,6 +1554,19 @@ def _create_task_for(
|
||||
_ASSIGNEE_DENIED = "담당자는 이 프로젝트를 볼 수 있는 사람(멤버·소유자·관리자)이어야 합니다."
|
||||
|
||||
|
||||
def _check_followers(st: Any, raw: Any, project_id: int) -> list[str]:
|
||||
"""업무를 만들 때 같이 고른 협업자 — 협업자 추가 API 와 같은 기준(그 프로젝트를 볼 수 있는 사람만, 아니면 400)."""
|
||||
if not raw:
|
||||
return []
|
||||
if not isinstance(raw, list):
|
||||
raise HTTPException(status_code=400, detail="협업자 목록이 올바르지 않습니다.")
|
||||
emails = store.normalize_emails([str(e) for e in raw])
|
||||
for em in emails:
|
||||
if not access.can_assign(st, em, project_id):
|
||||
raise HTTPException(status_code=400, detail="이 프로젝트 멤버만 협업자로 추가할 수 있습니다.")
|
||||
return emails
|
||||
|
||||
|
||||
def _check_assignee(st: Any, email: Any, project_id: int, *, previous: str = "") -> None:
|
||||
"""새로 지정하는 담당자가 그 프로젝트를 볼 수 있는지 — 권한 없는 사람에게 배정 알림(작업 제목
|
||||
등)이 가지 않게. 비우거나 그대로 두는 건 검사하지 않는다(멤버에서 빠진 예전 담당자 보존)."""
|
||||
|
||||
@@ -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=20261013a" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013b" />
|
||||
<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=20261013a" defer></script>
|
||||
<script src="/static/project.js?v=20261013b" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013a" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013b" />
|
||||
<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=20261013a" defer></script>
|
||||
<script src="/static/project.js?v=20261013b" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013a" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013b" />
|
||||
<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=20261013a" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013b" />
|
||||
<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=20261013a" defer></script>
|
||||
<script src="/static/project.js?v=20261013b" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013a" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013b" />
|
||||
<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=20261013a" defer></script>
|
||||
<script src="/static/project.js?v=20261013b" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013a" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013b" />
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
{% endblock %}
|
||||
|
||||
@@ -108,5 +108,5 @@
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
<script src="/static/project.js?v=20261013a" defer></script>
|
||||
<script src="/static/project.js?v=20261013b" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013a" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013b" />
|
||||
<!-- 구글 머티리얼 심볼(담당자 아이콘 등) — self-host -->
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
<!-- 타임라인 vis-timeline — self-host -->
|
||||
@@ -365,6 +365,7 @@
|
||||
<div class="pj-subtask-form">
|
||||
<input type="text" id="pj-subtask-input" placeholder="세부 업무 제목…" autocomplete="off" />
|
||||
<select id="pj-subtask-add-assignee"><option value="">담당자 없음</option></select>
|
||||
<button type="button" class="pj-assignee-btn is-empty pj-subtask-add-fol" id="pj-subtask-add-followers" title="협업자 지정">협업자 없음</button>
|
||||
<input type="date" id="pj-subtask-add-due" />
|
||||
<button type="button" class="pj-btn pj-btn-primary" id="pj-subtask-add">추가</button>
|
||||
</div>
|
||||
@@ -468,5 +469,5 @@
|
||||
</script>
|
||||
|
||||
<script src="/static/vendor/vis-timeline/vis-timeline-graph2d.min.js"></script>
|
||||
<script src="/static/project.js?v=20261013a" defer></script>
|
||||
<script src="/static/project.js?v=20261013b" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013a" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013b" />
|
||||
<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=20261013a" defer></script>
|
||||
<script src="/static/project.js?v=20261013b" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
/* 마감 지난 내 업무 알림 — ERP 모든 화면 위쪽 가운데(erp-overdue.js). body 에 붙어 화면 배율(.erp-app zoom) 밖. 긴급 공지(6000)보다 아래. */
|
||||
.erp-overdue {
|
||||
position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 5500;
|
||||
width: min(560px, calc(100vw - 32px)); box-sizing: border-box;
|
||||
padding: 12px 14px 10px; border-radius: 12px; background: #fff; color: #1e1f21;
|
||||
border: 1px solid #f3c5c6; border-top: 4px solid #e5484d;
|
||||
box-shadow: 0 12px 36px rgba(16, 24, 40, .22);
|
||||
font-size: 13.5px; animation: erp-overdue-in .22s ease-out;
|
||||
}
|
||||
.erp-overdue[hidden] { display: none; }
|
||||
@keyframes erp-overdue-in { from { opacity: 0; transform: translate(-50%, -10px); } to { opacity: 1; transform: translate(-50%, 0); } }
|
||||
.erp-overdue-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
|
||||
.erp-overdue-head b { flex: 1 1 auto; font-size: 14.5px; color: #c62a2f; }
|
||||
.erp-overdue-ic { font-size: 17px; }
|
||||
.erp-overdue-close {
|
||||
flex: none; border: 1px solid #d8dce2; background: #fff; color: #4b5059; border-radius: 8px;
|
||||
padding: 4px 10px; font: inherit; font-size: 12px; cursor: pointer;
|
||||
}
|
||||
.erp-overdue-close:hover { background: #f3f4f6; }
|
||||
.erp-overdue-list { display: flex; flex-direction: column; max-height: 50vh; overflow-y: auto; }
|
||||
.erp-overdue-item {
|
||||
display: flex; align-items: center; gap: 10px; padding: 7px 6px; border-radius: 8px;
|
||||
color: inherit; text-decoration: none;
|
||||
}
|
||||
.erp-overdue-item:hover { background: #fdf2f2; }
|
||||
.erp-overdue-dot { flex: none; width: 9px; height: 9px; border-radius: 3px; }
|
||||
.erp-overdue-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
|
||||
.erp-overdue-text b, .erp-overdue-text small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.erp-overdue-text b { font-weight: 600; }
|
||||
.erp-overdue-text small { color: #6b7079; font-size: 11.5px; }
|
||||
.erp-overdue-late { flex: none; color: #c62a2f; font-size: 12px; font-weight: 700; white-space: nowrap; }
|
||||
.erp-overdue-more { padding: 6px; font-size: 12px; color: #3b6fd8; text-decoration: none; }
|
||||
.erp-overdue-more:hover { text-decoration: underline; }
|
||||
@@ -0,0 +1,106 @@
|
||||
// 마감 지난 내 업무 알림 — ERP 모든 화면 위쪽 가운데(2026-10-13).
|
||||
// · GET /project/api/my-overdue — 내가 담당인 미완료 업무 중 마감일이 오늘(한국시간) 이전인 것(지금 볼 수 있는 것만).
|
||||
// · [닫기] 하면 1시간 동안 다시 띄우지 않는다(이 브라우저의 모든 탭 — localStorage). 1시간이 지나면 다시 나타난다.
|
||||
// 단, 닫을 때 없던 업무가 새로 마감을 넘기면 1시간을 기다리지 않고 바로 띄운다.
|
||||
// · 5분마다·창을 다시 볼 때 확인. 다 완료하면 알림은 사라진다.
|
||||
// · Project 권한이 없거나(403) 로그아웃(401)·모듈 미설정(503)이면 조용히 멈춘다. iframe(수신함 업무 창 등) 안에서는 돌지 않는다.
|
||||
(function () {
|
||||
"use strict";
|
||||
if (window.top !== window) return;
|
||||
const POLL_MS = 5 * 60 * 1000;
|
||||
const SNOOZE_MS = 60 * 60 * 1000;
|
||||
const KEY = "erp_overdue_snooze"; // {until: ms, ids: [업무 id]}
|
||||
const MAX_ROWS = 5;
|
||||
let box = null, timer = 0, busy = false, stopped = false, last = [], memSnooze = null;
|
||||
|
||||
function esc(s) {
|
||||
return String(s == null ? "" : s).replace(/[&<>"']/g, function (c) {
|
||||
return { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" }[c];
|
||||
});
|
||||
}
|
||||
function readSnooze() {
|
||||
try { return JSON.parse(localStorage.getItem(KEY) || "null") || memSnooze; } catch (_) { return memSnooze; }
|
||||
}
|
||||
function writeSnooze(v) {
|
||||
memSnooze = v;
|
||||
try { localStorage.setItem(KEY, JSON.stringify(v)); } catch (_) {}
|
||||
}
|
||||
// 닫은 지 1시간이 안 됐고, 지금 목록이 닫을 때 본 업무뿐이면 쉰다.
|
||||
function snoozed(tasks) {
|
||||
const s = readSnooze();
|
||||
if (!s || !(Date.now() < s.until)) return false;
|
||||
const seen = s.ids || [];
|
||||
return tasks.every(function (t) { return seen.indexOf(t.id) >= 0; });
|
||||
}
|
||||
function daysLate(due, today) {
|
||||
const a = Date.parse(String(due).slice(0, 10) + "T00:00:00Z"), b = Date.parse(String(today).slice(0, 10) + "T00:00:00Z");
|
||||
return isNaN(a) || isNaN(b) ? 0 : Math.round((b - a) / 86400000);
|
||||
}
|
||||
function md(due) {
|
||||
const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(due || "");
|
||||
return m ? parseInt(m[2], 10) + "/" + parseInt(m[3], 10) : "";
|
||||
}
|
||||
function schedule() { clearTimeout(timer); if (!stopped) timer = setTimeout(poll, POLL_MS); }
|
||||
|
||||
async function poll() {
|
||||
if (busy || stopped) return;
|
||||
if (document.hidden) { schedule(); return; }
|
||||
busy = true;
|
||||
try {
|
||||
const res = await fetch("/project/api/my-overdue", { headers: { Accept: "application/json" }, credentials: "same-origin" });
|
||||
if (res.status === 401 || res.status === 403 || res.status === 404 || res.status === 503) { stopped = true; hide(); return; }
|
||||
if (!res.ok) return;
|
||||
const data = await res.json();
|
||||
last = Array.isArray(data.tasks) ? data.tasks : [];
|
||||
if (!last.length || snoozed(last)) hide();
|
||||
else show(last, data.today || "");
|
||||
} catch (_) {
|
||||
// 네트워크 오류는 다음 주기에 다시
|
||||
} finally {
|
||||
busy = false;
|
||||
schedule();
|
||||
}
|
||||
}
|
||||
|
||||
function show(tasks, today) {
|
||||
if (!box) {
|
||||
box = document.createElement("div");
|
||||
box.className = "erp-overdue";
|
||||
box.setAttribute("role", "alert");
|
||||
document.body.appendChild(box); // 화면 배율(.erp-app zoom) 밖 — 늘 화면 위쪽 가운데
|
||||
box.addEventListener("click", function (e) {
|
||||
if (e.target.closest("[data-overdue-close]")) dismiss();
|
||||
});
|
||||
}
|
||||
const rows = tasks.slice(0, MAX_ROWS).map(function (t) {
|
||||
const late = daysLate(t.due_date, today);
|
||||
const where = [t.project_name, t.parent_title ? "상위: " + t.parent_title : ""].filter(Boolean).join(" · ");
|
||||
return '<a class="erp-overdue-item" href="/project/t/' + encodeURIComponent(t.id) + '">' +
|
||||
'<span class="erp-overdue-dot" style="background:' + esc(t.project_color || "#e5484d") + '"></span>' +
|
||||
'<span class="erp-overdue-text"><b>' + esc(t.title || "(제목 없음)") + "</b><small>" + esc(where) + "</small></span>" +
|
||||
'<span class="erp-overdue-late">마감 ' + esc(md(t.due_date)) + (late > 0 ? " · " + late + "일 지남" : "") + "</span></a>";
|
||||
}).join("");
|
||||
const more = tasks.length > MAX_ROWS
|
||||
? '<a class="erp-overdue-more" href="/project/">그 밖에 ' + (tasks.length - MAX_ROWS) + "건 — 내 업무에서 보기</a>" : "";
|
||||
box.innerHTML =
|
||||
'<div class="erp-overdue-head"><span class="erp-overdue-ic" aria-hidden="true">⏰</span>' +
|
||||
'<b>마감이 지난 내 업무 ' + tasks.length + "건</b>" +
|
||||
'<button type="button" class="erp-overdue-close" data-overdue-close title="닫으면 1시간 뒤에 다시 알려 드립니다">닫기 (1시간 뒤 다시)</button></div>' +
|
||||
'<div class="erp-overdue-list">' + rows + more + "</div>";
|
||||
box.hidden = false;
|
||||
}
|
||||
function hide() { if (box) box.hidden = true; }
|
||||
function dismiss() {
|
||||
writeSnooze({ until: Date.now() + SNOOZE_MS, ids: last.map(function (t) { return t.id; }) });
|
||||
hide();
|
||||
// 1시간 뒤 바로 다시 확인(5분 주기를 기다리지 않게)
|
||||
setTimeout(poll, SNOOZE_MS + 1000);
|
||||
}
|
||||
|
||||
// 다른 탭에서 닫으면 이 탭도 닫는다.
|
||||
window.addEventListener("storage", function (e) { if (e.key === KEY && last.length && snoozed(last)) hide(); });
|
||||
document.addEventListener("visibilitychange", function () { if (!document.hidden) poll(); });
|
||||
if (window.__ERP_OVERDUE_TEST__) window.__erpOverdue = { poll: poll, state: function () { return { last: last, stopped: stopped, box: box }; } };
|
||||
if (document.readyState === "loading") document.addEventListener("DOMContentLoaded", poll);
|
||||
else poll();
|
||||
})();
|
||||
+41
-3
@@ -1275,6 +1275,18 @@ html.pj-ui-scale #pj-timeline { zoom: calc(1 / var(--pj-z)); --tz: var(--pj-z);
|
||||
.pj-card-sub:hover .pj-card-sub-av.is-empty { opacity: 1; }
|
||||
.pj-card-sub-av.is-empty:hover { color: #1e1f21; background: #eceef0; }
|
||||
.pj-card-sub-empty { padding: 8px 4px; font-size: 12px; color: #9aa1a9; }
|
||||
/* 카드 세부 업무 줄 협업자(담당자 오른쪽) — 없으면 줄에 마우스를 올릴 때만 점선 원 두 사람 */
|
||||
.pj-card-sub-fol {
|
||||
flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: 1px;
|
||||
min-width: 24px; height: 24px; padding: 0 2px; border-radius: 12px; cursor: pointer; color: #6d6e6f;
|
||||
}
|
||||
.pj-card-sub-fol img.pj-person-ic { width: 20px; height: 20px; border-radius: 50%; }
|
||||
.pj-card-sub-fol .pj-gicon { font-size: 20px; }
|
||||
.pj-card-sub-fol > svg { width: 20px; height: 20px; }
|
||||
.pj-card-sub-fol:not(.is-empty):hover { background: #eceef0; }
|
||||
.pj-card-sub-fol.is-empty { opacity: 0; transition: opacity .12s; }
|
||||
.pj-card-sub:hover .pj-card-sub-fol.is-empty { opacity: 1; }
|
||||
.pj-card-sub-fol.is-empty:hover { color: #1e1f21; background: #eceef0; }
|
||||
/* 카드 하위 작업 맨 아래 "+ 하위 작업 추가"와 새 줄 입력(아사나) */
|
||||
.pj-card-subnew {
|
||||
display: flex; align-items: center; gap: 6px; min-height: 36px; padding: 2px 4px;
|
||||
@@ -1287,9 +1299,10 @@ html.pj-ui-scale #pj-timeline { zoom: calc(1 / var(--pj-z)); --tz: var(--pj-z);
|
||||
padding: 4px 0; font-size: 13px; font-family: inherit; color: var(--pj-ink);
|
||||
}
|
||||
.pj-card-subnew-title::placeholder { color: #9aa1a9; }
|
||||
/* 새 줄의 마감일·담당자 아이콘은 늘 보인다(기존 줄은 마우스를 올릴 때만) */
|
||||
/* 새 줄의 마감일·담당자·협업자 아이콘은 늘 보인다(기존 줄은 마우스를 올릴 때만) */
|
||||
.pj-card-subnew .pj-card-sub-due.is-empty,
|
||||
.pj-card-subnew .pj-card-sub-av.is-empty { opacity: 1; }
|
||||
.pj-card-subnew .pj-card-sub-av.is-empty,
|
||||
.pj-card-subnew .pj-card-sub-fol.is-empty { opacity: 1; }
|
||||
.pj-card-subadd {
|
||||
display: inline-flex; align-items: center; gap: 4px; margin: 6px 0 2px; padding: 4px 6px;
|
||||
border: none; background: transparent; border-radius: 6px; cursor: pointer;
|
||||
@@ -1457,7 +1470,8 @@ label.pj-desc-fmtbtn {
|
||||
.pj-subtask-fol .pj-gicon { font-size: 22px; }
|
||||
.pj-subtask-fol-n { font-size: 11px; font-weight: 600; color: var(--pj-ink-soft); }
|
||||
.pj-subtask-fol:not(.is-empty):hover { background: #eceef0; }
|
||||
.pj-subtask-fol.is-empty { opacity: 0; transition: opacity .12s; }
|
||||
.pj-subtask-fol > svg { width: 22px; height: 22px; }
|
||||
.pj-subtask-fol.is-empty { opacity: .5; transition: opacity .12s; } /* 비어 있어도 늘 보인다(옅게) */
|
||||
.pj-subtask-row:hover .pj-subtask-fol.is-empty { opacity: 1; }
|
||||
.pj-subtask-fol.is-empty:hover { color: #1e1f21; background: #eceef0; }
|
||||
/* 하위 작업 열기(›) — 줄에 마우스를 올리면 진해진다 */
|
||||
@@ -1572,6 +1586,14 @@ img.pj-person-ic { width: 22px; height: 22px; }
|
||||
flex: 0 0 auto; width: 110px; font-size: 12px; font-weight: 500; padding: 3px 6px;
|
||||
border-color: #d8dce2; border-radius: 8px; background: #fff;
|
||||
}
|
||||
.pj-assignee-btn.pj-subtask-add-fol {
|
||||
flex: 0 0 auto; width: 110px; font-size: 12px; font-weight: 500; padding: 3px 6px;
|
||||
border-color: #d8dce2; border-radius: 8px; background: #fff;
|
||||
}
|
||||
.pj-assignee-btn.pj-subtask-add-fol img.pj-person-ic { width: 18px; height: 18px; }
|
||||
.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; }
|
||||
.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,
|
||||
@@ -1594,6 +1616,21 @@ img.pj-person-ic { width: 22px; height: 22px; }
|
||||
box-shadow: var(--pj-card-shadow); padding: 18px 20px 20px; min-width: 0;
|
||||
}
|
||||
.pj-dash-card-wide { grid-column: 1 / -1; }
|
||||
/* 업무 합계(프로젝트별) — 가로 막대 줄(채움 = 완료율) */
|
||||
.pj-dash-projbars { display: flex; flex-direction: column; gap: 4px; max-height: 210px; overflow-y: auto; margin: 0 -6px; }
|
||||
.pj-dash-projrow {
|
||||
display: grid; grid-template-columns: 10px minmax(0, 1fr) minmax(70px, 1.2fr) auto; align-items: center; gap: 8px;
|
||||
padding: 6px; border-radius: 8px; color: var(--pj-ink); text-decoration: none; font-size: 12.5px;
|
||||
}
|
||||
.pj-dash-projrow:hover { background: #f5f6f8; }
|
||||
.pj-dash-projdot { width: 10px; height: 10px; border-radius: 3px; }
|
||||
.pj-dash-projname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
|
||||
.pj-dash-projtrack { position: relative; height: 10px; border-radius: 5px; background: #e6e3f7; overflow: hidden; }
|
||||
.pj-dash-projtrack i {
|
||||
position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 5px;
|
||||
background: var(--color-success-green, #2e9e5b); transition: width .6s cubic-bezier(.22,.9,.3,1);
|
||||
}
|
||||
.pj-dash-projval { color: var(--pj-ink-soft); font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 12px; }
|
||||
/* 담당자별 작업 합계 — 사람마다 메인·하위 세로 막대. 막대 = 그 작업 전체(100%), 초록 채움 = 완료율. 누르면 오른쪽 업무 목록 패널 */
|
||||
.pj-wl-legend { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: -6px 0 14px; font-size: 12px; color: var(--pj-ink-soft); }
|
||||
.pj-wl-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
|
||||
@@ -1709,6 +1746,7 @@ img.pj-person-ic { width: 22px; height: 22px; }
|
||||
.pj-dash-stats .pj-dash-stat:nth-child(4) { animation-delay: .12s; }
|
||||
.pj-dash-charts .pj-dash-card:nth-child(2) { animation-delay: .06s; }
|
||||
.pj-dash-charts .pj-dash-card:nth-child(3) { animation-delay: .12s; }
|
||||
.pj-dash-charts .pj-dash-card:nth-child(4) { animation-delay: .18s; }
|
||||
@keyframes pj-dash-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
|
||||
@media (max-width: 900px) { .pj-dash-stats { grid-template-columns: repeat(2, 1fr); } }
|
||||
|
||||
|
||||
+183
-30
@@ -968,6 +968,47 @@
|
||||
});
|
||||
return items;
|
||||
}
|
||||
// 협업자 고르기 메뉴 — 후보 멤버(지금 협업자는 ✓). 고르면 onToggle(email, 켜기?) 를 기다린 뒤 같은 자리에 메뉴를
|
||||
// 다시 열어 여러 명을 이어서 고른다(Esc·바깥 클릭으로 닫힘). current() = 지금 협업자 목록.
|
||||
function openFollowerMenu(anchor, emails, current, onToggle) {
|
||||
const lower = function (x) { return String(x || "").toLowerCase(); };
|
||||
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); });
|
||||
if (!cands.length) { showToast("지정할 수 있는 멤버가 없습니다."); return; }
|
||||
const r = anchor.getBoundingClientRect();
|
||||
showContextMenu(r.left, r.bottom + 4, cands.map(function (em) {
|
||||
const on = cur.indexOf(em) >= 0;
|
||||
return {
|
||||
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);
|
||||
},
|
||||
};
|
||||
}), { label: "협업자 지정" });
|
||||
}
|
||||
// 협업자 아이콘 — 없으면 점선 원 두 사람, 있으면 첫 사람 아이콘 + "+N".
|
||||
function followerIconHtml(list) {
|
||||
list = list || [];
|
||||
return list.length
|
||||
? personIconHtml(list[0]) + (list.length > 1 ? '<span class="pj-subtask-fol-n">+' + (list.length - 1) + "</span>" : "")
|
||||
: FOLLOWER_EMPTY_ICON_SVG;
|
||||
}
|
||||
// 세부 업무 협업자 넣기/빼기 → 그 업무의 협업자 목록.
|
||||
async function setTaskFollower(taskId, email, on) {
|
||||
const res = on
|
||||
? await api("POST", "/project/api/tasks/" + taskId + "/followers", { email: email })
|
||||
: await api("DELETE", "/project/api/tasks/" + taskId + "/followers/" + encodeURIComponent(email));
|
||||
return res.followers || [];
|
||||
}
|
||||
function pageMeEmail() {
|
||||
const w = document.querySelector(".pj-wrap");
|
||||
return ((w && w.dataset.me) || "").toLowerCase();
|
||||
}
|
||||
function followerTip(list) {
|
||||
return list && list.length ? "협업자: " + list.map(idOf).join(", ") : "협업자 지정";
|
||||
}
|
||||
// <select> 담당자 칸을 "아이콘 + 이름" 버튼으로 바꿔 보여준다. select 는 숨겨
|
||||
// 값 저장소로 그대로 둔다 — 기존 코드의 sel.value 읽기/쓰기, change 이벤트,
|
||||
// selectedOptions 가 그대로 동작. 코드가 sel.value 를 바꾸거나 옵션을 다시
|
||||
@@ -5039,6 +5080,11 @@
|
||||
? '<span class="pj-card-sub-av" data-tip="' + escapeHtml(idOf(sub.assignee_email)) + '">' +
|
||||
avatarHtml(sub.assignee_email, "pj-gicon-sm") + "</span>"
|
||||
: '<span class="pj-card-sub-av is-empty" data-tip="이 업무 배정">' + ASSIGN_EMPTY_ICON_SVG + "</span>") +
|
||||
// 협업자 — 담당자 오른쪽(편집 권한자, 서버가 followers 를 준 경우만). 누르면 멤버 메뉴.
|
||||
(canManage && Array.isArray(sub.followers)
|
||||
? '<span class="pj-card-sub-fol' + (sub.followers.length ? "" : " is-empty") + '" data-tip="' +
|
||||
escapeHtml(followerTip(sub.followers)) + '">' + followerIconHtml(sub.followers) + "</span>"
|
||||
: "") +
|
||||
"</div>";
|
||||
}
|
||||
// 담당자 미지정 아이콘(아사나 모양: 점선 원 안의 사람).
|
||||
@@ -5213,6 +5259,24 @@
|
||||
const r = av.getBoundingClientRect();
|
||||
openSubAssigneePicker(t, sub, box, r.left, r.bottom + 4);
|
||||
});
|
||||
const fol = row.querySelector(".pj-card-sub-fol");
|
||||
if (fol) fol.addEventListener("click", async function (e) {
|
||||
e.stopPropagation();
|
||||
let list;
|
||||
try { list = await membersOfProject(t.project_id); }
|
||||
catch (err) { showToast("멤버 조회 실패: " + err.message, "error"); return; }
|
||||
openFollowerMenu(fol, list.map(function (m) { return m.user_email; }), function () { return sub.followers; },
|
||||
async function (em, on) {
|
||||
try {
|
||||
sub.followers = await setTaskFollower(sub.id, em, on);
|
||||
// 메뉴가 같은 아이콘에 다시 붙도록 목록을 다시 그리지 않고 이 아이콘만 바꾼다.
|
||||
fol.classList.toggle("is-empty", !sub.followers.length);
|
||||
fol.innerHTML = followerIconHtml(sub.followers);
|
||||
fol.dataset.tip = followerTip(sub.followers);
|
||||
return true;
|
||||
} catch (err) { showToast("협업자 변경 실패: " + err.message, "error"); return false; }
|
||||
});
|
||||
});
|
||||
const check = row.querySelector(".pj-card-sub-check");
|
||||
check.addEventListener("click", async function (e) {
|
||||
e.stopPropagation();
|
||||
@@ -5249,6 +5313,7 @@
|
||||
'<input type="text" class="pj-card-subnew-title" placeholder="업무 이름 입력" autocomplete="off" />' +
|
||||
'<span class="pj-card-sub-due pj-card-subnew-due"></span>' +
|
||||
'<span class="pj-card-sub-av pj-card-subnew-av"></span>' +
|
||||
'<span class="pj-card-sub-fol pj-card-subnew-fol"></span>' +
|
||||
"</div>";
|
||||
}
|
||||
wrap.insertAdjacentHTML("beforeend",
|
||||
@@ -5260,7 +5325,7 @@
|
||||
wrap.addEventListener("click", function (e) { e.stopPropagation(); });
|
||||
wrap.addEventListener("mousedown", function () { if (card) card.draggable = false; });
|
||||
wrap.querySelector(".pj-card-subadd").addEventListener("click", function () {
|
||||
if (!subDrafts[t.id]) subDrafts[t.id] = { title: "", due: null, assignee: "", focused: true };
|
||||
if (!subDrafts[t.id]) subDrafts[t.id] = { title: "", due: null, assignee: "", followers: [], focused: true };
|
||||
else subDrafts[t.id].focused = true;
|
||||
refillSubs(box, t);
|
||||
});
|
||||
@@ -5269,6 +5334,8 @@
|
||||
const inp = wrap.querySelector(".pj-card-subnew-title");
|
||||
const dueEl = wrap.querySelector(".pj-card-subnew-due");
|
||||
const avEl = wrap.querySelector(".pj-card-subnew-av");
|
||||
const folEl = wrap.querySelector(".pj-card-subnew-fol");
|
||||
if (!draft.followers) draft.followers = [];
|
||||
inp.value = draft.title;
|
||||
function paintDue() {
|
||||
const di = dueInfo(draft.due, false);
|
||||
@@ -5281,7 +5348,12 @@
|
||||
avEl.innerHTML = draft.assignee ? avatarHtml(draft.assignee, "pj-gicon-sm") : ASSIGN_EMPTY_ICON_SVG;
|
||||
avEl.dataset.tip = draft.assignee ? idOf(draft.assignee) : "담당자 지정";
|
||||
}
|
||||
paintDue(); paintAv();
|
||||
function paintFol() {
|
||||
folEl.className = "pj-card-sub-fol pj-card-subnew-fol" + (draft.followers.length ? "" : " is-empty");
|
||||
folEl.innerHTML = followerIconHtml(draft.followers);
|
||||
folEl.dataset.tip = followerTip(draft.followers);
|
||||
}
|
||||
paintDue(); paintAv(); paintFol();
|
||||
function refocus() { if (inp.isConnected) inp.focus(); }
|
||||
inp.addEventListener("input", function () { draft.title = inp.value; });
|
||||
inp.addEventListener("focus", function () { draft.focused = true; if (card) card.draggable = false; });
|
||||
@@ -5293,7 +5365,7 @@
|
||||
draft.focused = document.activeElement === inp;
|
||||
// 날짜 팝업·담당자 메뉴를 쓰는 중이면 닫지 않는다.
|
||||
if (draft.focused || datePopEl || ctxMenuEl) return;
|
||||
if (!draft.title.trim() && !draft.due && !draft.assignee) closeDraft();
|
||||
if (!draft.title.trim() && !draft.due && !draft.assignee && !draft.followers.length) closeDraft();
|
||||
}, 150);
|
||||
});
|
||||
inp.addEventListener("keydown", function (e) {
|
||||
@@ -5324,7 +5396,7 @@
|
||||
if (subDrafts[t.id] !== draft) return;
|
||||
if (inp.isConnected) draft.title = inp.value;
|
||||
if (draft.title.trim()) createFromDraft(false);
|
||||
else if (!draft.due && !draft.assignee) closeDraft();
|
||||
else if (!draft.due && !draft.assignee && !draft.followers.length) closeDraft();
|
||||
}, 0);
|
||||
}
|
||||
if (subOutsideDown[t.id]) document.removeEventListener("pointerdown", subOutsideDown[t.id], true);
|
||||
@@ -5340,6 +5412,18 @@
|
||||
function (email) { draft.assignee = email || ""; paintAv(); refocus(); }
|
||||
));
|
||||
});
|
||||
// 협업자 — 고른 사람은 만들 때 followers 로 같이 보낸다(메뉴는 고를 때마다 다시 열려 여러 명).
|
||||
folEl.addEventListener("click", async function () {
|
||||
let list;
|
||||
try { list = await membersOfProject(t.project_id); }
|
||||
catch (e) { showToast("멤버 조회 실패: " + e.message, "error"); return; }
|
||||
openFollowerMenu(folEl, list.map(function (m) { return m.user_email; }), function () { return draft.followers; },
|
||||
function (em, on) {
|
||||
draft.followers = on ? draft.followers.concat([em]) : draft.followers.filter(function (x) { return x !== em; });
|
||||
paintFol();
|
||||
return true;
|
||||
});
|
||||
});
|
||||
function closeDraft() {
|
||||
delete subDrafts[t.id];
|
||||
if (box.isConnected) refillSubs(box, t);
|
||||
@@ -5356,14 +5440,23 @@
|
||||
due_date: draft.due || null,
|
||||
assignee_email: draft.assignee || "",
|
||||
assignee_name: draft.assignee ? idOf(draft.assignee) : "",
|
||||
followers: draft.followers,
|
||||
});
|
||||
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;
|
||||
}
|
||||
subs.push(res.task);
|
||||
adjustSubCounts(t.id, 1, 0);
|
||||
// Enter — 다음 세부 작업을 이어서 입력(아사나): 이름만 비우고 줄은 열어 둔다.
|
||||
// 바깥 누름 — 줄을 닫는다.
|
||||
if (keepOpen === false) delete subDrafts[t.id];
|
||||
else subDrafts[t.id] = { title: "", due: null, assignee: "", focused: true };
|
||||
else subDrafts[t.id] = { title: "", due: null, assignee: "", followers: [], focused: true };
|
||||
renderBoard(); // 카드의 "N ⤷" 숫자까지 맞춘다
|
||||
} catch (e) {
|
||||
showToast("세부 업무 추가 실패: " + e.message, "error");
|
||||
@@ -5436,7 +5529,7 @@
|
||||
tog.classList.add("is-open");
|
||||
// 세부 작업이 없는 카드 — 펼치면 곧바로 이름 입력 줄(아사나의 "세부 작업 추가")
|
||||
if (!t.subtask_total && canManage && !subDrafts[t.id]) {
|
||||
subDrafts[t.id] = { title: "", due: null, assignee: "", focused: true };
|
||||
subDrafts[t.id] = { title: "", due: null, assignee: "", followers: [], focused: true };
|
||||
}
|
||||
loadCardSubs(t).then(function (changed) { // 펼칠 때마다 최신으로
|
||||
if (changed) { renderBoard(); return; }
|
||||
@@ -5820,6 +5913,39 @@
|
||||
animateCount(valEl, value, 700);
|
||||
return tile;
|
||||
}
|
||||
// 프로젝트별 완료 막대 — 줄마다 색 점·프로젝트 이름(누르면 그 프로젝트)·막대(채움 = 완료율)·완료/전체(%).
|
||||
// 업무 수가 많은 프로젝트부터. 넘치면 카드 안에서 세로 스크롤.
|
||||
function dashProjectBars(list) {
|
||||
const by = {};
|
||||
list.forEach(function (t) {
|
||||
const k = String(t.project_id);
|
||||
const p = by[k] || (by[k] = { id: t.project_id, name: t.project_name || "프로젝트", color: t.project_color || "", done: 0, total: 0 });
|
||||
p.total++;
|
||||
if (t.completed_at) p.done++;
|
||||
});
|
||||
const rows = Object.keys(by).map(function (k) { return by[k]; })
|
||||
.sort(function (a, b) { return b.total - a.total || String(a.name).localeCompare(String(b.name), "ko"); });
|
||||
const wrap = document.createElement("div");
|
||||
wrap.className = "pj-dash-projbars";
|
||||
if (!rows.length) { wrap.innerHTML = "<div class='pj-empty-sm'>데이터가 없습니다.</div>"; return wrap; }
|
||||
rows.forEach(function (p) {
|
||||
const pct = p.total ? Math.round(p.done / p.total * 100) : 0;
|
||||
const row = document.createElement("a");
|
||||
row.className = "pj-dash-projrow";
|
||||
row.href = "/project/p/" + encodeURIComponent(p.id);
|
||||
row.title = p.name + " — 완료 " + p.done + " / " + p.total + " (" + pct + "%)";
|
||||
row.innerHTML = '<span class="pj-dash-projdot"></span><span class="pj-dash-projname"></span>' +
|
||||
'<span class="pj-dash-projtrack"><i></i></span><span class="pj-dash-projval"></span>';
|
||||
row.querySelector(".pj-dash-projdot").style.background = p.color || "var(--pj-accent)";
|
||||
row.querySelector(".pj-dash-projname").textContent = p.name;
|
||||
row.querySelector(".pj-dash-projval").textContent = p.done + "/" + p.total + " · " + pct + "%";
|
||||
const fill = row.querySelector(".pj-dash-projtrack i");
|
||||
fill.dataset.pct = String(pct);
|
||||
requestAnimationFrame(function () { requestAnimationFrame(function () { fill.style.width = pct + "%"; }); });
|
||||
wrap.appendChild(row);
|
||||
});
|
||||
return wrap;
|
||||
}
|
||||
// 세로 막대 그래프 — 섹션별/담당자별 공용. data = [{label, value}].
|
||||
function dashBarChart(data) {
|
||||
const wrap = document.createElement("div");
|
||||
@@ -5955,6 +6081,13 @@
|
||||
sectionCard.appendChild(dashBarChart(sectionData));
|
||||
charts.appendChild(sectionCard);
|
||||
|
||||
// 프로젝트별(2026-10-13) — 업무가 속한 프로젝트마다 완료/전체·완료율 막대. 완료 상태별 카드 바로 왼쪽.
|
||||
const projectCard = document.createElement("div");
|
||||
projectCard.className = "pj-dash-card";
|
||||
projectCard.innerHTML = '<div class="pj-dash-card-title">업무 합계(프로젝트별)</div>';
|
||||
projectCard.appendChild(dashProjectBars(vis));
|
||||
charts.appendChild(projectCard);
|
||||
|
||||
// 완료 상태별 — 2구간 도넛(완료=초록, 미완료=포인트 컬러).
|
||||
const statusCard = document.createElement("div");
|
||||
statusCard.className = "pj-dash-card";
|
||||
@@ -8116,6 +8249,30 @@
|
||||
const input = el("pj-subtask-input");
|
||||
const addAssignee = el("pj-subtask-add-assignee");
|
||||
enhanceAssigneeSelect(addAssignee);
|
||||
// 추가 칸 협업자(담당자 오른쪽) — 고른 사람은 [추가] 때 followers 로 같이 보낸다.
|
||||
const addFolBtn = el("pj-subtask-add-followers");
|
||||
let addFollowers = [];
|
||||
function paintAddFol() {
|
||||
if (!addFolBtn) return;
|
||||
addFolBtn.classList.toggle("is-empty", !addFollowers.length);
|
||||
addFolBtn.innerHTML = (addFollowers.length ? followerIconHtml(addFollowers) : personIconHtml("")) +
|
||||
'<span class="pj-assignee-btn-name"></span>';
|
||||
addFolBtn.querySelector(".pj-assignee-btn-name").textContent =
|
||||
addFollowers.length ? "협업자 " + addFollowers.length + "명" : "협업자 없음";
|
||||
addFolBtn.title = followerTip(addFollowers);
|
||||
}
|
||||
paintAddFol();
|
||||
if (addFolBtn) addFolBtn.addEventListener("click", async function () {
|
||||
if (!projectId || readOnly) return;
|
||||
const seq = ctxSeq;
|
||||
const emails = await memberEmails(projectId);
|
||||
if (seq !== ctxSeq) return;
|
||||
openFollowerMenu(addFolBtn, emails, function () { return addFollowers; }, function (em, on) {
|
||||
addFollowers = on ? addFollowers.concat([em]) : addFollowers.filter(function (x) { return x !== em; });
|
||||
paintAddFol();
|
||||
return true;
|
||||
});
|
||||
});
|
||||
const addDue = el("pj-subtask-add-due");
|
||||
enhanceDateInput(addDue, { placeholder: "마감일" }); // 아사나식 날짜 팝업
|
||||
const addBtn = el("pj-subtask-add");
|
||||
@@ -8207,10 +8364,8 @@
|
||||
const f = sub.followers;
|
||||
folEl.hidden = false;
|
||||
folEl.className = "pj-subtask-fol" + (f.length ? "" : " is-empty");
|
||||
folEl.innerHTML = f.length
|
||||
? personIconHtml(f[0]) + (f.length > 1 ? '<span class="pj-subtask-fol-n">+' + (f.length - 1) + "</span>" : "")
|
||||
: FOLLOWER_EMPTY_ICON_SVG;
|
||||
folEl.title = f.length ? "협업자: " + f.map(idOf).join(", ") : "협업자 지정";
|
||||
folEl.innerHTML = followerIconHtml(f);
|
||||
folEl.title = followerTip(f);
|
||||
}
|
||||
renderCheck(); renderDue(); renderAv(); renderFol();
|
||||
|
||||
@@ -8267,26 +8422,13 @@
|
||||
// 협업자 — 누르면 멤버 목록(협업자는 ✓). 고르면 넣고/빼고, 메뉴를 다시 열어 여러 명 지정.
|
||||
folEl.addEventListener("click", function (e) {
|
||||
e.stopPropagation();
|
||||
const r = folEl.getBoundingClientRect();
|
||||
const cur = (sub.followers || []).map(function (x) { return String(x).toLowerCase(); });
|
||||
const cands = emails.slice();
|
||||
cur.forEach(function (x) { if (cands.map(function (c) { return String(c).toLowerCase(); }).indexOf(x) < 0) cands.push(x); });
|
||||
if (!cands.length) { showToast("지정할 수 있는 멤버가 없습니다."); return; }
|
||||
showContextMenu(r.left, r.bottom + 4, cands.map(function (em) {
|
||||
const on = cur.indexOf(String(em).toLowerCase()) >= 0;
|
||||
return {
|
||||
label: idOf(em), icon: personIconHtml(em), checked: on,
|
||||
onClick: async function () {
|
||||
try {
|
||||
const res = on
|
||||
? await api("DELETE", "/project/api/tasks/" + sub.id + "/followers/" + encodeURIComponent(em))
|
||||
: await api("POST", "/project/api/tasks/" + sub.id + "/followers", { email: em });
|
||||
sub.followers = res.followers || [];
|
||||
renderFol();
|
||||
} catch (err) { showToast("협업자 변경 실패: " + err.message, "error"); }
|
||||
},
|
||||
};
|
||||
}), { label: "협업자 지정" });
|
||||
openFollowerMenu(folEl, emails, function () { return sub.followers; }, async function (em, on) {
|
||||
try {
|
||||
sub.followers = (await setTaskFollower(sub.id, em, on)) || [];
|
||||
renderFol();
|
||||
return true;
|
||||
} catch (err) { showToast("협업자 변경 실패: " + err.message, "error"); return false; }
|
||||
});
|
||||
});
|
||||
function open() { if (onOpen) onOpen(sub); }
|
||||
li.querySelector(".pj-subtask-open").addEventListener("click", function (e) { e.stopPropagation(); open(); });
|
||||
@@ -8405,11 +8547,21 @@
|
||||
assignee_email: addAssignee ? addAssignee.value : "",
|
||||
assignee_name: assigneeOpt ? assigneeOpt.textContent : "",
|
||||
due_date: addDue ? (addDue.value || null) : null,
|
||||
followers: addFollowers,
|
||||
});
|
||||
if (seq !== ctxSeq) return; // 다른 작업 창으로 바뀌었다 — 그 창의 목록·입력칸은 건드리지 않는다
|
||||
input.value = "";
|
||||
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;
|
||||
}
|
||||
addFollowers = []; paintAddFol();
|
||||
const emails = await memberEmails(pid);
|
||||
if (seq !== ctxSeq) return;
|
||||
const empty = listEl.querySelector(".pj-empty-sm");
|
||||
@@ -8437,6 +8589,7 @@
|
||||
if (input) input.value = "";
|
||||
if (addAssignee) addAssignee.value = "";
|
||||
if (addDue) addDue.value = "";
|
||||
addFollowers = []; paintAddFol();
|
||||
},
|
||||
setContext: function (opts) {
|
||||
const seq = ++ctxSeq;
|
||||
|
||||
@@ -343,5 +343,7 @@
|
||||
{# 긴급 공지 — erp_base 를 쓰지 않는 화면도 같이(app/modules/notice) #}
|
||||
<link rel="stylesheet" href="/static/erp-notice.css?v=20261012c" />
|
||||
<script src="/static/erp-notice.js?v=20261012a" defer></script>
|
||||
<link rel="stylesheet" href="/static/erp-overdue.css?v=20261013a" />
|
||||
<script src="/static/erp-overdue.js?v=20261013a" defer></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
<link rel="stylesheet" href="/static/erp-attach-viewer.css" />
|
||||
<link rel="stylesheet" href="/static/erp-dialog.css?v=20260930a" />
|
||||
<link rel="stylesheet" href="/static/erp-notice.css?v=20261012c" />
|
||||
<link rel="stylesheet" href="/static/erp-overdue.css?v=20261013a" />
|
||||
{% block head_extra %}{% endblock %}
|
||||
</head>
|
||||
<body class="erp-body erp-app-body">
|
||||
@@ -192,6 +193,8 @@
|
||||
<script src="/static/erp-attach-viewer.js" defer></script>
|
||||
{# 긴급 공지 — 로그인한 모든 화면 가운데(받는 사람이 [확인] 전까지). app/modules/notice #}
|
||||
{% if user %}<script src="/static/erp-notice.js?v=20261012a" defer></script>{% endif %}
|
||||
{# 마감 지난 내 업무 — 로그인한 모든 화면 위쪽(닫으면 1시간 뒤 다시). Project 권한이 없으면 조용히 멈춘다. #}
|
||||
{% if user %}<script src="/static/erp-overdue.js?v=20261013a" defer></script>{% endif %}
|
||||
{% block scripts %}{% endblock %}
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -170,5 +170,7 @@
|
||||
{# 긴급 공지 — erp_base 를 쓰지 않는 화면도 같이(app/modules/notice) #}
|
||||
<link rel="stylesheet" href="/static/erp-notice.css?v=20261012c" />
|
||||
<script src="/static/erp-notice.js?v=20261012a" defer></script>
|
||||
<link rel="stylesheet" href="/static/erp-overdue.css?v=20261013a" />
|
||||
<script src="/static/erp-overdue.js?v=20261013a" defer></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user