[CLAUDE] Docs: chốt session 2 — PE skeleton + G-084 + skill audit
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 2m55s

User feedback: "phần Duyệt NCC chưa xong đâu đấy nhé, còn chỉnh nhiều"
→ mark PE module skeleton (not feature-complete), liệt kê chi tiết chức
năng/UX/edge-case còn missing cho session tiếp.

Update 7 file:
 - STATUS.md — phase = "PE skeleton + refinement WIP", In Progress liệt
   kê 4 nhóm: A Chức năng MISSING (9 item), B UX/Polish (6 item),
   C Edge case (4 item), D Deploy/Ops (1 item). +G-084 row Recently Done.
 - HANDOFF.md — TL;DR "PE skeleton, còn chỉnh nhiều" + Priority 0 section
   cho session tiếp (9 task PE refinement) + cảnh báo runner + G-084.
 - migration-todos.md — Phase 7 checklist (A/B/C/D nhóm) trước Phase 8
   post-launch. Pending migrations: PaymentTermFields + DepartmentOpinions
   + CodeSequences.
 - architecture.md — Section 9 PurchaseEvaluation module (ERD + workflow
   A/B + kế thừa HĐ flow).
 - CLAUDE.md (root) — 5 file đọc đầu (thêm HANDOFF), Modules table, 12
   migration 46 bảng, +PurchaseEvaluation commit scope.
 - .claude/skills/ — 4 skill cross-ref Phase 6:
   * README: trạng thái updated với Phase 6 note
   * contract-workflow: note PE workflow tách table riêng
   * permission-matrix: +Pe_*/PeWf_* menu keys + TODO grant non-admin
   * ef-core-migration: 12 migration history + Phase 7 pending
 - docs/changelog/sessions/2026-04-23-2359-chot-session-pe-skeleton.md —
   session log full commits + MD files updated + session tiếp priorities
   + notes (PE là skeleton, runner check, G-084 rule, MaPhieu format).
This commit is contained in:
pqhuy1987
2026-04-23 17:46:41 +07:00
parent 3990066b04
commit 7ca6c914fa
10 changed files with 303 additions and 34 deletions

View File

