Files
solution-erp/docs/STATUS.md
pqhuy1987 ff5e35f279
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 2m47s
[CLAUDE] Docs: chốt session 2026-04-23 chiều — toolkit + 4-bảng + master + roles VN
11 commit feature work (b75448eae59cfe) → docs sync.

## STATUS.md

- Last updated 2026-04-23 16:00
- Phase header: Tier 3 + 4-bảng + master catalogs + roles VN
- 7 Recently Done row mới (3-panel layout, 4-bảng overhaul, Thao tác
  2-panel, Mã HĐ gen Create, master catalogs, roles VN demo users)
- Cumulative table thêm cột "+Toolkit/Catalogs/Roles" (DB 36, endpoints
  ~80, migrations 11, commits ~47)
- Session log link mới
- Skill list count = 13 file

## HANDOFF.md

- TL;DR cập nhật: 36 tables, 80 endpoints, 11 migrations
- Phase table thêm 5 row Done (3-panel, 4-bảng, mã HĐ, master, roles)
- Git state 18 commit gần nhất
- Credentials block thêm 13 demo user (User@123456) — warn rotate trước UAT

## migration-todos.md

Section "Session 2026-04-23 (chiều)" với 14 ticked checkbox + commit refs.

## schema-diagram.md

- Header: 24 → 36 bảng
- Migration table thêm row 9-11 (highlighted)
- Section 8bis mới: chi tiết 7 Details + ContractChangelogs + 4 Catalogs +
  Role.ShortName + User.DepartmentId/Position

## Session log mới

`docs/changelog/sessions/2026-04-23-1500-toolkit-data-roles.md` (~270
dòng) — outcome A→I, stats cumulative, 6 architectural decisions, next
session priority.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-23 14:39:48 +07:00

18 KiB
Raw Blame History

STATUS — Snapshot hiện tại

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 16:00 (post-toolkit + 4-bảng overhaul + master data + roles VN)

📍 Phase hiện tại: Tier 3 + 4-bảng data model + master catalogs + roles VN — Prod live, 36 DB tables, ~80 endpoints, 11 migrations. Còn: UAT thật + Email outbox (chờ SMTP) + rotate creds.

🌐 Production URLs

🔥 In Progress

(không có — Tier 3 + skill governance đóng gói xong, chờ UAT + chờ cron audit fire 2026-05-01)

Recently Done (newest on top)

