feat(project): 연간 목표 상·하반기 칸·반기 접기·이름 바로 수정·월 칸 병합·로아스 %
- 6월·12월 오른쪽에 상반기·하반기 칸 추가. 매출 목표·실적은 반기 합계, 달성률은 연간과 같은 규칙, 업무 영역 글 칸은 month 13·14 로 저장 - 반기 칸 머리 버튼으로 1~6월 / 7~12월 칸을 접었다 펴기(너비 애니메이션, localStorage pj_goal_fold). 표를 width:1px + table-layout:fixed 로 바꿔 펼칠 때도 애니메이션이 적용되게 함 - 업무 영역·줄 이름을 눌러 그 자리에서 수정(✎ 버튼 제거) - 월 칸 가로 병합(goal_cell_merges, 반기 안에서만): Shift+클릭 선택 후 병합 버튼, 우클릭 메뉴로 좌/우 병합·해제. 병합 시 글은 월 순서대로 첫 칸에 모음 - 로아스 목표·실적 칸 % 표기 - 마이그레이션 014 (goal_cells month CHECK 0~14, goal_cell_merges) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1840,6 +1840,11 @@ class ProjectStore:
|
||||
with self._pool.connection() as conn:
|
||||
return self._table_exists(conn, "goal_years")
|
||||
|
||||
def goals_halves_enabled(self) -> bool:
|
||||
"""상·하반기 글 칸·월 칸 병합(마이그레이션 014) 적용 여부."""
|
||||
with self._pool.connection() as conn:
|
||||
return self._table_exists(conn, "goal_cell_merges")
|
||||
|
||||
def list_goal_years(self) -> list[int]:
|
||||
"""목표를 만든 연도(최근 연도 먼저). 013 미적용이면 UndefinedTable."""
|
||||
with self._pool.connection() as conn:
|
||||
@@ -1913,7 +1918,9 @@ class ProjectStore:
|
||||
"""한 해 목표 표 전체. 연도가 없으면 None.
|
||||
|
||||
metrics = {"sales": {"target": {1: 12.0, ...}, "actual": {...}}, "roas": {...}}
|
||||
areas = [{id, name, color, rows: [{id, label, cells: {0: "연간 글", 1: "1월 글", ...}}]}]
|
||||
areas = [{id, name, color, rows: [{id, label, cells: {0: "연간 글", 1: "1월 글", 13: "상반기 글", ...},
|
||||
merges: {시작월: 칸 수}}]}]
|
||||
halves = 마이그레이션 014 적용 여부(상·하반기 글 칸·병합)
|
||||
"""
|
||||
with self._pool.connection() as conn:
|
||||
head = conn.execute(
|
||||
@@ -1940,6 +1947,13 @@ class ProjectStore:
|
||||
"WHERE a.year = %s",
|
||||
(year,),
|
||||
).fetchall()
|
||||
halves = self._table_exists(conn, "goal_cell_merges")
|
||||
merge_rows = conn.execute(
|
||||
"SELECT m.row_id, m.start_month, m.span FROM goal_cell_merges m "
|
||||
"JOIN goal_rows r ON r.id = m.row_id JOIN goal_areas a ON a.id = r.area_id "
|
||||
"WHERE a.year = %s",
|
||||
(year,),
|
||||
).fetchall() if halves else []
|
||||
metrics: dict[str, dict[str, dict[int, float]]] = {
|
||||
m: {k: {} for k in store.GOAL_KINDS} for m in store.GOAL_METRICS
|
||||
}
|
||||
@@ -1948,10 +1962,15 @@ class ProjectStore:
|
||||
cells: dict[int, dict[int, str]] = {}
|
||||
for c in cell_rows:
|
||||
cells.setdefault(int(c["row_id"]), {})[int(c["month"])] = c["body"]
|
||||
merges: dict[int, dict[int, int]] = {}
|
||||
for g in merge_rows:
|
||||
merges.setdefault(int(g["row_id"]), {})[int(g["start_month"])] = int(g["span"])
|
||||
rows_by_area: dict[int, list[dict[str, Any]]] = {}
|
||||
for r in row_rows:
|
||||
rid = int(r["id"])
|
||||
rows_by_area.setdefault(int(r["area_id"]), []).append(
|
||||
{"id": int(r["id"]), "label": r["label"], "cells": cells.get(int(r["id"]), {})}
|
||||
{"id": rid, "label": r["label"], "cells": cells.get(rid, {}),
|
||||
"merges": merges.get(rid, {})}
|
||||
)
|
||||
areas = [
|
||||
{"id": int(a["id"]), "name": a["name"], "color": a["color"],
|
||||
@@ -1959,7 +1978,7 @@ class ProjectStore:
|
||||
for a in area_rows
|
||||
]
|
||||
return {"year": int(head["year"]), "sales_unit": head["sales_unit"],
|
||||
"metrics": metrics, "areas": areas}
|
||||
"metrics": metrics, "areas": areas, "halves": halves}
|
||||
|
||||
def set_goal_metric(
|
||||
self, *, year: int, metric: str, kind: str, month: int, value: float | None, updated_by: str = ""
|
||||
@@ -2094,6 +2113,17 @@ class ProjectStore:
|
||||
with self._pool.connection() as conn:
|
||||
if not conn.execute("SELECT 1 FROM goal_rows WHERE id = %s", (row_id,)).fetchone():
|
||||
raise KeyError(row_id)
|
||||
if m != store.GOAL_YEAR:
|
||||
halves = self._table_exists(conn, "goal_cell_merges")
|
||||
if m > 12 and not halves:
|
||||
raise store.GoalMigration014Needed()
|
||||
# 병합된 칸의 가운데·끝 월(글은 병합 시작 월에만 둔다) — 다른 창에서 병합된 뒤의 늦은 저장
|
||||
if m <= 12 and halves and conn.execute(
|
||||
"SELECT 1 FROM goal_cell_merges WHERE row_id = %s "
|
||||
"AND start_month < %s AND start_month + span - 1 >= %s",
|
||||
(row_id, m, m),
|
||||
).fetchone():
|
||||
raise ValueError("병합된 칸입니다. 새로고침해 주세요.")
|
||||
if not text:
|
||||
conn.execute("DELETE FROM goal_cells WHERE row_id = %s AND month = %s", (row_id, m))
|
||||
else:
|
||||
@@ -2104,6 +2134,67 @@ class ProjectStore:
|
||||
(row_id, m, text, store.norm_str(updated_by, lower=True)),
|
||||
)
|
||||
|
||||
def merge_goal_cells(self, *, row_id: int, start: Any, end: Any, updated_by: str = "") -> tuple[int, int]:
|
||||
"""업무 영역 줄의 start~end 월 칸을 가로로 합친다 → (시작 월, 칸 수).
|
||||
|
||||
걸쳐 있는 기존 병합은 통째로 흡수한다(병합은 서로 겹치지 않고 반기 안이라 범위도 반기 안).
|
||||
글은 범위 안 칸들의 글을 월 순서대로 줄바꿈으로 이어 시작 월 칸에 두고, 나머지 칸 글은 지운다."""
|
||||
s, e = store.validate_goal_merge(start, end)
|
||||
who = store.norm_str(updated_by, lower=True)
|
||||
with self._pool.connection() as conn:
|
||||
with conn.transaction():
|
||||
if not self._table_exists(conn, "goal_cell_merges"):
|
||||
raise store.GoalMigration014Needed()
|
||||
if not conn.execute(
|
||||
"SELECT 1 FROM goal_rows WHERE id = %s FOR UPDATE", (row_id,)
|
||||
).fetchone():
|
||||
raise KeyError(row_id)
|
||||
for g in conn.execute(
|
||||
"SELECT start_month, span FROM goal_cell_merges WHERE row_id = %s", (row_id,)
|
||||
).fetchall():
|
||||
gs, ge = int(g["start_month"]), int(g["start_month"]) + int(g["span"]) - 1
|
||||
if gs <= e and ge >= s:
|
||||
s, e = min(s, gs), max(e, ge)
|
||||
bodies = [
|
||||
str(c["body"]).strip() for c in conn.execute(
|
||||
"SELECT body FROM goal_cells WHERE row_id = %s AND month BETWEEN %s AND %s "
|
||||
"ORDER BY month",
|
||||
(row_id, s, e),
|
||||
).fetchall()
|
||||
]
|
||||
text = store.validate_goal_text("\n".join(b for b in bodies if b))
|
||||
conn.execute(
|
||||
"DELETE FROM goal_cell_merges WHERE row_id = %s AND start_month BETWEEN %s AND %s",
|
||||
(row_id, s, e),
|
||||
)
|
||||
conn.execute(
|
||||
"DELETE FROM goal_cells WHERE row_id = %s AND month BETWEEN %s AND %s",
|
||||
(row_id, s, e),
|
||||
)
|
||||
if text:
|
||||
conn.execute(
|
||||
"INSERT INTO goal_cells (row_id, month, body, updated_by) VALUES (%s,%s,%s,%s)",
|
||||
(row_id, s, text, who),
|
||||
)
|
||||
conn.execute(
|
||||
"INSERT INTO goal_cell_merges (row_id, start_month, span, updated_by) "
|
||||
"VALUES (%s, %s, %s, %s)",
|
||||
(row_id, s, e - s + 1, who),
|
||||
)
|
||||
return s, e - s + 1
|
||||
|
||||
def unmerge_goal_cells(self, *, row_id: int, start: int) -> None:
|
||||
"""병합 해제 — 글은 시작 월 칸에 그대로 남는다."""
|
||||
with self._pool.connection() as conn:
|
||||
if not self._table_exists(conn, "goal_cell_merges"):
|
||||
raise store.GoalMigration014Needed()
|
||||
row = conn.execute(
|
||||
"DELETE FROM goal_cell_merges WHERE row_id = %s AND start_month = %s RETURNING row_id",
|
||||
(row_id, start),
|
||||
).fetchone()
|
||||
if row is None:
|
||||
raise KeyError(row_id)
|
||||
|
||||
# ════════════════════════════════════════════════════════════
|
||||
# 직렬화
|
||||
# ════════════════════════════════════════════════════════════
|
||||
|
||||
@@ -2514,6 +2514,7 @@ def inbox_page(request: Request) -> HTMLResponse:
|
||||
# 조회: project 권한자 전원 · 입력/구조 변경: 관리자(is_admin) 전용
|
||||
# ────────────────────────────────────────────────────────────
|
||||
_GOALS_MIGRATION_MSG = "연간 목표 기능이 아직 준비되지 않았습니다(DB 마이그레이션 013 필요)."
|
||||
_GOALS_014_MSG = "상·하반기 칸과 칸 병합은 DB 마이그레이션 014 가 필요합니다."
|
||||
|
||||
|
||||
def _fmt_goal_num(v: float | None) -> str:
|
||||
@@ -2525,10 +2526,37 @@ def _fmt_goal_num(v: float | None) -> str:
|
||||
return f"{v:,.2f}".rstrip("0").rstrip(".")
|
||||
|
||||
|
||||
def _goal_label(metric: str, v: float | None) -> str:
|
||||
"""지표 칸 표기 — 로아스는 % 단위(499 → "499%"). 입력칸도 이 표기로 보이고, 저장 때 % 는 떼고 읽는다."""
|
||||
s = _fmt_goal_num(v)
|
||||
return f"{s}%" if s and metric == "roas" else s
|
||||
|
||||
|
||||
def _goal_row_layout(merges: dict[int, int], this_month: int) -> list[dict[str, Any]]:
|
||||
"""업무 영역 한 줄의 칸 배치 — 연간 · 1~6월 · 상반기 · 7~12월 · 하반기 순서.
|
||||
|
||||
월 칸은 병합(시작 월 → 칸 수)을 반영해 {"m", "span", "h"(1|2), "now"}, 연간·반기 칸은 {"m": 0|13|14}.
|
||||
병합 정보가 반기를 넘거나 겹치면(있을 수 없지만) 그 병합은 무시한다."""
|
||||
out: list[dict[str, Any]] = [{"m": store.GOAL_YEAR, "kind": "year"}]
|
||||
for h, (lo, hi, half_m) in enumerate(((1, 6, store.GOAL_H1), (7, 12, store.GOAL_H2)), start=1):
|
||||
mo = lo
|
||||
while mo <= hi:
|
||||
span = int(merges.get(mo, 1) or 1)
|
||||
if span < 1 or mo + span - 1 > hi:
|
||||
span = 1
|
||||
out.append({"m": mo, "span": span, "h": h, "kind": "month",
|
||||
"now": mo <= this_month <= mo + span - 1})
|
||||
mo += span
|
||||
out.append({"m": half_m, "kind": "half", "h": h})
|
||||
return out
|
||||
|
||||
|
||||
def _goal_call(fn: Any, *args: Any, **kwargs: Any) -> Any:
|
||||
"""목표 DB 호출 공통 — 013 미적용 503, 없는 대상 404, 입력 오류 400."""
|
||||
try:
|
||||
return fn(*args, **kwargs)
|
||||
except store.GoalMigration014Needed:
|
||||
raise HTTPException(status_code=503, detail=_GOALS_014_MSG)
|
||||
except UndefinedTable:
|
||||
raise HTTPException(status_code=503, detail=_GOALS_MIGRATION_MSG)
|
||||
except KeyError:
|
||||
@@ -2562,11 +2590,15 @@ def goals_page(request: Request, year: int) -> HTMLResponse:
|
||||
admin = is_admin(user)
|
||||
enabled = st.goals_enabled()
|
||||
board = st.get_goal_board(year=year) if enabled else None
|
||||
if board:
|
||||
for m in board["metrics"].values():
|
||||
for kind in list(m):
|
||||
m[kind + "_label"] = {mo: _fmt_goal_num(v) for mo, v in m[kind].items()}
|
||||
today = today_kst()
|
||||
this_month = today.month if today.year == year else 0
|
||||
if board:
|
||||
for metric, m in board["metrics"].items():
|
||||
for kind in list(m):
|
||||
m[kind + "_label"] = {mo: _goal_label(metric, v) for mo, v in m[kind].items()}
|
||||
for area in board["areas"]:
|
||||
for row in area["rows"]:
|
||||
row["layout"] = _goal_row_layout(row.get("merges") or {}, this_month)
|
||||
return render_template(
|
||||
request,
|
||||
"project/goals.html",
|
||||
@@ -2588,7 +2620,9 @@ def goals_page(request: Request, year: int) -> HTMLResponse:
|
||||
"goal_year": year,
|
||||
"board": board,
|
||||
"months": list(range(1, 13)),
|
||||
"this_month": today.month if today.year == year else 0,
|
||||
"halves": [(1, list(range(1, 7)), store.GOAL_H1, "상반기"),
|
||||
(2, list(range(7, 13)), store.GOAL_H2, "하반기")],
|
||||
"this_month": this_month,
|
||||
"goal_area_colors": list(store.GOAL_AREA_COLORS),
|
||||
},
|
||||
)
|
||||
@@ -2631,7 +2665,7 @@ def api_set_goal_metric(request: Request, year: int, payload: dict[str, Any] = B
|
||||
kind=str(payload.get("kind") or ""), month=payload.get("month"),
|
||||
value=value, updated_by=user["email"],
|
||||
)
|
||||
return JSONResponse({"ok": True, "value": value, "label": _fmt_goal_num(value)})
|
||||
return JSONResponse({"ok": True, "value": value, "label": _goal_label(str(payload.get("metric") or ""), value)})
|
||||
|
||||
|
||||
@router.post("/api/goals/{year}/areas")
|
||||
@@ -2703,7 +2737,7 @@ def api_move_goal_row(request: Request, row_id: int, payload: dict[str, Any] = B
|
||||
def api_set_goal_cell(
|
||||
request: Request, row_id: int, month: int, payload: dict[str, Any] = Body(...)
|
||||
) -> JSONResponse:
|
||||
"""업무 영역 칸 글 — month 0 = 연간, 1~12 = 월. 빈 글 = 지움."""
|
||||
"""업무 영역 칸 글 — month 0 = 연간, 1~12 = 월, 13 = 상반기, 14 = 하반기(014). 빈 글 = 지움."""
|
||||
user = _require_admin(request)
|
||||
st = _db_or_503(request)
|
||||
_goal_call(
|
||||
@@ -2711,3 +2745,24 @@ def api_set_goal_cell(
|
||||
body=payload.get("body", ""), updated_by=user["email"],
|
||||
)
|
||||
return JSONResponse({"ok": True})
|
||||
|
||||
|
||||
@router.post("/api/goals/rows/{row_id}/merge")
|
||||
def api_merge_goal_cells(request: Request, row_id: int, payload: dict[str, Any] = Body(...)) -> JSONResponse:
|
||||
"""월 칸 가로 병합 {start, end}(반기 안, 2칸 이상) — 걸친 병합은 흡수, 글은 이어서 시작 월 칸에."""
|
||||
user = _require_admin(request)
|
||||
st = _db_or_503(request)
|
||||
start, span = _goal_call(
|
||||
st.merge_goal_cells, row_id=row_id, start=payload.get("start"), end=payload.get("end"),
|
||||
updated_by=user["email"],
|
||||
)
|
||||
return JSONResponse({"ok": True, "start": start, "span": span})
|
||||
|
||||
|
||||
@router.delete("/api/goals/rows/{row_id}/merge/{start}")
|
||||
def api_unmerge_goal_cells(request: Request, row_id: int, start: int) -> JSONResponse:
|
||||
"""병합 해제 — 글은 시작 월 칸에 남는다."""
|
||||
_require_admin(request)
|
||||
st = _db_or_503(request)
|
||||
_goal_call(st.unmerge_goal_cells, row_id=row_id, start=start)
|
||||
return JSONResponse({"ok": True})
|
||||
|
||||
@@ -356,7 +356,7 @@ def validate_time(t: Any) -> str | None:
|
||||
# ════════════════════════════════════════════════════════════
|
||||
# 연간 목표 (마이그레이션 013) — 사이드바 "목표" → 연도
|
||||
# ════════════════════════════════════════════════════════════
|
||||
GOAL_METRICS: tuple[str, ...] = ("sales", "roas") # 매출 · 로아스
|
||||
GOAL_METRICS: tuple[str, ...] = ("sales", "roas") # 매출 · 로아스(단위 %)
|
||||
GOAL_KINDS: tuple[str, ...] = ("target", "actual") # 목표 · 실적
|
||||
# 업무 영역 줄 배경색 — 스프레드시트처럼 연한 색 16가지(글자는 항상 진한 색, 8칸×2줄).
|
||||
# 처음 8색(상품·마케팅·컨텐츠·유통 기본색 포함)은 예전 목록 그대로 들어 있다.
|
||||
@@ -386,17 +386,46 @@ def validate_goal_year(y: Any) -> int:
|
||||
return v
|
||||
|
||||
|
||||
class GoalMigration014Needed(RuntimeError):
|
||||
"""상·하반기 글 칸·월 칸 병합은 마이그레이션 014(goal_cell_merges) 뒤에만 된다."""
|
||||
|
||||
|
||||
GOAL_YEAR = 0 # 업무 영역 글 칸 — 연간
|
||||
GOAL_H1 = 13 # 상반기(1~6월) — 마이그레이션 014
|
||||
GOAL_H2 = 14 # 하반기(7~12월)
|
||||
|
||||
|
||||
def goal_half_of(month: int) -> int:
|
||||
"""1~6월 → 1(상반기), 7~12월 → 2(하반기)."""
|
||||
return 1 if month <= 6 else 2
|
||||
|
||||
|
||||
def validate_goal_month(m: Any, *, allow_year: bool = False) -> int:
|
||||
"""1~12월. allow_year 이면 0(연간)도 허용."""
|
||||
"""1~12월. allow_year 이면 업무 영역 글 칸 — 0(연간)·13(상반기)·14(하반기)도 허용."""
|
||||
try:
|
||||
v = int(m)
|
||||
except (TypeError, ValueError):
|
||||
raise ValueError("월이 올바르지 않습니다.")
|
||||
if not ((0 if allow_year else 1) <= v <= 12):
|
||||
if not ((0 if allow_year else 1) <= v <= (GOAL_H2 if allow_year else 12)):
|
||||
raise ValueError("월이 올바르지 않습니다.")
|
||||
return v
|
||||
|
||||
|
||||
def validate_goal_merge(start: Any, end: Any) -> tuple[int, int]:
|
||||
"""월 칸 병합 범위(start~end 월, 2칸 이상) — 상반기·하반기를 넘지 않는다."""
|
||||
try:
|
||||
s, e = int(start), int(end)
|
||||
except (TypeError, ValueError):
|
||||
raise ValueError("병합할 월이 올바르지 않습니다.")
|
||||
if s > e:
|
||||
s, e = e, s
|
||||
if not (1 <= s and e <= 12) or s == e:
|
||||
raise ValueError("병합은 1~12월 안에서 2칸 이상 골라야 합니다.")
|
||||
if goal_half_of(s) != goal_half_of(e):
|
||||
raise ValueError("상반기(1~6월)와 하반기(7~12월)를 넘어 병합할 수 없습니다.")
|
||||
return s, e
|
||||
|
||||
|
||||
def validate_goal_value(v: Any) -> float | None:
|
||||
"""지표 숫자 — '1,234.5' 같은 쉼표·공백·% 는 떼고 읽는다. 빈값은 None(=지움)."""
|
||||
s = norm_str(v).replace(",", "").replace("%", "").replace(" ", "")
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20260930g" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261001a" />
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
{% endblock %}
|
||||
|
||||
@@ -51,8 +51,9 @@
|
||||
{% else %}
|
||||
{% set sm = board.metrics.sales %}
|
||||
{% set rm = board.metrics.roas %}
|
||||
{# 월 칸은 pj-goal-m + data-h(1 = 상반기 1~6월, 2 = 하반기 7~12월) — 반기 접기(initGoals)가 이걸로 숨긴다 #}
|
||||
{% macro num_cell(metric, kind, labels, mo) -%}
|
||||
<td class="pj-goal-numtd{% if mo == this_month %} is-now{% endif %}">
|
||||
<td class="pj-goal-numtd pj-goal-m{% if mo == this_month %} is-now{% endif %}" data-h="{{ 1 if mo <= 6 else 2 }}">
|
||||
{%- if is_admin -%}
|
||||
<input type="text" class="pj-goal-num" inputmode="decimal" autocomplete="off"
|
||||
data-metric="{{ metric }}" data-kind="{{ kind }}" data-month="{{ mo }}"
|
||||
@@ -63,88 +64,114 @@
|
||||
</td>
|
||||
{%- endmacro %}
|
||||
<table class="pj-goal-table" id="pj-goal-table" data-year="{{ goal_year }}"
|
||||
data-admin="{{ 'true' if is_admin else 'false' }}">
|
||||
data-admin="{{ 'true' if is_admin else 'false' }}"
|
||||
data-halves="{{ 'true' if board.halves else 'false' }}">
|
||||
<thead>
|
||||
<tr>
|
||||
{# 오른쪽 끝을 끌어 이름 칸 너비 조절 — 브라우저에 기억(localStorage pj_goal_col_w) #}
|
||||
<th class="pj-goal-c1"><span class="pj-goal-colresize" data-col="c1" title="끌어서 너비 조절"></span></th>
|
||||
<th class="pj-goal-c2"><span class="pj-goal-colresize" data-col="c2" title="끌어서 너비 조절"></span></th>
|
||||
<th class="pj-goal-year-col">연간</th>
|
||||
{% for mo in months %}<th class="{% if mo == this_month %}is-now{% endif %}">{{ mo }}월</th>{% endfor %}
|
||||
{% for h, hmonths, hm, hname in halves %}
|
||||
{% for mo in hmonths %}<th class="pj-goal-m{% if mo == this_month %} is-now{% endif %}" data-h="{{ h }}"><span class="pj-goal-mlabel">{{ mo }}월</span></th>{% endfor %}
|
||||
{# 반기 칸 — 버튼으로 그 반기의 월 칸을 접었다 편다(localStorage pj_goal_fold) #}
|
||||
<th class="pj-goal-half-col" data-h="{{ h }}">
|
||||
<button type="button" class="pj-goal-fold" data-h="{{ h }}" aria-expanded="true"
|
||||
data-label="{{ hmonths[0] }}~{{ hmonths[-1] }}월"
|
||||
title="{{ hmonths[0] }}~{{ hmonths[-1] }}월 접기"><span class="material-symbols-outlined">chevron_left</span></button>{{ hname }}
|
||||
</th>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
{# ── 숫자 지표 ── #}
|
||||
{# ── 숫자 지표 — 연간·반기 칸은 화면에서 계산(매출 합계·달성률), 로아스는 % 단위 ── #}
|
||||
<tbody class="pj-goal-kpi">
|
||||
<tr>
|
||||
<th class="pj-goal-c1" rowspan="3">매출</th>
|
||||
<th class="pj-goal-c2">목표</th>
|
||||
<td class="pj-goal-sum" data-metric="sales" data-kind="target"></td>
|
||||
{% for mo in months %}{{ num_cell("sales", "target", sm.target_label, mo) }}{% endfor %}
|
||||
<td class="pj-goal-sum pj-goal-year-col" data-metric="sales" data-kind="target" data-scope="0"></td>
|
||||
{% for h, hmonths, hm, hname in halves %}
|
||||
{% for mo in hmonths %}{{ num_cell("sales", "target", sm.target_label, mo) }}{% endfor %}
|
||||
<td class="pj-goal-sum pj-goal-half-col" data-metric="sales" data-kind="target" data-scope="{{ hm }}"></td>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="pj-goal-c2">실적</th>
|
||||
<td class="pj-goal-sum" data-metric="sales" data-kind="actual"></td>
|
||||
{% for mo in months %}{{ num_cell("sales", "actual", sm.actual_label, mo) }}{% endfor %}
|
||||
<td class="pj-goal-sum pj-goal-year-col" data-metric="sales" data-kind="actual" data-scope="0"></td>
|
||||
{% for h, hmonths, hm, hname in halves %}
|
||||
{% for mo in hmonths %}{{ num_cell("sales", "actual", sm.actual_label, mo) }}{% endfor %}
|
||||
<td class="pj-goal-sum pj-goal-half-col" data-metric="sales" data-kind="actual" data-scope="{{ hm }}"></td>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
<tr class="pj-goal-rate-row">
|
||||
<th class="pj-goal-c2">달성</th>
|
||||
<td class="pj-goal-rate" data-month="0"></td>
|
||||
{% for mo in months %}<td class="pj-goal-rate{% if mo == this_month %} is-now{% endif %}" data-month="{{ mo }}"></td>{% endfor %}
|
||||
<td class="pj-goal-rate pj-goal-year-col" data-month="0"></td>
|
||||
{% for h, hmonths, hm, hname in halves %}
|
||||
{% for mo in hmonths %}<td class="pj-goal-rate pj-goal-m{% if mo == this_month %} is-now{% endif %}" data-h="{{ h }}" data-month="{{ mo }}"></td>{% endfor %}
|
||||
<td class="pj-goal-rate pj-goal-half-col" data-month="{{ hm }}"></td>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="pj-goal-c1" rowspan="2">로아스</th>
|
||||
<th class="pj-goal-c2">목표</th>
|
||||
<td class="pj-goal-sum pj-goal-sum-na"></td>
|
||||
{% for mo in months %}{{ num_cell("roas", "target", rm.target_label, mo) }}{% endfor %}
|
||||
<td class="pj-goal-sum pj-goal-sum-na pj-goal-year-col"></td>
|
||||
{% for h, hmonths, hm, hname in halves %}
|
||||
{% for mo in hmonths %}{{ num_cell("roas", "target", rm.target_label, mo) }}{% endfor %}
|
||||
<td class="pj-goal-sum pj-goal-sum-na pj-goal-half-col"></td>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="pj-goal-c2">실적</th>
|
||||
<td class="pj-goal-sum pj-goal-sum-na"></td>
|
||||
{% for mo in months %}{{ num_cell("roas", "actual", rm.actual_label, mo) }}{% endfor %}
|
||||
<td class="pj-goal-sum pj-goal-sum-na pj-goal-year-col"></td>
|
||||
{% for h, hmonths, hm, hname in halves %}
|
||||
{% for mo in hmonths %}{{ num_cell("roas", "actual", rm.actual_label, mo) }}{% endfor %}
|
||||
<td class="pj-goal-sum pj-goal-sum-na pj-goal-half-col"></td>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
{# ── 업무 영역 — 영역마다 tbody 하나, 배경은 영역 색 ── #}
|
||||
{# ── 업무 영역 — 영역마다 tbody 하나, 배경은 영역 색. 이름은 눌러서 그 자리에서 수정(관리자) ── #}
|
||||
{% for area in board.areas %}
|
||||
<tbody class="pj-goal-area" data-area-id="{{ area.id }}" style="--goal-bg: {{ area.color or '#fff' }}">
|
||||
{% for row in area.rows %}
|
||||
<tr data-row-id="{{ row.id }}">
|
||||
{% if loop.first %}
|
||||
<th class="pj-goal-c1 pj-goal-area-name" rowspan="{{ area.rows | length }}">
|
||||
<span class="pj-goal-area-text">{{ area.name }}</span>
|
||||
<span class="pj-goal-area-text"{% if is_admin %} data-goal-edit="area" title="눌러서 이름 수정"{% endif %}>{{ area.name }}</span>
|
||||
{% if is_admin %}
|
||||
<span class="pj-goal-tools">
|
||||
<button type="button" class="pj-icon-btn" data-goal-act="area-rename" data-name="{{ area.name }}" title="이름 바꾸기">✎</button>
|
||||
<button type="button" class="pj-icon-btn" data-goal-act="area-color" data-color="{{ area.color }}" title="색 바꾸기"><span class="material-symbols-outlined">palette</span></button>
|
||||
<button type="button" class="pj-icon-btn" data-goal-act="area-up" title="위로">↑</button>
|
||||
<button type="button" class="pj-icon-btn" data-goal-act="area-down" title="아래로">↓</button>
|
||||
<button type="button" class="pj-icon-btn" data-goal-act="row-add" title="줄 추가">+</button>
|
||||
<button type="button" class="pj-icon-btn" data-goal-act="area-del" data-name="{{ area.name }}" title="영역 삭제">×</button>
|
||||
<button type="button" class="pj-icon-btn" data-goal-act="area-del" title="영역 삭제">×</button>
|
||||
</span>
|
||||
{% endif %}
|
||||
</th>
|
||||
{% endif %}
|
||||
<th class="pj-goal-c2 pj-goal-row-label">
|
||||
<span class="pj-goal-row-text">{{ row.label }}</span>
|
||||
{% if is_admin %}
|
||||
<span class="pj-goal-row-text"{% if is_admin %} data-goal-edit="row" title="눌러서 줄 이름 수정"{% endif %}>{{ row.label }}</span>
|
||||
{% if is_admin and area.rows | length > 1 %}
|
||||
<span class="pj-goal-tools">
|
||||
<button type="button" class="pj-icon-btn" data-goal-act="row-rename" data-label="{{ row.label }}" title="줄 이름 바꾸기">✎</button>
|
||||
{% if area.rows | length > 1 %}
|
||||
<button type="button" class="pj-icon-btn" data-goal-act="row-up" title="위로">↑</button>
|
||||
<button type="button" class="pj-icon-btn" data-goal-act="row-down" title="아래로">↓</button>
|
||||
<button type="button" class="pj-icon-btn" data-goal-act="row-del" data-label="{{ row.label }}" title="줄 삭제">×</button>
|
||||
{% endif %}
|
||||
<button type="button" class="pj-icon-btn" data-goal-act="row-del" title="줄 삭제">×</button>
|
||||
</span>
|
||||
{% endif %}
|
||||
</th>
|
||||
{% for mo in [0] + months %}
|
||||
<td class="pj-goal-texttd{% if mo == 0 %} pj-goal-year-col{% endif %}{% if mo == this_month %} is-now{% endif %}">
|
||||
{%- if is_admin -%}
|
||||
<textarea class="pj-goal-text" rows="1" data-row="{{ row.id }}" data-month="{{ mo }}"
|
||||
placeholder="{{ '연간 목표' if mo == 0 else '' }}">{{ row.cells.get(mo, '') }}</textarea>
|
||||
{% for c in row.layout %}
|
||||
{% set editable = is_admin and (c.kind != 'half' or board.halves) %}
|
||||
{% if c.kind == 'month' %}
|
||||
<td class="pj-goal-texttd pj-goal-m{% if c.span > 1 %} is-merged{% endif %}{% if c.now %} is-now{% endif %}"
|
||||
data-h="{{ c.h }}" data-month="{{ c.m }}" data-span="{{ c.span }}"{% if c.span > 1 %} colspan="{{ c.span }}" style="--span: {{ c.span }}"{% endif %}>
|
||||
{% else %}
|
||||
<td class="pj-goal-texttd {{ 'pj-goal-year-col' if c.kind == 'year' else 'pj-goal-half-col' }}" data-month="{{ c.m }}">
|
||||
{% endif %}
|
||||
{%- if editable -%}
|
||||
<textarea class="pj-goal-text" rows="1" data-row="{{ row.id }}" data-month="{{ c.m }}"
|
||||
placeholder="{{ '연간 목표' if c.m == 0 else ('상반기 목표' if c.m == 13 else ('하반기 목표' if c.m == 14 else '')) }}">{{ row.cells.get(c.m, '') }}</textarea>
|
||||
{%- else -%}
|
||||
<div class="pj-goal-text-ro">{{ row.cells.get(mo, '') }}</div>
|
||||
<div class="pj-goal-text-ro">{{ row.cells.get(c.m, '') }}</div>
|
||||
{%- endif -%}
|
||||
</td>
|
||||
{% endfor %}
|
||||
@@ -156,7 +183,8 @@
|
||||
{% if is_admin %}
|
||||
<div class="pj-goal-foot">
|
||||
<button type="button" class="pj-btn" id="pj-goal-area-add">+ 업무 영역 추가</button>
|
||||
<span class="pj-goal-note">칸을 고치면 바로 저장됩니다. 숫자 칸을 비우면 지워집니다.</span>
|
||||
<span class="pj-goal-note">칸을 고치면 바로 저장됩니다. 숫자 칸을 비우면 지워집니다.
|
||||
{%- if board.halves %} 월 칸은 Shift+클릭으로 여러 칸을 고른 뒤 병합하거나, 우클릭 메뉴로 병합·해제합니다.{% endif %}</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
@@ -169,5 +197,5 @@
|
||||
{% include "project/_side_modals.html" %}
|
||||
{% include "project/_member_tasks_modal.html" %}
|
||||
|
||||
<script src="/static/project.js?v=20260930g" defer></script>
|
||||
<script src="/static/project.js?v=20261001a" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20260930g" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261001a" />
|
||||
<link rel="stylesheet" href="/static/project-help.css?v=20260926v" />
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
{% endblock %}
|
||||
@@ -89,10 +89,15 @@
|
||||
<li><b>내 작업</b> — 내가 담당자인 작업 모음. 숫자 배지는 아직 끝나지 않은 작업 수입니다. (<a href="#mytasks">15장</a>)</li>
|
||||
<li><b>휴지통</b> — 지운 작업을 3개월 보관합니다. 관리자에게만 보입니다. (<a href="#trash">19장</a>)</li>
|
||||
<li><b>목표</b> — 누르면 바로 아래에 연도가 펼쳐집니다. 연도를 누르면 오른쪽에 그해 전체 목표가 한 표로 나옵니다 —
|
||||
맨 위에 <b>매출</b>(목표·실적·달성률)과 <b>로아스</b>(목표·실적)를 달마다, 그 아래에 <b>업무 영역</b>(상품·마케팅·컨텐츠·유통 등)별로
|
||||
연간·월별 계획을 적습니다. 매출의 <b>연간</b> 칸은 월 합계, <b>달성</b>은 실적÷목표(100% 이상 초록)로 저절로 계산됩니다.
|
||||
맨 위에 <b>매출</b>(목표·실적·달성률)과 <b>로아스</b>(목표·실적, 단위 %)를 달마다, 그 아래에 <b>업무 영역</b>(상품·마케팅·컨텐츠·유통 등)별로
|
||||
연간·반기·월별 계획을 적습니다. 6월 오른쪽에 <b>상반기</b>, 12월 오른쪽에 <b>하반기</b> 칸이 있고, 매출의 <b>연간·반기</b> 칸은 월 합계,
|
||||
<b>달성</b>은 실적÷목표(100% 이상 초록)로 저절로 계산됩니다. 반기 칸 머리의 <b>‹</b> 버튼을 누르면 그 반기의 월 칸(1~6월 또는 7~12월)이
|
||||
접히고, 다시 누르면 펼쳐집니다(접힌 상태는 내 브라우저에 기억).
|
||||
<b>입력은 관리자만</b> 할 수 있고(칸을 고치면 바로 저장), 다른 직원은 보기만 합니다. 관리자는 <b>+ 연도 추가</b>로 새해 목표를
|
||||
만들고(이전 연도의 업무 영역 구성을 그대로 가져옴), 영역 이름 칸에 마우스를 올려 이름·색·순서·줄 추가·삭제를 합니다.</li>
|
||||
만들고(이전 연도의 업무 영역 구성을 그대로 가져옴), 영역·줄 이름은 <b>눌러서 그 자리에서 고치고</b>(Enter 저장, Esc 취소),
|
||||
이름 칸에 마우스를 올려 색·순서·줄 추가·삭제를 합니다. 업무 영역의 월 칸은 <b>병합</b>할 수 있습니다 — 한 칸을 누르고
|
||||
<b>Shift+클릭</b>으로 같은 줄의 다른 칸까지 고른 뒤 떠 있는 "병합" 버튼을 누르거나, 칸을 <b>우클릭</b>해 "오른쪽/왼쪽 칸과 병합"·"병합 해제".
|
||||
병합은 상반기·하반기 안에서만 되고, 칸들의 글은 월 순서대로 첫 칸에 모입니다.</li>
|
||||
<li><b>프로젝트</b> — 내가 멤버인 프로젝트 목록입니다. 누르면 그 프로젝트 화면으로 갑니다. 완료한 프로젝트는 아래 <b>완료 프로젝트</b>에 흐리게 모입니다.</li>
|
||||
<li><b>전체 멤버</b> — 관리자에게만 보입니다. 사람 아이콘을 누르면 그 사람이 맡은 모든 작업을 한눈에 봅니다.</li>
|
||||
</ul>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20260930g" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261001a" />
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
{% endblock %}
|
||||
|
||||
@@ -104,5 +104,5 @@
|
||||
{% include "project/_side_modals.html" %}
|
||||
{% include "project/_member_tasks_modal.html" %}
|
||||
|
||||
<script src="/static/project.js?v=20260930g" defer></script>
|
||||
<script src="/static/project.js?v=20261001a" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20260930g" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261001a" />
|
||||
<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=20260930g" defer></script>
|
||||
<script src="/static/project.js?v=20261001a" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20260930g" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261001a" />
|
||||
<!-- 구글 머티리얼 심볼(담당자 아이콘 등) — self-host -->
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
<!-- 타임라인 vis-timeline — self-host -->
|
||||
@@ -496,5 +496,5 @@
|
||||
</script>
|
||||
|
||||
<script src="/static/vendor/vis-timeline/vis-timeline-graph2d.min.js"></script>
|
||||
<script src="/static/project.js?v=20260930g" defer></script>
|
||||
<script src="/static/project.js?v=20261001a" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20260930g" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261001a" />
|
||||
<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=20260930g" defer></script>
|
||||
<script src="/static/project.js?v=20261001a" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user