@ -1,18 +1,28 @@
# HANDOFF — Brief 5 phút cho session tiếp theo
**Last updated:** 2026-04-23 (Phase 6 — PurchaseEvaluation module E2E)
**Last updated:** 2026-04-23 tối (Phase 6 — PE skeleton + G-084 hardening, **PE còn chỉnh nhiều**)
## TL;DR
**Module Duyệt NCC (tiền-HĐ) E2E.** 2 quy trình A/B config được admin
(tái dùng framework versioned workflow), 10 bảng mới (7 core + 3
workflow config), 17 endpoint mới, 3 FE page × 2 app + PeDetailTabs
5-tab + PeWorkflowPanel timeline. Kế thừa HĐ 1-click từ phiếu DaDuyet:
Gen Contract draft với SupplierId/ProjectId/GiaTri kế thừa, link 2
chiều PE.ContractId.
**PE module skeleton E2E** 2 quy trình A/B config được admin, 10 bảng, 17
endpoint, 3 page × 2 app + kế thừa HĐ 1-click. BE + FE + migration đã push
lên Gitea main (`2c6f0ca..3990066`, 6 commit). **CHƯA XONG — nhiều polish
+ feature thiếu cho session tiếp** (xem STATUS.md §🔥 In Progress đầy đủ).
**Tổng:** 46 DB tables, ~110 endpoints, 12 migrations. Còn blockers
user/ops cũ: UAT thật + SMTP + rotate creds.
**G-084 hardening:** localhost → 127.0.0.1 trong scripts + skill, doc gotcha
#33 từ bài học VietReport (IPv4/IPv6 port hijack trên VPS shared).
**Tổng:** 46 DB tables, ~110 endpoints, 12 migrations, 33 gotchas. Blocker
user/ops cũ vẫn còn: UAT thật + SMTP + rotate creds + runner apply.
## ⚠️ CẢNH BÁO session tiếp
1. **Runner có thể đang stopped sau VPS restart**`/api/purchase-evaluations`
vẫn 404. Kiểm tra + start `gitea-runner` service trước khi test PE endpoint.
2. **PE chỉ là skeleton** — user nói "còn chỉnh nhiều". Nhóm A/B/C/D tasks
đầy đủ ở STATUS.md §🔥 In Progress.
3. **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
@ -92,6 +102,25 @@ Login: `admin@solutionerp.local` / `Admin@123456`
## Cần làm kế tiếp
### 🔥 Priority 0 — PE module refinement (session tiếp)
Xem **STATUS.md §🔥 In Progress** đầy đủ (nhóm A/B/C/D). Tóm tắt nhanh:
1. **PE Workflow admin designer UI** `/system/pe-workflows/:typeCode` — mirror pattern từ `WorkflowsPage.tsx` + `WorkflowDesigner.tsx`. BE cần `PeWorkflowAdminFeatures.cs` + `PeWorkflowsController.cs`. Framework backend đã sẵn, chỉ thiếu wire UI.
2. **PE Attachments upload** — copy pattern `ContractAttachmentFeatures.cs` + `ContractAttachmentsSection.tsx`. Entity + enum có sẵn.
3. **Ý 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.
4. **Payment terms tách field** từ JSON blob → 6 field riêng (Tạm ứng / TT tạm / Quyết toán / Bảo hành / Hạn mức / Đánh giá) theo Excel section D.
5. **Seed demo PE data** — 2-3 phiếu cho UAT + screenshot.
6. **Permission grant Pe_* cho non-admin role**`/system/permissions` tick `PurchaseEvaluations.Read` + CRUD cho role Drafter/PRO/CCM/BOD.
7. **MaPhieu format chính thức** — user confirm.
8. **Export phiếu PDF/Excel** — tái dùng `IDocumentConverter` + template.
9. **Auto-map PE Details → Contract Details** khi gen HĐ (optional — nâng cấp).
**Deploy blocker hiện tại:** commit `3990066` chưa apply prod. Check runner:
```powershell
Get-Service *gitea-runner* ; Start-Service gitea-runner
```
### A. Hard blockers (chờ user / ops)
1. **UAT thật 1 tuần với 2-3 user** — hard requirement từ roadmap. Kiến nghị:

View File

