diff --git a/CLAUDE.md b/CLAUDE.md index e47ec82..7c6fd9f 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -36,7 +36,7 @@ Claude Code는 이 저장소에서 작업을 시작하기 전에 **반드시 아 - 말레이시아 창고 재고관리 (`app/modules/malaysia/`, `malaysia_stock_db`) — 낱개(MT/MX/MZ) 입출고·조정, 세트(MY) BOM, 일일 재고조사(세트→낱개 자동 분해), 현재고 현황. 뚜껑(MD-)은 재고 집계 제외 — 단, 창고 랙에는 위치 확인용으로 배치 가능(`store.LID_ITEMS`). 상품은 `itemcode_db` 읽기 전용. 권한키 `malaysia` - 말레이시아 배송 (`app/modules/dispatch/`, `dispatch_db`) — TikTok·Shopee 출고관리. 플랫폼별 데이터 엑셀 업로드(TikTok=03_TikTok_Order_Export.xlsx, Shopee=Packing List.Doorstep Delivery.xlsx) → 1상자=1카드 출고 작업 리스트·SKU 피킹 요약·Kagayaku 전달표 자동 생성. 1상자 묶음 기준 Package ID > Tracking ID > Order ID, 같은 상자 같은 SKU 합산. 작업 상태 토글(`dispatch_logs` 기록). 받는 사람 이름/전화/주소는 상자 단위로 저장(작업 카드 표시 + 출고 엑셀 생성용 — 개인정보). 배치 다운로드 zip 에 업로드 원본 + 취합 출고 엑셀(`YYYY.MM.DD(Ddd)_tictoc|shopee.xlsx`) 포함. 엑셀은 openpyxl 파싱/생성. 권한키 `dispatch`. 상세는 `docs/DISPATCH_MODULE.md` - 카페24 상품관리 (`app/modules/cafe24/`, `cafe24_db`) — 카페24 관리자에 들어가지 않고 상품 상세페이지(description HTML) 조회·편집·즉시적용·예약적용·버전 이력. 3분할 화면(목록 | HTML 편집기 | 상품 정보 패널). 정보 패널(`routes_product_info.py`, `_side.html`)에서 상품명·판매가·공급가·소비자가, 대표이미지(`POST /admin/products/{no}/images` 에 base64 data URI + `image_upload_type=A` — NNEditor 업로드 경로를 PUT `detail_image` 에 넣는 방식은 적용 안 됨), 옵션(생성/이름·썸네일·표시방식 수정/삭제)·품목(자체코드·추가금액·진열·판매)을 수정. 카페24 OAuth/API 클라이언트는 향후 주문관리와 공유하기 위해 **공통 계층 `app/integrations/cafe24/`** 에 둔다 — 라우터에서 `httpx`/`requests` 직접 호출 금지. 토큰은 Fernet 암호화 저장(`CAFE24_TOKEN_SECRET`), 로그/화면에 토큰·시크릿 절대 미출력. 쓰기 직전 항상 카페24 현재 HTML 을 다시 읽어 `BACKUP` revision 생성(로컬 값을 현재값으로 가정 금지). **카페24 관리자 API 는 PUT 뒤 한동안 GET 에서 예전 값을 돌려준다(읽기 지연)** — 우리 캐시 문제가 아니다. 그래서 "마지막 쓰기가 권위": 상세설명은 카페24 값이 최근 revision 중 하나와 같으면 지연으로 보고 마지막 MANUAL/SCHEDULED 를 표시·지문 기준으로 쓰고(`store.resolve_description`), 스칼라(상품명·가격·이미지·진열/판매)는 PUT 응답 스냅샷(`cafe24_products.last_write_snapshot`, 마이그레이션 004)과 GET 의 `updated_date` 를 비교해 덮어씌운다(`store.overlay_recent_write`). 유예시간 `CAFE24_READ_LAG_GRACE_MIN`(기본 360분). 쓰기 후 화면은 PUT 응답으로 그리고 다시 GET 하지 않는다. 예약은 DB 저장 + 별도 worker(`app/modules/cafe24/worker.py`, compose 서비스 `dbx-cafe24-worker`)가 처리 — 웹 프로세스에서 대기하지 않는다. 권한키 `cafe24`(연결/해제는 admin 전용). 상세는 `docs/CAFE24_MODULE.md` -- 프로젝트 관리 (`app/modules/project/`, `project_db`) — 아사나식. 프로젝트/서브프로젝트(self-FK `parent_id`, CASCADE)·프로젝트 색상(32색 — 아사나 16색 + 진한 16색, 수정 창 12열)·아이콘(`projects.icon`, Material Symbols 42종, 마이그레이션 011 + [아사나 아이콘] 탭 33종 `"asana:"+이름`, 채워진 모양 전용 부분 글꼴 `material-symbols-asana.woff2`)·작업(`tasks`: 담당자·우선순위·시작/마감)·진행단계(`project_stages` 칸반, 새 프로젝트는 섹션 없이 시작 — `create_project(seed_stages=True)` 일 때만 기본 4단계, 섹션 머리는 모두 `#f3f3f3` — 섹션별 색 지정 없음, 섹션 이름 굵게, 섹션 기본 담당자 `default_assignee_email` — 담당자 빈 작업을 그 섹션에 만들거나 옮기면 자동 배정, 마이그레이션 009)·멤버 배정(`project_members`)·활동이력(`project_activity`). 첫 화면(`/project/`)은 **내 작업 목록**(프로젝트 홈 카드 화면은 폐지). 프로젝트 화면은 캘린더(FullCalendar)/타임라인(vis-timeline)/보드/목록/대시보드 뷰 토글. 좌측 사이드바는 수신함·내 작업·휴지통·프로젝트 화면 공용(`templates/project/_side.html` + 프로젝트 목록 동작 `initSideTree`, 새 프로젝트/수정 모달 `_side_modals.html`) — 프로젝트 목록(순서 변경·✎·×)은 어느 화면에서나 같다. 보드는 아사나처럼 섹션이 가로로 계속 늘어나고(넘치면 가로 스크롤) 카드의 담당자·마감일을 클릭해 그 자리에서 바꾼다. 좌측 사이드바에 수신함·전체 보기(Pro user 이상 — 예전 오른쪽 위 "전체 프로젝트" 토글, `?scope=all`)·내 작업(접이식) 메뉴. 설명란 서식 도구에 글자 색·크기(서버는 span style 의 color·font-size 만 허용, `desc_inline_style`). 설명란은 주소 붙여넣기 시 자동 링크, 설명란·댓글에서 @로 멤버를 태그하면 (`task_mentions`, 마이그레이션 006) 수신함에 그 작업이 쌓인다. 진입 권한키 `project`(관리자 페이지 토글로 직원별 부여, admin 자동). **관리자 등급 4단계(2026-10-12) — 수퍼관리자(`SUPER_ADMIN_EMAIL` 한 명 고정, 추가 불가) > Admin(`role=admin`) > Pro user(`role=pro`) > User** — 판단은 `access.is_pro`(Pro user 이상)·`access.is_project_admin`(Admin 이상), 라우터 `_require_pro`, 화면 `pj_pro`·`pj_admin`(`_role_ctx`, `is_admin` 은 ERP 상단 관리자 메뉴용 그대로). pro 는 프로젝트 모듈 밖에서는 user 와 같다. 새 프로젝트·프로젝트 이름/색/아이콘/소유자 수정·멤버 배정(자기가 멤버인 프로젝트)·사이드바 순서·남의 댓글 수정/삭제·휴지통·전체 보기·담당자별 합계·전체 멤버 = Pro user 이상, 프로젝트·섹션 삭제 = Admin 이상 또는 만든 사람, 작업 삭제·서브프로젝트 = 멤버 누구나(표는 docs/PROJECT_MODULE.md 6-14). 배정 멤버(또는 owner)만 그 프로젝트를 조회 — **관리자도 멤버가 아니면 안 보임, 예외는 슈퍼관리자뿐**(2026-10-07, `access.sees_all_projects`; 사이드바 목록·검색·휴지통·알림도 같은 기준, 화면·API 모두 비멤버 403)하고 서브프로젝트/작업/단계 CRUD — URL 의 섹션·부모 작업이 그 프로젝트 것인지 서버가 검증. 실시간 반영은 `project_live_version` 카운터(마이그레이션 007, 미적용 시 MAX 폴백). 사이드바 전체 검색(`/api/search`, 제목·설명·댓글, pg_trgm) + 프로젝트/내 작업 필터 바(찾기·상태·담당자·마감·우선순위·정렬, 클라이언트 필터). 협업자(`task_followers`, 자동 팔로우: 만든 사람·담당자·댓글·@태그) — 완료·댓글 알림은 담당자+협업자에게만. 나를 태그하거나 작업이 배정되면 프로젝트 화면 가운데 아래에 깜박이는 큰 팝업(닫기 전까지, `initTaskAlerts` + `GET /api/notifications/alerts`). 작업 삭제는 휴지통(`project_trash`, 마이그레이션 010) — 삭제 직전 스냅샷 3개월 보관, Pro user 이상만 보기·복구(`/project/trash`). 권한은 **지금 기준 공통 모듈 `access.py`**(목록·배지·알림·멘션·메일 수신자·삭제·댓글 수정까지 — 멤버에서 빠지면 기록이 있어도 안 보이고 알림도 없음), 소유자 변경은 Pro user 이상, 연결(멀티호밍)된 작업은 연결된 프로젝트 멤버에게 읽기 전용(docs/PROJECT_MODULE.md 6-10). 연간 목표(마이그레이션 013, `goal_*` 테이블) — 사이드바 "목표" → 연도 펼침 → `/project/goals/{연도}` 에 매출(목표·실적·달성)·로아스 월별 숫자 + 업무 영역(상품·마케팅·컨텐츠·유통 등)별 연간·월별 글, 조회는 전원·입력(주차별 목표·연도 추가/삭제 포함)은 Pro user 이상. 3·6·9·12월 오른쪽 1~4분기 칸(글 칸 13=1분기·15=2분기·14=3분기·16=4분기 — 예전 반기 칸 번호 재사용, 15·16 은 마이그레이션 017) + 분기 월 칸 접기 애니메이션(localStorage `pj_goal_fold_q`, 표는 `width:1px`+`table-layout:fixed`), 영역·줄 이름 클릭 바로 수정, **엑셀식 칸 병합**(마우스로 끌어 사각형 선택 → 우클릭 셀 병합/병합 해제, 같은 영역 안 세로 `row_span` + 같은 분기 월 칸 가로, 글은 왼쪽 위 칸 — `goal_cell_merges`, 마이그레이션 014·015·017), 3열 줄 추가는 같은 항목 칸(2열) 안에(`goal_rows.label_cont`, 마이그레이션 016), 구조 변경은 새로고침 없이 제자리 다시 그리기(`refreshTable`)+애니메이션, 로아스는 % 표기. 월 머리 → **주간 회의록**(`/project/goals/{연도}/meetings/{월}`, 프로젝트 권한자 **누구나 수정** — Pro user 이상 [회의 완료](`completed_at`, 마이그레이션 022)면 잠금(지난주 결과는 다음 주 회의록이 열려 있는 동안 허용), 삭제·완료·완료 해제는 Pro user 이상, 표 첫 열 머리 글자 "구분", 주차 탭 — **주차는 그 달 안**(`store.month_weeks`: 1일이 월~금이면 1일~일요일이 1주차, 토·일이면 1일~다음 주 일요일, 그 뒤 월~일, 말일이 월·화면 앞 주차에 붙음, 회의록 `week_start` = 주차 시작일, 마이그레이션 020), `goal_meetings`·`goal_meeting_items` 마이그레이션 015 — 지난주 = **바로 앞 주차**(`store.prev_week_period`) 회의록의 같은 연결키 줄(`line_key`, 마이그레이션 018 — 생성 순서·이름 변경과 무관, 이름 추정 연결 금지)로 리뷰(열: 주요 업무·정량 목표 ‖ 전주 업무·결과(글, `result_note` 020)·전주 목표·결과 — 정량 목표·결과는 숫자면 원 정수 칸, 아니면 글 칸 `target_text`·`result_text`(예: 20개, 021)), 실적 조회 장애는 0원이 아니라 "미확인", 위에 목표 표 그 달 열 글을 영역별 "N월 계획" 카드로, 참석자 옆 [회의록 보드] = 그 주차의 빈 Google 슬라이드를 독립 창으로(오른쪽 🔗 아이콘 = 그 보드 링크 복사)(공유 드라이브 `MEETING_BOARD_FOLDER_ID`, 없으면 만듦, `app/integrations/google_slides.py`, Drive appProperties 로 주차 연결 — Drive·Slides 권한 토큰 필요), 표를 스크롤해도 보이는 머리 영역 3칸 = ① 월 계획 + 머리 줄에 숫자 4개 작게 1행(월 목표 매출·월 누적 목표 매출(목표 표 **주차별 매출 목표** `goal_week_targets` 1주차~이 주차 합 — 목표 표 매출 목표 월 칸을 누르면 입력 창 — 월 전체 목표는 직접 입력(주차 합계와 별개), 맨 아래 차이 = 월 목표 − 주차 합계)·월 누적 실적(1일~오늘)·누적 목표 대비 차액·%) | ② 결정 사항·메모 | ③ "N주차 작업 등록" 표(제목·담당자·프로젝트·섹션 → [적용] = 서버가 그 프로젝트에 작업 생성, `initMeetQuickTasks` — 주차별 서버 표 `goal_meeting_tasks`(마이그레이션 025)라 모두가 같이 보고, 남의 프로젝트 이름은 가림, 완료 프로젝트·섹션은 목록에서 뺌, 작업 칸(마이그레이션 026 `parent_task_id`) = 이미 있는 작업을 고르면 그 작업의 세부 작업으로 등록, 등록된 줄 제목 = 오른쪽 작업 창(편집, 저장 대기), [크게 열기] = 같은 표를 넓은 창으로), 실적 모듈 `performance_store` 매출은 머리 카드에만 읽기 전용 — 줄(쇼핑몰)별 자동 결과·이번주 실적·연결 배지·쇼핑몰 연결 메뉴는 폐지, 지난주 결과는 늘 직접 입력). 모든 열 너비 끌어서 조절(localStorage `pj_goal_col_w`), 세로 스크롤 틀 고정은 머리 줄+매출·로아스 줄까지, 항목 칸 +·우클릭으로 줄 위/아래 추가·삭제, 구분(구역) 칸 우클릭·⋯ = 구역 통째로 위/아래(`move-section`). 마감 알림(`reminders.py` 데몬 스레드, 영업일 09시, D-1/당일/지연, `task_reminders` 로 중복 방지, `PROJECT_REMINDER_*` env) — 마이그레이션 008. 라우터 핸들러는 동기 DB 라 `def` 로 둔다(`async def` 금지). 말풍선은 전부 아사나식 공용 말풍선(`.pj-hovertip`) — 새 기능도 `title=`/`data-tip=` 만 달고 별도 툴팁 구현 금지. 멤버 배정 후보는 `project` 권한 보유 등록 사용자에서 자동 목록(`GET /project/api/assignable-users`). 작업 배정·완료 시 관리자에게 메일(`app/mail.py` stdlib smtplib, `SMTP_*`+`PROJECT_NOTIFY_EMAIL` env, 미설정 시 조용히 skip, `BackgroundTasks` 비동기). 목표 표·회의록 칸 저장은 공용 `createFieldSaver`(같은 칸 요청 직렬화·보낸 값만 저장됨·실패 시 초안 유지·localStorage 초안 백업, 저장 실패면 구조 변경 중단 — docs/PROJECT_MODULE.md 6-9-3), 구역·항목 메뉴는 우클릭 + ⋮ 버튼(키보드·터치). ERP 메뉴 이름은 "Project"(`app/main.py` 모듈 목록 title). **PC 알림 프로그램**(`desktop/notifier/`, C# .NET Framework 4.8 WinForms exe 하나·트레이 상주, 마이그레이션 023 `notifier_links`·`notifier_tokens`) — 브라우저가 뒤에 있어도 태그·배정 알림을 웹 팝업과 같은 모양으로 화면 위에. 브라우저 `/project/notifier?code=` 승인으로 PC별 토큰(서버는 SHA-256 만, PC 는 DPAPI), `GET /project/api/notifier/alerts`(Bearer)는 웹 알림과 같은 `_alerts_payload`, 토큰마다 지금 사용자·권한 재확인. 프로그램이 돌고 있으면(최근 3분 확인, `notifier_active`) 웹 큰 팝업은 쉰다(`desktop: true`). 압축·난독화 금지(백신 오탐), 빌드 `desktop/notifier/build.ps1`, 상세 docs/PROJECT_MODULE.md 6-11. 댓글·답글 입력칸은 Enter 등록·Shift+Enter 줄바꿈(textarea), 설명란 이미지 더블클릭 = 별도 창 이미지 보기(확대·축소·끌어 이동). 작업 창은 **저장 버튼 없이 실시간 저장**(칸별 PUT, `saveField`/`saveChain`, 새 작업은 제목이 생기는 순간 생성). 댓글 답글·이모티콘 반응(마이그레이션 012 `task_comments.parent_id`·`task_comment_reactions`, 미적용 시 버튼 숨김·API 503), 완료 이력 줄은 `project_activity` completed 를 댓글 사이에 표시(댓글 수 제외), 댓글 `@아이디` 는 아이콘+이름 칩. 수신함은 확인 안 한 태그·읽지 않은 알림만(2026-10-08) — [확인] 버튼 없이 줄을 누르면 읽음·확인 처리(같은 작업 줄 함께) + 페이지 이동 없이 오른쪽 iframe 패널, 다른 줄을 고르거나 패널을 닫으면 그 줄은 목록에서 빠짐. 용어는 "세부 작업"(예전 하위 작업)·"메인 작업 추가". 패널(`/project/p/{pid}?task=&embed=1`, `html.pj-embed`). 상단 바 화면 배율 토글(`html.pj-ui-scale` → `.erp-app` zoom .75, 2880×1620·200%용) — **팝업은 반드시 `document.body` 에 붙인다**(배율 안의 fixed 좌표는 어긋남). 상세는 `docs/PROJECT_MODULE.md` +- 프로젝트 관리 (`app/modules/project/`, `project_db`) — 아사나식. 프로젝트/서브프로젝트(self-FK `parent_id`, CASCADE)·프로젝트 색상(32색 — 아사나 16색 + 진한 16색, 수정 창 12열)·아이콘(`projects.icon`, Material Symbols 42종, 마이그레이션 011 + [아사나 아이콘] 탭 33종 `"asana:"+이름`, 채워진 모양 전용 부분 글꼴 `material-symbols-asana.woff2`)·작업(`tasks`: 담당자·우선순위·시작/마감)·진행단계(`project_stages` 칸반, 새 프로젝트는 섹션 없이 시작 — `create_project(seed_stages=True)` 일 때만 기본 4단계, 섹션 머리는 모두 `#f3f3f3` — 섹션별 색 지정 없음, 섹션 이름 굵게, 섹션 기본 담당자 `default_assignee_email` — 담당자 빈 작업을 그 섹션에 만들거나 옮기면 자동 배정, 마이그레이션 009)·멤버 배정(`project_members`)·활동이력(`project_activity`). 첫 화면(`/project/`)은 **내 작업 목록**(프로젝트 홈 카드 화면은 폐지). 프로젝트 화면은 캘린더(FullCalendar)/타임라인(vis-timeline)/보드/목록/대시보드 뷰 토글. 좌측 사이드바는 수신함·내 작업·휴지통·프로젝트 화면 공용(`templates/project/_side.html` + 프로젝트 목록 동작 `initSideTree`, 새 프로젝트/수정 모달 `_side_modals.html`) — 프로젝트 목록(순서 변경·✎·×)은 어느 화면에서나 같다. 보드는 아사나처럼 섹션이 가로로 계속 늘어나고(넘치면 가로 스크롤) 카드의 담당자·마감일을 클릭해 그 자리에서 바꾼다. 좌측 사이드바에 수신함·전체 보기(Pro user 이상 — 예전 오른쪽 위 "전체 프로젝트" 토글, `?scope=all`)·내 작업(접이식) 메뉴. 설명란 서식 도구에 글자 색·크기(서버는 span style 의 color·font-size 만 허용, `desc_inline_style`). 설명란은 주소 붙여넣기 시 자동 링크, 설명란·댓글에서 @로 멤버를 태그하면 (`task_mentions`, 마이그레이션 006) 수신함에 그 작업이 쌓인다. 진입 권한키 `project`(관리자 페이지 토글로 직원별 부여, admin 자동). **관리자 등급 4단계(2026-10-12) — 수퍼관리자(`SUPER_ADMIN_EMAIL` 한 명 고정, 추가 불가) > Admin(`role=admin`) > Pro user(`role=pro`) > User** — 판단은 `access.is_pro`(Pro user 이상)·`access.is_project_admin`(Admin 이상), 라우터 `_require_pro`, 화면 `pj_pro`·`pj_admin`(`_role_ctx`, `is_admin` 은 ERP 상단 관리자 메뉴용 그대로). pro 는 프로젝트 모듈 밖에서는 user 와 같다. 새 프로젝트·프로젝트 이름/색/아이콘/소유자 수정·멤버 배정(자기가 멤버인 프로젝트)·사이드바 순서·남의 댓글 수정/삭제·휴지통·전체 보기·담당자별 합계·전체 멤버 = Pro user 이상, 프로젝트·섹션 삭제 = Admin 이상 또는 만든 사람, 작업 삭제·서브프로젝트 = 멤버 누구나(표는 docs/PROJECT_MODULE.md 6-14). 배정 멤버(또는 owner)만 그 프로젝트를 조회 — **관리자도 멤버가 아니면 안 보임, 예외는 슈퍼관리자뿐**(2026-10-07, `access.sees_all_projects`; 사이드바 목록·검색·휴지통·알림도 같은 기준, 화면·API 모두 비멤버 403)하고 서브프로젝트/작업/단계 CRUD — URL 의 섹션·부모 작업이 그 프로젝트 것인지 서버가 검증. 실시간 반영은 `project_live_version` 카운터(마이그레이션 007, 미적용 시 MAX 폴백). 사이드바 전체 검색(`/api/search`, 제목·설명·댓글, pg_trgm) + 프로젝트/내 작업 필터 바(찾기·상태·담당자·마감·우선순위·정렬, 클라이언트 필터). 협업자(`task_followers`, 자동 팔로우: 만든 사람·담당자·댓글·@태그) — 완료·댓글 알림은 담당자+협업자에게만. 나를 태그하거나 작업이 배정되면 프로젝트 화면 가운데 아래에 깜박이는 큰 팝업(닫기 전까지, `initTaskAlerts` + `GET /api/notifications/alerts`). 작업 삭제는 휴지통(`project_trash`, 마이그레이션 010) — 삭제 직전 스냅샷 3개월 보관, Pro user 이상만 보기·복구(`/project/trash`). 권한은 **지금 기준 공통 모듈 `access.py`**(목록·배지·알림·멘션·메일 수신자·삭제·댓글 수정까지 — 멤버에서 빠지면 기록이 있어도 안 보이고 알림도 없음), 소유자 변경은 Pro user 이상, 연결(멀티호밍)된 작업은 연결된 프로젝트 멤버에게 읽기 전용(docs/PROJECT_MODULE.md 6-10). 연간 목표(마이그레이션 013, `goal_*` 테이블) — 사이드바 "목표" → 연도 펼침 → `/project/goals/{연도}` 에 매출(목표·실적·달성)·로아스 월별 숫자 + 업무 영역(상품·마케팅·컨텐츠·유통 등)별 연간·월별 글, 조회는 전원·입력(주차별 목표·연도 추가/삭제 포함)은 Pro user 이상. 3·6·9·12월 오른쪽 1~4분기 칸(글 칸 13=1분기·15=2분기·14=3분기·16=4분기 — 예전 반기 칸 번호 재사용, 15·16 은 마이그레이션 017) + 분기 월 칸 접기 애니메이션(localStorage `pj_goal_fold_q`, 표는 `width:1px`+`table-layout:fixed`), 영역·줄 이름 클릭 바로 수정, **엑셀식 칸 병합**(마우스로 끌어 사각형 선택 → 우클릭 셀 병합/병합 해제, 같은 영역 안 세로 `row_span` + 같은 분기 월 칸 가로, 글은 왼쪽 위 칸 — `goal_cell_merges`, 마이그레이션 014·015·017), 3열 줄 추가는 같은 항목 칸(2열) 안에(`goal_rows.label_cont`, 마이그레이션 016), 구조 변경은 새로고침 없이 제자리 다시 그리기(`refreshTable`)+애니메이션, 로아스는 % 표기. 월 머리 → **주간 회의록**(`/project/goals/{연도}/meetings/{월}`, 프로젝트 권한자 **누구나 수정** — Pro user 이상 [회의 완료](`completed_at`, 마이그레이션 022)면 잠금(지난주 결과는 다음 주 회의록이 열려 있는 동안 허용), 삭제·완료·완료 해제는 Pro user 이상, 표 첫 열 머리 글자 "구분", 주차 탭 — **주차는 그 달 안**(`store.month_weeks`: 1일이 월~금이면 1일~일요일이 1주차, 토·일이면 1일~다음 주 일요일, 그 뒤 월~일, 말일이 월·화면 앞 주차에 붙음, 회의록 `week_start` = 주차 시작일, 마이그레이션 020), `goal_meetings`·`goal_meeting_items` 마이그레이션 015 — 지난주 = **바로 앞 주차**(`store.prev_week_period`) 회의록의 같은 연결키 줄(`line_key`, 마이그레이션 018 — 생성 순서·이름 변경과 무관, 이름 추정 연결 금지)로 리뷰(열: 주요 업무·정량 목표 ‖ 전주 업무·결과(글, `result_note` 020)·전주 목표·결과 — 정량 목표·결과는 숫자면 원 정수 칸, 아니면 글 칸 `target_text`·`result_text`(예: 20개, 021)), 실적 조회 장애는 0원이 아니라 "미확인", 위에 목표 표 그 달 열 글을 영역별 "N월 계획" 카드로, 참석자 옆 [회의록 보드] = 그 주차의 빈 Google 슬라이드를 독립 창으로(오른쪽 🔗 아이콘 = 그 보드 링크 복사)(공유 드라이브 `MEETING_BOARD_FOLDER_ID`, 없으면 만듦, `app/integrations/google_slides.py`, Drive appProperties 로 주차 연결 — Drive·Slides 권한 토큰 필요), 표를 스크롤해도 보이는 머리 영역 3칸 = ① 월 계획 + 머리 줄에 숫자 4개 작게 1행(월 목표 매출·월 누적 목표 매출(목표 표 **주차별 매출 목표** `goal_week_targets` 1주차~이 주차 합 — 목표 표 매출 목표 월 칸을 누르면 입력 창 — 월 전체 목표는 직접 입력(주차 합계와 별개), 맨 아래 차이 = 월 목표 − 주차 합계)·월 누적 실적(1일~오늘)·누적 목표 대비 차액·%) | ② 결정 사항·메모 | ③ "N주차 작업 등록" 표(제목·담당자·프로젝트·섹션 → [적용] = 서버가 그 프로젝트에 작업 생성, `initMeetQuickTasks` — 주차별 서버 표 `goal_meeting_tasks`(마이그레이션 025)라 모두가 같이 보고, 남의 프로젝트 이름은 가림, 완료 프로젝트·섹션은 목록에서 뺌, 작업 칸(마이그레이션 026 `parent_task_id`) = 이미 있는 작업을 고르면 그 작업의 세부 작업으로 등록, 등록된 줄 제목 = 오른쪽 작업 창(편집, 저장 대기), [크게 열기] = 같은 표를 넓은 창으로), 실적 모듈 `performance_store` 매출은 머리 카드에만 읽기 전용 — 줄(쇼핑몰)별 자동 결과·이번주 실적·연결 배지·쇼핑몰 연결 메뉴는 폐지, 지난주 결과는 늘 직접 입력). 모든 열 너비 끌어서 조절(localStorage `pj_goal_col_w`), 세로 스크롤 틀 고정은 머리 줄+매출·로아스 줄까지, 항목 칸 +·우클릭으로 줄 위/아래 추가·삭제, 회의록 "주요 업무" 칸 우클릭 위/아래 줄 추가 = 항목 칸은 그대로 그 항목 안에(마이그레이션 027 `label_cont`, 항목 칸 나누기), 회의록 줄 작업은 새로고침 없이 제자리 다시 그리기(`refreshMeeting`)+애니메이션, 구분(구역) 칸 우클릭·⋯ = 구역 통째로 위/아래(`move-section`). 마감 알림(`reminders.py` 데몬 스레드, 영업일 09시, D-1/당일/지연, `task_reminders` 로 중복 방지, `PROJECT_REMINDER_*` env) — 마이그레이션 008. 라우터 핸들러는 동기 DB 라 `def` 로 둔다(`async def` 금지). 말풍선은 전부 아사나식 공용 말풍선(`.pj-hovertip`) — 새 기능도 `title=`/`data-tip=` 만 달고 별도 툴팁 구현 금지. 멤버 배정 후보는 `project` 권한 보유 등록 사용자에서 자동 목록(`GET /project/api/assignable-users`). 작업 배정·완료 시 관리자에게 메일(`app/mail.py` stdlib smtplib, `SMTP_*`+`PROJECT_NOTIFY_EMAIL` env, 미설정 시 조용히 skip, `BackgroundTasks` 비동기). 목표 표·회의록 칸 저장은 공용 `createFieldSaver`(같은 칸 요청 직렬화·보낸 값만 저장됨·실패 시 초안 유지·localStorage 초안 백업, 저장 실패면 구조 변경 중단 — docs/PROJECT_MODULE.md 6-9-3), 구역·항목 메뉴는 우클릭 + ⋮ 버튼(키보드·터치). ERP 메뉴 이름은 "Project"(`app/main.py` 모듈 목록 title). **PC 알림 프로그램**(`desktop/notifier/`, C# .NET Framework 4.8 WinForms exe 하나·트레이 상주, 마이그레이션 023 `notifier_links`·`notifier_tokens`) — 브라우저가 뒤에 있어도 태그·배정 알림을 웹 팝업과 같은 모양으로 화면 위에. 브라우저 `/project/notifier?code=` 승인으로 PC별 토큰(서버는 SHA-256 만, PC 는 DPAPI), `GET /project/api/notifier/alerts`(Bearer)는 웹 알림과 같은 `_alerts_payload`, 토큰마다 지금 사용자·권한 재확인. 프로그램이 돌고 있으면(최근 3분 확인, `notifier_active`) 웹 큰 팝업은 쉰다(`desktop: true`). 압축·난독화 금지(백신 오탐), 빌드 `desktop/notifier/build.ps1`, 상세 docs/PROJECT_MODULE.md 6-11. 댓글·답글 입력칸은 Enter 등록·Shift+Enter 줄바꿈(textarea), 설명란 이미지 더블클릭 = 별도 창 이미지 보기(확대·축소·끌어 이동). 작업 창은 **저장 버튼 없이 실시간 저장**(칸별 PUT, `saveField`/`saveChain`, 새 작업은 제목이 생기는 순간 생성). 댓글 답글·이모티콘 반응(마이그레이션 012 `task_comments.parent_id`·`task_comment_reactions`, 미적용 시 버튼 숨김·API 503), 완료 이력 줄은 `project_activity` completed 를 댓글 사이에 표시(댓글 수 제외), 댓글 `@아이디` 는 아이콘+이름 칩. 수신함은 확인 안 한 태그·읽지 않은 알림만(2026-10-08) — [확인] 버튼 없이 줄을 누르면 읽음·확인 처리(같은 작업 줄 함께) + 페이지 이동 없이 오른쪽 iframe 패널, 다른 줄을 고르거나 패널을 닫으면 그 줄은 목록에서 빠짐. 용어는 "세부 작업"(예전 하위 작업)·"메인 작업 추가". 패널(`/project/p/{pid}?task=&embed=1`, `html.pj-embed`). 상단 바 화면 배율 토글(`html.pj-ui-scale` → `.erp-app` zoom .75, 2880×1620·200%용) — **팝업은 반드시 `document.body` 에 붙인다**(배율 안의 fixed 좌표는 어긋남). 상세는 `docs/PROJECT_MODULE.md` - 실적 (`app/modules/performance/`, `performance_db`) — 쇼핑몰 통합 매출. 네 영역 분리: ① 수집 `adapters/`(쇼핑몰 하나 = 어댑터 파일 하나 + `registry.py` 한 줄 + SQL seed 한 줄) + `sync.py`(공통 동기화, 같은 쇼핑몰 동시 실행 차단, 쇼핑몰별 실패 격리) ② 보안 `security/`(AES-256-GCM, 키 버전, 비밀값 가리기) + `credentials.py` ③ 계산 `calc.py`(주=월~일, 수수료 반올림은 `commission()` 한 곳, 요율 이력) + `db.py` ④ 화면 `dashboard.py`/`router.py`/템플릿. 쇼핑몰 API 인증정보는 `.env` 가 아니라 **설정 화면에서 입력 → 마스터 키 `APP_ENCRYPTION_KEY` 로 암호화해 DB 저장**, secret 원문은 화면으로 다시 보내지 않는다. 쇼핑몰 API 는 백엔드에서만 호출, 오류·로그·raw 는 `redact` 후 저장. 매출 기준일: 결제=결제일, 취소·반품=발생일(`sync.sales_date_for`). 금액은 원 단위 정수. 권한키 `performance`, 설정 화면은 모듈 권한자 누구나(일반 사용자는 수수료율만), 수수료 외 설정 API 는 `is_admin`. 매출 업데이트 진행 창에서 쇼핑몰별 [중지](그 쇼핑몰만 멈추고 다음 쇼핑몰로). 카페24 어댑터는 기존 `app/integrations/cafe24` 토큰 재사용. 1단계는 모의 데이터(`is_sample`)·구조까지, 실제 수집은 쇼핑몰별로 공식 문서 확인 후 순차 구현. 쿠팡은 판매자배송 발주서 + 로켓그로스 주문을 결제일로 합산(WING 판매분석 대조는 원본 데이터 확인으로). 설정의 쇼핑몰별 **수동 입력** 토글(마이그레이션 002 `manual_input`·`perf_manual_sales`) — 켜면 일자별 표 날짜 칸에 총매출 직접 입력, 넣은 날은 API 값 대신(`daily_amounts` 한 곳). 열 순서 카페24·네이버·쿠팡·토스·GS샵·11번가·나머지. 상세는 `docs/PERFORMANCE_MODULE.md` diff --git a/app/modules/notice/templates/notice/admin.html b/app/modules/notice/templates/notice/admin.html index 3744898..9131fb6 100644 --- a/app/modules/notice/templates/notice/admin.html +++ b/app/modules/notice/templates/notice/admin.html @@ -2,7 +2,7 @@ {% block head_extra %} {# 프로젝트 화면 부품(설명 편집기·날짜 팝업·멤버 고르기)을 그대로 쓴다 — project.js 는 PJ_LIB_ONLY 로 부품만 #} - + {% endblock %} @@ -64,7 +64,7 @@ - + {% endif %} {% endblock %} diff --git a/app/modules/project/db.py b/app/modules/project/db.py index d6cc102..e6993b4 100644 --- a/app/modules/project/db.py +++ b/app/modules/project/db.py @@ -2776,7 +2776,23 @@ class ProjectStore: return (self._MEETING_ITEM_COLS + (", line_key" if self._meeting_keys(conn) else "") + (", content_row_span" if self._meeting_cells(conn) else "") + (", result_note" if self._meeting_v20(conn) else "") - + (", target_text, result_text" if self._meeting_v21(conn) else "")) + + (", target_text, result_text" if self._meeting_v21(conn) else "") + + (", label_cont" if self._meeting_v27(conn) else "")) + + def _meeting_v27(self, conn: Any) -> bool: + """마이그레이션 027 — 항목 칸 묶음(label_cont: 바로 위 줄의 항목 칸에 이어 붙는 줄).""" + if getattr(self, "_meeting_v27_ok", False): + return True + ok = self._column_exists(conn, "goal_meeting_items", "label_cont") + if ok: + self._meeting_v27_ok = True + return ok + + @staticmethod + def _meeting_conts(rows: list[dict[str, Any]]) -> list[bool]: + """줄 순서대로 '실제로 이어 붙은 줄'인가 — label_cont 이고 바로 위 줄이 같은 구역일 때만(구역 첫 줄은 늘 묶음 첫 줄).""" + return [bool(r.get("label_cont")) and i > 0 and rows[i - 1]["section"] == r["section"] + for i, r in enumerate(rows)] def _meeting_v21(self, conn: Any) -> bool: """마이그레이션 021 — 정량 목표·결과 글(target_text·result_text, 예: "20개").""" @@ -2999,6 +3015,7 @@ class ProjectStore: if ws.weekday() != 0 and not self._meeting_v20(conn): raise store.MeetingMigration020Needed() # 월요일만 허용하던 CHECK 가 아직 있다 keyed = self._meeting_keys(conn) + v27 = self._meeting_v27(conn) ins = conn.execute( "INSERT INTO goal_meetings (week_start, created_by, updated_by) VALUES (%s, %s, %s) " "ON CONFLICT (week_start) DO NOTHING RETURNING week_start", @@ -3006,7 +3023,8 @@ class ProjectStore: ).fetchone() if ins is None: return False - src_cols = "id, section, section_color, label, marketplace_code, sort_order" + (", line_key" if keyed else "") + src_cols = ("id, section, section_color, label, marketplace_code, sort_order" + (", line_key" if keyed else "") + + (", label_cont" if v27 else "")) src_items: list[dict[str, Any]] = [] src_is_prev = True for cmp_, order, is_prev in (("<", "DESC", True), (">", "ASC", False)): @@ -3042,6 +3060,12 @@ class ProjectStore: "marketplace_code, carry_from, sort_order, updated_by) VALUES (%s,%s,%s,%s,%s,%s,%s,%s)", (ws, r["section"], r["section_color"], r["label"], r["marketplace_code"], carry, n, who), ) + if v27 and r.get("label_cont"): + # 항목 칸 묶음도 그대로 이어받는다(027) — 방금 넣은 줄(같은 주차·순서) + conn.execute( + "UPDATE goal_meeting_items SET label_cont = true WHERE week_start = %s AND sort_order = %s", + (ws, n), + ) else: n = 0 for name, color in sections or [(k, "") for k in store.MEETING_TEMPLATE]: @@ -3108,9 +3132,14 @@ class ProjectStore: def add_meeting_item( self, *, week_start: date, section: str, section_color: str = "", label: str = "", - ref_item_id: int | None = None, place: str = "below", updated_by: str = "", + ref_item_id: int | None = None, place: str = "below", updated_by: str = "", same_label: bool = False, ) -> int: - """줄 추가 — 기준 줄 위/아래(같은 구역), 없으면 그 구역 끝(구역이 없으면 맨 끝 = 새 구역).""" + """줄 추가 — 기준 줄 위/아래(같은 구역), 없으면 그 구역 끝(구역이 없으면 맨 끝 = 새 구역). + + same_label(주요 업무 칸에서 추가, 027) = 새 줄을 기준 줄과 **같은 항목 칸** 안에: 아래면 새 줄이 이어 붙고(label_cont), + 위면 — 기준 줄이 묶음 첫 줄이면 새 줄이 첫 줄이 되어 이름을 넘겨받고 기준 줄이 이어 붙는다(연간 목표 016 과 같은 규칙).""" + if same_label and ref_item_id is None: + raise ValueError("같은 항목 칸에 추가하려면 기준 줄이 필요합니다.") sec = store.norm_str(section) if not sec or len(sec) > store.MEETING_LABEL_MAX: raise ValueError("구역 이름을 입력하세요(50자 이하).") @@ -3141,14 +3170,31 @@ class ProjectStore: i = same[-1] + 1 if same else len(ids) if any(a < i <= b for a, b in self._meeting_merge_ranges(rows)): raise ValueError("병합된 셀 안에 줄을 추가하려면 먼저 병합을 해제해 주세요.") + cont = False + if same_label: + if not self._meeting_v27(conn): + raise store.MeetingMigration027Needed() + k = ids.index(ref_item_id) + ref = rows[k] + if ref["section"] != sec: + raise ValueError("기준 줄과 같은 구역이어야 합니다.") + if place == "above" and not self._meeting_conts(rows)[k]: + # 묶음 첫 줄 위 — 새 줄이 첫 줄(이름을 넘겨받음), 기준 줄은 이어 붙는다 + lb = ref["label"] + conn.execute("UPDATE goal_meeting_items SET label = '', label_cont = true WHERE id = %s", + (ref_item_id,)) + else: + lb, cont = "", True # 새 줄 = 새 연결키(018) — 이름이 같은 다른 줄과 섞이지 않는다 keyed = self._meeting_keys(conn) + v27 = self._meeting_v27(conn) new_id = int(conn.execute( "INSERT INTO goal_meeting_items (week_start, section, section_color, label, marketplace_code, " - "sort_order, updated_by" + (", line_key" if keyed else "") + ") VALUES (%s,%s,%s,%s,%s,0,%s" - + (",%s" if keyed else "") + ") RETURNING id", + "sort_order, updated_by" + (", line_key" if keyed else "") + (", label_cont" if v27 else "") + + ") VALUES (%s,%s,%s,%s,%s,0,%s" + (",%s" if keyed else "") + (",%s" if v27 else "") + ") RETURNING id", (week_start, sec, color, lb, store.guess_meeting_market(sec, lb), - store.norm_str(updated_by, lower=True), *((str(uuid.uuid4()),) if keyed else ())), + store.norm_str(updated_by, lower=True), *((str(uuid.uuid4()),) if keyed else ()), + *((cont,) if v27 else ())), ).fetchone()["id"]) ids.insert(i, new_id) for n, x in enumerate(ids): @@ -3304,6 +3350,15 @@ class ProjectStore: i = next(n for n, r in enumerate(rows) if int(r["id"]) == item_id) if any(a <= i <= b for a, b in self._meeting_merge_ranges(rows)): raise ValueError("병합된 셀의 줄을 삭제하려면 먼저 병합을 해제해 주세요.") + if self._meeting_v27(conn): + # 항목 칸 묶음 첫 줄을 지우면 바로 아래 이어 붙은 줄이 첫 줄이 되고 이름을 넘겨받는다(비어 있으면) + conts = self._meeting_conts(rows) + if not conts[i] and i + 1 < len(rows) and conts[i + 1]: + conn.execute( + "UPDATE goal_meeting_items SET label_cont = false, " + "label = CASE WHEN label = '' THEN %s ELSE label END WHERE id = %s", + (rows[i]["label"], rows[i + 1]["id"]), + ) row = conn.execute("DELETE FROM goal_meeting_items WHERE id = %s RETURNING id", (item_id,)).fetchone() if row is None: raise KeyError(item_id) @@ -3321,6 +3376,10 @@ class ProjectStore: return if any(a <= i <= b or a <= j <= b for a, b in self._meeting_merge_ranges(rows)): raise ValueError("병합된 셀의 줄을 이동하려면 먼저 병합을 해제해 주세요.") + conts = self._meeting_conts(rows) + in_group = lambda k: conts[k] or (k + 1 < len(rows) and conts[k + 1]) # noqa: E731 + if in_group(i) or in_group(j): + raise ValueError("같은 항목 칸으로 묶인 줄은 옮길 수 없습니다. 항목 칸을 나눈 뒤 옮기세요.") ids[i], ids[j] = ids[j], ids[i] for n, x in enumerate(ids): conn.execute("UPDATE goal_meeting_items SET sort_order = %s WHERE id = %s", (n, x)) @@ -3348,6 +3407,24 @@ class ProjectStore: for n, x in enumerate(order): conn.execute("UPDATE goal_meeting_items SET sort_order = %s WHERE id = %s", (n, x)) + def split_meeting_label(self, *, item_id: int) -> int: + """항목 칸 나누기(027) — item_id(묶음 첫 줄) 아래 이어 붙은 줄들을 각자 항목 칸으로(이름은 빈 칸). 나눈 줄 수.""" + with self._pool.connection() as conn: + with conn.transaction(): + self._require_meetings(conn) + if not self._meeting_v27(conn): + raise store.MeetingMigration027Needed() + rows = self._locked_meeting_items(conn, item_id) + conts = self._meeting_conts(rows) + i = next(n for n, r in enumerate(rows) if int(r["id"]) == item_id) + n = 0 + for k in range(i + 1, len(rows)): + if not conts[k]: + break + conn.execute("UPDATE goal_meeting_items SET label_cont = false WHERE id = %s", (rows[k]["id"],)) + n += 1 + return n + # ── 회의록 작업 등록 표(025) — 주차별 한 표, 모두가 같이 본다. [적용] 전 줄은 고치고, [적용]은 한 번만 ── # 026 — 작업 칸(parent_task_id): 고르면 [적용] 때 그 작업의 세부 작업으로(비우면 그 섹션에 새 작업). # 025 의 parent_id(표 안 줄끼리 세부 작업)는 화면에서 쓰지 않는다(열·값은 그대로, 읽기·쓰기 안 함). diff --git a/app/modules/project/router.py b/app/modules/project/router.py index e6c9900..a78f126 100644 --- a/app/modules/project/router.py +++ b/app/modules/project/router.py @@ -2924,6 +2924,20 @@ def _goal_area_layout(rows: list[dict[str, Any]], this_month: int) -> None: row["layout"] = out +def _meeting_label_spans(rows: list[dict[str, Any]]) -> None: + """회의록 구역 한 덩어리의 항목 칸 묶음(027) — 이어 붙은 줄(label_cont, 구역 첫 줄 제외)은 항목 칸을 그리지 않고 + (label_hidden) 묶음 첫 줄이 rowspan(label_span). label_shown = 그 줄이 속한 항목 이름(칸 이름표·접근성용).""" + grp: dict[str, Any] | None = None + for i, it in enumerate(rows): + if i and it.get("label_cont") and grp is not None: + it["label_hidden"] = True + grp["label_span"] += 1 + else: + grp = it + it["label_hidden"], it["label_span"] = False, 1 + it["label_shown"] = grp["label"] + + def _goal_label_spans(rows: list[dict[str, Any]]) -> None: """항목 칸(2열) 묶음(016) — 묶음 첫 줄 label_span = 이어 붙은 줄 수 + 1, 이어 붙은 줄은 label_span 0(2열을 그리지 않음). 영역 첫 줄은 늘 묶음 첫 줄.""" @@ -2956,6 +2970,8 @@ def _goal_call(fn: Any, *args: Any, **kwargs: Any) -> Any: raise HTTPException(status_code=409, detail="회의가 완료되어 수정할 수 없습니다. 관리자가 [완료 해제]하면 다시 고칠 수 있습니다.") except store.MeetingMigration022Needed: raise HTTPException(status_code=503, detail="회의 완료 기능은 project_db 마이그레이션 022 적용 후 사용할 수 있습니다.") + except store.MeetingMigration027Needed: + raise HTTPException(status_code=503, detail="같은 항목 칸 안 줄 추가·항목 칸 나누기는 project_db 마이그레이션 027 적용 후 사용할 수 있습니다.") except store.MeetingParentTaskMigrationNeeded: raise HTTPException(status_code=503, detail="작업 칸(이미 있는 작업의 세부 작업으로 등록)은 project_db 마이그레이션 026 적용 후 사용할 수 있습니다.") except store.MeetingTaskMigrationNeeded: @@ -3440,6 +3456,7 @@ def _meeting_view(request: Request, st: Any, *, year: int, month: int, week: dat meeting["sections"] = sections for sec in sections: covered = 0 + _meeting_label_spans(sec["rows"]) for i, it in enumerate(sec["rows"]): it["content_html"] = store.goal_text_html(it["content"]) it["content_hidden"] = covered > 0 @@ -3683,7 +3700,8 @@ def api_delete_meeting(request: Request, week_start: str) -> JSONResponse: @router.post("/api/goals/meetings/{week_start}/items") def api_add_meeting_item(request: Request, week_start: str, payload: dict[str, Any] = Body(...)) -> JSONResponse: - """줄 추가 {section, label?, ref_item_id?, place?: above|below} — 기준 줄 위/아래, 없으면 구역 끝(새 구역이면 맨 끝).""" + """줄 추가 {section, label?, ref_item_id?, place?: above|below, same_label?} — 기준 줄 위/아래, 없으면 구역 끝(새 구역이면 맨 끝). + same_label = 주요 업무 칸에서 추가 — 기준 줄과 같은 항목 칸 안에(027).""" user = _require_user(request) st = _db_or_503(request) ws = _goal_call(store.validate_week_start, week_start) @@ -3695,6 +3713,7 @@ def api_add_meeting_item(request: Request, week_start: str, payload: dict[str, A item_id = _goal_call( st.add_meeting_item, week_start=ws, section=payload.get("section", ""), label=payload.get("label", ""), ref_item_id=ref_id, place=payload.get("place") or "below", updated_by=user["email"], + same_label=bool(payload.get("same_label")), ) return JSONResponse({"ok": True, "id": item_id}, status_code=201) @@ -3753,6 +3772,14 @@ def api_move_meeting_item(request: Request, item_id: int, payload: dict[str, Any return JSONResponse({"ok": True}) +@router.post("/api/goals/meeting-items/{item_id}/split-label") +def api_split_meeting_label(request: Request, item_id: int) -> JSONResponse: + """항목 칸 나누기(027) — item_id = 묶음 첫 줄. 이어 붙은 줄들이 각자 항목 칸(이름 빈 칸)으로. 줄 순서와 같은 권한.""" + _require_user(request) + n = _goal_call(_db_or_503(request).split_meeting_label, item_id=item_id) + return JSONResponse({"ok": True, "split": n}) + + # ── 회의록 작업 등록 표(025) — 주차별 한 표를 서버에(예전엔 각자 브라우저에만 있어 다른 사람 줄이 안 보였다) ── # 보기·고치기: 회의록을 볼 수 있는 사람 누구나(회의 완료면 잠금). 줄에 고른 프로젝트는 내가 멤버인 것만 고를 수 있고, # 내가 멤버가 아닌 프로젝트를 가리키는 남의 줄은 프로젝트·섹션 이름·만든 작업을 가린다. [적용] = 그 프로젝트 멤버만. diff --git a/app/modules/project/store.py b/app/modules/project/store.py index 79498e2..5a9faae 100644 --- a/app/modules/project/store.py +++ b/app/modules/project/store.py @@ -431,6 +431,10 @@ class MeetingMigration022Needed(RuntimeError): """회의 완료(잠금)는 마이그레이션 022 뒤에만 된다.""" +class MeetingMigration027Needed(RuntimeError): + """같은 항목 칸 안 줄 추가·항목 칸 나누기(goal_meeting_items.label_cont)는 마이그레이션 027 뒤에만 된다.""" + + class MeetingTaskMigrationNeeded(RuntimeError): """회의록 작업 등록 표(서버 저장)는 마이그레이션 025 뒤에만 된다.""" diff --git a/app/modules/project/templates/project/goal_meeting.html b/app/modules/project/templates/project/goal_meeting.html index 1a2b934..a8c8965 100644 --- a/app/modules/project/templates/project/goal_meeting.html +++ b/app/modules/project/templates/project/goal_meeting.html @@ -1,7 +1,7 @@ {% extends "project/_meeting_content_base.html" if meeting_embedded else "erp_base.html" %} {% block head_extra %} - + {% endblock %} @@ -227,22 +227,25 @@ {% for it in sec.rows %} {% set p = it.prev %} - + {% if loop.first %} {{ sec.name }} {% if edit %} {% endif %} {% endif %} - + {# 항목 칸 — 같은 항목 칸 안에 이어 붙은 줄(027 label_cont)은 그리지 않고 묶음 첫 줄이 rowspan #} + {% if not it.label_hidden %} + 1 %} rowspan="{{ it.label_span }}"{% endif %}> {{ it.label }} {% if edit %}{% endif %} + {% endif %} {% if not it.content_hidden %} - {% if edit %}
{% if it.content_html is defined %}{{ it.content_html | safe }}{% else %}{{ it.content }}{% endif %}
+ {% if edit %}
{% if it.content_html is defined %}{{ it.content_html | safe }}{% else %}{{ it.content }}{% endif %}
{% else %}
{% if it.content_html is defined %}{{ it.content_html | safe }}{% else %}{{ it.content }}{% endif %}
{% endif %} {% endif %} @@ -255,7 +258,7 @@
{% if p.content_html is defined %}{{ p.content_html | safe }}{% else %}{{ p.content }}{% endif %}
{# 결과(글) — 지난 주차 줄의 result_note(020). 미적용이면 보기만 #} - {% if edit and meeting.result_notes %} + {% if edit and meeting.result_notes %} {% else %}
{{ p.result_note or '' }}
{% endif %} {{ p.target_text or won(p.target_amount) }} @@ -294,6 +297,6 @@ {% include "project/_member_tasks_modal.html" %} - - + + {% endblock %} diff --git a/app/modules/project/templates/project/goals.html b/app/modules/project/templates/project/goals.html index acf9cf2..80430df 100644 --- a/app/modules/project/templates/project/goals.html +++ b/app/modules/project/templates/project/goals.html @@ -1,7 +1,7 @@ {% extends "erp_base.html" %} {% block head_extra %} - + {% endblock %} @@ -207,5 +207,5 @@ {% include "project/_member_tasks_modal.html" %} - + {% endblock %} diff --git a/app/modules/project/templates/project/help.html b/app/modules/project/templates/project/help.html index 0131a70..3436e7c 100644 --- a/app/modules/project/templates/project/help.html +++ b/app/modules/project/templates/project/help.html @@ -1,7 +1,7 @@ {% extends "erp_base.html" %} {% block head_extra %} - + {% endblock %} @@ -699,6 +699,7 @@ diff --git a/app/modules/project/templates/project/inbox.html b/app/modules/project/templates/project/inbox.html index 30e91db..2f9c833 100644 --- a/app/modules/project/templates/project/inbox.html +++ b/app/modules/project/templates/project/inbox.html @@ -1,7 +1,7 @@ {% extends "erp_base.html" %} {% block head_extra %} - + {% endblock %} @@ -101,5 +101,5 @@ {% include "project/_side_modals.html" %} {% include "project/_member_tasks_modal.html" %} - + {% endblock %} diff --git a/app/modules/project/templates/project/mytasks.html b/app/modules/project/templates/project/mytasks.html index bb227cf..3b482da 100644 --- a/app/modules/project/templates/project/mytasks.html +++ b/app/modules/project/templates/project/mytasks.html @@ -1,7 +1,7 @@ {% extends "erp_base.html" %} {% block head_extra %} - + {% endblock %} @@ -100,5 +100,5 @@ "today": {{ today | tojson }} } - + {% endblock %} diff --git a/app/modules/project/templates/project/notifier.html b/app/modules/project/templates/project/notifier.html index 79ef679..133ae88 100644 --- a/app/modules/project/templates/project/notifier.html +++ b/app/modules/project/templates/project/notifier.html @@ -1,7 +1,7 @@ {% extends "erp_base.html" %} {% block head_extra %} - + {% endblock %} @@ -108,5 +108,5 @@ }); })(); - + {% endblock %} diff --git a/app/modules/project/templates/project/project.html b/app/modules/project/templates/project/project.html index 3c8cc4c..42af370 100644 --- a/app/modules/project/templates/project/project.html +++ b/app/modules/project/templates/project/project.html @@ -1,7 +1,7 @@ {% extends "erp_base.html" %} {% block head_extra %} - + @@ -468,5 +468,5 @@ - + {% endblock %} diff --git a/app/modules/project/templates/project/trash.html b/app/modules/project/templates/project/trash.html index 52eb973..eb60d2f 100644 --- a/app/modules/project/templates/project/trash.html +++ b/app/modules/project/templates/project/trash.html @@ -1,7 +1,7 @@ {% extends "erp_base.html" %} {% block head_extra %} - + {% endblock %} @@ -70,5 +70,5 @@ {% include "project/_side_modals.html" %} {% include "project/_member_tasks_modal.html" %} - + {% endblock %} diff --git a/app/static/project-meeting-cells.js b/app/static/project-meeting-cells.js index 5531ea6..2c05ebb 100644 --- a/app/static/project-meeting-cells.js +++ b/app/static/project-meeting-cells.js @@ -287,19 +287,25 @@ if (merged.length) items.push({ label: "병합 해제", icon: opts.icon("call_split"), onClick: () => unmergeCells(merged) }); if (cells.some(c => editorOf(c).value)) items.push({ label: "내용 지우기 (Del)", icon: opts.icon("ink_eraser"), onClick: () => clearCells(cells) }); if (saver) { + // 주요 업무 칸에서 추가한 줄은 같은 항목 칸 안에 들어간다(항목 칸은 그대로 — 027 sameLabel) items.push(null, - { label: "위에 줄 추가", icon: opts.icon("add_row_above"), onClick: () => saver.addRow(cell.closest("tbody").dataset.section, cell.dataset.meetItem, "above") }, + { label: "위에 줄 추가", icon: opts.icon("add_row_above"), onClick: () => saver.addRow(cell.closest("tbody").dataset.section, cell.dataset.meetItem, "above", { sameLabel: true }) }, { label: "아래에 줄 추가", icon: opts.icon("add_row_below"), onClick: () => { const rows = Array.from(cell.closest("tbody").rows), bottom = rows[rows.indexOf(cell.parentElement) + cell.rowSpan - 1]; - saver.addRow(cell.closest("tbody").dataset.section, bottom.dataset.item, "below"); + saver.addRow(cell.closest("tbody").dataset.section, bottom.dataset.item, "below", { sameLabel: true }); } }); + if (cell.rowSpan === 1 && cells.length === 1 && saver.deleteRow) { + items.push({ label: "줄 삭제", danger: true, icon: opts.icon("delete"), onClick: () => saver.deleteRow(cell.parentElement) }); + } } } if (items.length) items.push(null); items.push(...widthItems(td)); if (items.length) { e.preventDefault(); opts.menu(e.clientX, e.clientY, items); } }); - return { bindSaver: s => { saver = s; }, widthItems: widthItems }; + // 줄 구조를 다시 끼운 뒤(refreshMeeting) — 새 칸에 열 너비 손잡이·이동 테두리, 너비 다시 적용, 선택 풀기 + function refresh() { anchor = null; clearSelection(); handles(); applyWidths(); } + return { bindSaver: s => { saver = s; }, widthItems: widthItems, refresh: refresh }; } window.PJMeetingCells = { init: init }; })(); diff --git a/app/static/project.css b/app/static/project.css index 582f0c9..4a4d2dd 100644 --- a/app/static/project.css +++ b/app/static/project.css @@ -2475,6 +2475,9 @@ html.pj-goal-moving, html.pj-goal-moving * { cursor: grabbing !important; user-s @keyframes pj-goal-merge-flash { from { box-shadow: inset 0 0 0 2px var(--pj-accent), inset 0 0 0 999px rgba(123, 104, 238, .14); } to { box-shadow: inset 0 0 0 2px transparent, inset 0 0 0 999px rgba(123, 104, 238, 0); } } @media (prefers-reduced-motion: reduce) { .pj-goal-table tr.is-new-row > *, .pj-goal-table td.is-merge-flash { animation: none; } } +/* 주간 회의록 — 줄을 그 자리에서 다시 그린 뒤(refreshMeeting) 새 줄 잠깐 강조(연간 목표와 같은 색) */ +.pj-meet-table tr.is-new-row > * { animation: pj-goal-row-new 1.4s ease-out; } +@media (prefers-reduced-motion: reduce) { .pj-meet-table tr.is-new-row > * { animation: none; } } /* 칸 병합 — 끌어서 고르는 동안 글 선택 막기 */ html.pj-goal-selecting, html.pj-goal-selecting * { user-select: none !important; cursor: cell !important; } /* 칸 아무 곳이나 눌러 입력 — 칸 전체가 글 입력 커서(관리자 화면) */ diff --git a/app/static/project.js b/app/static/project.js index 00b75af..ec91b5b 100644 --- a/app/static/project.js +++ b/app/static/project.js @@ -10572,6 +10572,7 @@ btn.setAttribute("aria-pressed", prevFirst ? "true" : "false"); } arrange(); + table.addEventListener("pj-meet-rows", arrange); // 줄 구조를 다시 끼운 뒤(refreshMeeting) 새 줄도 같은 순서로 btn.addEventListener("click", function () { prevFirst = !prevFirst; try { localStorage.setItem(KEY, prevFirst ? "prev" : "this"); } catch (_) {} @@ -11408,7 +11409,10 @@ return ta.dataset.field === "result_note" ? "meet:item:" + tr.dataset.prev + ":result_note" : "meet:item:" + tr.dataset.item + ":content"; }, - onSaved: function (ta) { const n = ta.closest("td") || ta; clearSaveFailed(n); flashSaved(n); }, + onSaved: function (ta) { + const n = ta.closest("td") || ta; clearSaveFailed(n); flashSaved(n); + if (pendingMeetRefresh && !textSaver.anyDirty()) refreshMeeting().catch(function (err) { showToast(err.message, "error"); }); + }, onClear: function (ta) { clearSaveFailed(ta.closest("td") || ta); }, onFail: function (ta, err) { markSaveFailed(ta.closest("td") || ta, err); }, }); @@ -11433,8 +11437,11 @@ if (table) table.querySelectorAll(".pj-meet-text, .pj-meet-rnote").forEach(bindText); if (cellGrid) cellGrid.bindSaver({ flush: flushAll, save: function (ta) { return textSaver.flush(ta); }, replace: function (ta, value) { ta.value = value; textSaver.acceptSaved(ta, ta.value); }, - rowMenu: rowMenu, addRow: function (section, ref, place) { run(function () { return addRow(section, ref, place); }); }, - reload: reloadKeepScroll }); + rowMenu: rowMenu, + // 주요 업무 칸 메뉴 — 위/아래 줄 추가는 같은 항목 칸 안에(027, 이름을 묻지 않음), 줄 삭제 + addRow: function (section, ref, place, o) { run(function () { return addRow(section, ref, place, o && o.sameLabel); }); }, + deleteRow: function (tr) { run(function () { return deleteRow(tr); }); }, + reload: function () { refreshMeeting().catch(function (err) { showToast("처리 실패: " + err.message, "error"); }); } }); if (table && window.PJGoalText) window.PJGoalText.init(table, el("pj-goal-format")); if (restored) showToast("저장되지 않았던 글 " + restored + "칸을 되살려 다시 저장합니다."); else if (conflict) showToast("다른 곳에서 바뀐 칸 " + conflict + "개는 예전 초안을 되살리지 않았습니다."); @@ -11500,41 +11507,150 @@ span.addEventListener("blur", onBlur); }); - // ── 줄 메뉴(⋯ · 항목 우클릭) — 위/아래 줄 추가 · 순서 · 삭제 ── - // 줄 작업 뒤엔 새로고침 — 그 전에 저장 안 된 칸(대기·진행 중·실패)을 저장하고, 실패하면 작업 자체를 하지 않는다(초안 유지) - async function run(fn) { - try { - await flushAll(); - if (!(await fn())) return; - await flushAll(); - reloadKeepScroll(); - } catch (err) { showToast("처리 실패: " + err.message, "error"); } + // ── 줄 메뉴(⋯ · 항목 우클릭) — 위/아래 줄 추가 · 순서 · 항목 칸 나누기 · 삭제 ── + // 줄 작업 전에 저장 안 된 칸(대기·진행 중·실패)을 저장하고, 실패하면 작업 자체를 하지 않는다(초안 유지). + // 작업 뒤엔 새로고침 대신 표만 그 자리에서 다시 그린다(refreshMeeting — 연간 목표 표와 같은 애니메이션). + // fn 이 true 면 다시 그리기, { removed: [tr…] } 면 그 줄을 흐리게 지운 뒤 다시 그리기, false 면 아무것도 안 함. + let meetStruct = Promise.resolve(); + function run(fn) { + const job = meetStruct.then(async function () { // 줄 작업은 한 번에 하나씩(앞 작업 다시 그리기가 끝난 뒤) + try { + await flushAll(); + const r = await fn(); + if (!r) return; + await flushAll(); + await refreshMeeting(r === true ? {} : r); + } catch (err) { showToast("처리 실패: " + err.message, "error"); } + }); + meetStruct = job; + return job; } - async function addRow(section, ref, place) { + // sameLabel(주요 업무 칸에서) = 기준 줄과 같은 항목 칸 안에 — 이름을 묻지 않는다(027) + async function addRow(section, ref, place, sameLabel) { + if (sameLabel) { + await api("POST", meetingUrl + "/items", { section: section, label: "", ref_item_id: ref, place: place, same_label: true }); + return true; + } const v = await prompt("새 줄 이름 (예: 쿠팡 — 비워 둬도 됩니다)", ""); if (v == null) return false; await api("POST", meetingUrl + "/items", { section: section, label: String(v).trim(), ref_item_id: ref, place: place }); return true; } + // 항목 칸 묶음의 첫 줄(이어 붙은 줄이면 위로 거슬러 올라감)·맨 아래 줄 + function groupHead(tr) { + let r = tr; + while (r && r.dataset.labelCont === "1" && r.previousElementSibling) r = r.previousElementSibling; + return r; + } + function groupBottom(tr) { + const head = groupHead(tr), th = head.querySelector("th.pj-meet-c-label"); + const rows = Array.from(head.closest("tbody").rows); + return rows[Math.min(rows.length - 1, rows.indexOf(head) + ((th && th.rowSpan) || 1) - 1)]; + } + async function deleteRow(tr) { + const head = groupHead(tr); + const label = ((head.querySelector(".pj-meet-label") || {}).textContent || "").trim(); + const grouped = groupBottom(tr) !== head; + const msg = !grouped ? "'" + (label || "이 줄") + "' 줄을 삭제할까요? 주요 업무·금액도 함께 삭제됩니다." + : tr === head ? "'" + (label || "이 항목") + "' 항목의 첫 줄을 삭제할까요? 주요 업무·금액도 함께 삭제되고, 아래 줄이 항목 이름을 이어받습니다." + : "'" + (label || "이 항목") + "' 항목의 이 줄을 삭제할까요? 주요 업무·금액도 함께 삭제됩니다."; + const ok = await confirm(msg, { okText: "삭제", cancelText: "취소" }); + if (!ok) return false; + await api("DELETE", itemUrl(tr.dataset.item)); + return { removed: [tr] }; + } function rowMenu(x, y, tr) { - const id = tr.dataset.item, section = tr.dataset.section; - const label = (tr.querySelector(".pj-meet-label") || {}).textContent || ""; - showContextMenu(x, y, [ + tr = groupHead(tr); + const id = tr.dataset.item, section = tr.dataset.section, bottom = groupBottom(tr); + const grouped = bottom !== tr; + // 항목 칸에서 추가 = 항목 칸 밖에 따로(묶음 맨 위·맨 아래 기준). 묶인 칸은 순서 대신 "항목 칸 나누기" + const items = [ { label: "위에 줄 추가", icon: menuIcon("add_row_above"), onClick: function () { run(function () { return addRow(section, id, "above"); }); } }, - { label: "아래에 줄 추가", icon: menuIcon("add_row_below"), onClick: function () { run(function () { return addRow(section, id, "below"); }); } }, - { label: "위로", icon: menuIcon("arrow_upward"), onClick: function () { run(async function () { await api("POST", itemUrl(id) + "/move", { direction: -1 }); return true; }); } }, - { label: "아래로", icon: menuIcon("arrow_downward"), onClick: function () { run(async function () { await api("POST", itemUrl(id) + "/move", { direction: 1 }); return true; }); } }, - null, - { label: "줄 삭제", danger: true, icon: menuIcon("delete"), onClick: function () { - run(async function () { - const ok = await confirm("'" + (label.trim() || "이 줄") + "' 줄을 삭제할까요? 주요 업무·금액도 함께 삭제됩니다.", - { okText: "삭제", cancelText: "취소" }); - if (!ok) return false; - await api("DELETE", itemUrl(id)); - return true; + { label: "아래에 줄 추가", icon: menuIcon("add_row_below"), onClick: function () { run(function () { return addRow(section, bottom.dataset.item, "below"); }); } }, + ]; + if (grouped) { + items.push({ label: "항목 칸 나누기", icon: menuIcon("horizontal_split"), onClick: function () { + run(async function () { await api("POST", itemUrl(id) + "/split-label"); return true; }); + } }); + } else { + items.push( + { label: "위로", icon: menuIcon("arrow_upward"), onClick: function () { run(async function () { await api("POST", itemUrl(id) + "/move", { direction: -1 }); return true; }); } }, + { label: "아래로", icon: menuIcon("arrow_downward"), onClick: function () { run(async function () { await api("POST", itemUrl(id) + "/move", { direction: 1 }); return true; }); } }); + } + items.push(null, { label: grouped ? "첫 줄 삭제" : "줄 삭제", danger: true, icon: menuIcon("delete"), onClick: function () { + run(function () { return deleteRow(tr); }); + } }); + showContextMenu(x, y, items.concat(cellGrid ? [null].concat(cellGrid.widthItems(tr.querySelector("th.pj-meet-c-label"))) : [])); + } + + // ── 줄 구조가 바뀐 뒤(줄 추가·삭제·이동·항목 칸 나누기·구역 이동·셀 병합) 새로고침 없이 표의 구역 부분만 서버에서 다시 받아 + // 그 자리에서 바꿔 끼운다(연간 목표 refreshTable 과 같은 방식) — 지운 줄은 흐려지며 사라지고, 남은 줄은 예전 자리에서 + // 새 자리로 미끄러지고(FLIP), 새 줄은 위에서 내려오며 잠깐 강조. 동작 줄이기 설정이면 애니메이션 없이. + // 글 보호: 시작 전에 저장(실패하면 throw — 표는 그대로), 받는 사이에 새로 입력한 글이 있으면 저장 후 다시 받고, + // 계속 입력 중이면 바꿔 끼우지 않고 저장이 끝난 뒤 다시 그린다(pendingMeetRefresh). 받아 오기에 실패하면 예전처럼 새로고침. + const MEET_ANIM_MS = 280; + let pendingMeetRefresh = false; + async function refreshMeeting(opts) { + opts = opts || {}; + await flushAll(); + const reduce = !Element.prototype.animate || + (window.matchMedia && window.matchMedia("(prefers-reduced-motion: reduce)").matches); + const busy = function () { + return textSaver.anyDirty() || amtSaver.anyDirty() || !!table.querySelector("[data-meet-edit].is-editing"); + }; + let fresh = null, anims = []; + for (let tries = 0; ; tries++) { + fresh = null; + try { + const res = await fetch(location.href, { credentials: "same-origin", cache: "no-store" }); + if (res.ok) fresh = new DOMParser().parseFromString(await res.text(), "text/html").getElementById("pj-meet-table"); + } catch (_) { fresh = null; } + if (!busy() && opts.removed && opts.removed.length && !reduce && !anims.length) { + anims = opts.removed.filter(function (tr) { return tr.isConnected; }).map(function (tr) { + return tr.animate([{ opacity: 1 }, { opacity: 0 }], { duration: 180, easing: "ease-in", fill: "forwards" }); }); - } }, - ].concat(cellGrid ? [null].concat(cellGrid.widthItems(tr.querySelector("th.pj-meet-c-label"))) : [])); + await Promise.all(anims.map(function (a) { return a.finished.catch(function () {}); })); + } + if (!busy()) break; + anims.forEach(function (a) { try { a.cancel(); } catch (_) {} }); + anims = []; + if (tries >= 2) { + pendingMeetRefresh = true; + showToast("입력 중인 칸이 있어 표를 아직 다시 그리지 않았습니다 — 저장되면 다시 그립니다."); + return; + } + await flushAll(); // 받는 동안 새로 입력한 글 — 저장 실패면 throw(표는 그대로) + } + if (!fresh) { reloadKeepScroll(); return; } + pendingMeetRefresh = false; + const before = new Map(); + table.querySelectorAll("tbody.pj-meet-sec > tr[data-item]").forEach(function (tr) { + before.set(tr.dataset.item, tr.getBoundingClientRect().top); + }); + table.querySelectorAll("tbody.pj-meet-sec").forEach(function (t) { t.remove(); }); + fresh.querySelectorAll("tbody.pj-meet-sec").forEach(function (t) { table.appendChild(document.importNode(t, true)); }); + textSaver.prune(); + amtSaver.prune(); + table.querySelectorAll(".pj-meet-text, .pj-meet-rnote").forEach(bindText); + table.querySelectorAll("input.pj-meet-amount").forEach(bindAmount); + table.dispatchEvent(new CustomEvent("pj-meet-rows")); // 이번주 ↔ 지난주 칸 순서(initMeetOrder) + if (cellGrid && cellGrid.refresh) cellGrid.refresh(); // 열 너비 손잡이·이동 테두리·선택 + if (reduce) return; + table.querySelectorAll("tbody.pj-meet-sec > tr[data-item]").forEach(function (tr) { + const top = tr.getBoundingClientRect().top; + if (before.has(tr.dataset.item)) { + const dy = before.get(tr.dataset.item) - top; + if (Math.abs(dy) > 1) { + tr.animate([{ transform: "translateY(" + dy + "px)" }, { transform: "translateY(0)" }], + { duration: MEET_ANIM_MS, easing: "cubic-bezier(.2,.8,.2,1)" }); + } + } else { + tr.animate([{ opacity: 0, transform: "translateY(-10px)" }, { opacity: 1, transform: "translateY(0)" }], + { duration: MEET_ANIM_MS + 40, easing: "cubic-bezier(.2,.8,.2,1)" }); + tr.classList.add("is-new-row"); + setTimeout(function () { tr.classList.remove("is-new-row"); }, 1400); + } + }); } // ── 구역 메뉴(구분 칸 ⋯ · 우클릭) — 구역을 통째로 위/아래(그 안의 줄 순서·병합은 그대로), 구역 끝에 줄 추가 ── function secMenu(x, y, tbody) { diff --git a/docs/DEPLOYMENT.md b/docs/DEPLOYMENT.md index c445944..807cfaf 100644 --- a/docs/DEPLOYMENT.md +++ b/docs/DEPLOYMENT.md @@ -125,6 +125,18 @@ docker exec postgres-db psql -U postgres -d project_db -c "SELECT to_regclass('g 설정이 없거나 권한이 모자라면 버튼을 눌렀을 때 사유가 안내되고(503), 회의록 다른 기능은 그대로 동작한다. +## 주간 회의록 항목 칸 묶음 마이그레이션 (027) + +027은 `goal_meeting_items.label_cont` 열만 추가한다(기본 false, 기존 값 그대로, 다시 실행 가능). 미적용이면 "주요 업무" 칸의 +같은 항목 칸 줄 추가·항목 칸 나누기만 503 안내, 나머지는 그대로. + +```bash +cd /opt/www/main +docker exec postgres-db pg_dump -U postgres project_db > ~/project_db_before_027_$(date +%Y%m%d%H%M).sql +docker exec -i postgres-db psql -v ON_ERROR_STOP=1 -U postgres -d project_db < scripts/sql/project_db_027_meeting_label_groups.sql +docker exec postgres-db psql -U postgres -d project_db -c "SELECT column_name FROM information_schema.columns WHERE table_name='goal_meeting_items' AND column_name='label_cont';" +``` + ## 실적 수동 입력·열 순서 마이그레이션 (performance_db 002) 002는 `perf_marketplaces.manual_input` 열(기본 꺼짐) + `perf_manual_sales` 표를 추가하고, 쇼핑몰 순서(`sort_order`)를 diff --git a/docs/PROJECT_MODULE.md b/docs/PROJECT_MODULE.md index b4b516d..dfe4ad0 100644 --- a/docs/PROJECT_MODULE.md +++ b/docs/PROJECT_MODULE.md @@ -1196,6 +1196,19 @@ Windows 트레이 프로그램 **DBX 알림**(`desktop/notifier/`, C# .NET Frame 행 잠금 안에서 이어진 같은 구역 줄 묶음과 옆 묶음의 자리를 바꾼다(묶음 안 줄 순서·세로 병합 그대로, 맨 끝이면 그대로). 줄 이동과 같은 권한(누구나, 회의 완료면 409). 다음 회의록은 `create_meeting` 이 이 순서를 이어받는다. 마이그레이션 없음. +- **회의록 항목 칸 묶음**(2026-10-12, 마이그레이션 027 `goal_meeting_items.label_cont`): "주요 업무" 칸 우클릭 → 위/아래 줄 추가는 + **항목 칸은 그대로 두고 그 항목 안에** 줄을 늘린다(`POST …/items {same_label: true}` — 이름을 묻지 않음. 아래 = 새 줄이 이어 붙고, + 묶음 첫 줄 위 = 새 줄이 첫 줄이 되어 이름을 넘겨받고 기준 줄이 이어 붙음 — 연간 목표 016 과 같은 규칙). 주요 업무 칸 메뉴에 "줄 삭제"(그 한 줄). + 화면은 묶음 첫 줄 항목 칸 `rowspan`(`router._meeting_label_spans`, 구역 첫 줄은 늘 묶음 첫 줄), 이어 붙은 줄은 `tr[data-label-cont]`. + 항목 칸 메뉴(우클릭·⋯) = 따로 추가(묶음 맨 위·맨 아래 기준, 이름 물음) · 묶였으면 위로/아래로 대신 **항목 칸 나누기** + (`POST /api/goals/meeting-items/{id}/split-label`) · 첫 줄 삭제(아래 줄이 이름을 이어받음). 묶인 줄의 순서 이동은 400. + 줄마다 주요 업무·정량 목표·연결키(line_key)는 따로라 지난주 리뷰는 줄 단위 그대로, 다음 주 회의록은 묶음을 이어받는다. + 027 미적용이면 같은 항목 칸 추가·나누기만 503, 나머지는 예전처럼. +- **회의록 줄 작업 애니메이션**(2026-10-12): 줄 추가·삭제·이동·항목 칸 나누기·구역 이동·셀 병합/해제 뒤 새로고침 대신 `refreshMeeting` — + 같은 주소를 다시 받아 표의 구역(`tbody.pj-meet-sec`)만 바꿔 끼우고 저장·셀 도구(`PJMeetingCells.refresh`)·칸 순서(`pj-meet-rows` 이벤트)를 + 다시 붙인다. 지운 줄은 흐려지며 사라지고, 남은 줄은 미끄러지고(FLIP), 새 줄은 내려오며 강조(연간 목표 `refreshTable` 과 같음). + 저장 안 된 글은 먼저 저장(실패면 작업 안 함), 계속 입력 중이면 저장 뒤 다시 그림, 받아 오기 실패면 새로고침. 줄 작업은 한 번에 하나씩. + - **회의록 작업 등록 — 새 프로젝트·새 섹션**(2026-10-12): 프로젝트 칸 목록 맨 위 "새 프로젝트"(Pro user 이상만 보임 — `POST /api/projects`, 만든 사람이 소유자), 섹션 칸 맨 위 "새 섹션"(그 프로젝트 멤버 — `POST /api/projects/{id}/stages`). 이름만 묻고 만든 뒤 바로 그 칸에 고른다. - **회의록 작업 등록 — 고를 목록**(2026-10-12): 완료 프로젝트(`status = completed`)·완료 섹션(`is_done_stage`)은 목록에서 빼고, diff --git a/scripts/sql/project_db_027_meeting_label_groups.sql b/scripts/sql/project_db_027_meeting_label_groups.sql new file mode 100644 index 0000000..376baa8 --- /dev/null +++ b/scripts/sql/project_db_027_meeting_label_groups.sql @@ -0,0 +1,17 @@ +-- ===================================================================== +-- project_db 마이그레이션 027 — 주간 회의록: 같은 항목 칸 안에 줄 추가(항목 칸 묶음) +-- ===================================================================== +-- 멱등(idempotent). 열 하나만 추가한다(기존 값 변경·삭제 없음). 운영: /opt/www/main 에서 기존 project_db 에 적용. +-- +-- 왜(2026-10-12 사용자 요청): 회의록 표 "주요 업무" 칸에서 위/아래 줄 추가를 하면 "항목" 칸은 그대로 두고 +-- 그 항목 안에 줄이 늘어나게(연간 목표 goal_rows.label_cont(016)와 같은 방식). +-- label_cont = true 인 줄은 바로 위 줄(같은 구역)의 항목 칸에 이어 붙는다 — 항목 이름은 묶음 첫 줄에만. +-- 줄마다 주요 업무·정량 목표·지난주 결과·연결키(line_key)는 따로다. 다음 주차 회의록은 묶음을 그대로 이어받는다. +-- ===================================================================== +BEGIN; + +ALTER TABLE goal_meeting_items ADD COLUMN IF NOT EXISTS label_cont BOOLEAN NOT NULL DEFAULT FALSE; +COMMENT ON COLUMN goal_meeting_items.label_cont IS '바로 위 줄(같은 구역)의 항목 칸에 이어 붙는 줄 — 항목 이름은 묶음 첫 줄에'; + +COMMIT; +SELECT 'project_db 027 meeting label groups ready' AS status; diff --git a/tests/js/goals_meeting_ui.test.js b/tests/js/goals_meeting_ui.test.js index 5f2adab..c7e98ce 100644 --- a/tests/js/goals_meeting_ui.test.js +++ b/tests/js/goals_meeting_ui.test.js @@ -15,7 +15,8 @@ const ROOT = path.join(__dirname, "..", ".."); const OUT = path.join(__dirname, ".out"); const JS = fs.readFileSync(path.join(ROOT, "app", "static", "project.js"), "utf8"); const PAGE = {}; -["goals_admin", "goals_ro", "goals_weekly_admin", "meeting_admin", "meeting_err", "meeting_ro", "meeting_member"].forEach(function (n) { +["goals_admin", "goals_ro", "goals_weekly_admin", "meeting_admin", "meeting_err", "meeting_ro", "meeting_member", + "meeting_groups", "meeting_groups_added"].forEach(function (n) { PAGE[n] = fs.readFileSync(path.join(OUT, n + ".html"), "utf8"); }); const GOALS_URL = "http://localhost/project/goals/2026"; @@ -355,21 +356,25 @@ function meetServer(env, st) { // 첫 열(구분) — 구역 통째로 위/아래(우클릭·⋯), 맨 위는 "위로" 없음, 구역 첫 줄 id 로 요청 await section(async function () { const env = makeEnv(PAGE.meeting_admin, MEET_URL); - meetServer(env); + const st = meetServer(env); await boot(env); const blocks = Array.from(env.d.querySelectorAll("tbody.pj-meet-sec")); blocks[0].querySelector("th.pj-meet-c-sec").dispatchEvent(new env.w.MouseEvent("contextmenu", { bubbles: true, cancelable: true, clientX: 5, clientY: 5 })); let labels = Array.from(env.d.querySelectorAll(".pj-ctxmenu-item")).map(itemLabel); check("[1e] 첫 구역 우클릭 — 구역 아래로·구역 끝에 줄 추가(위로 없음)", labels.indexOf("구역 아래로") >= 0 && labels.indexOf("구역 위로") < 0 && labels.indexOf("구역 끝에 줄 추가") >= 0, labels); + const gets0 = st.gets || 0; // 부팅 때 실적 자동 갱신이 이미 한 번 받는다 Array.from(env.d.querySelectorAll(".pj-ctxmenu-item")).find(function (b) { return itemLabel(b) === "구역 아래로"; }).click(); await settle(); await wait(20); await settle(); const firstId = blocks[0].querySelector("tr[data-item]").dataset.item; const call = env.calls.find(function (c) { return /\/move-section$/.test(c.url); }); - check("[1e] 구역 아래로 → 그 구역 첫 줄로 move-section(direction 1) 후 새로고침", + // 2026-10-12 — 새로고침 대신 표만 서버에서 다시 받아 그 자리에서 바꿔 끼운다(연간 목표와 같은 애니메이션) + check("[1e] 구역 아래로 → 그 구역 첫 줄로 move-section(direction 1) 후 표만 다시 받음(새로고침 없음)", !!call && call.method === "POST" && call.url.indexOf("/meeting-items/" + firstId + "/move-section") >= 0 && - call.body.direction === 1 && env.navigations === 1, [call, env.navigations]); - const last = blocks[blocks.length - 1]; + call.body.direction === 1 && env.navigations === 0 && st.gets === gets0 + 1 && + !blocks[0].isConnected && env.d.querySelectorAll("tbody.pj-meet-sec").length === blocks.length, [call, env.navigations, st.gets]); + const fresh = Array.from(env.d.querySelectorAll("tbody.pj-meet-sec")); + const last = fresh[fresh.length - 1]; last.querySelector('[data-meet-act="sec-menu"]').click(); labels = Array.from(env.d.querySelectorAll(".pj-ctxmenu-item")).map(itemLabel); check("[1e] 마지막 구역 ⋯ — 구역 위로(아래로 없음)", labels.indexOf("구역 위로") >= 0 && labels.indexOf("구역 아래로") < 0, labels); @@ -1205,18 +1210,23 @@ function meetServer(env, st) { const request = env.calls.find(c => /\/meeting-cells\/merge$/.test(c.url)); check("[회의록 병합] 선택한 주의 줄 ID로 요청", request.body.item_from === "2" && request.body.item_to === "3"); env.route("POST", /\/meeting-cells\/merge$/, () => ({ body: { ok: true } })); + const gets0 = st.gets || 0; b.dispatchEvent(new env.w.MouseEvent("contextmenu", { bubbles: true, cancelable: true })); Array.from(env.d.querySelectorAll(".pj-ctxmenu-item")).find(n => itemLabel(n).startsWith("셀 병합")).click(); await settle(); - check("[회의록 병합] 저장 성공 뒤 화면을 다시 받음", env.navigations === 1); + await wait(20); await settle(); + check("[회의록 병합] 저장 성공 뒤 표만 다시 받음(새로고침 없음)", env.navigations === 0 && st.gets === gets0 + 1, [env.navigations, st.gets]); }); await section(async function () { - const env = makeEnv(fs.readFileSync(path.join(OUT, "meeting_merged.html"), "utf8"), MEET_URL); meetServer(env); await boot(env); + const env = makeEnv(fs.readFileSync(path.join(OUT, "meeting_merged.html"), "utf8"), MEET_URL); const st = meetServer(env); await boot(env); + const gets0 = st.gets || 0; const a = env.d.querySelector('td[data-meet-item="2"]'); check("[회의록 병합 화면] 첫 셀만 표시하고 숫자 칸 유지", a.rowSpan === 2 && !env.d.querySelector('td[data-meet-item="3"]') && env.d.querySelectorAll('.pj-meet-amount[data-field="target_amount"]').length === 3); a.dispatchEvent(new env.w.MouseEvent("contextmenu", { bubbles: true, cancelable: true })); Array.from(env.d.querySelectorAll(".pj-ctxmenu-item")).find(n => itemLabel(n) === "병합 해제").click(); await settle(); - check("[회의록 병합 해제] 첫 셀 ID로 요청하고 화면 갱신", env.calls.some(c => c.method === "DELETE" && /\/meeting-items\/2\/cell-merge$/.test(c.url)) && env.navigations === 1); + await wait(20); await settle(); + check("[회의록 병합 해제] 첫 셀 ID로 요청하고 표만 다시 받음", env.calls.some(c => c.method === "DELETE" && /\/meeting-items\/2\/cell-merge$/.test(c.url)) && + env.navigations === 0 && st.gets === gets0 + 1, [env.navigations, st.gets]); check("[회의록 병합 해제] 요청 중 합쳐진 글 보존", a.textContent.includes("병합한 계획")); }); @@ -1303,6 +1313,69 @@ function meetServer(env, st) { check("[서식 혼합] 초기화는 모든 서식 제거·내용 보존", editor.value === "작은큰"); }); + // ════════════════════ [2h] 항목 칸 묶음(027) — 주요 업무 칸 줄 추가는 같은 항목 칸 안에 · 표만 다시 그리며 애니메이션 ════════════════════ + await section(async function () { + const env = makeEnv(PAGE.meeting_groups, MEET_URL); + const st = meetServer(env, { page: PAGE.meeting_groups }); + // jsdom 에는 Web Animations 가 없다 — 있는 것처럼(애니메이션 경로·새 줄 강조 확인용) + const animated = []; + env.w.Element.prototype.animate = function (frames) { animated.push([this, frames]); return { finished: Promise.resolve(), cancel: function () {} }; }; + const posts = []; + env.route("POST", /\/project\/api\/goals\/meetings\/2026-09-28\/items$/, function (u, body) { + posts.push(body); st.page = PAGE.meeting_groups_added; return { status: 201, body: { ok: true, id: 9 } }; + }); + await boot(env); + const gets0 = st.gets || 0; + const head = env.d.querySelector('tr[data-item="2"] th.pj-meet-c-label'); + check("[2h] 묶음 첫 줄 항목 칸 rowspan=2 · 이어 붙은 줄은 항목 칸 없음", + head && head.rowSpan === 2 && !env.d.querySelector('tr[data-item="3"] th.pj-meet-c-label') && + env.d.querySelector('tr[data-item="3"]').dataset.labelCont === "1"); + const td = env.d.querySelector('td[data-meet-item="2"]'); + td.dispatchEvent(new env.w.MouseEvent("contextmenu", { bubbles: true, cancelable: true, clientX: 5, clientY: 5 })); + let labels = Array.from(env.d.querySelectorAll(".pj-ctxmenu-item")).map(itemLabel); + check("[2h] 주요 업무 칸 메뉴 — 위/아래 줄 추가 · 줄 삭제", labels.indexOf("위에 줄 추가") >= 0 && labels.indexOf("아래에 줄 추가") >= 0 && + labels.indexOf("줄 삭제") >= 0, labels); + const prompts = env.prompts.length; + const oldRow2 = env.d.querySelector('tr[data-item="2"]'); + Array.from(env.d.querySelectorAll(".pj-ctxmenu-item")).find(function (b) { return itemLabel(b) === "아래에 줄 추가"; }).click(); + await settle(); await wait(20); await settle(); + check("[2h] 아래에 줄 추가 → 같은 항목 칸(same_label)·이름 안 물음", posts.length === 1 && posts[0].same_label === true && + String(posts[0].ref_item_id) === "2" && posts[0].place === "below" && env.prompts.length === prompts, posts); + check("[2h] 새로고침 없이 표만 다시 받아 바꿔 끼움", env.navigations === 0 && st.gets === gets0 + 1 && !oldRow2.isConnected && + !!env.d.querySelector('tr[data-item="9"]'), [env.navigations, st.gets]); + const head2 = env.d.querySelector('tr[data-item="2"] th.pj-meet-c-label'); + check("[2h] 항목 칸은 그대로(rowspan 3) — 새 줄에 항목 칸 없음", head2 && head2.rowSpan === 3 && + !env.d.querySelector('tr[data-item="9"] th.pj-meet-c-label')); + const row9 = env.d.querySelector('tr[data-item="9"]'); + check("[2h] 새 줄 — 내려오며 나타나고 잠깐 강조", row9.classList.contains("is-new-row") && + animated.some(function (a) { return a[0] === row9 && a[1][0].opacity === 0; })); + // 다시 끼운 칸도 저장이 연결됨(새 줄 주요 업무 입력 → 그 줄로 PUT) + const ta9 = row9.querySelector(".pj-meet-text"); + ta9.focus(); type(env, ta9, "새 줄 업무"); ta9.blur(); + await settle(); await wait(20); await settle(); + check("[2h] 다시 끼운 새 줄도 저장 연결", st.items[9] && st.items[9].content === "새 줄 업무", st.items[9]); + // 항목 칸 메뉴(묶음) — 순서 대신 항목 칸 나누기, 아래 추가는 묶음 맨 아래 줄 기준(항목 칸 밖에 따로) + env.d.querySelector('tr[data-item="2"] th.pj-meet-c-label').dispatchEvent(new env.w.MouseEvent("contextmenu", { bubbles: true, cancelable: true, clientX: 5, clientY: 5 })); + labels = Array.from(env.d.querySelectorAll(".pj-ctxmenu-item")).map(itemLabel); + check("[2h] 묶인 항목 칸 메뉴 — 항목 칸 나누기·첫 줄 삭제(위로·아래로 없음)", labels.indexOf("항목 칸 나누기") >= 0 && + labels.indexOf("첫 줄 삭제") >= 0 && labels.indexOf("위로") < 0 && labels.indexOf("아래로") < 0, labels); + Array.from(env.d.querySelectorAll(".pj-ctxmenu-item")).find(function (b) { return itemLabel(b) === "아래에 줄 추가"; }).click(); + await settle(); await wait(20); await settle(); + check("[2h] 항목 칸에서 아래 줄 추가 → 묶음 맨 아래 줄(3) 기준·따로(같은 항목 아님)·이름 물음", + posts.length === 2 && String(posts[1].ref_item_id) === "3" && !posts[1].same_label && env.prompts.length === prompts + 1, posts[1]); + // 이어 붙은 줄의 주요 업무 칸 → 줄 삭제(흐려지며 사라진 뒤 다시 그림) + let deleted = null; + env.route("DELETE", /\/project\/api\/goals\/meeting-items\/\d+$/, function (u) { deleted = u; return { body: { ok: true } }; }); + const gets = st.gets; + const row3 = env.d.querySelector('tr[data-item="3"]'); + row3.querySelector('td[data-meet-item="3"]').dispatchEvent(new env.w.MouseEvent("contextmenu", { bubbles: true, cancelable: true, clientX: 5, clientY: 5 })); + Array.from(env.d.querySelectorAll(".pj-ctxmenu-item")).find(function (b) { return itemLabel(b) === "줄 삭제"; }).click(); + await settle(); await wait(20); await settle(); + check("[2h] 주요 업무 칸 줄 삭제 → 그 줄 DELETE · 흐려짐 · 표 다시 받음", + /\/meeting-items\/3$/.test(deleted || "") && animated.some(function (a) { return a[0] === row3 && a[1][1].opacity === 0; }) && + st.gets === gets + 1 && env.navigations === 0, [deleted, st.gets]); + }); + clearTimeout(WATCHDOG); const realUnhandled = unhandled.filter(function (m) { return !/Not implemented/.test(m); }); check("처리 안 된 Promise 거부 없음", realUnhandled.length === 0, realUnhandled); diff --git a/tests/js/render_goals.py b/tests/js/render_goals.py index 560005c..fcdc8b8 100644 --- a/tests/js/render_goals.py +++ b/tests/js/render_goals.py @@ -19,7 +19,7 @@ sys.path.insert(0, ROOT) OUT_DIR = os.path.join(ROOT, "tests", "js", ".out") from app.modules.project import store # noqa: E402 -from app.modules.project.router import _goal_area_layout, _goal_label_spans # noqa: E402 +from app.modules.project.router import _goal_area_layout, _goal_label_spans, _meeting_label_spans # noqa: E402 BASE_STUB = ("{% block head_extra %}{% endblock %}{% block topbar_after_logout %}{% endblock %}{% block topbar_actions %}{% endblock %}" "
{% block content %}{% endblock %}
") @@ -151,6 +151,22 @@ def meeting_merged_ctx() -> dict: return ctx +def meeting_groups_ctx(added: bool = False) -> dict: + """항목 칸 묶음(027) — 상품 구역: 상품1(묶음 첫 줄) + 이어 붙은 줄(id 3, label_cont) — 실제 라우터 도우미로 칸 계산. + added = 상품1 아래에 같은 항목 칸으로 줄(id 9)을 추가한 뒤의 화면(다시 받기 응답).""" + ctx = meeting_ctx(True, False, can_sync=False) + rows = ctx["meeting"]["sections"][0]["rows"] + rows[1].update(label="", label_cont=True) + if added: + new = copy.deepcopy(rows[1]) + new.update(id=9, content="", target_amount=None, prev=None) + rows.insert(1, new) + ctx["meeting"]["items"].insert(1, new) + for sec in ctx["meeting"]["sections"]: + _meeting_label_spans(sec["rows"]) + return ctx + + def main() -> None: env = jinja2.Environment(loader=jinja2.ChoiceLoader([ jinja2.DictLoader({"erp_base.html": BASE_STUB}), @@ -171,6 +187,8 @@ def main() -> None: "meeting_layout_admin.html": ("project/goal_meeting.html", meeting_layout_ctx(True)), "meeting_layout_ro.html": ("project/goal_meeting.html", meeting_layout_ctx(False)), "meeting_merged.html": ("project/goal_meeting.html", meeting_merged_ctx()), + "meeting_groups.html": ("project/goal_meeting.html", meeting_groups_ctx()), + "meeting_groups_added.html": ("project/goal_meeting.html", meeting_groups_ctx(added=True)), "meeting_content_admin.html": ("project/goal_meeting.html", meeting_ctx(True, False, can_sync=False) | {"meeting_embedded": True}), "meeting_content_ro.html": ("project/goal_meeting.html", meeting_ctx(False, False, can_sync=False) | {"meeting_embedded": True}), } diff --git a/tests/test_project_module.py b/tests/test_project_module.py index 334581c..af6daaa 100644 --- a/tests/test_project_module.py +++ b/tests/test_project_module.py @@ -1196,6 +1196,78 @@ def test_review_meeting_section_move(): _drop_meetings([w1, w2]) +def test_review_meeting_label_groups(): + """항목 칸 묶음(027) — 주요 업무 칸에서 추가(same_label)는 같은 항목 칸 안에(아래 = 이어 붙음, 묶음 첫 줄 위 = 새 줄이 + 첫 줄·이름 넘겨받음), 화면은 항목 칸 rowspan, 묶인 줄은 순서 이동 거절, 다음 주 회의록이 묶음을 이어받음, + 첫 줄 삭제 = 아래 줄이 이름을 이어받음, 항목 칸 나누기, 회의 완료 뒤 잠금.""" + from app.modules.project import store + + w1 = store.month_weeks(2032, 2)[1][0] + w2 = store.week_period(w1)[1] + timedelta(days=1) + _drop_meetings([w1, w2]) + try: + _create_meeting(w1) + rows = lambda w=w1: ST.get_meeting(week_start=w)["items"] # noqa: E731 + a = rows()[0] + url = f"/project/api/goals/meetings/{w1}/items" + r = req("POST", url, BOB, json={"section": a["section"], "ref_item_id": a["id"], "place": "below", "same_label": True}) + assert r.status_code == 201, r.text + b_id = r.json()["id"] + cur = rows() + k = [x["id"] for x in cur].index(a["id"]) + assert cur[k + 1]["id"] == b_id and cur[k + 1]["label_cont"] and cur[k + 1]["label"] == "" and not cur[k]["label_cont"] + # 묶음 첫 줄 위 → 새 줄이 첫 줄(이름 넘겨받음), 기준 줄은 이어 붙음 + r = req("POST", url, BOB, json={"section": a["section"], "ref_item_id": a["id"], "place": "above", "same_label": True}) + assert r.status_code == 201, r.text + c_id = r.json()["id"] + cur = rows() + ids = [x["id"] for x in cur] + k = ids.index(c_id) + assert ids[k:k + 3] == [c_id, a["id"], b_id], ids + assert cur[k]["label"] == a["label"] and not cur[k]["label_cont"] + assert cur[k + 1]["label"] == "" and cur[k + 1]["label_cont"] and cur[k + 2]["label_cont"] + # 줄마다 연결키는 따로(지난주 리뷰가 줄 단위로 이어짐) + assert len({cur[k + n]["line_key"] for n in range(3)}) == 3 + # 화면 — 회의록 화면이 그려지고(이 테스트 환경은 템플릿을 실제로 그리지 않음 — 표 모양은 jsdom [2h]), + # 화면용 묶음 계산(라우터 도우미) = 항목 칸 rowspan 3 · 이어 붙은 줄은 항목 칸 없음 + from app.modules.project.router import _meeting_label_spans + page = req("GET", f"/project/goals/{w1.year}/meetings/{w1.month}?week={w1}&content=1", BOB) + assert page.status_code == 200, page.text[:300] + sec_rows = [x for x in rows() if x["section"] == a["section"]] + _meeting_label_spans(sec_rows) + spans = {x["id"]: (x.get("label_span"), x["label_hidden"], x["label_shown"]) for x in sec_rows} + assert spans[c_id][:2] == (3, False) and spans[a["id"]][1] and spans[b_id][1], spans + assert spans[b_id][2] == a["label"] + # 묶인 줄은 옮길 수 없다(항목 칸을 나눈 뒤) + r = req("POST", f"/project/api/goals/meeting-items/{a['id']}/move", BOB, json={"direction": 1}) + assert r.status_code == 400 and "항목 칸" in r.text, r.text + # 같은 항목 칸 추가는 기준 줄이 필요 + assert req("POST", url, BOB, json={"section": a["section"], "same_label": True}).status_code == 400 + # 다음 주 회의록 — 묶음을 그대로 이어받음(연결키 기준) + _create_meeting(w2) + by_key = {x["line_key"]: x for x in rows(w2)} + assert [bool(by_key[cur[k + n]["line_key"]]["label_cont"]) for n in range(3)] == [False, True, True] + assert by_key[cur[k]["line_key"]]["label"] == a["label"] + # 첫 줄(c) 삭제 → 바로 아래 줄(a)이 첫 줄이 되고 이름을 이어받음 + assert req("DELETE", f"/project/api/goals/meeting-items/{c_id}", BOB).status_code == 200 + cur = rows() + k = [x["id"] for x in cur].index(a["id"]) + assert not cur[k]["label_cont"] and cur[k]["label"] == a["label"] and cur[k + 1]["id"] == b_id and cur[k + 1]["label_cont"] + # 항목 칸 나누기 → b 가 따로(이름 빈 칸) + r = req("POST", f"/project/api/goals/meeting-items/{a['id']}/split-label", BOB) + assert r.status_code == 200 and r.json()["split"] == 1, r.text + cur = rows() + k = [x["id"] for x in cur].index(b_id) + assert not cur[k]["label_cont"] and cur[k]["label"] == "" + assert req("POST", f"/project/api/goals/meeting-items/{a['id']}/move", BOB, json={"direction": 1}).status_code == 200 + # 회의 완료 뒤 잠금 + ST.set_meeting_completed(week_start=w1, done=True, by=ADMIN) + assert req("POST", url, BOB, json={"section": a["section"], "ref_item_id": a["id"], "place": "below", + "same_label": True}).status_code == 409 + finally: + _drop_meetings([w1, w2]) + + def _clear_quick(*weeks) -> None: """작업 등록 표 테스트 주차 비우기(로컬 테스트 DB — 앞선 실패한 실행의 줄이 남지 않게).""" with ST._pool.connection() as conn: # noqa: SLF001