[CLAUDE] Docs: chốt session 4 — Budget BE module + 14 Solutions users
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 2m53s

- STATUS.md: header Phase 7 + 3 row Recently Done (Budget BE / 14 users / Docs cleanup) + cumulative cột mới (51 tables / 14 mig / ~124 endpoints)
- HANDOFF.md: TL;DR session 4 (2 milestone Budget BE + 14 users) + Cảnh báo session 5 + Priority 0 (FE Budget + PE/HD integration + PE feature gap) + Credentials 30 user
- migration-todos.md: Phase 7 thêm section D Budget done + Phase 8 mới (FE Budget pages + integration) + pending migrations Budget
- architecture.md: §10 Budget module mới (ERD + state machine + auto-recompute + integration roadmap)
- database/schema-diagram.md: migration history rows 13+14 + §12 Budget ERD chi tiết
- ef-core-migration SKILL: migration 14 entry + Phase 8 pending Budget refinement
- CLAUDE.md root + docs: modules table thêm Budget row + scope Budget + count 51 bảng / 14 mig
- Session log 2026-04-28-chot-session-4-budget.md (10+ section detailed)

Stats: 51 tables (+4 Budget), 14 migrations (+AddBudgets), ~124 endpoints (+11 Budget),
30 demo user (16 sample + 14 Solutions thật), 38 gotchas, ~340 LOC Budget CQRS.
FE Budget pages chưa làm — Priority 0 session 5.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
pqhuy1987
2026-04-28 12:36:31 +07:00
parent a05c57b081
commit e0b4e7f096
9 changed files with 575 additions and 110 deletions

View File

