Files
dbx-main/app/modules/project/templates/project/goals.html
T
king 2dab20f718 feat(project): 주간 회의록 작은 달력 — 보고 있는 주 영역 표시, 주 줄을 누르면 그 주 회의록
- 주차 탭 오른쪽에 그 달 월요일 시작 달력(주 = 월~일 한 줄)
- 보고 있는 주 영역 표시, 오늘 동그라미, 토 파랑·일/공휴일 빨강, 다른 달 날짜 흐리게, 회의록 있는 주 점
- 줄(주)을 누르면 그 주 회의록(?week=), 인쇄에선 숨김, 좁은 화면은 아래로
- 캐시 버전 20261001g, 문서 갱신

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 12:07:21 +09:00

212 lines
14 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{% extends "erp_base.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/project.css?v=20261001g" />
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
{% endblock %}
{% block topbar_after_logout %}{% include "project/_help_btn.html" %}{% endblock %}
{% block content %}
{# 연간 목표 — 좌측 사이드바 "목표" → 연도. 스프레드시트처럼 한 표에
① 매출(목표·실적·달성)·로아스(목표·실적) 월별 숫자
② 업무 영역(상품·마케팅·컨텐츠·유통 …)별 연간·월별 글.
입력·구조 변경은 관리자만(칸별 즉시 저장, project.js initGoals), 나머지는 보기만.
DB: project_db 013 (goal_years·goal_metrics·goal_areas·goal_rows·goal_cells). #}
<div class="pj-wrap pj-inbox-view pj-goal-view">
<div class="pj-layout">
{% with current_pid = 0, side_active = "goals" %}{% include "project/_side.html" %}{% endwith %}
<section class="pj-main">
<div class="pj-section-head">
<h2>{{ goal_year }}년 목표</h2>
{% if board %}
<div class="pj-goal-head-acts">
{% if is_admin %}
<label class="pj-goal-unit">매출 단위
<input type="text" id="pj-goal-unit" maxlength="20" placeholder="예: 백만원"
value="{{ board.sales_unit }}" data-year="{{ goal_year }}" />
</label>
<button type="button" class="pj-btn pj-btn-danger" id="pj-goal-year-del"
data-year="{{ goal_year }}">연도 삭제</button>
{% else %}
{% if board.sales_unit %}<span class="pj-goal-unit-ro">매출 단위: {{ board.sales_unit }}</span>{% endif %}
<span class="pj-goal-note">목표는 관리자만 입력할 수 있습니다.</span>
{% endif %}
</div>
{% endif %}
</div>
<div class="pj-view pj-goal-pane" id="pj-goal-pane">
{% if not goals_enabled %}
<div class="pj-empty">연간 목표가 아직 준비되지 않았습니다(DB 마이그레이션 013 필요).</div>
{% elif not board %}
<div class="pj-empty pj-goal-empty">
<p>{{ goal_year }}년 목표가 아직 없습니다.</p>
{% if is_admin %}
<p class="pj-goal-empty-sub">만들면 가장 가까운 이전 연도의 업무 영역 구성을 그대로 가져옵니다(처음이면 상품·마케팅·컨텐츠·유통).</p>
<button type="button" class="pj-btn pj-btn-primary" id="pj-goal-create" data-year="{{ goal_year }}">{{ goal_year }}년 목표 만들기</button>
{% endif %}
</div>
{% 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 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 }}"
value="{{ labels.get(mo, '') }}" />
{%- else -%}
<span class="pj-goal-num" data-metric="{{ metric }}" data-kind="{{ kind }}" data-month="{{ mo }}">{{ labels.get(mo, '') }}</span>
{%- endif -%}
</td>
{%- endmacro %}
<table class="pj-goal-table" id="pj-goal-table" data-year="{{ goal_year }}"
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>
{# 연간·월·반기 칸도 머리 칸 오른쪽 끝을 끌어 너비 조절(data-col: y · m1~m12 · h1 · h2) #}
<th class="pj-goal-year-col" data-col="y">연간<span class="pj-goal-colresize" data-col="y" title="끌어서 너비 조절"></span></th>
{% for h, hmonths, hm, hname in halves %}
{# 월 이름을 누르면 그 달 주간 회의록(/goals/{연도}/meetings/{월}) #}
{% for mo in hmonths %}<th class="pj-goal-m{% if mo == this_month %} is-now{% endif %}" data-h="{{ h }}" data-col="m{{ mo }}"><a class="pj-goal-mlabel pj-goal-mlink" href="/project/goals/{{ goal_year }}/meetings/{{ mo }}" title="{{ mo }}월 주간 회의록">{{ mo }}월</a><span class="pj-goal-colresize" data-col="m{{ mo }}" title="끌어서 너비 조절"></span></th>{% endfor %}
{# 반기 칸 — 버튼으로 그 반기의 월 칸을 접었다 편다(localStorage pj_goal_fold) #}
<th class="pj-goal-half-col" data-h="{{ h }}" data-col="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 }}
<span class="pj-goal-colresize" data-col="h{{ h }}" title="끌어서 너비 조절"></span>
</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 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 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 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>
{# 로아스 연간·반기 = 월 매출로 가중한 평균(광고비 = 매출 ÷ 로아스로 환산) — project.js recompute #}
<td class="pj-goal-sum pj-goal-year-col" data-metric="roas" data-kind="target" data-scope="0"></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-half-col" data-metric="roas" data-kind="target" data-scope="{{ hm }}"></td>
{% endfor %}
</tr>
<tr>
<th class="pj-goal-c2">실적</th>
<td class="pj-goal-sum pj-goal-year-col" data-metric="roas" data-kind="actual" data-scope="0"></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-half-col" data-metric="roas" data-kind="actual" data-scope="{{ hm }}"></td>
{% endfor %}
</tr>
</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"{% 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-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" title="영역 삭제">×</button>
</span>
{% endif %}
</th>
{% endif %}
<th class="pj-goal-c2 pj-goal-row-label">
<span class="pj-goal-row-text"{% if is_admin %} data-goal-edit="row" title="눌러서 줄 이름 수정"{% endif %}>{{ row.label }}</span>
{# 줄 도구 — + = 이 줄 아래에 줄 추가, × = 줄 삭제(영역의 마지막 한 줄은 못 지움). 우클릭 메뉴로 위/아래 추가·삭제도 #}
{% if is_admin %}
<span class="pj-goal-tools">
{% 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>
{% endif %}
<button type="button" class="pj-icon-btn" data-goal-act="row-insert" title="아래에 줄 추가">+</button>
{% if area.rows | length > 1 %}
<button type="button" class="pj-icon-btn" data-goal-act="row-del" title="줄 삭제">×</button>
{% endif %}
</span>
{% endif %}
</th>
{# 칸 배치는 router._goal_area_layout — 엑셀식 사각형 병합(colspan·rowspan), 가려진 칸은 없다 #}
{% for c in row.layout %}
{% set editable = is_admin and (c.kind != 'half' or board.halves) %}
{% set merged = c.span > 1 or c.rspan > 1 %}
<td class="pj-goal-texttd {{ 'pj-goal-m' if c.kind == 'month' else ('pj-goal-year-col' if c.kind == 'year' else 'pj-goal-half-col') }}{% if merged %} is-merged{% endif %}{% if c.now %} is-now{% endif %}"
{% if c.kind == 'month' %}data-h="{{ c.h }}" {% endif %}data-month="{{ c.m }}" data-span="{{ c.span }}" data-rspan="{{ c.rspan }}"
{%- if c.span > 1 %} colspan="{{ c.span }}" style="--span: {{ c.span }}"{% endif %}{% if c.rspan > 1 %} rowspan="{{ c.rspan }}"{% 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(c.m, '') }}</div>
{%- endif -%}
</td>
{% endfor %}
</tr>
{% endfor %}
</tbody>
{% endfor %}
</table>
{% 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">칸을 고치면 바로 저장됩니다. 숫자 칸을 비우면 지워집니다. 항목 칸을 우클릭하면 줄을 추가·삭제합니다.
{%- if board.halves %} 칸을 마우스로 끌어 여러 칸을 고른 뒤 우클릭 → 셀 병합, 병합된 칸은 우클릭 → 병합 해제(글은 왼쪽 위 칸에 남음).{% endif %}
월 이름을 누르면 그 달 주간 회의록이 열립니다.</span>
</div>
{% endif %}
{% endif %}
</div>
</section>
</div>
</div>
{% if goal_area_colors %}<script>window.PJ_GOAL_COLORS = {{ goal_area_colors | tojson }};</script>{% endif %}
{% include "project/_side_modals.html" %}
{% include "project/_member_tasks_modal.html" %}
<script src="/static/project.js?v=20261001g" defer></script>
{% endblock %}