From c995f42e0d1f70f36448139c83b113135f00a471 Mon Sep 17 00:00:00 2001 From: pqhuy1987 Date: Fri, 22 May 2026 11:00:29 +0700 Subject: [PATCH] =?UTF-8?q?[CLAUDE]=20FE-Admin+FE-User:=20Plan=20CA=20Chun?= =?UTF-8?q?k=20C=20=E2=80=94=20Sidebar=20filter=202=20app=20(admin=20HIDE?= =?UTF-8?q?=20+=20user=20SHOW)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fe-admin/src/components/Layout.tsx: - Add ADMIN_HIDDEN_MASTER_KEYS Set với 9 menu key danh mục - Extend isAdminHidden predicate: hide Ct_* + ADMIN_HIDDEN_MASTER_KEYS - Master/Suppliers/Projects/Departments/Catalogs/4 sub-catalogs giờ ẩn khỏi admin sidebar fe-user/src/components/Layout.tsx: - Remove `Master, Suppliers, Projects, Departments` khỏi USER_HIDDEN_KEYS - Catalogs (root + 4 leaf) auto-visible qua tree-inherit từ Master - Giữ ẩn `System, Users, Roles, Permissions, Forms, Reports` (admin tools) Verify: - npm run build × 2 app PASS 0 TS err - fe-admin bundle `index-BQidGwKU.js` 1,404 KB gz 357 KB (rotate) - fe-user bundle `index-Co8LTtad.js` 1,317 KB gz 342 KB (rotate) - Pattern 5 (mirror 2 app §3.9) applied — cùng 1 plan touch 2 file Layout Plan CA chain: - Chunk A 80d39a0 BE Role + Seed (em main solo) - Chunk B 06a441c FE move 4 pages (Implementer Case 2) - Chunk C (this) sidebar filter (em main solo) - Pending Chunk D: smoke verify + tạo demo user catalog.manager@solutions.com.vn Co-Authored-By: Claude Opus 4.7 (1M context) --- fe-admin/src/components/Layout.tsx | 10 +++++++++- fe-user/src/components/Layout.tsx | 6 +++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/fe-admin/src/components/Layout.tsx b/fe-admin/src/components/Layout.tsx index 6f7c2d8..3a841fc 100644 --- a/fe-admin/src/components/Layout.tsx +++ b/fe-admin/src/components/Layout.tsx @@ -108,8 +108,16 @@ function resolvePath(key: string): string | null { // Admin side: hide the per-ContractType contract submenu (Ct_*) — that's a // user-app concern. Keep Wf_* workflow-admin leaves. +// [Plan CA S29 2026-05-22] cũng hide "Cấu hình danh mục dùng chung" (Master + +// Catalogs) — đã move sang fe-user/eoffice. Admin vẫn phân quyền role × menu × +// CRUD qua /system/permissions (Permission Matrix tự reflect 9 menu key này). +const ADMIN_HIDDEN_MASTER_KEYS = new Set([ + 'Master', 'Suppliers', 'Projects', 'Departments', + 'Catalogs', 'CatalogUnits', 'CatalogMaterials', 'CatalogServices', 'CatalogWorkItems', +]) + function isAdminHidden(key: string): boolean { - return key.startsWith('Ct_') + return key.startsWith('Ct_') || ADMIN_HIDDEN_MASTER_KEYS.has(key) } function filterForAdmin(nodes: MenuNode[]): MenuNode[] { diff --git a/fe-user/src/components/Layout.tsx b/fe-user/src/components/Layout.tsx index c3b800e..4abd94b 100644 --- a/fe-user/src/components/Layout.tsx +++ b/fe-user/src/components/Layout.tsx @@ -96,8 +96,12 @@ function resolvePath(key: string): string | null { // Menu entries not applicable to user app — filtered out client-side so the // sidebar only shows what matters to a contract drafter/approver. +// [Plan CA S29 2026-05-22] REMOVED `Master, Suppliers, Projects, Departments` +// khỏi hidden set — "Cấu hình danh mục dùng chung" giờ ở fe-user/eoffice cho +// role CatalogManager (admin tạo + gán qua Permission Matrix). Catalogs (root +// + 4 leaf) tree-inherit từ Master nên auto-visible. Forms/Reports/System/ +// Users/Roles/Permissions vẫn ẩn (admin tools only). const USER_HIDDEN_KEYS = new Set([ - 'Master', 'Suppliers', 'Projects', 'Departments', 'System', 'Users', 'Roles', 'Permissions', 'Forms', 'Reports', ])