Ngày Ai Task Commit
2026-04-23 Claude Roles VN labels (ShortName) + Users dept/position + 13 demo users — Migration 11 AddRoleShortNameAndUserDepartment. Role thêm ShortName max 50 (QTV/BOD/CCM/PRO/FIN/...) + Description full VN. User thêm DepartmentId FK Restrict + Position. Idempotent backfill 12 roles VN labels. Seed 13 demo users (bod/pm/ccm/pro/fin/act/equ/hra TPB + 4 Drafter), pwd User@123456. FE UsersPage column Phòng ban + Chức vụ + edit dialog mới + roles checkbox "ShortName — Full". PermissionsPage Panel 1 2-line per role. 330d529 + ae59cfe
2026-04-23 Claude 4 master catalogs cho Details + datalist autocomplete — Migration 10 AddMasterCatalogs: UnitsOfMeasure (20 seed) + MaterialItems (15) + ServiceItems (10) + WorkItems (15). CQRS CRUD 13 endpoint, Admin role POST/PUT/DELETE. Menu mới Catalogs group + 4 leaves dưới Master. FE Admin CatalogsPage generic 4-tab CRUD /master/catalogs/:kind. FE Details Add form HTML5 <datalist> per field + smart-fill (pick code → autofill name + defaultUnit). DB 32→36 bảng. e27c547 + 16e24ed
2026-04-23 Claude Mã HĐ gen ngay tại CreateContract + backfill HĐ legacyCreateContractCommandHandler call codeGenerator.GenerateAsync trước db.Contracts.Add. TransitionAsync giữ defensive if MaHopDong null gen cho legacy. BackfillContractCodesAsync trong DbInitializer chạy startup, idempotent (NULL count → skip nếu 0). Trade-off: gap sequence khi reject nhưng user có mã ngay đầu để reference giấy tờ. 51449d6
2026-04-23 Claude "Thao tác" 2-panel + Edit/Xóa hover + Detail previewContractCreatePage rewrite: Panel 1 List HĐ theo type + button "+ Thêm mới" cuối. Panel 2 ContractHeaderForm (new) hoặc ContractEditForm (edit) + Chi tiết section. URL state ?type/?id/?mode=new. Action buttons row Panel 1: Edit ✏ + Xóa 🗑 luôn hiện, mờ + disabled khi Phase != DangSoanThao. ContractDetailsPreview cho create mode show table headers + lock icon. 8c4b4da + ec0c983 + 501b4de + 7f26ff9 + 39031ca
2026-04-23 Claude Panel 2 layout: tabs → 7/3 grid (UX iter 2) — Bỏ tabs Tổng quan/Chi tiết/Lịch sử. Render flat: Tổng quan (Info+Comments+Attachments) ở trên, dưới grid lg:grid-cols-10 (Chi tiết 7 cột + Lịch sử Changelog 3 cột). b3762af (tabs) → ad0652d (grid)
2026-04-23 Claude 4-bảng data model overhaul (Header+Details+Workflow+Changelog) — Migration 9 AddContractDetailsAndChangelog: 7 ContractType-specific Details bảng + 1 ContractChangelog unified audit log. IChangelogService 5 method, wired vào CreateContract+UpdateDraft+AddComment+Upload/Delete/Transition. CQRS 9 endpoint mới (GetBundle+7 Add+Delete+ListChangelogs). FE ContractDetailsTab + ContractChangelogsTab. DB 24→32 bảng. 70810e1 + 71c035d + e684455
2026-04-23 Claude 3-panel layout HĐ (List/Detail/Workflow) + Inbox + sidebar accordion + UserDashboard fix — MyContractsPage + ContractsListPage + InboxPage 3-panel lg:grid-cols-[320px_1fr_360px], ?id= URL state, mobile fallback fullpage. Sidebar accordion qua AccordionContext (chỉ 1 Ct_ expand). Tách "Tổng quan" → /dashboard riêng (fix bug trùng /inbox), UserDashboardPage 5-card "Của tôi" + recent contracts. b75448e + 89c7e88 + 7ea3957 + d326e80
2026-04-23 Claude Skill governance + audit định kỳdocs/rules.md §9 mới (6 skill bảng, nguyên tắc tạo project-specific, format SKILL.md bắt buộc, workflow audit 7 bước, 4 anti-patterns). Cron task solution-erp-skill-audit-monthly fire 9:00 AM ngày 1 mỗi tháng (next 2026-05-01) — self-contained prompt cold-start, auto-refresh stale nhỏ + đề xuất add/archive cho human approve, log vào docs/changelog/skill-audit-{YYYY-MM}.md, ABORT nếu repo dirty. Touch-points: CLAUDE.md callout + HANDOFF A1 + migration-todos checkbox + skill scope commit b904a25
2026-04-23 Claude 3 skill ops project-specific — Khảo sát alirezarezvani/claude-skills, quyết định KHÔNG bulk-clone (skill global đã cover phần generic, repo còn lại doc-dump không có when-to-use). Viết 3 skill mới encode SOLUTION_ERP-only: dependency-audit-erp (npm/dotnet CVE scan respect MediatR 12.4.1 + Swashbuckle 6.9.0 pin), ef-core-migration (8 migration history + 3-file rule + DesignTimeDbContextFactory + 6 pitfalls cụ thể), iis-deploy-runbook (3 IIS site + win-acme + NSSM gitea-runner + LibreOffice + debug playbook 500/502/SignalR). Total skill project-level = 6 (3 domain + 3 ops) 661f859
2026-04-22 Claude PermissionsPage 3-panel layout — Grid lg:grid-cols-[280px_1fr_300px]: Panel 1 Role list click-to-select (active ring-brand), Panel 2 Menu×CRUD matrix sticky thead + search + column bulk-toggle + brand-tinted hover, Panel 3 Granted progress bar + CRUD breakdown color badges (slate/emerald/amber/red) + Tip 91b2da1
2026-04-22 Claude Admin Workflows tabs → sidebar menu items — Seed 7 Wf_<Code> leaf dưới group Workflows. Layout resolvePath Wf_<Code>/system/workflows/<code>. WorkflowsPage bỏ tab bar, URL param drives type selection. Landing 7-card grid khi click top-level Quy trình HĐ. Inheritance: Workflows.Read perm → tất cả 7 leaves auto-visible. f216169
2026-04-22 Claude Versioned workflow per ContractType — 3 entity mới: WorkflowDefinition (Code+Version+IsActive+ContractType), WorkflowStep (Order+Phase+Name+SlaDays), WorkflowStepApprover (Role/User + AssignmentValue). Contract.WorkflowDefinitionId nullable FK pin tại create. Migration AddVersionedWorkflows. Seed v01 per 7 ContractType. WorkflowPolicyRegistry.FromDefinition() build runtime policy từ DB. ContractWorkflowService load pinned definition. Admin /system/workflows/:typeCode Designer modal (create new version, clone, add/remove step, +Role/+User approvers). POST /api/workflows auto-increment Version + deactivate old. Invariant: HĐ cũ pin v01 giữ nguyên khi v02 active. E2E verified: QT-MB-v02 active, HĐ cũ vẫn chạy v01. e7e5f2d + 355bbe3
2026-04-21 Claude Nested sidebar menu fe-user — 7 ContractType × 3 actions (Danh sách/Thao tác/Duyệt), nested 3-level. Admin hide Ct_*. Layout recursive MenuNodeRenderer. MyContracts + Inbox filter ?type=X 5e0f380 + 48e91fe
2026-04-21 Claude Seed master data + MyDashboard widgets — DbInitializer seed 9 departments (PM/QS/CCM/PRO/FIN/ACT/EQU/HRA/BOD) + 5 demo suppliers + 3 demo projects idempotent. MyDashboard endpoint role-aware: DraftsInProgress / PendingMyApproval / DueSoon / Overdue / DraftsTotalValue. FE "Của tôi" row 4 card hover-interactive, admin auto-hide nếu = 0 6197c84
2026-04-21 Claude Dynamic workflow policy per ContractType — Domain WorkflowPolicy record + registry (Standard 8-phase cho Thầu phụ/Giao khoán/NCC; SkipCcm 7-phase cho Dịch vụ/Mua bán/Nguyên tắc). ContractWorkflowService dùng policy.ForContract(c). FE xóa NEXT_PHASES hardcoded, dùng contract.workflow.nextPhases BE trả. WorkflowSummaryCard timeline visual. Gotcha #21 resolved cae4d84
2026-04-21 Claude PDF export + .doc/.xls auto-convert + DynamicForm — LibreOffice 25.8.6 VPS, IDocumentConverter shell soffice --convert-to pdf/docx/xlsx timeout+temp isolation. Admin upload .doc auto-convert .docx. DynamicForm parse FieldSpec JSON render inputs (text/textarea/number/date/currency/select). Form↔JSON toggle. E2E verified PDF 488KB/126 pages e459097 + 6bbd894
2026-04-21 Claude Form template builder CRUD — Admin tự upload .docx/.xlsx qua UI (không cần dev). BE multipart + FormCode regex unique + FieldSpec JSON validation + soft delete via IsActive. FE FormsPage upload dialog + row actions render/edit/delete. E2E verified 166d26c
2026-04-21 Claude Fix Gitea 500 sau Install Web-WebSockets — appcmd unlock section webSocket. Gotcha #25 c52186b
2026-04-21 Claude SignalR realtime notifications E2E — 3-project clean-arch: IRealtimeNotifier (App) + SignalRNotifier (Api) + NotificationPushInterceptor (Infra SaveChanges hook). Hub /hubs/notifications JWT ?access_token= query (WebSocket headers limit). FE singleton lib/realtime.ts auto-reconnect + toast + query invalidation. IIS WebSocket module enabled ea9ab5e
2026-04-21 Claude Attachment upload E2E — IFileStorage + LocalFileStorage (path-traversal guard) + CQRS Upload/Download/Delete + 3 endpoint (multipart, stream, DELETE) + FE ContractAttachmentsSection drag-drop + purpose selector + icon-per-MIME + auth-blob download + confirm delete. Wired 2 ContractDetailPage c8d0070 + dc3f09b
2026-04-21 Claude Content polish — typography 14px + leading 1.55 + tracking-tight + PageHeader border-b + Button shadow+active + Input inset shadow + DataTable rounded-xl UPPERCASE header brand hover 346bd5d
2026-04-21 Claude Brand identity từ Solutions logo — pixel-sampled #1F7DC1 → palette brand-50..900 + accent red + Be Vietnam Pro (Vietnamese-first) + favicon 'S' crop + apple-touch-icon + login gradient brand 4abb559 + bf1fbe3
2026-04-21 Claude Fix login Network Error — SPA web.config HTTP→HTTPS redirect rule (CORS chỉ https) 397eb36
2026-04-21 Claude Notifications module E2E — Domain entity + EF migration + Infra service + CQRS + API controller + FE bells wire real endpoint + ContractWorkflowService emit notification cho Drafter khi phase transition 49c0ddc
2026-04-21 Claude PermissionsPage iter 1 — search, stats badge, bulk column toggle, empty state 6c0e206
2026-04-21 Claude ERP shell — TopBar + NotificationBell + UserMenu (avatar + role badges). Layout [sidebar] [topbar + content] 2b6f91c
2026-04-21 Claude Tier 1 UI polish — SlaTimer (inline + full variant, 5 chỗ), Inbox stat cards, DataTable skeleton rows, EmptyState 290936a..2e43799
2026-04-21 Claude CI/CD deploy xanh E2E — self-hosted Windows runner, single job build+deploy, fresh node_modules (Vite 8 rolldown binding), appsettings từ secrets, /health/live 200 sau deploy b40da1e
2026-04-21 Claude VPS prod setup — SQL DB (SQLEXPRESS), IIS sites (SolutionErp-Api/Admin/User), win-acme 3 Let's Encrypt + auto-renew, shared gitea-runner với VIETREPORT 169e268..519ba85
2026-04-21 Claude IDOR + SLA Job + Admin warning — ContractsController filter theo role. SlaExpiryJob BackgroundService 15min auto-approve Decision=AutoApprove. DbInitializer warn khi admin vẫn default fba0754
2026-04-21 Claude Phase 5.1 Security + Users Mgmt — Security headers + Identity lockout + LoginHandler check + Users CQRS + UsersController + FE /system/users 11e61c9
2026-04-21 Claude Phase 5 Prep — BE rate limit + health check + Serilog file + HSTS + scripts deploy-iis/backup-sql + .gitea/workflows/deploy.yml + 4 guides + FE refresh token queue pattern 46a2cab
2026-04-21 Claude Phase 4 Report MVP — Dashboard KPI + Excel export + rules.md + architecture.md + schema-diagram.md + gotchas 26 pitfalls fe7ad8e
2026-04-21 Claude Phase 3 Workflow MVP — 9 phase state machine + gen mã HĐ RG-001 7e957a7
2026-04-21 Claude Phase 2 Form Engine MVP 5113e4c
2026-04-21 Claude Phase 1.2 — CRUD Master + Permission Matrix 54d6c9b
2026-04-21 Claude Phase 1 foundation + Docs addition 702411f + 49a5f57
2026-04-21 Claude Phase 0 25dad7f

