From 78683a9ae49b8c66ef7feb7ac1e4fe9de45f9eef Mon Sep 17 00:00:00 2001 From: king Date: Tue, 15 Sep 2026 08:42:28 +0900 Subject: [PATCH] =?UTF-8?q?feat(project):=20=ED=99=88=20=ED=99=94=EB=A9=B4?= =?UTF-8?q?=20=ED=94=84=EB=A1=9C=EC=A0=9D=ED=8A=B8=20=EC=B9=B4=EB=93=9C?= =?UTF-8?q?=EC=97=90=20=EC=97=85=EB=AC=B4=20=EB=AF=B8=EB=A6=AC=EB=B3=B4?= =?UTF-8?q?=EA=B8=B0=C2=B7=EC=A7=84=ED=96=89=EB=A5=A0=20=ED=91=9C=EC=8B=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 카드마다 완료/전체 진행률 바와 미완료 업무 목록(담당자·마감일, 최대 8건)을 붙여 프로젝트 전체 현황을 홈에서 한눈에 볼 수 있게 함. Co-Authored-By: Claude Sonnet 5 --- app/modules/project/router.py | 31 ++++++++++++++++ .../project/templates/project/index.html | 37 ++++++++++++++++++- app/static/project.css | 29 ++++++++++++++- docs/PROJECT_MODULE.md | 1 + 4 files changed, 96 insertions(+), 2 deletions(-) diff --git a/app/modules/project/router.py b/app/modules/project/router.py index 5924517..506b23b 100644 --- a/app/modules/project/router.py +++ b/app/modules/project/router.py @@ -339,6 +339,36 @@ async def index(request: Request) -> HTMLResponse: # 완료된 프로젝트는 비활성으로 맨 끝에 (홈 카드 정렬). 안정 정렬. projects = sorted(projects, key=lambda p: 1 if p.get("status") == "completed" else 0) tree = _build_tree(projects) + + # 아바타 맵: 이메일(소문자) → 구글 프로필 이미지 URL (홈 카드 업무 담당자 표시용) + from app.main import user_store # noqa: WPS433 + avatars = { + store.norm_str(u["email"], lower=True): u.get("picture") or "" + for u in user_store.list_all() + if u.get("picture") + } + + # 프로젝트 카드에 업무 미리보기(담당자·마감일·진행률) 붙이기 — 한눈에 현황 파악용 + today_iso = today_kst().isoformat() + for p in tree: + p_tasks = st.list_tasks(project_id=p["id"], include_subprojects=True, limit=500) + total = len(p_tasks) + done = sum(1 for t in p_tasks if t.get("completed_at")) + open_tasks = [t for t in p_tasks if not t.get("completed_at")] + open_tasks.sort(key=lambda t: (t.get("due_date") is None, t.get("due_date") or "", t["id"])) + for t in open_tasks: + t["assignee_display"] = ( + t.get("assignee_name") + or (t["assignee_email"].split("@")[0] if t.get("assignee_email") else "") + ) + d = t.get("due_date") + t["due_overdue"] = bool(d and d[:10] < today_iso) + p["task_total"] = total + p["task_done"] = done + p["task_percent"] = round(done * 100 / total) if total else 0 + p["task_preview"] = open_tasks[:8] + p["task_more"] = max(0, len(open_tasks) - 8) + my_tasks = st.list_tasks(assignee_email=user["email"], limit=500) # 내 업무를 프로젝트별로 묶어 트리로 표시 my_groups: dict[int, dict[str, Any]] = {} @@ -366,6 +396,7 @@ async def index(request: Request) -> HTMLResponse: "page_subtitle": "달력·타임라인·보드로 프로젝트를 관리하세요.", "tree": tree, "my_projects": my_projects, + "avatars": avatars, "today": today_kst().isoformat(), }, ) diff --git a/app/modules/project/templates/project/index.html b/app/modules/project/templates/project/index.html index f5c1324..ba6e802 100644 --- a/app/modules/project/templates/project/index.html +++ b/app/modules/project/templates/project/index.html @@ -1,7 +1,7 @@ {% extends "erp_base.html" %} {% block head_extra %} - + {% endblock %} @@ -63,7 +63,13 @@ {% if p.description %}
{{ p.description }}
{% endif %}
{% if p.due_date %}마감 {{ p.due_date }}{% endif %} + {% if p.task_total %}업무 {{ p.task_done }}/{{ p.task_total }}{% endif %}
+ {% if p.task_total %} +
+
+
+ {% endif %} {% if is_admin %} @@ -71,6 +77,35 @@ edit {% endif %} + + {% if p.task_preview %} + + {% if p.task_more %} + +{{ p.task_more }}개 업무 더보기 + {% endif %} + {% elif p.task_total == 0 %} +
진행 중인 업무가 없습니다.
+ {% endif %} {% endfor %} diff --git a/app/static/project.css b/app/static/project.css index 5261940..c318c33 100644 --- a/app/static/project.css +++ b/app/static/project.css @@ -33,7 +33,7 @@ .pj-home { display: grid; grid-template-columns: 1fr 320px; gap: 28px; align-items: start; } @media (max-width: 980px) { .pj-home { grid-template-columns: 1fr; } } -.pj-project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; } +.pj-project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; align-items: start; } .pj-project-card { position: relative; border: 1px solid #e7e9ec; border-radius: 14px; background: #fff; transition: box-shadow .14s, transform .1s; @@ -59,6 +59,33 @@ .pj-project-name { font-weight: 700; font-size: 15px; } .pj-project-desc { color: #6b7280; font-size: 12.5px; margin-top: 3px; } .pj-project-meta { margin-top: 10px; display: flex; gap: 6px; flex-wrap: wrap; } +.pj-project-progress { margin-top: 10px; height: 5px; border-radius: 999px; background: #eef0f2; overflow: hidden; } +.pj-project-progress-bar { height: 100%; border-radius: 999px; background: var(--pj-color, #4573d2); } + +/* 카드 하단 업무 미리보기 목록 */ +.pj-project-tasklist { list-style: none; margin: 0; padding: 0 10px 6px; border-top: 1px solid #f0f1f3; } +.pj-project-taskrow a { + display: flex; align-items: center; gap: 7px; padding: 7px 6px; border-radius: 7px; + text-decoration: none; color: inherit; +} +.pj-project-taskrow a:hover { background: #f6f7f8; } +.pj-project-task-ic { font-size: 16px; flex: 0 0 auto; color: #b7bdc5; } +.pj-project-task-title { + font-size: 12.5px; font-weight: 600; flex: 1; min-width: 0; + overflow: hidden; text-overflow: ellipsis; white-space: nowrap; +} +.pj-project-task-assignee { + display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: #6b7280; + flex: 0 0 auto; max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; +} +.pj-project-task-due { font-size: 11px; color: #9aa1a9; flex: 0 0 auto; } +.pj-project-task-due.is-overdue { color: #c22b10; font-weight: 700; } +.pj-project-more { + display: block; padding: 6px 16px 12px; font-size: 12px; font-weight: 600; + color: #6b7280; text-decoration: none; +} +.pj-project-more:hover { color: #1e1f21; text-decoration: underline; } +.pj-project-tasks-empty { padding: 4px 16px 14px; font-size: 12px; color: #b7bdc5; border-top: 1px solid #f0f1f3; margin-top: 2px; } .pj-home-side { border-left: 1px solid #eef0f2; padding-left: 24px; } @media (max-width: 980px) { .pj-home-side { border-left: none; padding-left: 0; } } diff --git a/docs/PROJECT_MODULE.md b/docs/PROJECT_MODULE.md index 02d24e5..daa654b 100644 --- a/docs/PROJECT_MODULE.md +++ b/docs/PROJECT_MODULE.md @@ -27,6 +27,7 @@ ## 3. 화면 / 뷰 - **홈** (`/project/`): 프로젝트 카드 그리드 + "내 업무" 사이드. 관리자는 "새 프로젝트". + 각 카드에 진행률 바(완료/전체 업무)와 미완료 업무 미리보기(담당자·마감일, 최대 8건 + 더보기)를 표시해 전체 현황을 한눈에 파악. - **프로젝트** (`/project/p/{id}`): 좌측 서브프로젝트/멤버, 우측 뷰 토글. - **달력** — FullCalendar. 업무를 시작~마감 기간으로 표시. 클릭 편집. - **타임라인** — vis-timeline(간트형). 기간 있는 업무만.