@ -1,42 +1,48 @@
# HANDOFF — Brief 5 phút cho session tiếp theo
**Last updated:** 2026-04-24 chiều (Phase 6**PE polish iter 2 + domain rebrand hoàn tất, UAT-ready**)
**Last updated:** 2026-04-28 (Phase 7**Module Ngân sách (Budget) BE + 14 demo users Solutions thật**)
## TL;DR
**PE module UX polish gần complete.** Session 3 (24/04) apply 10 commit
fix tất cả UX friction user báo:
- Rename menu "Phương Án" → "Giải pháp"
- Menu tree inheritance Pe_*/PeWf_* (fix bug children không hiện)
- Accordion mutex 2 PE group + sidebar w-72 nowrap label
- NavLink active check query string (fix 2 leaf cùng highlight)
- PE detail flat layout: Panel 2 = 4 section (Thông tin/NCC/Hạng mục/**Bảng so sánh**), Panel 3 thêm Duyệt + Lịch sử thay đổi
- Upload file đính kèm per-NCC (SupplierAttachmentsCell) + Bảng so sánh tổng
- readOnly mode cho menu "Duyệt" (pendingMe=1)
- HĐ: move Lịch sử điều chỉnh Panel 2 → Panel 3
- Demo email rebrand `@solutionerp.local → @solutions.com.vn` với backfill
**Session 4 (28/04)** thêm 2 milestone lớn:
**Domain migration (session 2):** 3 subdomain `.huypham.vn``.solutions.com.vn`
live E2E — `api/admin/eoffice.solutions.com.vn`. Cert Let's Encrypt + CORS +
FE bundle VITE_API_BASE_URL đều đã apply.
### A. Module Ngân sách (Budget) BE — migration 14, +4 bảng, +11 endpoint
**Tổng:** 47 DB tables, ~113 endpoints, 13 migrations, 33 gotchas, 20+ commit
session 3 push lên Gitea.
- 4 entity: `Budget` (Header) + `BudgetDetail` (flat row) + `BudgetApproval` (history) + `BudgetChangelog` (audit log).
- Enum `BudgetPhase` 5 state (DangSoanThao→ChoCCM→ChoCEO→DaDuyet + TuChoi).
- `BudgetPolicy.Default` hardcoded simple 3-step (Drafter→CCM→CEO) — chưa versioned (TODO khi user cần admin config UI).
-`NS-YYYYMM-XXXX` Random.Shared (chưa atomic — TODO khi format chính thức).
- Link nullable: `Contract.BudgetId?` + `PE.BudgetId?` đã có FK + index, FE chưa wire form.
- Menu seed `Budgets` root + 3 leaf (Bg_List/Bg_Create/Bg_Pending) order=27 icon Wallet.
- Application: 11 CQRS handler ~340 LOC (Create/UpdateDraft/Transition/List/GetDetail/Delete + Detail CRUD auto-recompute TongNganSach + ListChangelogs).
- Api: `BudgetsController` 11 endpoint REST.
- **FE chưa làm — Priority 0 session 5.**
## ⚠️ CẢNH BÁO session tiếp (Session 4)
### B. 14 demo user Solutions thật
1. **Chưa xóa binding cũ `.huypham.vn`** — vẫn active fallback. Sau 1-2 ngày
- PRO 5 (TPB tra.bui + 4 NV) + CCM 7 (TPB ngocanh.huynh + 6 NV) + ISO 1 (chau.le) + CEO 1 (huy.duong).
- Pwd `User@123456`. Reconcile pattern (gotcha #38 4-field rename).
- Tổng 30 user (16 sample cũ giữ + 14 Solutions thật mới).
**Tổng:** 51 DB tables, ~124 endpoints, 14 migrations, 38 gotchas, 5+ commit
session 4 push lên Gitea.
## ⚠️ CẢNH BÁO session tiếp (Session 5)
1. **FE Budget pages CHƯA LÀM** — BE đã sẵn sàng nhưng chưa có page nào. Pattern: copy từ PE 3-panel List + Create + Detail tabs (Thông tin / Hạng mục) + WorkflowPanel timeline. Mirror sang fe-user. Thêm route `/budgets`, `/budgets/new`, `/budgets/:id`. Menu resolver `Bg_*` → URL.
2. **PE/Contract → Budget integration CHƯA WIRE** — BE đã có `BudgetId?` nullable FK trên cả 2 entity, FE form chưa thêm field "Ngân sách" select. Cần filter Budget theo `Phase=DaDuyet && NamNganSach=current && ProjectId match`. Tab Hạng mục có thể bonus cột "So với ngân sách".
3. **Chưa xóa binding cũ `.huypham.vn`** — vẫn active fallback. Sau 1-2 ngày
verify stable → `.\migrate-domains.ps1 -RemoveOld -SkipCert` trên VPS.
2. **win-acme scheduled task "unhealthy"** — cert auto-renew có thể fail
4. **win-acme scheduled task "unhealthy"** — cert auto-renew có thể fail
khi gần 2026-06-18. Fix: mở `wacs.exe` interactive → Manage Renewals →
recreate task.
3. **PE còn 3 task MISSING** cho feature-complete (xem STATUS §A):
5. **PE feature gap carry over** (xem STATUS §C):
- PE Workflow admin designer UI `/system/pe-workflows/:typeCode`
- Auto-map PE Details → Contract 7 per-type Details khi gen HĐ
- Section "Ý kiến 4 phòng ban" (Phê duyệt/CCM/MuaHàng/SM-PM)
4. **Login email mới** `admin@solutions.com.vn` / `Admin@123456` — old
`@solutionerp.local` đã bị rename 401.
5. **Chú ý G-084:** VPS shared với VietReport — mọi reverse proxy / backend
- Export phiếu PDF/Excel
6. **Login email** `admin@solutionerp.local` / `Admin@123456` — domain default
chưa đổi sang `@solutions.com.vn` (chỉ demo user và rebrand cũ trong BackfillDemoEmail).
7. **Chú ý G-084:** VPS shared với VietReport — mọi reverse proxy / backend
service mới phải dùng `127.0.0.1` + bind loopback IPv4 explicit.
## ⭐ Skills (.claude/skills/) — PHẢI dùng khi task khớp
@ -76,7 +82,12 @@ session 3 push lên Gitea.
| **Master expand 15 NCC + 8 Project** + backfill demo HĐ diverse | ✅ Done |
| **Deps audit script** (`scripts/deps-audit.ps1`) | ✅ Done |
| **Module Duyệt NCC (tiền-HĐ) E2E** — 10 bảng + 2 workflow + Kế thừa HĐ | ✅ Done |
| 6+ Post-launch (E-signature, Bravo/SAP, Mobile, AI) | 📝 Future |
| **PE polish iter 2** — flat layout + per-NCC attachments + readOnly Duyệt + email rebrand | ✅ Done |
| **Domain rebrand huypham.vn → solutions.com.vn** — 3 subdomain + cert + CORS + FE bundle | ✅ Done |
| **Module Ngân sách BE** — 4 bảng + 11 endpoint + workflow simple + 30 user | ✅ Done (FE TODO) |
| **PE Workflow designer UI + Ý kiến 4 phòng ban + Export PDF** | 📝 Pending session 5+ |
| **FE Budget pages + PE/Contract → Budget integration** | 📝 Priority 0 session 5 |
| 8+ Post-launch (E-signature, Bravo/SAP, Mobile, AI) | 📝 Future |
## Run nhanh
@ -117,25 +128,41 @@ Login: `admin@solutionerp.local` / `Admin@123456`
## Cần làm kế tiếp
### 🔥 Priority 0 — PE feature gap (session 4)
### 🔥 Priority 0 — Budget FE + PE/HD integration (session 5)
Xem **STATUS.md §🔥 In Progress** đầy đủ (nhóm A/B/C/D). 3 task MISSING cuối:
Xem **STATUS.md §🔥 In Progress** đầy đủ (nhóm A/B/C/D/E). Tóm tắt:
1. **PE Workflow admin designer UI** `/system/pe-workflows/:typeCode` — mirror pattern `WorkflowsPage.tsx` + `WorkflowDesigner.tsx`. BE cần `PeWorkflowAdminFeatures.cs` (GetOverview + CreateNewVersion) + `PeWorkflowsController.cs`. Framework backend đã sẵn (3 bảng `PurchaseEvaluationWorkflow*` + `FromDefinition` builder), chỉ thiếu wire UI.
**A. Budget FE pages — copy pattern PE:**
1. `fe-admin/src/types/budget.ts` (types + enums BudgetPhase + ApprovalDecision reuse)
2. `fe-admin/src/pages/budgets/BudgetsListPage.tsx` (3-panel `lg:grid-cols-[320px_1fr_360px]` — Panel 1 list + Panel 2 detail tabs + Panel 3 workflow timeline)
3. `fe-admin/src/pages/budgets/BudgetCreatePage.tsx` (form Header: tên/năm/dự án/phòng ban/người soạn)
4. `fe-admin/src/components/budgets/BudgetDetailTabs.tsx` (Thông tin / Hạng mục — flat row giống PE Details)
5. `fe-admin/src/components/budgets/BudgetWorkflowPanel.tsx` (Panel 3: timeline phase + ô comment + button Trình)
6. Mirror tất cả sang `fe-user/`
7. App.tsx routes `/budgets`, `/budgets/new`, `/budgets/:id` cả 2 app
8. Menu resolver `Bg_*` ở Layout: `Bg_List``/budgets`, `Bg_Pending``/budgets?phase=Pending`, `Bg_Create``/budgets/new`
**B. PE/Contract → Budget integration:**
1. **PE form** thêm field `Ngân sách` select Budget (filter `Phase=DaDuyet && NamNganSach=current && ProjectId=peProjectId`). Lưu `PE.BudgetId`.
2. **Contract form** tương tự — link sang Budget cho đối chiếu chi phí.
3. PE Detail tab có thể thêm cột "So với ngân sách" — compute từ `BudgetDetail` tương ứng (match GroupCode + ItemCode) nếu có Budget link.
**C. PE feature gap (carry over từ session 3):**
1. **PE Workflow admin designer UI** `/system/pe-workflows/:typeCode` — mirror pattern `WorkflowsPage.tsx` + `WorkflowDesigner.tsx`. BE cần `PeWorkflowAdminFeatures.cs` + `PeWorkflowsController.cs`. Framework backend đã sẵn (3 bảng `PurchaseEvaluationWorkflow*` + `FromDefinition`), chỉ thiếu wire UI.
2. **Ý kiến 4 phòng ban** (Phê duyệt / P.CCM / P.MuaHàng / SM-PM) — Excel form có, entity chưa map. Cần design: 4 text field + signoff date, hoặc dùng Approvals với role-kind.
3. **Export phiếu PDF/Excel** — tái dùng `IDocumentConverter` + template `PE-TrinhDuyet.docx`.
4. **Payment terms tách field** từ JSON blob → 6 field riêng (optional UX polish).
5. **Auto-map PE Details → Contract Details** khi gen HĐ (optional nâng cấp).
**Đã xong trong session 3 (check STATUS Recently Done):**
- ~~PE Attachments upload~~ ✅ (per-NCC + Bảng so sánh tổng)
- ~~Menu tree inheritance Pe_*/PeWf_*~~ ✅
- ~~Accordion mutex + sidebar width + label nowrap~~ ✅
- ~~NavLink query active check~~ ✅
- ~~PE detail flat layout + readOnly mode~~ ✅
- ~~HĐ move Lịch sử điều chỉnh → Panel 3~~ ✅
- ~~Menu rename Phương Án → Giải pháp~~ ✅
- ~~Demo email rebrand solutionerp.local → solutions.com.vn~~ ✅
**D. Optional polish:**
- Budget MaNganSach atomic sequence (hiện Random.Shared, format chốt sau)
- Budget versioned workflow (admin config qua UI — hiện hardcoded `BudgetPolicy.Default`)
- Payment terms PE tách field
- Auto-map PE Details → Contract Details khi gen HĐ
- Matrix Quotes bulk paste từ Excel
**Đã xong trong session 4 (check STATUS Recently Done):**
- ~~Module Ngân sách BE — 4 bảng + 11 endpoint + workflow simple~~ ✅
- ~~14 demo user Solutions thật (PRO 5 + CCM 7 + ISO 1 + CEO 1)~~ ✅
- ~~Docs cleanup + tái cấu trúc MD~~ ✅
### A. Hard blockers (chờ user / ops)
@ -195,7 +222,7 @@ Trigger: user nói "audit skill" hoặc tự chạy đầu Phase mới.
## Lưu ý kỹ thuật quan trọng
**Đọc [`gotchas.md`](gotchas.md) (26 bẫy) trước khi:**
**Đọc [`gotchas.md`](gotchas.md) (38 bẫy) trước khi:**
- Thêm package mới → .NET 10 compat (MediatR 14 fail → dùng 12.4.1)
- Debug TS enum error → dùng const-object pattern (`erasableSyntaxOnly`)
@ -363,18 +390,23 @@ Remote: https://git.baocaogiaoduc.vn/vietreport-admin/solution-erp.git
```
admin@solutionerp.local / Admin@123456 ← Admin (QTV)
Demo users (User@123456):
bod.huynh@solutionerp.local Tổng GĐ (BOD)
bod.le@solutionerp.local Phó GĐ NĐUQ
pm.nguyen@solutionerp.local GĐ Dự án FLOCK 01 (PM)
ccm.tran@solutionerp.local TPB Kiểm soát chi phí (CCM + TPB)
pro.pham@solutionerp.local TPB Cung ứng (PRO + TPB)
fin.do@solutionerp.local TPB Tài chính (FIN + TPB)
act.vu@solutionerp.local Kế toán trưởng (ACT + TPB)
equ.bui@solutionerp.local TPB Thiết bị (EQU + TPB)
hra.dang@solutionerp.local TPB HRA (HRA + TPB)
Demo users — 30 user (User@123456):
── 16 sample @solutionerp.local (giữ cho test legacy) ──
bod.huynh, bod.le Tổng GĐ + Phó GĐ NĐUQ
pm.nguyen GĐ Dự án FLOCK 01 (PM)
ccm.tran, pro.pham, fin.do TPB CCM/PRO/FIN
act.vu, equ.bui, hra.dang Kế toán trưởng / TPB EQU / TPB HRA
qs.hoang, qs.ngo QS công trường (NV.PB)
nv.cao, nv.dinh NV Cung ứng/Tài chính (NV.PB)
nv.cao, nv.dinh, nv.truong NV Cung ứng/Tài chính/CCM (NV.PB)
bod.tran, pm.le Bonus NĐUQ + PM thứ 2
── 14 Solutions thật @solutions.com.vn (session 4) ──
PRO 5: tra.bui (TPB) + phuong.nguyen, binh.lethanh, danh.huynh, dat.tran (NV)
CCM 7: ngocanh.huynh (TPB) + ha.dao, cuong.do, long.le, ha.nguyen,
dung.nguyen, anh.nguyen (NV)
ISO 1: chau.le
CEO 1: huy.duong
⚠ Rotate ALL passwords trước UAT thật
```