Session logs: P0 · P1f · P1.2 · P2 · P3 · P4 · P5prep · Tier 3 · Skill gov · Toolkit+4-bảng+Roles VN

Docs entry points:

🎯 Next up

Hard blockers (chờ user / ops)

  • UAT 1 tuần 2-3 user thật — hard requirement từ roadmap Phase 5
  • Email outbox — MailKit + SMTP (BLOCKED chờ user cấp SMTP host/user/pass)
  • Rotate credentials — SA, vrapp, JWT secret, runner token (đã post chat)
  • SQL backup daily — Task Scheduler (script scripts/backup-sql.ps1 đã có, chưa schedule)

Optional polish (khi rảnh / UAT phát sinh)

  • Roles CRUD — admin tạo custom role ngoài 12 hardcoded (schema sẵn, chỉ cần CQRS + FE)
  • User-level approver targeting runtime — data model đã có (WorkflowStepApprover.Kind=User), chỉ cần wire User-kind vào ContractWorkflowService.TransitionAsync guard
  • PermissionsPage: grant Workflows.Read cho non-admin role → menu Wf_* visible
  • Warning notification khi còn 20% SLA (SlaWarningSent flag đã có, chỉ thiếu job emit)
  • E2E test reject → quay về DangSoanThao (multi-role)
  • Dependencies scan CI (dotnet list package --vulnerable, npm audit)