@ -2,9 +2,9 @@
> **Update rule:** trước khi bắt đầu 1 task → ghi row vào `🔥 In Progress`. Xong → chuyển sang `✅ Recently Done`.
**Last updated:** 2026-04-23 (Phase 6 — PurchaseEvaluation module E2E, migration 12, 46 DB tables)
**Last updated:** 2026-04-23 tối (Phase 6 — PE module **skeleton E2E + G-084 hardening, CÒN CHỈNH NHIỀU**)
## 📍 Phase hiện tại: **Module Duyệt NCC (tiền-HĐ) live E2E** — Prod live 3 domain, 46 DB tables (+10 PE), ~110 endpoints (+17 PE), 12 migrations. 2 quy trình Duyệt NCC config được admin (QT-DN-A 3-step / QT-DN-B 5-step). Kế thừa HĐ 1-click từ phiếu DaDuyet.
## 📍 Phase hiện tại: **Module Duyệt NCC (tiền-HĐ) — skeleton deployed, refinement WIP** — 46 DB tables (+10 PE), ~110 endpoints (+17 PE), 12 migrations, 6 commits PE push Gitea (`2c6f0ca..3990066`). Skeleton BE + FE + kế thừa HĐ hoạt động; còn nhiều polish + feature thiếu (designer UI, attachments, details mapping, export PDF).
### 🌐 Production URLs
@ -14,14 +14,55 @@
- https://git.baocaogiaoduc.vn/vietreport-admin/solution-erp — Gitea repo + Actions
- Default admin: `admin@solutionerp.local` / `Admin@123456` ⚠️ **RE-ROTATE sau login đầu**
## 🔥 In Progress
## 🔥 In Progress — PE module chưa xong (session tiếp xử lý)
_(không có — Tier 3 + skill governance đóng gói xong, chờ UAT + chờ cron audit fire 2026-05-01)_
> **User feedback (2026-04-23 tối session 2):** "phần Duyệt NCC chưa xong đâu đấy nhé, còn chỉnh nhiều".
### A. Chức năng MISSING trong MVP (phải làm)
- [ ] **PE Workflow admin designer UI** `/system/pe-workflows/:typeCode` — framework versioned WF đã có (3 bảng + policy `FromDefinition`). Chỉ thiếu:
- BE `PeWorkflowAdminFeatures.cs` (mirror `WorkflowAdminFeatures.cs` — GetOverview + CreateNewVersion)
- `PeWorkflowsController.cs` — GET overview + POST create-version
- FE `PeWorkflowsPage.tsx` + `PeWorkflowDesigner.tsx` (mirror `WorkflowsPage.tsx` + `WorkflowDesigner.tsx`)
- Menu leaf `PeWf_*` đã seed rồi, resolver Layout.tsx đã map `/system/pe-workflows/:code`
- [ ] **PE Attachments upload** — pattern copy từ `ContractAttachmentFeatures.cs` + FE `ContractAttachmentsSection.tsx`. Entity + `PurchaseEvaluationAttachmentPurpose` enum đã sẵn (QuoteDocument/RequirementSpec/DecisionExport).
- [ ] **Auto-map PE Details → Contract 7 per-type Details khi gen HĐ** — hiện `CreateContractFromEvaluationCommand` chỉ copy header + GiaTri, KHÔNG copy Details. Cần mapping per ContractType (PE Detail schema flat ≠ 7 Contract Details schemas).
- [ ] **Demo PE data seed** — chưa có `[DEMO]` PE nào. Cần 2-3 phiếu seed (1 NccOnly đã DaDuyet chưa tạo HĐ, 1 NccWithPlan ở phase ChoCCM giữa chừng, 1 TuChoi) cho UAT + screenshot.
- [ ] **MaPhieu format chính thức** — hiện `PE-YYYYMM-XXXX` random 4-digit. User said "tính sau". Cần confirm format: `{ProjectCode}/PE/{seq:D3}` hoặc atomic sequence bảng như `ContractCodeSequences`.
- [ ] **Section "Ý kiến các phòng ban" (Phê duyệt/P.CCM/P.MuaHàng/SM-PM) ở tab Thông tin** — Excel form mẫu có, entity hiện chưa map. Cần thêm 4-8 text field + signoff date (hoặc dùng Approvals row như ContractApprovals).
### B. UX / Polish cần chỉnh
- [ ] **Payment terms chi tiết** — hiện JSON blob. UX tách field riêng (Tạm ứng / TT tạm / Quyết toán / Bảo hành / Hạn mức / Đánh giá) theo Excel section D.
- [ ] **Matrix Quotes bulk paste** — click cell → popup: OK. Nhưng bulk paste column giá từ Excel chưa có (power user feature).
- [ ] **Export phiếu PDF/Excel** — user cần bản in ký. Tái dùng `IDocumentConverter` + template `PE-TrinhDuyet.docx`.
- [ ] **Permission grant Pe_* cho non-admin role** — admin thấy menu Pe_*, non-admin chưa. Cần vào `/system/permissions` tick `PurchaseEvaluations.Read` cho role Drafter/Procurement/CostControl/Director.
- [ ] **fe-user Inbox** — hiện chỉ HĐ. Cần thêm section "Phiếu Duyệt NCC chờ tôi" (hoặc route `/pe-inbox` riêng).
- [ ] **Sidebar accordion fe-user** — test `Pe_DuyetNcc` group với `Ct_*` accordion context (Layout.tsx fe-user accordion hiện chỉ track `Ct_<code>`, có thể cần extend cover `Pe_<code>`).
### C. Edge case chưa test
- [ ] Reject path E2E: DangSoanThao → ChoPurchasing → (CCM reject) → DangSoanThao — verify approval row vẫn log
- [ ] Xóa phiếu khi đã có Contract kế thừa (PE.ContractId set) — cascade delete child OK, Contract standalone không break, nhưng nên warning dialog
- [ ] Admin tạo PE workflow v02 sau khi có phiếu pin v01 — invariant "phiếu cũ giữ cũ" chưa test (pattern giống HĐ, nên pass)
- [ ] Change EvaluationType (A ↔ B) sau create — form hiện disable, đúng. User có đổi nhầm → phải xóa + tạo lại.
### D. Deploy / Ops
- [ ] **Verify CI/CD apply commit 3990066 lên prod** — hiện `/api/purchase-evaluations` trả 404 (phiên bản cũ). Check runner status:
```powershell
Get-Service *gitea-runner* ; & "C:\nssm\nssm.exe" status gitea-runner
# Nếu Stopped → Start-Service gitea-runner
```
Sau đó recheck `curl https://api.huypham.vn/api/purchase-evaluations` → 401 = deploy OK.
## ✅ Recently Done (newest on top)
## ✅ Recently Done (newest on top)
| Ngày | Ai | Task | Commit |
|---|---|---|---|
| 2026-04-23 | Claude | **G-084 hardening** — localhost → 127.0.0.1 trong `deploy-iis.ps1` + skill `iis-deploy-runbook`. Thêm gotcha #33 (IPv4/IPv6 port hijack) ref VietReport incident + 3 rules (reverse-proxy IP literal / backend loopback IPv4 explicit / service dependency). SOLUTION_ERP risk thấp (API in-process IIS, no ARR proxy) nhưng chuẩn hóa cho tương lai. | `3990066` |
| 2026-04-23 | Claude | **Kế thừa HĐ từ phiếu PE** — `CreateContractFromEvaluationCommand` guard DaDuyet + SelectedSupplier + ContractId=null → tạo Contract draft với SupplierId/ProjectId/GiaTri kế thừa. Link 2 chiều PE.ContractId. 2 endpoint mới (approved-pending-contract + create-contract). FE PeDetailTabs InfoTab banner emerald + CreateContractDialog pick ContractType 7 loại. | `a385d70` |
| 2026-04-23 | Claude | **PE FE — 2 app pages (List/Create/Detail 3-panel)** — Types + PurchaseEvaluationsListPage 3-panel + PurchaseEvaluationCreatePage + PeDetailTabs (5 tab: Thông tin/NCC/Hạng mục+Quote matrix/Duyệt/Lịch sử) + PeWorkflowPanel timeline. Menu resolver Pe_* → /purchase-evaluations?type=N. fe-user mirror. TS build pass cả 2 app. | commit Phase 3 |
| 2026-04-23 | Claude | **PE App+Api CQRS** — ~900 dòng: Create/UpdateDraft/Transition/List/Inbox/GetDetail bundle/Delete + Supplier CRUD + Detail CRUD + Quote Upsert + SelectWinner + Changelog list. PurchaseEvaluationWorkflowService policy-based guard + notification push. PurchaseEvaluationsController ~15 endpoint. | commit Phase 2 BE |

