20 Commits

Author SHA1 Message Date
king e9f57b6ff6 Merge branch 'fix/cafe24-variant-toggle-center' 2026-11-17 10:36:24 +09:00
king 262ae7fdf8 fix(카페24): 옵션/품목 팝업 토글 버튼 가운데 정렬
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 10:36:24 +09:00
king 083eebfd95 Merge branch 'feat/cafe24-variant-th-center' 2026-11-17 10:29:58 +09:00
king 0f4608cb43 style(카페24): 옵션/품목 팝업 표 헤더 굵게·가운데 정렬
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 10:29:57 +09:00
king 8e5a682f0d Merge branch 'feat/cafe24-variant-inventory' 2026-11-17 10:08:54 +09:00
king b0e816cbdc feat(카페24): 옵션/품목 팝업에 재고관리·재고 수량·품절표시 설정
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 10:07:53 +09:00
king c39139a605 Merge branch 'feat/performance-yoy-kakao-pf' 2026-11-16 11:34:57 +09:00
king 91fd454b2c feat(실적): 매출 KPI 전년 같은 기간 대비 · 광고비 카톡 플친 열
- 매출 실적 KPI 줄에 전월 대비 옆 "전년 같은 기간 대비" % (연 보기 제외)
- 광고비 탭 카톡 플친(kakao_pf) 열 — 직접 입력, ROAS 없음
- 매출 탭 카페24 칸 광고비 줄에 구글·메타 다음 카톡 플친

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 11:34:56 +09:00
king 78d2e665ee Merge branch 'chore/malaysia-add-my1007' 2026-11-15 03:29:50 +09:00
king 4af44f2f7a chore(말레이시아재고): 신규 세트 MY-1007 malaysia_items 등록 SQL
BOM·구성 낱개는 이미 등록돼 있고 malaysia_items 에만 MY-1007 이 빠져
재고 화면 세트 목록에 안 보이던 것을 채운다. 이름은 itemcode_db 에서 psql 변수로 받는다.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 03:29:48 +09:00
king 60d5ca417d Merge branch 'feat/cafe24-keep-variant-price' 2026-11-15 03:15:32 +09:00
king 2465874198 feat(카페24): 판매가 변경 시 품목 판매 가격 유지 — 추가금액 자동 조정
기본 정보에서 판매가를 바꾸면 같은 잠금 안에서 옵션 품목 추가금액을
(옛 판매가 - 새 판매가)만큼 옮겨 품목 판매 가격(판매가+추가금액)을 그대로 둔다.
품목 조정 실패는 판매가 저장을 되돌리지 않고 화면 메시지로 알린다.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 03:15:26 +09:00
king f982a5fa9c Merge branch 'feat/project-timepicker-all' 2026-11-11 15:22:01 +09:00
king aa701ed611 feat(프로젝트): 시각 고르기를 공용 시각 팝업으로 — 옵션 알림 시각·긴급 공지 띄울 시각
- project.js openTimePopover·enhanceTimeInput(PJLib): 날짜 팝업 모양, 시 00~23·분 5분 단위, 끝에서 멈춤
- 모달 dialog 안이면 그 창 안 popover, 아니면 body

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 15:22:00 +09:00
king 8bcf9b4b20 Merge branch 'feat/project-daily-on-create' 2026-11-11 15:03:14 +09:00
king dd648d4752 feat(프로젝트): 메인 업무·세부 업무 추가 칸 날짜 팝업에도 [매일]
- POST tasks 의 repeat_daily: true = 만든 뒤 켬(033 미적용 503), 화면은 data-daily-ready(db.daily_ready)일 때만 버튼

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 15:03:12 +09:00
king 37df7be461 Merge branch 'fix/project-timepop-inert' 2026-11-11 14:50:56 +09:00
king 6e69abcfa3 fix(프로젝트): 옵션 시각 팝업 휠·마우스 오버·클릭 안 먹던 문제 — 모달 창 안에 붙임, 지우기·확인 동작·색
모달 dialog 가 열려 있으면 창 밖(body) 요소는 inert 라 popover 를 body 에 붙이면 마우스가 통과했다.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 14:50:55 +09:00
king 0e6bb53c9c Merge branch 'feat/project-options-timepicker' 2026-11-11 14:46:54 +09:00
king 117f40c96f feat(프로젝트): Project 옵션 알림 시각 고르기를 날짜 팝업 모양으로 — 시 00~23·분 5분 단위, 끝에서 멈춤
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 14:46:53 +09:00
35 changed files with 515 additions and 92 deletions
+3 -1
View File
@@ -16,7 +16,9 @@
- 대표이미지는 `POST /admin/products/{no}/images` 에 base64 data URI + `image_upload_type=A`.
NNEditor 업로드 경로를 PUT `detail_image` 에 넣는 방식은 적용 안 됨.
- 옵션/품목 팝업 「판매 가격」 열: 기본 정보 판매가 + 추가금액을 보여주고, 입력하면 추가금액을 역산(`cafe24-options.js` `bindSalePrice`). 저장되는 값은 추가금액뿐.
- 옵션/품목 팝업 옵션값 이름·자체 품목코드·추가금액·판매 가격 칸: Enter·↓ 아래 행, ↑ 위 행 같은 열로 이동(한글 조합 중에는 이동 안 함).
- 기본 정보에서 판매가를 바꾸면 같은 잠금 안에서 품목 추가금액을 (옛 판매가 − 새 판매가)만큼 옮겨 품목 판매 가격을 유지(`_keep_variant_sale_prices`, `store.shift_additional_amounts`). 공급가·소비자가는 품목과 무관. 판매가는 이미 반영됐으므로 품목 조정 실패는 화면 메시지(`variants_error`)로만.
- 옵션/품목 팝업 「재고관리」(use_inventory)·「재고」(quantity)·「품절표시」(display_soldout) 열: 같은 PUT variants 로 기본몰에만 보냄(재고는 쇼핑몰 공통).
- 옵션/품목 팝업 옵션값 이름·자체 품목코드·추가금액·판매 가격·재고 칸: Enter·↓ 아래 행, ↑ 위 행 같은 열로 이동(한글 조합 중에는 이동 안 함).
- 옵션/품목 팝업(단일 옵션 화면) 「모바일 스와이프 복사(코드)」: `// 상품명` + `"품목코드": "/web/…썸네일 경로",` 줄들을 클립보드로
(`cafe24-options.js` `swipeCode` — 행에 지금 보이는 썸네일 기준, 도메인/CDN 은 떼고 `/web/` 부터).
「모바일 스와이프 복사(이름)」은 키가 품목코드 대신 옵션값 이름(`swipeCode(tbody, true)`, 품목코드 있는 행만).
+39 -3
View File
@@ -145,12 +145,46 @@ def product_basic(
raise _http_from_cafe24(exc) from exc
remember_write(st, product_no, updated if isinstance(updated, dict) else {})
shifted = (_keep_variant_sale_prices(st, api, product_no, before["price"], changes["price"])
if "price" in changes else {})
merged = {**current, **(updated if isinstance(updated, dict) else {}), **changes}
detail = ", ".join(f"{k}: '{before[k]}' → '{v}'" for k, v in changes.items())
if shifted.get("detail"):
detail += f" / 품목 추가금액 조정: {shifted['detail']}"
writes.audit_safe(st, actor=actor, action="update_basic", product_no=product_no,
result="SUCCESS", detail=detail)
logger.info("카페24 상품 %s 기본정보 변경 (%s): %s", product_no, actor, detail)
return {"ok": True, "changed": list(changes.keys()), "product": _scalar_view(merged)}
return {"ok": True, "changed": list(changes.keys()), "product": _scalar_view(merged),
"variants_shifted": shifted.get("count", 0), "variants_error": shifted.get("error", "")}
def _keep_variant_sale_prices(st: Any, api: Any, product_no: int, old_price: str, new_price: str) -> dict[str, Any]:
"""판매가가 바뀐 뒤 품목 판매 가격(판매가 + 추가금액)이 그대로이도록 추가금액을 옮긴다.
판매가는 이미 반영됐으므로 실패해도 예외를 올리지 않고 {"error": …} 로 알린다.
반환 {"count": 반영된 품목 수, "error": 사유, "detail": 감사 로그용}.
"""
try:
variants = _load_options_and_variants(st, api, product_no)["effective_variants"]
requests = store.build_variant_updates(store.shift_additional_amounts(variants, old_price, new_price))
except (Cafe24Error, ValueError) as exc:
logger.warning("카페24 상품 %s 품목 추가금액 조정 준비 실패: %s", product_no, exc)
return {"error": f"품목 추가금액 조정 실패: {exc}", "detail": f"실패 {exc}"}
if not requests:
return {}
results = products.update_variants(api.client, product_no, requests)
sent = {r["variant_code"]: r["additional_amount"] for r in requests}
ok = {r["variant_code"]: sent[r["variant_code"]] for r in results if r["status"] == products.VARIANT_OK}
bad = [r for r in results if r["status"] != products.VARIANT_OK]
if ok:
_save_snapshot_safe(st, product_no, "variants", {c: {"additional_amount": a} for c, a in ok.items()})
detail = "; ".join(f"{c}={a}" for c, a in ok.items())
error = ""
if bad:
error = f"품목 {len(bad)}건 추가금액 조정 실패 — {bad[0]['error']} (옵션/품목 창에서 확인하세요)"
detail += f" / 실패 {len(bad)}건: {bad[0]['error']}"
logger.warning("카페24 상품 %s 품목 추가금액 조정 %s건 실패: %s", product_no, len(bad), bad[0]["error"])
return {"count": len(ok), "error": error, "detail": detail}
# ════════════════════════════════════════════════════════════
@@ -223,6 +257,7 @@ def _variant_view(v: dict[str, Any]) -> dict[str, Any]:
"selling": products._flag(v.get("selling")), # noqa: SLF001
"quantity": v.get("quantity"),
"use_inventory": products._flag(v.get("use_inventory"), default=False), # noqa: SLF001
"display_soldout": products._flag(v.get("display_soldout"), default=False), # noqa: SLF001
"image": str(v.get("image") or ""),
}
@@ -630,7 +665,7 @@ def variants_update(
product_no: int,
payload: dict[str, Any] = Body(default_factory=dict),
) -> dict[str, Any]:
"""품목 여러 건의 자체코드 · 추가금액 · 진열 · 판매를 한 번에 바꾼다 — **행별 결과**.
"""품목 여러 건의 자체코드 · 추가금액 · 진열 · 판매 · 재고(사용·수량·품절표시)를 한 번에 바꾼다 — **행별 결과**.
응답 {"ok": 전부 성공?, "partial": 일부만?, "updated": {code: 반영된 값},
"failed": {code: 사유}, "unknown": {code: 사유}}
@@ -663,7 +698,8 @@ def variants_update(
code = result["variant_code"]
if result["status"] == products.VARIANT_OK:
patch = dict(sent.get(code) or {})
for key in ("custom_variant_code", "additional_amount", "display", "selling", "display_order"):
for key in ("custom_variant_code", "additional_amount", "display", "selling", "display_order",
"use_inventory", "display_soldout", "quantity"):
value = (result.get("variant") or {}).get(key)
if value is not None:
patch[key] = value
+27 -1
View File
@@ -1071,6 +1071,24 @@ def parse_additional_amount(value: object) -> str | None:
return f"{number}.00"
def shift_additional_amounts(variants: list[dict], old_price: object, new_price: object) -> list[dict]:
"""판매가 old → new 일 때 품목 판매 가격(판매가 + 추가금액)이 그대로이도록 추가금액을 옮긴 행들.
build_variant_updates 에 그대로 넣는 화면 행 모양. 판매가가 같거나 숫자가 아니면 [].
"""
try:
delta = int(round(float(old_price))) - int(round(float(new_price))) # type: ignore[arg-type]
except (TypeError, ValueError):
return []
if not delta:
return []
return [
{"variant_code": str(v["variant_code"]),
"additional_amount": str(int(round(float(v.get("additional_amount") or 0))) + delta)}
for v in variants if v.get("variant_code")
]
def build_variant_updates(rows: list[dict]) -> list[dict]:
"""화면 행 목록 → PUT /variants `requests` 배열. 바뀔 것이 없는 행은 뺀다."""
out: list[dict] = []
@@ -1088,9 +1106,17 @@ def build_variant_updates(rows: list[dict]) -> list[dict]:
amount = parse_additional_amount(row["additional_amount"])
if amount is not None:
item["additional_amount"] = amount
for flag in ("display", "selling"):
for flag in ("display", "selling", "use_inventory", "display_soldout"):
if row.get(flag) is not None:
item[flag] = "T" if parse_tristate(row[flag]) else "F"
if row.get("quantity") is not None and str(row["quantity"]).strip() != "":
try:
qty = int(str(row["quantity"]).strip().replace(",", ""))
except ValueError:
raise ValueError("재고 수량은 숫자여야 합니다.") from None
if not 0 <= qty <= ADDITIONAL_AMOUNT_MAX:
raise ValueError("재고 수량은 0 이상이어야 합니다.")
item["quantity"] = qty
# 진열 순서(1~300) — 카페24 문서: 조합형 옵션 품목에만. 화면의 드래그 정렬이 보낸다.
if row.get("display_order") is not None:
try:
@@ -929,6 +929,7 @@
window.erpAlert("상품명은 비울 수 없습니다.");
return;
}
if ("price" in payload) lines.push("\n※ 옵션 품목은 판매 가격이 그대로이도록 추가금액을 함께 조정합니다.");
window.erpConfirm("다음 항목을 카페24에 바로 반영합니다. 계속할까요?\n\n" + lines.join("\n"))
.then(function (ok) {
if (!ok) return;
@@ -943,7 +944,10 @@
form.querySelector('[name="retail_price"]').value = p.retail_price ? String(parseInt(p.retail_price, 10)) : "";
commitValues(form);
if (p.product_name) paintTitle(p.product_name);
setMsg(msg, (data.changed && data.changed.length) ? "카페24에 반영했습니다." : "변경된 값이 없어 보내지 않았습니다.", "is-ok");
var done = (data.changed && data.changed.length) ? "카페24에 반영했습니다." : "변경된 값이 없어 보내지 않았습니다.";
if (data.variants_shifted) done += " 품목 " + data.variants_shifted + "건 추가금액 조정.";
if (data.variants_error) setMsg(msg, done + " " + data.variants_error, "is-err");
else setMsg(msg, done, "is-ok");
})
.catch(function (err) { setMsg(msg, "실패: " + err.message, "is-err"); })
.then(function () { btn.disabled = false; });
+44
View File
@@ -1304,6 +1304,38 @@ def test_delete_variant_wrapper():
assert client.calls[-1][:2] == ("DELETE", "/admin/products/7/variants/P000000R000A")
def test_shift_additional_amounts_keeps_sale_price():
"""판매가 7900 → 12700: 품목 판매 가격(판매가+추가금액)은 그대로, 추가금액만 -4800."""
variants = [{"variant_code": "P000000R000A", "additional_amount": "0.00"},
{"variant_code": "P000000R000B", "additional_amount": "18000.00"}]
assert store.shift_additional_amounts(variants, "7900.00", "12700.00") == [
{"variant_code": "P000000R000A", "additional_amount": "-4800"},
{"variant_code": "P000000R000B", "additional_amount": "13200"},
]
assert store.shift_additional_amounts(variants, "7900.00", "7900") == []
assert store.shift_additional_amounts(variants, "", "7900") == []
def test_keep_variant_sale_prices_puts_shifted_amounts():
from types import SimpleNamespace
from app.modules.cafe24 import routes_product_info as rpi
client = _RouteClient({
"GET /admin/products/7/options": {"option": {"has_option": "T", "options": []}},
"GET /admin/products/7/variants": {"variants": [
{"variant_code": "P000000R000A", "additional_amount": "6000.00"}]},
"PUT /admin/products/7/variants": {"variants": [
{"variant_code": "P000000R000A", "additional_amount": "1000.00"}]},
})
st = fakes.MemoryStore()
out = rpi._keep_variant_sale_prices(st, SimpleNamespace(client=client), 7, "7900.00", "12900.00")
assert out["count"] == 1 and out["error"] == ""
put = [c for c in client.calls if c[0] == "PUT"][-1]
assert put[2]["requests"] == [{"variant_code": "P000000R000A", "additional_amount": "1000.00"}]
assert st.get_write_snapshot(7)["variants"]["data"]["P000000R000A"]["additional_amount"] == "1000.00"
def test_build_variant_updates():
rows = [
{"variant_code": "p000000r000a", "custom_variant_code": " ABC ", "additional_amount": "1,000", "display": "on"},
@@ -1321,6 +1353,18 @@ def test_build_variant_updates():
pass
else:
raise AssertionError("bad code accepted")
# 재고관리 사용 · 수량 · 품절표시
assert store.build_variant_updates([
{"variant_code": "P000000R000A", "use_inventory": "on", "quantity": "1,200", "display_soldout": "off"},
{"variant_code": "P000000R000B", "quantity": ""}, # 빈 수량 → 변경 없음
]) == [{"variant_code": "P000000R000A", "use_inventory": "T", "display_soldout": "F", "quantity": 1200}]
for bad in ("-1", "x"):
try:
store.build_variant_updates([{"variant_code": "P000000R000A", "quantity": bad}])
except ValueError:
pass
else:
raise AssertionError(bad)
# 드래그 정렬 → display_order (1~300)
assert store.build_variant_updates([{"variant_code": "P000000R000A", "display_order": "3"}]) == [
{"variant_code": "P000000R000A", "display_order": 3}
@@ -2,7 +2,7 @@
{% block head_extra %}
{# 출고리스트 작성 팝업의 날짜 칸은 프로젝트 화면의 날짜 팝업을 그대로 쓴다 — project.js 는 PJ_LIB_ONLY 로 부품만 #}
<link rel="stylesheet" href="/static/project.css?v=20261111c" />
<link rel="stylesheet" href="/static/project.css?v=20261111f" />
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
<link rel="stylesheet" href="/static/cupang.css?v=20261023d" />
<script>window.PJ_LIB_ONLY = true; window.PJ_HOLIDAYS = {{ (pj_kr_holidays or {}) | tojson }};</script>
@@ -249,7 +249,7 @@
{% endblock %}
{% block scripts %}
<script src="/static/project.js?v=20261111b" defer></script>
<script src="/static/project.js?v=20261111d" defer></script>
<script src="/static/cupang-outbound.js?v=20261023d" defer></script>
<script>
(function () {
@@ -2,7 +2,7 @@
{% block head_extra %}
{# 프로젝트 화면 부품(설명 편집기·날짜 팝업·멤버 고르기)을 그대로 쓴다 — project.js 는 PJ_LIB_ONLY 로 부품만 #}
<link rel="stylesheet" href="/static/project.css?v=20261111c" />
<link rel="stylesheet" href="/static/project.css?v=20261111f" />
<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=20261111b" defer></script>
<script src="/static/erp-notice-admin.js?v=20261012b" defer></script>
<script src="/static/project.js?v=20261111d" defer></script>
<script src="/static/erp-notice-admin.js?v=20261111a" defer></script>
{% endif %}
{% endblock %}
+3 -2
View File
@@ -79,7 +79,7 @@
## 매출 실적 화면 (2026-10-19)
- KPI 는 **수수료 차감 매출 하나만** 화면 왼쪽 한 줄(`.perf-kpi-line` — 금액 + 비교 기간 대비 %, 모든 기간 공통). 총매출·수수료·월/연 누적 카드는 뺐다.
- KPI 는 **수수료 차감 매출 하나만** 화면 왼쪽 한 줄(`.perf-kpi-line` — 금액 + 비교 기간 대비 % + **전년 같은 기간 대비 %**(2026-11-16, `calc.Period.yoy_range` — 1년 전 같은 날짜, 진행 중이면 오늘까지, 연 보기는 직전 비교가 이미 전년이라 없음), 모든 기간 공통). 총매출·수수료·월/연 누적 카드는 뺐다.
- 일자별 표 기본 보기 = **수수료 차감 매출**(라우터 기본 `metric=net`, 예전에 고른 보기 localStorage 는 안 씀).
- 마지막 업데이트 옆 **다음 업데이트까지 남은 시간** 초 단위 실시간(`router._auto_sync_ctx(store, kind)` — 매출 탭 = 매출 일정, 광고비 탭 = 광고비 일정 → `performance.js initNextUpdate`·`nextScheduleSlot`, `auto_sync.next_slot` 과 같은 규칙으로 화면이 다음 회차 계산, 서버 시각으로 PC 시계 보정, 자동 업데이트(env·그 종류 일정) 꺼지면 숨김).
- **화면 자동 새로 고침**(2026-10-26) — 자동 업데이트(다른 사람이 누른 업데이트 포함)가 끝나면 매출 실적·광고비 화면이 20초 안에 reload.
@@ -87,7 +87,7 @@
(`jobs.last_finished` — 메모리 작업만, DB 안 읽음). 도는 중이면 끝날 때까지, 칸 입력·창(`.perf-modal`)·메뉴·확인 창이 열려 있으면 닫힐 때까지 기다림
(마지막 업데이트 옆 안내), 탭이 안 보이면 안 묻고 다시 보이면 바로. 보는 사람이 직접 누른 업데이트는 진행 창이 새로 그린다. `performance.js initUpdateWatch`.
- 일자별 표 매출 칸 아래 **광고비(ROAS%)** 주황 줄(`--perf-ad`, `dashboard._ad_lines`) — 광고비 탭과 같은 값(`ad_spend.channel_roas`). 쇼핑몰 → 광고 채널은 `dashboard.sales_ad_channels`: 카페24 = 구글·메타 두 줄(이름 붙임), 네이버 = 네이버, 나머지는 `ROAS_SALES_CODE`(쿠팡 ← 쿠팡(윙)). 일 합계 = 보이는 쇼핑몰 광고비 합, ROAS = **일 합계 금액 ÷ 일 합계 광고비**(2026-10-19 — 예전엔 광고비 있는 쇼핑몰 매출만 더했다; `roas` 총매출·`roas_net` 수수료 차감 매출 기준, 보기 기준에 따라 하나만). 광고비 표 없으면 줄 없음.
- 일자별 표 매출 칸 아래 **광고비(ROAS%)** 주황 줄(`--perf-ad`, `dashboard._ad_lines`) — 광고비 탭과 같은 값(`ad_spend.channel_roas`). 쇼핑몰 → 광고 채널은 `dashboard.sales_ad_channels`: 카페24 = 구글·메타·카톡 플친 줄(이름 붙임, 카페24(전체)·카페24(실적) 같은 줄), 네이버 = 네이버, 나머지는 `ROAS_SALES_CODE`(쿠팡 ← 쿠팡(윙)). 일 합계 = 보이는 쇼핑몰 광고비 합, ROAS = **일 합계 금액 ÷ 일 합계 광고비**(2026-10-19 — 예전엔 광고비 있는 쇼핑몰 매출만 더했다; `roas` 총매출·`roas_net` 수수료 차감 매출 기준, 보기 기준에 따라 하나만). 광고비 표 없으면 줄 없음.
- **열 접기**(2026-11-06) — 매출 실적·광고비 일자별 표 머리글 위 작은 화살표 버튼(`.perf-cfold`, `performance.js initColFold`)으로 열 하나씩 접기/펴기(날짜 열 빼고, 일 합계·그룹 열 포함).
접은 열 = 26px 띠(`is-cfold`, 칸 내용 숨김·클릭/메모 안 됨, 너비는 JS `CFOLD_W` 와 CSS 같게, 수동 열 너비 표도 같음). **로그인한 사람 본인에게만** —
`PUT /api/my-col-fold {kind: sales|ads, cols}` → `perf_settings` key `col_fold:<이메일 sha1>`(key 64자 제한) = `{sales, ads}`, 화면은 표 `data-col-fold`(라우터 `_load_col_fold`). 011 미적용이면 다 펼침·저장 503.
@@ -124,6 +124,7 @@
- 탭은 [매출 실적]·[광고비]·[틱톡] + 맨 오른쪽 설정 톱니.
- **표 모양(2026-10-22)** — 매출 실적 표와 같은 `perf-autofit`(열 너비 = 내용 길이, 날짜 열 가로 스크롤 고정).
- **기타광고비** 열(`etc`, 애터미아자몰 오른쪽, 2026-10-22) — 쇼핑몰에 딸리지 않은 광고비 직접 입력. 매출 쇼핑몰이 없어(`ad_spend.NO_SALES`) ROAS 없음·매출 탭 광고비 줄에 안 나옴, 광고비 합계·매출 대비 광고비에는 들어감.
- **카톡 플친** 열(`kakao_pf`, 메타 오른쪽, 2026-11-16) — 직접 입력, `NO_SALES` 라 ROAS 없음. 매출 탭 카페24 칸 아래 구글·메타 다음 줄, 일 합계 광고비에도 더함.
- `ad_spend.py`, 마이그레이션 005 `perf_ad_spend`. 구글·메타·네이버·쿠팡(윙)·쿠팡(로켓)·오늘의집·G마켓·카카오·GS샵·11번가·롯데ON·토스·애터미아자몰 일 광고비를 연·월·일로.
- 칸 = "광고비(ROAS%)"(ROAS = 그 쇼핑몰 매출 ÷ 광고비). 구글·메타·네이버는 계산 안 함 — 광고 보고서 ROAS(마이그레이션 006 `roas`·`metrics`).
- 날짜 칸 직접 입력 + 쿠팡(윙)·쿠팡(로켓)·네이버 광고 보고서 업로드.
+2 -1
View File
@@ -35,6 +35,7 @@ from .manual_upload import MAX_AMOUNT, MAX_DATA_ROWS, MAX_ERRORS, MAX_FILE_BYTES
CHANNELS: tuple[tuple[str, str], ...] = (
("google", "구글"),
("meta", "메타"),
("kakao_pf", "카톡 플친"), # 2026-11-16 — 카카오톡 플러스친구(자사몰 광고, 직접 입력), ROAS 없음, 매출 탭 카페24 줄에 구글·메타 아래
("naver", "네이버"),
("coupang_wing", "쿠팡(윙)"),
("coupang_rocket", "쿠팡(로켓)"),
@@ -55,7 +56,7 @@ CHANNEL_CODES = tuple(c for c, _ in CHANNELS)
# 여러 날(주·월·합계)의 ROAS = Σ(그날 ROAS × 그날 광고비) ÷ Σ광고비(ROAS 가 있는 날만) = 광고 매출 합 ÷ 광고비 합.
FILE_ROAS = frozenset({"google", "meta", "naver"})
NO_ROAS = FILE_ROAS # 예전 이름(계산 안 하는 채널)
NO_SALES = frozenset({"etc"}) # 매출 쇼핑몰이 없는 채널 — ROAS 를 계산하지 않고 매출 탭 광고비 줄에도 안 나온다
NO_SALES = frozenset({"etc", "kakao_pf"}) # ROAS 를 계산하지 않는 채널 — 매출 탭 광고비 줄은 sales_ad_channels 에 적은 것만(카톡 플친 = 카페24)
ROAS_SALES_CODE: dict[str, str] = {c: c for c in CHANNEL_CODES if c not in FILE_ROAS and c not in NO_SALES}
ROAS_SALES_CODE["coupang_wing"] = "coupang"
TIKTOK = "tiktok" # 광고 API 채널이지만 CHANNELS 에 없다 — 틱톡 탭(build_tiktok_dashboard)에서만 보인다
+11
View File
@@ -156,6 +156,17 @@ class Period:
unit = {"day": "전일", "week": "전주", "month": "전월", "year": "전년"}.get(self.kind, "직전 기간")
return prev_start, prev_end, f"{unit} {note}".strip()
def yoy_range(self, today: date) -> tuple[date, date, str]:
"""1년 전 같은 날짜 범위(2026-11-16 매출 KPI 전년 대비). 진행 중인 기간이면 오늘까지만. 2/29 → 2/28."""
def back(d: date) -> date:
try:
return d.replace(year=d.year - 1)
except ValueError:
return d.replace(year=d.year - 1, day=28)
end = today if self.start <= today < self.end else self.end
return back(self.start), back(end), "전년 같은 기간"
def resolve_period(
kind: str,
+9 -4
View File
@@ -161,7 +161,7 @@ def amount_text(value: Any, unit: str = "won") -> str:
def _ad_lines(store: Any, table: list[dict[str, Any]], codes: Sequence[str], cells: Mapping[Any, Any],
period: Any, q_start: date, q_end: date) -> None:
"""매출 칸 아래 광고비(ROAS%) — 광고비 화면과 같은 값(ROAS = 그 쇼핑몰 매출 ÷ 광고비, 구글·메타·네이버는 보고서 ROAS).
카페24 = 구글·메타 두 줄. 행마다 r["ads"][쇼핑몰] = [{label, amount, roas}], r["ads_total"] = 보이는 쇼핑몰 광고비 합.
카페24 = 구글·메타·카톡 플친 줄. 행마다 r["ads"][쇼핑몰] = [{label, amount, roas}], r["ads_total"] = 보이는 쇼핑몰 광고비 합.
일 합계 ROAS 는 단순하게 일 합계 금액 ÷ 일 합계 광고비(2026-10-19) — roas = 총매출 기준, roas_net = 수수료 차감 매출 기준
(화면 표시 기준에 따라 하나만 보인다). 예전엔 광고비가 있는 쇼핑몰 매출만 더해 일 합계 금액과 맞지 않았다.
광고비 표(005)가 없거나 읽기 실패면 줄 없음."""
@@ -217,11 +217,11 @@ def _ad_lines(store: Any, table: list[dict[str, Any]], codes: Sequence[str], cel
def sales_ad_channels() -> dict[str, tuple[tuple[str, str], ...]]:
"""쇼핑몰(매출 코드) → 그 아래 보일 광고 채널 [(채널, 줄 이름)]. 카페24 = 구글·메타(자사몰 광고), 네이버 = 네이버 광고,
"""쇼핑몰(매출 코드) → 그 아래 보일 광고 채널 [(채널, 줄 이름)]. 카페24 = 구글·메타·카톡 플친(자사몰 광고), 네이버 = 네이버 광고,
나머지는 광고비 화면의 ROAS 매출 쇼핑몰(쿠팡(윙) 광고 → 쿠팡 매출)."""
from . import ad_spend # noqa: WPS433
out: dict[str, tuple[tuple[str, str], ...]] = {"cafe24": (("google", "구글"), ("meta", "메타")), "naver": (("naver", ""),)}
out: dict[str, tuple[tuple[str, str], ...]] = {"cafe24": (("google", "구글"), ("meta", "메타"), ("kakao_pf", "카톡 플친")), "naver": (("naver", ""),)}
for ch, c in ad_spend.ROAS_SALES_CODE.items():
out[c] = out.get(c, ()) + ((ch, ""),)
return out
@@ -261,7 +261,10 @@ def build_dashboard(store: Any, *, kind: str, anchor: date, today: date,
m_cmp_start, m_cmp_end, m_cmp_label = month_period.compare_range(today)
y_cmp_start, y_cmp_end, y_cmp_label = year_period.compare_range(today)
q_start = min(period.start, cmp_start, m_cmp_start, y_cmp_start)
# 전년 같은 기간 대비(2026-11-16) — 연 보기는 직전 비교가 이미 전년이라 뺀다
yoy = period.yoy_range(today) if period.kind != "year" else None
q_start = min(period.start, cmp_start, m_cmp_start, y_cmp_start, *(yoy[:1] if yoy else ()))
q_end = max(period.end, year_period.end)
gb = groupbuy_code(markets)
# 공동구매를 필터로 뺐어도 카페24(실적) 계산엔 필요 — 합계·그래프는 아래에서 codes 만 더한다
@@ -292,6 +295,8 @@ def build_dashboard(store: Any, *, kind: str, anchor: date, today: date,
{"key": "net", "label": f"{period_word} 수수료 차감 매출", "value": cur.net, "primary": True,
"delta": calc.pct_change(cur.net, prev.net), "cmp": cmp_label},
]
if yoy:
kpis[0].update(yoy_delta=calc.pct_change(cur.net, calc.sum_range(summary, codes, yoy[0], yoy[1]).net), yoy_cmp=yoy[2])
share = calc.by_code(summary, codes, period.start, period.end)
# 비중 그래프·월 누적 표의 카페24 줄 = 카페24(실적) — 줄을 더하면 합계와 같다
@@ -111,6 +111,14 @@
{% if k.delta > 0 %}▲{% elif k.delta < 0 %}▼{% else %}–{% endif %} {{ "%.1f" | format(k.delta | abs) }}%</span>
<span class="perf-muted">{{ k.cmp }} 대비</span>
{% endif %}
{% if k.yoy_cmp %}
{% if k.yoy_delta is none %}<span class="perf-muted">{{ k.yoy_cmp }} 비교 없음</span>
{% else %}
<span class="perf-delta {% if k.yoy_delta == 0 %}is-flat{% elif k.yoy_delta > 0 %}is-up{% else %}is-down{% endif %}">
{% if k.yoy_delta > 0 %}▲{% elif k.yoy_delta < 0 %}▼{% else %}–{% endif %} {{ "%.1f" | format(k.yoy_delta | abs) }}%</span>
<span class="perf-muted">{{ k.yoy_cmp }} 대비</span>
{% endif %}
{% endif %}
</div>
{% endfor %}
@@ -120,7 +120,7 @@ class _Store:
def test_ad_dashboard_month():
ctx = ads.build_ad_dashboard(_Store(), kind="month", anchor=date(2026, 10, 7), today=date(2026, 10, 7),
sales_codes=["cafe24"])
assert ctx["codes"] == ["google", "meta", "naver", "coupang_wing", "coupang_rocket", "ohouse", "gmarket", "kakao",
assert ctx["codes"] == ["google", "meta", "kakao_pf", "naver", "coupang_wing", "coupang_rocket", "ohouse", "gmarket", "kakao",
"gsshop", "elevenst", "lotteon", "toss", "atomy", "etc"] # 기타광고비(2026-10-22) = 애터미아자몰 오른쪽
assert ctx["names"]["etc"] == "기타광고비" and ctx["roas_basis"]["etc"] == "" and "etc" not in ads.ROAS_SALES_CODE # 매출 쇼핑몰 없음 = ROAS 없음
k = {x["key"]: x for x in ctx["kpis"]}
@@ -51,7 +51,7 @@ class _Store:
def test_sales_ad_channels_mapping():
m = dashboard.sales_ad_channels()
assert m["cafe24"] == (("google", "구글"), ("meta", "메타"))
assert m["cafe24"] == (("google", "구글"), ("meta", "메타"), ("kakao_pf", "카톡 플친"))
assert m["naver"] == (("naver", ""),) and m["coupang"] == (("coupang_wing", ""),)
assert m["coupang_rocket"] == (("coupang_rocket", ""),) and "google" not in m
@@ -187,6 +187,29 @@ def test_kpi_is_net_only():
ctx = dashboard.build_dashboard(_Store(), kind="week", anchor=TODAY, today=TODAY)
assert [k["key"] for k in ctx["kpis"]] == ["net"]
assert ctx["kpis"][0]["value"] == 2_600_000 + 1_234_567
assert ctx["kpis"][0]["yoy_cmp"] == "전년 같은 기간" and ctx["kpis"][0]["yoy_delta"] is None # 작년 매출 없음
assert "yoy_cmp" not in dashboard.build_dashboard(_Store(), kind="year", anchor=TODAY, today=TODAY)["kpis"][0]
def test_kakao_pf_line_under_cafe24():
"""카톡 플친(2026-11-16) — 광고비 탭 열, ROAS 없음, 매출 탭 카페24 칸 아래 구글·메타 다음 줄."""
from app.modules.performance import ad_spend
assert ad_spend.CHANNEL_NAMES["kakao_pf"] == "카톡 플친" and "kakao_pf" not in ad_spend.ROAS_SALES_CODE
class _S(_Store):
def ad_amounts(self, start, end):
rows = {(date(2026, 10, 5), "google"): 100_000, (date(2026, 10, 5), "kakao_pf"): 30_000}
rows = {k: v for k, v in rows.items() if start <= k[0] <= end}
return rows, {k: "manual" for k in rows}
def ad_roas(self, start, end):
return {}
day5 = next(r for r in dashboard.build_dashboard(_S(), kind="week", anchor=TODAY, today=TODAY)["table"]
if r.get("date") == "2026-10-05")
assert [(a["label"], a["amount"], a["roas"]) for a in day5["ads"]["cafe24"]] == [("구글", 100_000, None), ("카톡 플친", 30_000, None)]
assert day5["ads_total"]["amount"] == 130_000
def test_pages_render_formula_cells_future_inputs_and_total_on_top(monkeypatch):
@@ -160,6 +160,11 @@ def test_periods():
# 진행 중인 달 — 전월 같은 날까지(말일 넘지 않게)
s, e, _ = calc.resolve_period("month", date(2026, 3, 31)).compare_range(today=date(2026, 3, 31))
assert (s, e) == (date(2026, 2, 1), date(2026, 2, 28))
# 전년 같은 기간 — 진행 중이면 오늘까지, 2/29 → 2/28
s, e, label = calc.resolve_period("month", date(2026, 11, 16)).yoy_range(today=date(2026, 11, 16))
assert (s, e, label) == (date(2025, 11, 1), date(2025, 11, 16), "전년 같은 기간")
s, e, _ = calc.resolve_period("month", date(2028, 2, 10)).yoy_range(today=date(2028, 3, 5))
assert (s, e) == (date(2027, 2, 1), date(2027, 2, 28))
assert calc.pct_change(110, 100) == 10.0 and calc.pct_change(5, 0) is None and calc.pct_change(0, 0) is None
+4 -1
View File
@@ -17,6 +17,8 @@
- 용어는 **"업무"**(2026-10-13 "작업"에서 다시 통일 — 화면·메시지·알림 제목, 코드·DB 는 그대로)·"세부 업무"·"메인 업무 추가". ERP 메뉴 이름은 "Project"(`app/main.py` 모듈 목록 title).
- 화면 기능을 바꾸면 도움말(`/project/help`)도 같이 고친다.
- UI 버그는 로컬 헤드리스 크롬/엣지로 렌더·좌표 덤프해 재현 후 고칠 것.
- **시각 고르기 = 공용 시각 팝업**(2026-11-11, `openTimePopover`·`enhanceTimeInput`, `PJLib` 로도) — 날짜 팝업 모양, 시 00~23·분 5분 단위, 끝에서 멈춤.
프로젝트(긴급 공지 포함)에서 `<input type="time">` 기본 시계 금지. 모달 dialog 안 칸이면 그 창 안에 popover 로 붙음(body 면 inert 로 마우스가 안 먹음).
- 날짜 팝업(`openDatePopover`·`enhanceDateInput`·`.pj-datepop` CSS)은 다른 모듈용 공용 복사본이 있다 — `app/static/erp-datepop.js`·`.css`
(2026-10-27, 휴가 신청 날짜 칸). 모양·동작을 바꾸면 그쪽도 같이 고칠 것(나중에 프로젝트도 공용 파일로 옮기면 하나가 됨).
@@ -101,7 +103,8 @@
카드·목록·내 업무·세부 업무·업무 창 마감 칸 = `dueInfo(…, daily)` → `.is-daily`(CSS ::before repeat 아이콘 + "매일", 노랑).
알림 = `reminders.run_daily_alerts`(데몬 1분 주기, 영업일, `daily_alert_times` 중 지난 가장 늦은 시각 하나 — `task_reminders` kind `daily@HH:MM`·그날로 중복 방지)
→ 담당자(없으면 협업자)에게 `type=daily` 알림 → 큰 팝업 `_ALERT_TYPES` 에 포함, 줄 배경 노랑(`.pj-alert-item.is-daily`), PC 알림 프로그램 `Alert.IsDaily`.
새 업무 만들기 칸(보드 아래 추가·세부 업무 추가 줄)에는 [매일] 없음 — 만든 뒤 날짜 칸에서. 033 미적용이면 [매일] 숨김·PUT 503·알림 skip.
추가 칸(보드 아래 메인 업무 추가·카드 세부 업무 추가 줄)에도 [매일] — `data-daily-ready`(`db.daily_ready`), `POST …/tasks` 의 `repeat_daily: true` = 만든 뒤 `update_task` 로 켬.
033 미적용이면 [매일] 숨김·PUT/POST 503·알림 skip.
- 수신함은 확인 안 한 태그·읽지 않은 알림만(2026-10-08) — [확인] 버튼 없이 줄을 누르면 읽음·확인 처리(같은 작업 줄 함께) + 페이지 이동 없이 오른쪽 iframe 패널, 다른 줄을 고르거나 패널을 닫으면 그 줄은 목록에서 빠짐.
- 나를 태그하거나 작업이 배정되면 프로젝트 화면 가운데 아래에 깜박이는 큰 팝업(닫기 전까지, `initTaskAlerts` + `GET /api/notifications/alerts`).
+12
View File
@@ -1758,6 +1758,18 @@ class ProjectStore:
([int(i) for i in ordered_ids], stage_id),
)
def daily_ready(self) -> bool:
"""tasks.repeat_daily(마이그레이션 033, 매일 하는 업무) 가 있는지. 한 번 켜지면 기억."""
if getattr(self, "_daily_ready", False):
return True
with self._pool.connection() as conn:
ok = bool(conn.execute(
"SELECT 1 FROM information_schema.columns WHERE table_schema = 'public' "
"AND table_name = 'tasks' AND column_name = 'repeat_daily'"
).fetchone())
self._daily_ready = ok
return ok
def link_order_ready(self) -> bool:
"""task_project_links.sort_order(마이그레이션 032) 가 있는지. 한 번 켜지면 기억."""
if getattr(self, "_link_order_ready", False):
+11
View File
@@ -901,6 +901,7 @@ def project_page(request: Request, project_id: int) -> HTMLResponse:
"user": user,
**_role_ctx(user, request),
"pj_options": _project_options(st),
"pj_daily_ready": st.daily_ready(), # 033 — 새 업무·세부 업무 추가 칸 날짜 팝업의 [매일]
"can_manage": can_manage,
"nav_items": build_erp_nav(user, active="project"),
"page_title": project["name"],
@@ -1549,12 +1550,22 @@ def _create_task_for(
"""작업 만들기 공통(작업 창 등) — 권한(멤버)·담당자 확인·만들기·자동 협업자·배정/완료 알림·@태그.
돌려주는 값: (작업, 태그하지 못한 이메일). 회의록 [적용]은 같은 확인·후처리를 쓰되 만들기만 줄 잠금 트랜잭션 안에서."""
project, followers = _task_create_checks(request, st, user, project_id, payload)
daily = payload.get("repeat_daily", False) # 추가 칸 날짜 팝업 [매일](033) — 만든 뒤 켠다(마감일은 비움)
if not isinstance(daily, bool):
raise HTTPException(status_code=400, detail="매일 반복 값이 올바르지 않습니다.")
try:
task = st.create_task(**_task_create_fields(user, project_id, payload))
except ValueError as exc:
raise HTTPException(status_code=400, detail=str(exc))
except KeyError as exc:
raise HTTPException(status_code=404, detail=str(exc))
if daily:
try:
task = st.update_task(task_id=task["id"], fields={"repeat_daily": True}, actor=user["email"])
except UndefinedColumn:
raise HTTPException(status_code=503, detail="DB 마이그레이션 033(매일 하는 업무)이 아직 적용되지 않았습니다.")
task.pop("_newly_assigned", None)
task.pop("_newly_completed", None)
return task, _task_created_effects(request, st, user, project, task, followers, bg)
@@ -129,4 +129,4 @@
document.documentElement.dataset.pjFont = pf;
} catch (_) {}
</script>
<script src="/static/project-options.js?v=20261111b" defer></script>
<script src="/static/project-options.js?v=20261111e" defer></script>
@@ -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=20261111c" />
<link rel="stylesheet" href="/static/project.css?v=20261111f" />
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
{% endblock %}
@@ -289,5 +289,5 @@
<script src="/static/project-goal-text.js?v=20261026a" defer></script>
<script src="/static/project-meeting-cells.js?v=20261012a" defer></script>
<script src="/static/project.js?v=20261111b" defer></script>
<script src="/static/project.js?v=20261111d" defer></script>
{% endblock %}
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/project.css?v=20261111c" />
<link rel="stylesheet" href="/static/project.css?v=20261111f" />
<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=20261026a" defer></script>
<script src="/static/project.js?v=20261111b" defer></script>
<script src="/static/project.js?v=20261111d" defer></script>
{% endblock %}
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/project.css?v=20261111c" />
<link rel="stylesheet" href="/static/project.css?v=20261111f" />
<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=20261111c" />
<link rel="stylesheet" href="/static/project.css?v=20261111f" />
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
{% endblock %}
@@ -106,5 +106,5 @@
{% include "project/_side_modals.html" %}
{% include "project/_member_tasks_modal.html" %}
<script src="/static/project.js?v=20261111b" defer></script>
<script src="/static/project.js?v=20261111d" defer></script>
{% endblock %}
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/project.css?v=20261111c" />
<link rel="stylesheet" href="/static/project.css?v=20261111f" />
<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=20261111b" defer></script>
<script src="/static/project.js?v=20261111d" defer></script>
{% endblock %}
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/project.css?v=20261111c" />
<link rel="stylesheet" href="/static/project.css?v=20261111f" />
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
{% endblock %}
@@ -108,5 +108,5 @@
});
})();
</script>
<script src="/static/project.js?v=20261111b" defer></script>
<script src="/static/project.js?v=20261111d" defer></script>
{% endblock %}
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/project.css?v=20261111c" />
<link rel="stylesheet" href="/static/project.css?v=20261111f" />
<!-- 구글 머티리얼 심볼(담당자 아이콘 등) — self-host -->
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
<!-- 타임라인 vis-timeline — self-host -->
@@ -27,7 +27,7 @@
<div class="pj-wrap pj-project-view"
data-project-id="{{ project.id }}"
data-can-manage="{{ 'true' if can_manage else 'false' }}"
data-is-pro="{{ 'true' if pj_pro else 'false' }}" data-all-view="{{ 'true' if pj_all_view else 'false' }}" data-is-padmin="{{ 'true' if pj_admin else 'false' }}"
data-is-pro="{{ 'true' if pj_pro else 'false' }}" data-all-view="{{ 'true' if pj_all_view else 'false' }}" data-daily-ready="{{ '1' if pj_daily_ready else '' }}" data-is-padmin="{{ 'true' if pj_admin else 'false' }}"
data-is-super="{{ 'true' if user.is_super_admin else 'false' }}"
data-default-view="{{ pj_options.default_view if pj_options else 'board' }}"
data-board-cover="{{ '0' if pj_options and not pj_options.board_cover else '1' }}"
@@ -476,5 +476,5 @@
</script>
<script src="/static/vendor/vis-timeline/vis-timeline-graph2d.min.js"></script>
<script src="/static/project.js?v=20261111b" defer></script>
<script src="/static/project.js?v=20261111d" defer></script>
{% endblock %}
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/project.css?v=20261111c" />
<link rel="stylesheet" href="/static/project.css?v=20261111f" />
<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=20261111b" defer></script>
<script src="/static/project.js?v=20261111d" defer></script>
{% endblock %}
+55 -28
View File
@@ -149,10 +149,16 @@
return out + "</select>";
}
// 품목 토글 — [켜짐, 꺼짐] 표기
var FLAG_LABELS = {
display: ["진열", "미진열"], selling: ["판매", "중지"],
use_inventory: ["사용", "미사용"], display_soldout: ["표시", "안함"]
};
var FLAGS = Object.keys(FLAG_LABELS);
function toggleBtn(flag, on) {
var label = flag === "display" ? (on ? "진열" : "미진열") : (on ? "판매" : "중지");
return '<button type="button" class="cf24-v-toggle' + (on ? " is-on" : "") + '" data-flag="' + flag +
'" data-on="' + (on ? 1 : 0) + '" data-initial="' + (on ? 1 : 0) + '">' + label + "</button>";
'" data-on="' + (on ? 1 : 0) + '" data-initial="' + (on ? 1 : 0) + '">' + FLAG_LABELS[flag][on ? 0 : 1] + "</button>";
}
function paintToggle(btn, on, resetInitial) {
@@ -160,7 +166,25 @@
if (resetInitial) btn.dataset.initial = btn.dataset.on;
btn.classList.toggle("is-on", on);
btn.classList.toggle("is-dirty", btn.dataset.on !== btn.dataset.initial);
btn.textContent = btn.dataset.flag === "display" ? (on ? "진열" : "미진열") : (on ? "판매" : "중지");
btn.textContent = FLAG_LABELS[btn.dataset.flag][on ? 0 : 1];
}
// 재고관리 · 재고 수량 · 품절표시 칸 (진열·판매 다음)
var INVENTORY_TH = '<th class="cf24-v-flag">재고관리</th><th class="cf24-v-qty">재고</th><th class="cf24-v-flag">품절표시</th>';
function inventoryCells(variant) {
var qty = variant && variant.quantity != null ? String(variant.quantity) : "0";
return '<td class="cf24-v-flag">' + toggleBtn("use_inventory", !!(variant && variant.use_inventory)) + "</td>" +
'<td class="cf24-v-qty"><input type="text" name="quantity" inputmode="numeric" value="' + esc(qty) + '" /></td>' +
'<td class="cf24-v-flag">' + toggleBtn("display_soldout", !!(variant && variant.display_soldout)) + "</td>";
}
// 행의 품목 입력 요소들 — 저장 패치(variantPatch/newRowPatch)용
function variantFields(tr, into) {
into.custom = tr.querySelector('[name="custom_variant_code"]');
into.amount = tr.querySelector('[name="additional_amount"]');
into.quantity = tr.querySelector('[name="quantity"]');
FLAGS.forEach(function (flag) { into[flag] = tr.querySelector('.cf24-v-toggle[data-flag="' + flag + '"]'); });
return into;
}
function bindToggles(container) {
@@ -339,7 +363,7 @@
});
tbody.addEventListener("keydown", function (e) {
// isComposing: 한글 조합 중 Enter 는 글자 확정용이다 — 여기서 옮기면 글자가 깨지거나 두 칸 내려간다.
if (e.isComposing || !e.target.matches('[name="option_text"], [name="custom_variant_code"], [name="additional_amount"], .cf24-sale-price')) return;
if (e.isComposing || !e.target.matches('[name="option_text"], [name="custom_variant_code"], [name="additional_amount"], .cf24-sale-price, [name="quantity"]')) return;
var down = e.key === "Enter" || e.key === "ArrowDown";
if (!down && e.key !== "ArrowUp") return;
e.preventDefault();
@@ -425,6 +449,7 @@
salePriceCell(variant ? variant.additional_amount : "0") +
'<td class="cf24-v-flag">' + toggleBtn("display", variant ? !!variant.display : true) + "</td>" +
'<td class="cf24-v-flag">' + toggleBtn("selling", variant ? !!variant.selling : true) + "</td>" +
inventoryCells(variant) +
'<td class="cf24-u-del">' + (awaiting ? "" : '<button type="button" class="cf24-u-remove" title="' + (isNewRow ? "행 삭제" : "품목 삭제 (카페24에 바로 반영)") + '">✕</button>') + "</td>" +
"</tr>";
}
@@ -449,7 +474,7 @@
"</div>" +
'<div class="cf24-u-tablewrap"><table class="cf24-variants cf24-u-table"><thead><tr>' +
'<th class="cf24-u-drag"></th><th class="cf24-u-thumb">썸네일</th><th>옵션값 이름</th><th class="cf24-v-syscode">품목코드</th>' +
'<th class="cf24-v-code">자체 품목코드</th><th class="cf24-v-amount">추가금액</th><th class="cf24-v-amount">판매 가격</th><th class="cf24-v-flag">진열</th><th class="cf24-v-flag">판매</th><th class="cf24-u-del"></th>' +
'<th class="cf24-v-code">자체 품목코드</th><th class="cf24-v-amount">추가금액</th><th class="cf24-v-amount">판매 가격</th><th class="cf24-v-flag">진열</th><th class="cf24-v-flag">판매</th>' + INVENTORY_TH + '<th class="cf24-u-del"></th>' +
"</tr></thead><tbody id=\"cf24-u-body\">";
rows.forEach(function (r, i) { html += rowHtml(r, canDrag, i); });
if (isNew) html += rowHtml({ index: null, value: null, variant: null }, true, null);
@@ -569,8 +594,8 @@
link: tr.querySelector('[name="option_link_image"]').value,
custom: tr.querySelector('[name="custom_variant_code"]').value,
amount: tr.querySelector('[name="additional_amount"]').value,
display: tr.querySelector('.cf24-v-toggle[data-flag="display"]').dataset.on,
selling: tr.querySelector('.cf24-v-toggle[data-flag="selling"]').dataset.on
quantity: tr.querySelector('[name="quantity"]').value,
flags: FLAGS.map(function (flag) { return tr.querySelector('.cf24-v-toggle[data-flag="' + flag + '"]').dataset.on; })
};
});
}
@@ -598,11 +623,12 @@
set('[name="option_text"]', k.text);
set('[name="custom_variant_code"]', k.custom);
set('[name="additional_amount"]', k.amount);
set('[name="quantity"]', k.quantity);
if (k.image) { tr.querySelector('[name="option_image_file"]').value = k.image; }
if (k.link) { tr.querySelector('[name="option_link_image"]').value = k.link; }
["display", "selling"].forEach(function (flag) {
FLAGS.forEach(function (flag, i) {
var btn = tr.querySelector('.cf24-v-toggle[data-flag="' + flag + '"]');
if (btn && btn.dataset.on !== k[flag]) paintToggle(btn, k[flag] === "1", false);
if (btn && btn.dataset.on !== k.flags[i]) paintToggle(btn, k.flags[i] === "1", false);
});
});
}
@@ -766,7 +792,7 @@
/* ── 저장 (통합) ── */
function collectUnified(tbody) {
return Array.prototype.map.call(tbody.children, function (tr, i) {
return {
return variantFields(tr, {
tr: tr,
position: i,
isNew: tr.classList.contains("is-new"),
@@ -774,12 +800,8 @@
code: tr.dataset.code || "",
text: tr.querySelector('[name="option_text"]').value.trim(),
image: tr.querySelector('[name="option_image_file"]').value,
link: tr.querySelector('[name="option_link_image"]').value,
custom: tr.querySelector('[name="custom_variant_code"]'),
amount: tr.querySelector('[name="additional_amount"]'),
display: tr.querySelector('.cf24-v-toggle[data-flag="display"]'),
selling: tr.querySelector('.cf24-v-toggle[data-flag="selling"]')
};
link: tr.querySelector('[name="option_link_image"]').value
});
});
}
@@ -801,20 +823,25 @@
var any = false;
if (r.custom.value !== r.custom.defaultValue) { patch.custom_variant_code = r.custom.value.trim(); any = true; }
if (r.amount.value !== r.amount.defaultValue) { patch.additional_amount = r.amount.value.trim() || "0"; any = true; }
if (r.display.dataset.on !== r.display.dataset.initial) { patch.display = r.display.dataset.on === "1" ? "on" : "off"; any = true; }
if (r.selling.dataset.on !== r.selling.dataset.initial) { patch.selling = r.selling.dataset.on === "1" ? "on" : "off"; any = true; }
if (r.quantity.value !== r.quantity.defaultValue) { patch.quantity = r.quantity.value.trim() || "0"; any = true; }
FLAGS.forEach(function (flag) {
if (r[flag].dataset.on !== r[flag].dataset.initial) { patch[flag] = r[flag].dataset.on === "1" ? "on" : "off"; any = true; }
});
if (withOrder) { patch.display_order = r.position + 1; any = true; }
return any ? patch : null;
}
// 새 행(아직 품목 없음)의 초기 패치 — 기본값(빈 코드·0원·진열·판매)과 다른 것만
// 새 행(아직 품목 없음)의 초기 패치 — 기본값(빈 코드·0원·진열·판매·재고관리 미사용·재고 0·품절표시 안함)과 다른 것만
function newRowPatch(r, code) {
var p = { variant_code: code };
var any = false;
if (r.custom.value.trim()) { p.custom_variant_code = r.custom.value.trim(); any = true; }
if (amountPlain(r.amount.value) !== "0") { p.additional_amount = r.amount.value.trim(); any = true; }
if (r.display.dataset.on !== "1") { p.display = "off"; any = true; }
if (r.selling.dataset.on !== "1") { p.selling = "off"; any = true; }
if (amountPlain(r.quantity.value) !== "0") { p.quantity = r.quantity.value.trim(); any = true; }
FLAGS.forEach(function (flag) {
var defaultOn = flag === "display" || flag === "selling";
if ((r[flag].dataset.on === "1") !== defaultOn) { p[flag] = defaultOn ? "off" : "on"; any = true; }
});
return any ? p : null;
}
@@ -866,7 +893,7 @@
var lines = [];
if (optionsChanged) lines.push("옵션명·옵션값 이름/썸네일/표시방식");
if (patches.length) lines.push("품목 " + patches.length + "건 (자체코드·추가금액·진열/판매" + (orderChanged ? "·순서" : "") + ")");
if (patches.length) lines.push("품목 " + patches.length + "건 (자체코드·추가금액·진열/판매·재고" + (orderChanged ? "·순서" : "") + ")");
window.erpConfirm("카페24에 바로 반영합니다. 계속할까요?\n\n- " + lines.join("\n- ")).then(function (ok) {
if (!ok) return;
saveBtn.disabled = true;
@@ -1013,7 +1040,7 @@
html += '<p class="cf24-muted">품목이 아직 조회되지 않았습니다. 잠시 뒤 창을 닫았다 다시 여세요.</p>';
} else {
html += '<div class="cf24-variants-wrap"><table class="cf24-variants"><thead><tr><th class="cf24-v-imgcol"></th><th>옵션</th><th class="cf24-v-syscode">품목코드</th>' +
'<th class="cf24-v-code">자체 품목코드</th><th class="cf24-v-amount">추가금액</th><th class="cf24-v-amount">판매 가격</th><th class="cf24-v-flag">진열</th><th class="cf24-v-flag">판매</th><th class="cf24-u-del"></th></tr></thead><tbody>';
'<th class="cf24-v-code">자체 품목코드</th><th class="cf24-v-amount">추가금액</th><th class="cf24-v-amount">판매 가격</th><th class="cf24-v-flag">진열</th><th class="cf24-v-flag">판매</th>' + INVENTORY_TH + '<th class="cf24-u-del"></th></tr></thead><tbody>';
variants.forEach(function (v) {
var label = v.options.map(function (o) { return o.value; }).join(" / ") || v.variant_code;
html += '<tr class="cf24-v-item" data-code="' + esc(v.variant_code) + '">' +
@@ -1024,6 +1051,7 @@
'<td class="cf24-v-amount"><input type="text" name="additional_amount" inputmode="numeric" value="' + esc(amountPlain(v.additional_amount)) + '" /></td>' +
salePriceCell(v.additional_amount) +
'<td class="cf24-v-flag">' + toggleBtn("display", !!v.display) + "</td><td class=\"cf24-v-flag\">" + toggleBtn("selling", !!v.selling) + "</td>" +
inventoryCells(v) +
'<td class="cf24-u-del"><button type="button" class="cf24-u-remove" data-code="' + esc(v.variant_code) + '" title="품목 삭제 (카페24에 바로 반영)">✕</button></td></tr>';
});
html += "</tbody></table></div><div class=\"cf24-side-actions\" style=\"margin-top:8px;\"><span class=\"cf24-muted\" id=\"cf24-var-msg\"></span>" +
@@ -1106,9 +1134,7 @@
var saveBtn = body.querySelector("#cf24-var-save");
var rows = [];
wrap.querySelectorAll("tr[data-code]").forEach(function (tr) {
var r = { code: tr.dataset.code, custom: tr.querySelector('[name="custom_variant_code"]'), amount: tr.querySelector('[name="additional_amount"]'),
display: tr.querySelector('.cf24-v-toggle[data-flag="display"]'), selling: tr.querySelector('.cf24-v-toggle[data-flag="selling"]') };
var p = variantPatch(r, false);
var p = variantPatch(variantFields(tr, { code: tr.dataset.code }), false);
if (p) rows.push(p);
});
if (!rows.length) { setMsg(msg, "바뀐 품목이 없습니다.", ""); return; }
@@ -1125,6 +1151,7 @@
if (!tr) return;
if (u.custom_variant_code !== undefined) tr.querySelector('[name="custom_variant_code"]').value = u.custom_variant_code;
if (u.additional_amount !== undefined) tr.querySelector('[name="additional_amount"]').value = amountPlain(u.additional_amount);
if (u.quantity != null) tr.querySelector('[name="quantity"]').value = String(u.quantity);
tr.querySelectorAll(".cf24-v-toggle").forEach(function (btn) {
if (u[btn.dataset.flag] !== undefined) paintToggle(btn, !!u[btn.dataset.flag], true);
});
@@ -1132,8 +1159,8 @@
if (v.variant_code !== code) return;
if (u.custom_variant_code !== undefined) v.custom_variant_code = u.custom_variant_code;
if (u.additional_amount !== undefined) v.additional_amount = u.additional_amount;
if (u.display !== undefined) v.display = !!u.display;
if (u.selling !== undefined) v.selling = !!u.selling;
if (u.quantity != null) v.quantity = u.quantity;
FLAGS.forEach(function (flag) { if (u[flag] !== undefined) v[flag] = !!u[flag]; });
});
});
commitValues(wrap);
+5 -2
View File
@@ -1331,7 +1331,8 @@ body.cf24-modal-open {
}
.cf24-variants th {
font-weight: 500;
font-weight: 700;
text-align: center;
font-size: 12px;
color: var(--color-midtone-gray, #737373);
white-space: nowrap;
@@ -1348,7 +1349,9 @@ body.cf24-modal-open {
.cf24-v-code { width: 132px; }
.cf24-v-amount { width: 90px; }
.cf24-v-amount input { text-align: right; }
.cf24-v-flag { width: 56px; text-align: center; }
.cf24-v-qty { width: 70px; }
.cf24-v-qty input { text-align: right; }
.cf24-variants .cf24-v-flag { width: 56px; text-align: center; }
/* 품목코드 — 클릭하면 클립보드로. 눌리는 것임을 커서·밑줄로 알린다. */
.cf24-v-copy {
+1
View File
@@ -54,6 +54,7 @@
});
// ── 날짜 — 프로젝트 날짜 팝업 ──
L.enhanceDateInput(dateEl, { placeholder: "날짜(비우면 바로)" });
if (L.enhanceTimeInput) L.enhanceTimeInput(timeEl, { placeholder: "00:00" }); // 프로젝트 공용 시각 팝업(5분 단위)
// ── 받는 사람 — 프로젝트 멤버 고르기 모양 ──
peopleBox.innerHTML = people.map(L.memberPickHtml).join("") || '<span class="pj-empty-sm">등록된 사람이 없습니다.</span>';
function toAll() { return root.querySelector('input[name="ntc-to"]:checked').value === "all"; }
+26 -10
View File
@@ -50,13 +50,25 @@
return { default_view: o.default_view, board_cover: !!o.board_cover, all_view_users: resolveAllView(o.all_view_users),
daily_alert_times: (o.daily_alert_times || []).slice().sort() };
}
function timeInputs() { return timesBox ? Array.from(timesBox.querySelectorAll("input[type=time]")) : []; }
function timeBtns() { return timesBox ? Array.from(timesBox.querySelectorAll(".pj-time-btn")) : []; }
// 고른 시각들 — 빈 칸은 빼고 중복 제거·정렬(서버도 같게 정규화)
function pickedTimes() {
const out = [];
timeInputs().forEach(function (i) { const v = (i.value || "").slice(0, 5); if (v && out.indexOf(v) < 0) out.push(v); });
timeBtns().forEach(function (b) { const v = b.dataset.value || ""; if (v && out.indexOf(v) < 0) out.push(v); });
return out.sort();
}
function setTimeBtn(btn, v) {
btn.dataset.value = v || "";
btn.querySelector(".pj-time-text").textContent = v || "시각 선택";
btn.classList.toggle("is-empty", !v);
}
// 시각 고르기 = 프로젝트 공용 날짜 팝업 모양 시각 팝업(project.js openTimePopover — 옵션 창 안에 붙어 휠·클릭이 먹음)
function openTimePop(btn) {
if (!window.PJLib || !window.PJLib.openTimePopover) return;
window.PJLib.openTimePopover(btn, { value: btn.dataset.value || "", onChange: function (v) { setTimeBtn(btn, v); } });
}
function closeTimePop() { if (window.PJLib && window.PJLib.closeTimePopover) window.PJLib.closeTimePopover(); }
function renumberTimes() {
if (!timesBox) return;
Array.from(timesBox.children).forEach(function (li, i) { li.firstChild.textContent = "알림 " + (i + 1); });
@@ -64,18 +76,21 @@
}
function addTimeRow(v) {
const li = document.createElement("li");
li.innerHTML = '<span></span><input type="time" step="60" aria-label="알림 시각">' +
'<button type="button" title="이 알림 빼기" aria-label="이 알림 빼기"><span class="material-symbols-outlined">delete</span></button>';
li.querySelector("input").value = v || "";
li.querySelector("input").disabled = !sys;
li.querySelector("button").disabled = !sys;
li.querySelector("button").addEventListener("click", function () { li.remove(); renumberTimes(); });
li.innerHTML = '<span></span><button type="button" class="pj-time-btn" aria-label="알림 시각" title="시각 바꾸기">' +
'<span class="pj-time-text"></span><span class="material-symbols-outlined">schedule</span></button>' +
'<button type="button" class="pj-time-del" title="이 알림 빼기" aria-label="이 알림 빼기"><span class="material-symbols-outlined">delete</span></button>';
const tb = li.querySelector(".pj-time-btn"), del = li.querySelector(".pj-time-del");
setTimeBtn(tb, v);
tb.disabled = del.disabled = !sys;
tb.addEventListener("click", function () { if (document.querySelector(".pj-timepop")) closeTimePop(); else openTimePop(tb); });
del.addEventListener("click", function () { closeTimePop(); li.remove(); renumberTimes(); });
timesBox.appendChild(li);
renumberTimes();
return li;
}
function fillTimes(list) {
if (!timesBox) return;
closeTimePop();
timesBox.innerHTML = "";
(list || []).forEach(addTimeRow);
renumberTimes();
@@ -179,7 +194,8 @@
select.addEventListener("change", paint);
if (timesAdd) timesAdd.addEventListener("click", function () {
if (timesBox.children.length >= TIMES_MAX) return;
addTimeRow("").querySelector("input").focus();
const tb = addTimeRow("").querySelector(".pj-time-btn");
tb.focus(); openTimePop(tb);
});
if (allPicker) {
allPicker.addEventListener("change", paintAllView);
@@ -196,7 +212,7 @@
cancel.addEventListener("click", close);
closeX.addEventListener("click", close);
dialog.addEventListener("cancel", function (e) { if (save.disabled) e.preventDefault(); });
dialog.addEventListener("close", function () { openSeq++; button.focus(); });
dialog.addEventListener("close", function () { closeTimePop(); openSeq++; button.focus(); });
form.addEventListener("submit", async function (e) {
e.preventDefault(); if (save.disabled) return;
const fontValue = select.value, font = names[fontValue];
+22 -3
View File
@@ -3306,9 +3306,28 @@ label.pj-options-row[for] { cursor: pointer; }
.pj-options-times { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }
.pj-options-times li { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.pj-options-times li > span:first-child { min-width: 52px; color: var(--pj-ink-soft); }
.pj-options-times input[type=time] { padding: 6px 8px; border: 1px solid #d8dce2; border-radius: 6px; font: inherit; }
.pj-options-times button { display: inline-flex; padding: 4px; border: 0; border-radius: 6px; background: none; color: #6d6e6f; cursor: pointer; }
.pj-options-times button:hover { background: #fdecec; color: #b42318; }
.pj-time-btn { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px; border: 1px solid #d8dce2; border-radius: 8px; background: #fff; color: var(--pj-ink); font: inherit; font-size: 13.5px; font-variant-numeric: tabular-nums; cursor: pointer; }
.pj-time-btn:hover:not(:disabled) { border-color: #4573d2; }
.pj-time-btn:disabled { opacity: .6; cursor: default; }
.pj-time-btn .material-symbols-outlined { font-size: 18px; color: #6d6e6f; }
.pj-time-btn.is-empty .pj-time-text { color: #9aa1a9; }
.pj-options-times .pj-time-del { display: inline-flex; padding: 4px; border: 0; border-radius: 6px; background: none; color: #6d6e6f; cursor: pointer; }
.pj-options-times .pj-time-del:hover { background: #fdecec; color: #b42318; }
/* 시각 고르기 팝업 — 날짜 팝업(.pj-datepop) 모양 그대로 + 시·분 두 열(돌아가지 않는 목록). popover(top layer) 기본값을 지운다. */
.pj-timepop { width: 200px; }
.pj-timepop[popover] { inset: auto; margin: 0; overflow: visible; }
.pj-tp-value { display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.pj-tp-heads, .pj-tp-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pj-tp-heads span { text-align: center; font-size: 12px; font-weight: 600; color: #6d6e6f; padding: 2px 0 4px; }
.pj-tp-col { height: 238px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; display: flex; flex-direction: column; gap: 2px; }
.pj-tp-item { flex: none; height: 32px; border: 0; border-radius: 16px; background: transparent; font: inherit; font-size: 13.5px; font-variant-numeric: tabular-nums; color: var(--pj-ink); cursor: pointer; }
.pj-tp-item:hover { background: #f1f2f4; }
.pj-tp-item.is-selected { background: #4573d2; color: #fff; font-weight: 600; }
.pj-timepop .pj-dp-link { transition: background .12s, color .12s; }
.pj-timepop .pj-dp-link[data-tp="clear"]:hover { background: #fdecec; color: #b42318; }
.pj-timepop .pj-dp-link[data-tp="ok"] { color: #4573d2; }
.pj-timepop .pj-dp-link[data-tp="ok"]:hover { background: #4573d2; color: #fff; }
.pj-timepop .pj-dp-link:active { transform: translateY(1px); }
.pj-options-times:empty::before { content: "알림 없음"; font-size: 12px; color: var(--pj-ink-soft); }
.pj-options-allview:empty::before { content: "불러오는 중…"; padding: 6px; font-size: 12px; color: var(--pj-ink-soft); }
/* 켜기/끄기 스위치 */
+149 -11
View File
@@ -757,6 +757,135 @@
sync();
}
// ── 시각 고르기 팝업(2026-11-11, 프로젝트 공용 — Project 옵션 알림 시각·긴급 공지 띄울 시각) ──
// 날짜 팝업(.pj-datepop)과 같은 카드·꼬리·파란 선택. 시(00~23)·분(00~55, 5분 단위) 두 열 — 브라우저 기본
// 시계처럼 돌아가지 않고 끝에서 멈춘다. 시 = 바꾸고 열어 둠, 분 = 바꾸고 닫음, [확인] = 지금 값 넣고 닫기,
// [지우기] = 비우고 닫기. opts: { value: "HH:MM"|"", onChange(v) }.
// 모달 대화창(dialog[open]) 안의 칸이면 그 창 **안에** popover(top layer)로 붙인다 — 창 밖(body)에 붙이면
// 모달 때문에 inert 라 휠·마우스 오버·클릭이 안 먹는다. 그 밖에는 body(배율 .pj-ui-scale 밖).
let timePopEl = null, timePopCleanup = null;
function closeTimePopover() {
if (timePopCleanup) timePopCleanup();
timePopCleanup = null;
if (timePopEl) {
try { if (timePopEl.matches(":popover-open")) timePopEl.hidePopover(); } catch (_) {}
timePopEl.remove(); timePopEl = null;
}
}
function openTimePopover(anchor, opts) {
closeTimePopover();
const pad2 = function (n) { return (n < 10 ? "0" : "") + n; };
const cur = /^\d{2}:\d{2}/.test(opts.value || "") ? opts.value.slice(0, 5) : "";
let h = cur ? cur.slice(0, 2) : "", m = cur ? cur.slice(3, 5) : "";
const hours = [], mins = [];
for (let i = 0; i < 24; i++) hours.push(pad2(i));
for (let i = 0; i < 60; i += 5) mins.push(pad2(i));
function col(kind, list, sel) {
return '<div class="pj-tp-col" data-kind="' + kind + '">' + list.map(function (v) {
return '<button type="button" class="pj-tp-item' + (v === sel ? " is-selected" : "") + '" data-v="' + v + '">' + v + "</button>";
}).join("") + "</div>";
}
const pop = document.createElement("div");
pop.className = "pj-datepop pj-timepop";
pop.innerHTML = '<div class="pj-dp-fields"><span class="pj-dp-field is-active pj-tp-value"></span></div>' +
'<div class="pj-tp-heads"><span>시</span><span>분</span></div>' +
'<div class="pj-tp-cols">' + col("h", hours, h) + col("m", mins, m) + "</div>" +
'<div class="pj-dp-foot"><button type="button" class="pj-dp-link" data-tp="clear">지우기</button>' +
'<button type="button" class="pj-dp-link" data-tp="ok">확인</button></div>';
function paintHead() { pop.querySelector(".pj-tp-value").textContent = (h || "--") + ":" + (m || "--"); }
paintHead();
const host = anchor.closest("dialog[open]");
if (host) { pop.setAttribute("popover", "manual"); host.appendChild(pop); try { pop.showPopover(); } catch (_) {} }
else document.body.appendChild(pop);
function emit(v) { if (opts.onChange) opts.onChange(v); }
function commit() { if (h) emit(h + ":" + (m || "00")); }
pop.addEventListener("click", function (e) {
const it = e.target.closest(".pj-tp-item");
if (it) {
const kind = it.parentNode.dataset.kind;
it.parentNode.querySelectorAll(".is-selected").forEach(function (x) { x.classList.remove("is-selected"); });
it.classList.add("is-selected");
if (kind === "h") { h = it.dataset.v; if (!m) m = "00"; } else { m = it.dataset.v; if (!h) h = "09"; }
paintHead(); commit();
if (kind === "m") { closeTimePopover(); anchor.focus(); }
return;
}
const act = e.target.closest("[data-tp]");
if (!act) return;
if (act.dataset.tp === "clear") emit(""); else commit();
closeTimePopover(); anchor.focus();
});
// 자리 — 앵커 아래(자리 없으면 위), 꼬리가 앵커 가운데(openDatePopover place 와 같음).
// 배율(zoom) 안의 dialog 에 붙었으면 left/top 값도 배율만큼 줄어 보이므로 나눠 준다(currentCSSZoom).
const z = pop.currentCSSZoom || 1;
const r = anchor.getBoundingClientRect();
const vw = document.documentElement.clientWidth, vh = document.documentElement.clientHeight;
const w = pop.offsetWidth * z, ph = pop.offsetHeight * z, ax = r.left + r.width / 2;
const left = Math.min(Math.max(8, ax - w / 2), vw - w - 8);
const below = r.bottom + 10 + ph <= vh - 8 || r.top - 10 - ph < 8;
pop.classList.toggle("is-above", !below);
pop.style.left = left / z + "px";
pop.style.top = (below ? r.bottom + 10 : r.top - 10 - ph) / z + "px";
pop.style.setProperty("--pj-dp-tail", Math.min(Math.max(ax - left, 16), w - 16) / z + "px");
// 고른 값이 보이게 — 열 안에서만 스크롤(맨 위 00 부터, 끝에서 멈춤)
pop.querySelectorAll(".pj-tp-col").forEach(function (c) {
const sel = c.querySelector(".is-selected");
if (sel) c.scrollTop = sel.offsetTop - c.offsetTop - (c.clientHeight - sel.offsetHeight) / 2;
});
function onDown(e) { if (!pop.contains(e.target) && !anchor.contains(e.target)) closeTimePopover(); }
function onKey(e) { if (e.key === "Escape") { e.preventDefault(); e.stopPropagation(); closeTimePopover(); anchor.focus(); } }
document.addEventListener("pointerdown", onDown, true);
document.addEventListener("keydown", onKey, true);
window.addEventListener("resize", closeTimePopover);
timePopEl = pop;
timePopCleanup = function () {
document.removeEventListener("pointerdown", onDown, true);
document.removeEventListener("keydown", onKey, true);
window.removeEventListener("resize", closeTimePopover);
};
}
// <input type="time"> 를 시각 버튼으로 — 브라우저 기본 시계 대신 openTimePopover. input 은 숨긴 값 저장소
// (value 읽기/쓰기·change 이벤트 그대로, value 를 쓰면 버튼 글자도 바뀜 — enhanceDateInput 과 같은 방식).
function enhanceTimeInput(input, opts) {
if (!input || input.dataset.pjTime) return;
opts = opts || {};
input.dataset.pjTime = "1";
input.style.display = "none";
const btn = document.createElement("button");
btn.type = "button";
btn.className = "pj-time-btn";
btn.innerHTML = '<span class="pj-time-text"></span><span class="material-symbols-outlined">schedule</span>';
if (input.getAttribute("aria-label")) btn.setAttribute("aria-label", input.getAttribute("aria-label"));
input.after(btn);
const desc = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value");
Object.defineProperty(input, "value", {
configurable: true,
get: function () { return desc.get.call(this); },
set: function (v) { desc.set.call(this, v); sync(); },
});
function sync() {
const v = (input.value || "").slice(0, 5);
btn.querySelector(".pj-time-text").textContent = v || opts.placeholder || "시각 선택";
btn.classList.toggle("is-empty", !v);
btn.disabled = input.disabled;
btn.title = v ? "시각 변경" : "시각 지정";
}
btn.addEventListener("click", function (e) {
e.preventDefault();
if (timePopEl) { closeTimePopover(); return; }
openTimePopover(btn, {
value: input.value,
onChange: function (v) {
if ((input.value || "").slice(0, 5) === v) return;
input.value = v;
input.dispatchEvent(new Event("input", { bubbles: true }));
input.dispatchEvent(new Event("change", { bubbles: true }));
},
});
});
sync();
}
// ── 탭 그룹(뷰 탭/스코프 토글, 둘 다 .pj-view-tabs 마크업 공유)에 슬라이드
// 하이라이트를 붙인다 — is-active 를 단순 배경색 대신, 실제 위치가 움직이는
// 절대배치 요소 하나로 표현한다. 탭 클릭·초기 렌더·리사이즈마다 위치 재계산.
@@ -3495,7 +3624,8 @@
// 등급(2026-10-12) — isPro = Pro user 이상(프로젝트 수정·멤버 배정·전체 보기·담당자별 합계·남의 댓글 수정),
// isPAdmin = Admin 이상(남이 만든 섹션도 삭제).
const isPro = root.dataset.isPro === "true";
const canAllView = root.dataset.allView === "true"; // 왼쪽 "전체 보기" 메뉴 — Project 옵션 대상자(서버 pj_all_view)
const canAllView = root.dataset.allView === "true";
const dailyReady = root.dataset.dailyReady === "1"; // 033 — 새 업무·세부 업무 추가 칸 날짜 팝업에도 [매일] // 왼쪽 "전체 보기" 메뉴 — Project 옵션 대상자(서버 pj_all_view)
const isPAdmin = root.dataset.isPadmin === "true";
// 시스템 Project 옵션(서버 project_options, 수퍼관리자·Admin 이 바꾸면 모든 사용자에게) — 보드 카드 표지 켬/끔.
// 옵션 창에서 저장하면 pj-options-change 로 바로 바뀐다(아래).
@@ -5118,9 +5248,10 @@
av.title = draft.assignee ? idOf(draft.assignee) : "담당자 지정";
}
function paintDue() {
const di = dueInfo(draft.due, false);
due.innerHTML = di ? escapeHtml(di.text) : DUE_EMPTY_ICON_SVG;
due.title = draft.due || "마감일 지정";
const di = dueInfo(draft.due, false, draft.daily);
due.innerHTML = !di ? DUE_EMPTY_ICON_SVG
: draft.daily ? '<span class="pj-due-label is-daily">' + escapeHtml(di.text) + "</span>" : escapeHtml(di.text);
due.title = draft.daily ? "매일 하는 업무" : draft.due || "마감일 지정";
}
function paintFol() {
fol.innerHTML = followerIconHtml(draft.followers);
@@ -5171,8 +5302,12 @@
});
due.addEventListener("click", function () {
openDatePopover(due, {
due: draft.due, allowStart: false,
onChange: function (patch) { if (!current()) return; draft.due = patch.due_date || null; paintDue(); refocus(); },
due: draft.due, allowStart: false, daily: !!draft.daily, allowDaily: dailyReady,
onChange: function (patch) {
if (!current()) return;
draft.due = patch.due_date || null; draft.daily = !!patch.repeat_daily;
paintDue(); refocus();
},
});
});
function close() {
@@ -5194,6 +5329,7 @@
assignee_email: draft.assignee, assignee_name: draft.assignee ? idOf(draft.assignee) : "",
due_date: draft.due || null,
followers: draft.followers,
...(draft.daily ? { repeat_daily: true } : {}),
});
if (!current()) return;
mergeTask(res.task);
@@ -6031,7 +6167,7 @@
if (!draft.followers) draft.followers = [];
inp.value = draft.title;
function paintDue() {
const di = dueInfo(draft.due, false);
const di = dueInfo(draft.due, false, draft.daily);
dueEl.className = "pj-card-sub-due pj-card-subnew-due" + (di ? " " + di.cls : " is-empty");
dueEl.innerHTML = di ? escapeHtml(di.text) : DUE_EMPTY_ICON_SVG;
dueEl.dataset.tip = di ? dueTip(di) : "마감일 지정";
@@ -6058,7 +6194,7 @@
draft.focused = document.activeElement === inp;
// 날짜 팝업·담당자 메뉴를 쓰는 중이면 닫지 않는다.
if (draft.focused || datePopEl || ctxMenuEl) return;
if (!draft.title.trim() && !draft.due && !draft.assignee && !draft.followers.length) closeDraft();
if (!draft.title.trim() && !draft.due && !draft.daily && !draft.assignee && !draft.followers.length) closeDraft();
}, 150);
});
inp.addEventListener("keydown", function (e) {
@@ -6068,9 +6204,9 @@
});
dueEl.addEventListener("click", function () {
openDatePopover(dueEl, {
due: draft.due, allowStart: false,
due: draft.due, allowStart: false, daily: !!draft.daily, allowDaily: dailyReady,
// 날짜를 고르면 팝업이 닫히므로 이어서 이름을 칠 수 있게 입력칸으로 돌아간다.
onChange: function (patch) { draft.due = patch.due_date || null; paintDue(); refocus(); },
onChange: function (patch) { draft.due = patch.due_date || null; draft.daily = !!patch.repeat_daily; paintDue(); refocus(); },
});
});
// 바깥을 누르면 Enter 와 같다 — 이름이 있으면 만들고 줄을 닫는다(아사나). 이름이 없으면
@@ -6089,7 +6225,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 && !draft.followers.length) closeDraft();
else if (!draft.due && !draft.daily && !draft.assignee && !draft.followers.length) closeDraft();
}, 0);
}
if (subOutsideDown[t.id]) document.removeEventListener("pointerdown", subOutsideDown[t.id], true);
@@ -6138,6 +6274,7 @@
assignee_email: draft.assignee || "",
assignee_name: draft.assignee ? idOf(draft.assignee) : "",
followers: draft.followers,
...(draft.daily ? { repeat_daily: true } : {}),
});
const subs = subsCache[t.id] || (subsCache[t.id] = []);
// 새 줄 협업자 아이콘 — 서버 자동 협업자와 같은 규칙(만든 사람·담당자·고른 협업자)
@@ -13601,6 +13738,7 @@
// 공용 말풍선만 켠다(프로젝트 알림 팝업 확인·실시간 동기화 등이 그 화면에서 돌지 않게).
window.PJLib = {
createDescEditor: createDescEditor, enhanceDateInput: enhanceDateInput,
enhanceTimeInput: enhanceTimeInput, openTimePopover: openTimePopover, closeTimePopover: closeTimePopover,
memberPickHtml: memberPickHtml, showToast: showToast,
};
document.addEventListener("DOMContentLoaded", function () {
@@ -0,0 +1,17 @@
-- ════════════════════════════════════════════════════════════
-- 마이그레이션: 신규 세트 MY-1007 등록
-- malaysia_items 에 세트 MY-1007(kind='set')을 추가한다 — 재고 화면 세트 목록 노출용.
-- BOM(MT-1800·MT-2200·MT-3200 각 1개)은 itemcode_db.set_components 에 이미 있음(확인됨).
-- 구성 낱개 MT-1800/2200/3200 은 malaysia_items 에 이미 있음(확인됨).
-- 이름은 psql 변수 name 으로 받는다(itemcode_db.set_items.name). 비면 코드로.
-- NAME=$(docker exec postgres-db psql -U postgres -d itemcode_db -tAc "SELECT name FROM set_items WHERE item_code='MY-1007'")
-- docker exec -i postgres-db psql -v ON_ERROR_STOP=1 -v name="$NAME" -U postgres -d malaysia_stock_db < scripts/sql/malaysia_stock_db_add_my1007.sql
-- superuser/owner 로 실행. 멱등(재실행 시 이름·활성만 갱신, 순서 유지).
-- ════════════════════════════════════════════════════════════
INSERT INTO malaysia_items (item_code, item_name, kind, sort_order)
SELECT 'MY-1007', COALESCE(NULLIF(trim(:'name'), ''), 'MY-1007'), 'set',
(SELECT COALESCE(MAX(sort_order), 0) + 1 FROM malaysia_items)
ON CONFLICT (item_code) DO UPDATE
SET item_name = EXCLUDED.item_name,
kind = EXCLUDED.kind,
active = TRUE;
+10
View File
@@ -1677,6 +1677,16 @@ def test_repeat_daily_task_and_alerts():
got = req("PUT", f"/project/api/tasks/{t['id']}", ALICE, json={"due_date": "2026-12-05"}).json()["task"]
assert got["repeat_daily"] is False and got["due_date"] == "2026-12-05", got
assert t["id"] not in [x["id"] for x in ST.list_open_daily_tasks()]
# 추가 칸(보드 새 업무·세부 업무)에서 [매일]로 만들기 — POST repeat_daily
r = req("POST", f"/project/api/projects/{a['id']}/tasks", ALICE,
json={"title": "매일 점검", "stage_id": sa["id"], "due_date": None, "repeat_daily": True})
assert r.status_code == 201, r.text
assert r.json()["task"]["repeat_daily"] is True and "_newly_assigned" not in r.json()["task"]
r = req("POST", f"/project/api/projects/{a['id']}/tasks", ALICE,
json={"title": "세부 매일", "parent_task_id": t["id"], "repeat_daily": True})
assert r.status_code == 201 and r.json()["task"]["repeat_daily"] is True, r.text
assert req("POST", f"/project/api/projects/{a['id']}/tasks", ALICE, json={"title": "x", "repeat_daily": 1}).status_code == 400
assert ST.daily_ready() is True
def test_move_stage_to_other_project():