Tier 3 ERP roadmap ✓ (close)

  • Attachment upload BE + FE ✓
  • SignalR real-time push ✓
  • Form template builder CRUD + DynamicForm ✓
  • PDF export qua LibreOffice headless ✓
  • .doc/.xls → .docx/.xlsx auto-conversion ✓
  • Dynamic workflow policy per ContractType ✓
  • Versioned workflow (WorkflowDefinition pinned per Contract)
  • Admin workflow designer UI (per-type, per-step approvers)
  • Nested sidebar menu per ContractType (fe-user) + menu split admin/user
  • PermissionsPage 3-panel layout
  • Email outbox for Notification (blocked — SMTP config)

📊 Thông số cumulative

P0 P1f P1.2 P2 P3 P4 P5prep Tier3 +Toolkit/Catalogs/Roles
BE LOC 0 ~400 ~1500 ~1900 ~2700 ~3100 ~3300 ~4800 ~7800
DB tables 0 7 12 14 19 19 19 24 36 (+7 Details +1 Changelog +4 Catalogs)
API endpoints 0 4 20 23 31 33 35 ~50 ~80 (+9 Details/Changelogs +13 Catalogs CRUD)
Migrations 0 1 3 4 5 5 5 8 11 (+AddContractDetailsAndChangelog +AddMasterCatalogs +AddRoleShortNameAndUserDepartment)
FE pages 0 2 6 7 14 16 16 ~20 ~22 (+UserDashboard +CatalogsPage)
FE components many +ContractDetailContent +WorkflowHistoryPanel +ContractDetailsTab +ContractChangelogsTab +ContractDetailsPreview
Scripts PS 0 0 0 1 1 1 3 4 4
CI/CD workflow 0 0 0 0 0 0 1 1 1
Docs 10 13 14 24 26 30 35 ~40 ~42 (+session log toolkit)
Commits 1 2 3 5 6 7 8 ~25 ~47

🚨 Blockers / risks

  • ⚠️ Email SMTP chưa có — blocker cho notification outbound
  • ⚠️ UAT real user chưa chạy — risk phát sinh bug edge-case quan trọng
  • ⚠️ Credentials leaked trong chat — cần rotate trước go-live thật
  • ⚠️ SQL backup không auto — risk data loss nếu VPS crash
  • ⚠️ Permission Workflows.Read cho non-admin — cần grant để họ thấy menu Wf_* (hiện chỉ admin thấy)
  • ⚠️ User-kind approver chưa enable runtime — designer cho chọn User nhưng guard fall back DeptManager

Credentials + URLs

admin@solutionerp.local / Admin@123456