View File

@ -241,7 +241,33 @@ Claude auto-invoke theo description matching.
| Observability | Serilog console | + file rolling daily + Seq/ELK |
| Security | JWT + HTTPS dev | + rate limit + audit log + CSP |
## 9. Liên quan
## 9. PurchaseEvaluation (Phase 6 — tiền-HĐ)
Module mới song song Contract phiếu trình duyệt so sánh giá N NCC × M hạng mục, duyệt xong kế thừa làm .
```
PurchaseEvaluation (Header) ─< PurchaseEvaluationSupplier (N:M × Supplier)
─< PurchaseEvaluationDetail (hạng mục) ─< PurchaseEvaluationQuote (báo giá N×M)
─< PurchaseEvaluationApproval (workflow history)
─< PurchaseEvaluationChangelog (audit)
─< PurchaseEvaluationAttachment (file)
─> PurchaseEvaluationWorkflowDefinition (PINNED at create)
─> Contract? (nullable FK — set khi gen HĐ từ phiếu DaDuyet)
```
**Workflow** (tách riêng Phase enum khác ContractPhase):
- A `DuyetNcc` 3 step: Drafter Procurement CostControl Director DaDuyet
- B `DuyetNccPhuongAn` 5 step: + ProjectManager sau Procurement, + Director duyệt PA trước duyệt NCC
**Kế thừa HĐ** (`CreateContractFromEvaluationCommand`):
- Guard: phase = DaDuyet, SelectedSupplierId != null, ContractId = null
- User pick ContractType (1-7) gen Contract draft với SupplierId/ProjectId/GiaTri kế thừa
- Pin `Contract.WorkflowDefinitionId` theo ContractType chọn
- Link 2 chiều: `PurchaseEvaluation.ContractId = contract.Id`
Chi tiết: [`database/schema-diagram.md §11`](database/schema-diagram.md).
## 10. Liên quan
- [`rules.md`](rules.md) coding conventions
- [`database/database-guide.md`](database/database-guide.md) DB schema chi tiết

