[CLAUDE] Docs: chot session 3 — PE polish iter 2 + domain rebrand + 5 gotcha moi
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 2m55s

User request: 'Chot lai toan bo MD de sang session moi'.

Session 3 (2026-04-24) — ~15 commit feat/fix PE module + domain migration:
 - Domain 3 subdomain huypham.vn → solutions.com.vn E2E live
 - PE rename 'Phuong An' → 'Giai phap' + backfill DB
 - Menu tree inheritance extend Pe_*/PeWf_*
 - Accordion mutex Pe_* + sidebar w-72 + label nowrap
 - NavLink queryMatches (fix 2 leaf cung highlight)
 - PE detail flat layout: Panel 2 = 4 section, Panel 3 + approvals/history
 - Upload file dinh kem per-NCC (SupplierAttachmentsCell) + Bang so sanh tong
 - readOnly mode menu 'Duyet' (pendingMe=1)
 - HD move Lich su dieu chinh → Panel 3
 - Demo email rebrand @solutionerp.local → @solutions.com.vn + BackfillUserEmailDomain

Docs updated (6 file):
 - STATUS.md: +9 row Recently Done session 3. In Progress tick 10+ done. Phase
   hien tai = 'UX polish hoan thien, UAT-ready'.
 - HANDOFF.md: TL;DR session 3 summary. Priority 0 = 3 task MISSING cuoi
   (Designer UI, Y kien 4 phong ban, Export PDF). Login email moi.
 - gotchas.md: +5 entry (#34 NavLink query, #35 menu inheritance extend,
   #36 Vite env rebuild, #37 PS 5.1 ASCII, #38 Identity rename 4 field) +
   checklist debug +5 entry.
 - ef-core-migration SKILL: migration 13 AddPurchaseEvaluationCodeSequences
   + Phase 6 update section (ComparisonTable enum + BackfillUserEmail).
 - skills/README: ef-core-migration 13 migration label updated.
 - docs/changelog/sessions/2026-04-24-chot-session-3-pe-polish.md: session log
   15 commit + bugs + stats + next priorities session 4.

Memory project_solution_erp.md: Phase 6 iter 2 DONE. Domain rebrand DONE.
Session 4 priority 3 PE gap remaining.

Stats: 47 DB tables (+1 MaPhieu seq), ~113 endpoint (+3 PE attachments),
13 migrations, 38 gotchas, ~85 commits total.
This commit is contained in:
pqhuy1987
2026-04-25 00:37:30 +07:00
parent a336997cfe
commit e65578a821
6 changed files with 348 additions and 46 deletions

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-24 sáng (Phase 6 — PE module **demo seed + MaPhieu atomic + Pe_* perm defaults**)
**Last updated:** 2026-04-24 chiều (Phase 6 — **PE polish iter 2: rename/attachments/readOnly/comparison-table + email rebrand**)
## 📍 Phase hiện tại: **Module Duyệt NCC (tiền-HĐ) — skeleton deployed, refinement WIP** — 47 DB tables (+10 PE +1 MaPhieu seq), ~110 endpoints (+17 PE), 13 migrations (+13 `AddPurchaseEvaluationCodeSequences`), 6+ commits PE push Gitea. Skeleton BE + FE + kế thừa HĐ + 4 [DEMO] PE seed + Pe_* perm defaults hoạt động; còn polish: designer UI, attachments, details mapping, export PDF.
## 📍 Phase hiện tại: **Module Duyệt NCC — UX polish hoàn thiện, UAT-ready** — 47 DB tables, ~113 endpoints (+3 PE attachments), 13 migrations. Tất cả tính năng session 3 yêu cầu đã apply prod. PE module live đầy đủ: Domain rebrand + layout 4-section + upload file per-NCC + bảng so sánh tổng + readOnly menu Duyệt + accordion mutex + NavLink query match + Lịch sử điều chỉnh HĐ move sang Panel 3 + email @solutions.com.vn.
### 🌐 Production URLs
@ -18,17 +18,17 @@
> **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)
### A. Chức năng MISSING trong MVP (còn lại)
- [ ] **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).
- [x] **PE Attachments upload** (2026-04-24) — `PurchaseEvaluationAttachmentFeatures.cs` (Upload/Download/Delete) + 3 endpoint REST + `IFileStorage` reuse. FE column "File đính kèm" per-NCC (SupplierAttachmentsCell) + section "Bảng so sánh (file tổng)" (GeneralAttachmentsSection, `supplierRowId=null`). Enum purpose: QuoteDocument=1/RequirementSpec=2/DecisionExport=3/**ComparisonTable=4**/Other=99. 20MB MIME whitelist.
- [ ] **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).
- [x]**Demo PE data seed** (2026-04-24) — 4 phiếu `[DEMO]` cover full state-space: A-001 DangSoanThao (Drafter mới mở), A-002 ChoCEODuyetNCC (winner đề xuất + 9 quotes), A-003 DaDuyet (chưa tạo HĐ — kế thừa demo), B-001 ChoDuAn (5-step giữa chừng). Idempotent skip-if-exists. PaymentTerms JSON cho A-003.
- [x]**MaPhieu atomic sequence** (2026-04-24) — Migration 13 `AddPurchaseEvaluationCodeSequences` (1 bảng, Prefix PK). `IPurchaseEvaluationCodeGenerator` + `PurchaseEvaluationCodeGenerator` (SERIALIZABLE transaction, mirror ContractCodeGenerator). Format `PE/{YYYY}/{TypeLetter}/{Seq:D3}` — VD `PE/2026/A/001`. Wired vào CreatePurchaseEvaluationCommandHandler thay Random.Shared. DI registered.
- [x]**Demo PE data seed** (2026-04-24) — 4 phiếu `[DEMO]` cover full state-space.
- [x]**MaPhieu atomic sequence** (2026-04-24) — Migration 13. Format `PE/{YYYY}/{A|B}/{Seq:D3}`.
- [ ] **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
@ -36,9 +36,17 @@
- [ ] **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`.
- [x]**Permission grant Pe_* cho non-admin role** (2026-04-24)`SeedPurchaseEvaluationPermissionDefaultsAsync` grant CRUD per role: Drafter/DeptManager/Procurement (R+C+U) · CostControl/PM/Director/AuthorizedSigner (R+U). DeptManager thêm Delete. Idempotent per-(roleId × menuKey). 9 menu key (PurchaseEvaluations + 2× group + 6× leaf) × 7 role = ~63 row defaults. Sau seed admin bật/tắt finer-grain qua `/system/permissions`.
- [x]**Permission grant Pe_* cho non-admin role** (2026-04-24).
- [x]**Menu tree inheritance Pe_*/PeWf_*** (2026-04-24) — `GetMyMenuTreeQuery` extend 2 inherit root mới (PurchaseEvaluations + PeWorkflows). Fix bug: admin có perm nhưng menu children không hiện.
- [x]**Sidebar accordion mutex Pe_*** (2026-04-24) — extend `AccordionContextValue` + `expandedPeCode` + URL sync pathname. 2 PE group không expand cùng lúc; Ct_ + Pe_ độc lập gia đình.
- [x]**NavLink query active check** (2026-04-24) — `queryMatches` helper. 2 leaf cùng pathname `/purchase-evaluations` (Danh sách `?type=2` vs Duyệt `?type=2&pendingMe=1`) không còn cùng highlight. Áp dụng Ct_* + Pe_*.
- [x]**Sidebar width + label nowrap** (2026-04-24) — w-64 → w-72 (288px). Top-level group: `text-xs tracking-wider``text-[11px] tracking-wide whitespace-nowrap`. "QUY TRÌNH CHỌN THẦU PHỤ - NCC" fit single-line.
- [x]**PE detail flat layout** (2026-04-24) — Panel 2 bỏ 5 tabs, render flat 4 section (Thông tin / NCC tham gia / Hạng mục + Báo giá / **Bảng so sánh**). Panel 3 add Duyệt + Lịch sử sections dưới workflow timeline.
- [x]**PE readOnly mode menu Duyệt** (2026-04-24) — pendingMe=1 → hide toàn bộ action (Sửa/Xóa/Thêm/Edit inline/Upload/Delete attachment). Giữ download + comment khi transition. Chip "chế độ duyệt" ở header.
- [x]**Contract: move Lịch sử điều chỉnh Panel 2 → Panel 3** (2026-04-24) — Chi tiết HĐ full-width. Panel 3 bổ sung ContractChangelogsTab dưới Lịch sử duyệt.
- [x]**Menu rename "Phương Án" → "Giải pháp"** (2026-04-24) — DbInitializer labels + backfill UPDATE existing rows. Giữ nguyên enum value + menu key + typeCode + policy name (zero breaking change).
- [x]**Demo email @solutionerp.local → @solutions.com.vn** (2026-04-24) — AdminEmail const + 17 demo users rename trong source + BackfillUserEmailDomainAsync idempotent rename existing users (Email/NormalizedEmail/UserName/NormalizedUserName). Chạy trước SeedAdmin tránh duplicate. Password + role + refresh token giữ nguyên.
- [ ] **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