View File

@ -310,7 +310,61 @@
- [ ] **PE Attachments upload** (pattern reuse ContractAttachmentFeatures) — optional
- [ ] **Auto-map PE Details → Contract Details per-type** khi gen HĐ — phức tạp vì 7 ContractType schema khác nhau, user điền lại manual — optional
## Post-launch (Phase 6+future)
## Phase 7PE refinement (session tiếp)
**User feedback (2026-04-23 tối session 2):** "phần Duyệt NCC chưa xong đâu đấy nhé, còn chỉnh nhiều"
### A. Chức năng MISSING trong MVP
- [ ] **PE Workflow admin designer UI** `/system/pe-workflows/:typeCode`
- BE `Application/PurchaseEvaluations/PeWorkflowAdminFeatures.cs` — mirror `WorkflowAdminFeatures.cs` (GetOverview + CreateNewVersion)
- `Api/Controllers/PeWorkflowsController.cs` — GET overview + POST create-version (`[Authorize(Policy = "PeWorkflows.Create")]`)
- FE `fe-admin/src/pages/system/PeWorkflowsPage.tsx` — URL-driven, landing + per-type
- FE `fe-admin/src/components/workflow/PeWorkflowDesigner.tsx` — Steps + Approvers modal
- Route `/system/pe-workflows/:typeCode` trong App.tsx (menu `PeWf_*` + resolver đã sẵn)
- [ ] **PE Attachments upload** — pattern copy từ `ContractAttachmentFeatures.cs`
- BE `Application/PurchaseEvaluations/PurchaseEvaluationAttachmentFeatures.cs` (Upload/Download/Delete)
- 3 endpoint POST/GET/DELETE `/api/purchase-evaluations/{id}/attachments`
- FE `components/pe/PeAttachmentsSection.tsx` — drag-drop với purpose selector
- [ ] **Ý kiến 4 phòng ban** (Phê duyệt / P.CCM / P.MuaHàng / SM-PM từ Excel form)
- Option A: Thêm 4 text field (NhậnXétPheDuyet/CCM/MuaHang/SmPm) + 4 date field + 4 UserId vào `PurchaseEvaluations` header
- Option B: Dùng existing `PurchaseEvaluationApprovals` với roleKind extra field
- UX: tab Thông tin hiển thị 4 box sign-off như Excel
- [ ] **Payment terms tách field** từ JSON → 6 columns hoặc subtable
- Migration `AddPurchaseEvaluationPaymentTerms` — cột/bảng: TamUng%, ThanhToanTam%, QuyetToan%, BaoHanh%, HanMucCongNo, DanhGia
- FE form field-based (loại bỏ JSON textarea)
- [ ] **Auto-map PE Details → Contract Details khi gen HĐ** (optional — nâng cấp)
- 7 mapping function per ContractType (khó vì schema khác biệt)
- MVP: skip, user nhập manual
- [ ] **Demo PE data seed**`SeedDemoPurchaseEvaluationsAsync`
- 1 NccOnly DaDuyet chưa tạo HĐ (showcase kế thừa button)
- 1 NccWithPlan phase ChoCCM (showcase workflow middle)
- 1 TuChoi (showcase reject path)
- [ ] **MaPhieu format chính thức** — hiện `PE-YYYYMM-XXXX` random. User confirm format + atomic sequence:
- Option A: `{ProjectCode}/PE/{yyyy}/{seq:D3}` — atomic via `PurchaseEvaluationCodeSequences` bảng mới
- Option B: Tái dùng `ContractCodeSequences` với Prefix = `PE-{yyyy}-{ProjectCode}`
### B. UX / Polish
- [ ] Matrix Quotes **bulk paste** từ Excel column giá → paste matrix row
- [ ] **Export phiếu PDF/Excel** — tái dùng `IDocumentConverter` + template `PE-TrinhDuyet.docx` upload qua FormsPage
- [ ] **Permission grant Pe_* cho non-admin role** — 1 click trong PermissionsPage matrix (Pe_* inherit từ `PurchaseEvaluations.Read` tương tự Contracts inheritance)
- [ ] **fe-user Inbox** thêm section "Phiếu Duyệt NCC chờ tôi" (hoặc route `/pe-inbox`)
- [ ] **Sidebar accordion fe-user** extend cover `Pe_<code>` (hiện chỉ track `Ct_<code>`)
- [ ] **Dashboard** — thêm KPI "PE phiếu chờ tôi", "PE đã duyệt tháng này", "PE cần tạo HĐ"
### C. Edge case + E2E test
- [ ] Reject path E2E: DangSoanThao → ChoPurchasing → (CCM reject) → DangSoanThao
- [ ] Admin tạo PE workflow v02 sau khi có phiếu pin v01 — invariant test
- [ ] Xóa phiếu khi PE.ContractId set — warning dialog
- [ ] 2 admin đồng thời tạo v02 cho cùng type — race condition (atomic dealsactivate old)
### D. Deploy
- [ ] Verify commit `3990066` apply prod (runner status + `/api/purchase-evaluations` → 401 expected)
## Post-launch (Phase 8+ — future)
- [ ] **Email outbox** (MailKit + SMTP) — blocked chờ SMTP config
- [x] **Roles CRUD** — admin tạo custom role ngoài 12 hardcoded (commit 072ad6d)

View File

@ -0,0 +1,80 @@
# Session 2026-04-23 ~23:59 — Chốt session 2: PE skeleton + G-084 + docs
**Focus:** Chốt toàn bộ MD trước khi sang session mới. PE module còn
CHỈNH NHIỀU (user nhấn mạnh), G-084 hardening apply preemptively.
## Commits session này (7 total)
| Commit | Nội dung |
|---|---|
| `2c6f0ca` | Domain+Infra — 10 bảng PE + migration 12 + seed menu/workflow |
| `4678d19` | App+Api — PurchaseEvaluation CQRS (~900 LOC) + Controller 15 endpoint + WorkflowService |
| `a737196` | FE 2 app — PE pages (List/Create/Detail tabs) + menu resolver Pe_*/PeWf_* |
| `a385d70` | Kế thừa HĐ — CreateContractFromEvaluationCommand + FE dialog pick ContractType |
| `aaf03be` | Docs Phase 6 — STATUS/HANDOFF/schema-diagram/migration-todos/session log |
| `3990066` | G-084 hardening — localhost → 127.0.0.1 scripts + skill + gotcha #33 |
| `(this)` | Chốt session — STATUS/HANDOFF/migration-todos/skills/CLAUDE/architecture |
Tất cả đã push lên Gitea `main`. Runner cần verify apply deploy.
## MD files updated
| File | Changes |
|---|---|
| `docs/STATUS.md` | Phase hiện tại + In Progress PE refinement (nhóm A/B/C/D), +G-084 row Recently Done |
| `docs/HANDOFF.md` | TL;DR session 2 + Priority 0 PE refinement + cảnh báo session tiếp |
| `docs/changelog/migration-todos.md` | Phase 7 PE refinement checklist (A/B/C/D) |
| `docs/architecture.md` | Section 9 PurchaseEvaluation module (ERD + workflow + kế thừa HĐ) |
| `docs/database/schema-diagram.md` | §11 PE module full (done session trước) |
| `docs/gotchas.md` | #33 G-084 IPv4/IPv6 port hijack (done session trước) |
| `CLAUDE.md` (root) | Scope commit `PurchaseEvaluation`, 5 file đọc đầu, 12 migration, 46 bảng, modules table |
| `.claude/skills/README.md` | 3 skill cross-ref Phase 6 PE |
| `.claude/skills/contract-workflow/SKILL.md` | Cross-ref PE workflow separate tables |
| `.claude/skills/permission-matrix/SKILL.md` | +Pe_*/PeWf_* menu keys + TODO grant non-admin |
| `.claude/skills/ef-core-migration/SKILL.md` | 12 migration history + Phase 7 pending |
| `.claude/skills/iis-deploy-runbook/SKILL.md` | +Hardening section G-084 + localhost→127.0.0.1 (done session trước) |
## Session tiếp cần làm — đọc STATUS.md §🔥 In Progress
**User feedback khóa chốt:** "phần Duyệt NCC chưa xong đâu đấy nhé, còn chỉnh nhiều"
### Priority 0 (PE refinement)
1. PE Workflow admin designer UI `/system/pe-workflows/:typeCode`
2. PE Attachments upload (reuse ContractAttachment pattern)
3. Ý kiến 4 phòng ban section (Phê duyệt/CCM/MuaHàng/SM-PM)
4. Payment terms tách field từ JSON blob → 6 column
5. Demo PE data seed
6. Permission grant Pe_* cho non-admin role
7. MaPhieu format chính thức (user confirm)
8. Export PDF/Excel
9. Auto-map PE Details → Contract Details (optional)
### Priority 1 (blockers user/ops)
- UAT thật, SMTP, rotate creds, SQL backup schedule
- Verify commit 3990066 đã apply prod (runner status)
### Audit cron
- `solution-erp-skill-audit-monthly` fire 2026-05-01 9:00 AM
- Log vào `docs/changelog/skill-audit-2026-05.md`
## Stats cuối session 2
| | Đầu session 2 | Cuối session 2 | Δ |
|---|---:|---:|---:|
| BE LOC | ~8800 | ~11100 | +2300 |
| DB tables | 36 | 46 | +10 |
| Migrations | 11 | 12 | +1 |
| API endpoints | ~93 | ~110 | +17 |
| FE pages | ~23 | ~26 | +3 × 2 app |
| Gotchas | 32 | 33 | +1 (G-084) |
| Commits | 52 | 59 | +7 |
| Skills | 6 | 6 | 0 (audit + cross-ref) |
## Notes cho session 3
1. **PE là skeleton** — đừng treat as feature-complete. Ưu tiên Priority 0.
2. **Runner VPS có thể stopped** sau khi restart — check trước khi debug "endpoint 404".
3. **G-084 rule** áp dụng mọi service mới: `127.0.0.1` thay `localhost` trong reverse proxy / backend bind.
4. **Workflow audit** cron đã set — không cần manual trigger trừ khi có skill mới thêm nhiều.
5. **MaPhieu PE** hiện random — PHẢI confirm format với user trước khi seed demo data hoặc go-live thật.
6. **Không fix localhost trong FE dev configs** (vite.config.ts, launchSettings.json, docs dev-only) — đó là dev context, risk zero. Chỉ fix prod deploy/proxy paths.