[CLAUDE] Domain+App+Api+FE-User+FE-Admin: Plan AA Chunk A - BE IsUserSelectable filter + menu seed Pe_DuyetNcc_WfView + sidebar widen w-72 xl:w-80 + revert Plan U truncate

BE changes:
- MenuKeys.cs +helper PurchaseEvaluationWorkflowView(typeCode) => "Pe_{typeCode}_WfView"
- DbInitializer.cs SeedMenuTreeAsync:
  - tree.Add LuongDuyet (Order=2 first child) cho 2 type PE
  - INSERT-only loop -> INSERT-OR-UPDATE-Order (shift existing prod rows Order+1)
  - Idempotent: skip nếu Order match, UPDATE nếu mismatch
- DbInitializer.cs SeedPurchaseEvaluationPermissionDefaultsAsync +WfView leaf cho 7 role Read
- ApprovalWorkflowV2AdminFeatures.cs GetAwAdminOverviewQuery +IsUserSelectable bool? = null
  + handler conditional Where(d => d.IsUserSelectable == ius)
- ApprovalWorkflowsV2Controller.cs Overview signature +[FromQuery] bool? isUserSelectable
  pass-through to mediator (gotcha #44 fix preserved class-level [Authorize] bare)

FE Layout changes (mirror 2 app rule §3.9):
- fe-user resolvePath regex (List|Create|Pending|WfView) + route
  /purchase-evaluations/workflow-matrix?type=N
- fe-user + fe-admin sidebar w-60 xl:w-72 -> w-72 xl:w-80 (+48/+32px gain)
- Revert Plan U S23 t11 truncate × 5 sites (3 fe-user MenuGroup+MenuLeaf+StaticLeaf
  + 2 fe-admin MenuGroup+MenuLeaf). Keep min-w-0 flex-1 + shrink-0 + title
  tooltip (no harm). Bro request hiển thị đầy đủ label custom Mig 27 dài.

Why:
- User UAT request 2026-05-15: thêm menu "Luồng duyệt" trên Danh sách hiển thị
  ma trận phân quyền workflow V2 admin Designer ghim ra cho user xem trước khi
  tạo phiếu. Filter IsUserSelectable=true (Mig 25).
- Sidebar Plan U S23 t11 truncate hiển thị "..." → bro muốn full label.
  Widen sidebar +32-48px + bỏ truncate cho phép wrap natural khi cực dài.

Verify:
- dotnet build SolutionErp.slnx PASS clean 0 err 2 warn pre-existing DocxRenderer
- Investigator Pre-A confirm gotcha #44 đã fix permanent từ 2026-05-08
- Reviewer cumulative PASS 0 critical / 0 major / 0 minor blocker

Pending Chunk B: FE WorkflowMatrixViewPage.tsx ~215 LOC + types + App.tsx route.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
pqhuy1987
2026-05-15 16:34:40 +07:00
parent a1a910f576
commit ee776d5745
6 changed files with 73 additions and 24 deletions

View File

@ -75,11 +75,15 @@ function resolvePath(key: string): string | null {
}
// Pe_<Code>_<Action> cho module Duyệt NCC (user side)
const peMatch = key.match(/^Pe_([^_]+)_(List|Create|Pending)$/)
const peMatch = key.match(/^Pe_([^_]+)_(List|Create|Pending|WfView)$/)
if (peMatch) {
const [, code, action] = peMatch
const typeInt = PE_CODE_TO_INT[code]
if (!typeInt) return null
// [Plan AA S24 t1] "Luồng duyệt" leaf — read-only matrix view phía trên
// Danh sách. User xem trước khi tạo phiếu ai duyệt step nào (filter
// workflow IsUserSelectable=true admin ghim).
if (action === 'WfView') return `/purchase-evaluations/workflow-matrix?type=${typeInt}`
if (action === 'List') return `/purchase-evaluations?type=${typeInt}`
// "Thao tác" leaf → workspace 2-panel (Q4 2026-05-07): pick + create + sửa
// tables inline. Header-only `/new` page giữ tồn tại cho deep-link cũ
@ -180,12 +184,14 @@ function MenuGroup({ node, depth }: { node: MenuNode; depth: number }) {
isAccordion && open && 'bg-slate-50 text-slate-900',
)}
>
{/* Plan U S23 t11 — truncate label dài + tooltip hover (admin Mig 27
th đặt DisplayLabel dài). min-w-0 cần thiết để truncate hoạt
động trong flex child. shrink-0 giữ icon + chevron không co. */}
{/* [Plan AA S24 t1] Revert truncate Plan U S23 t11 — bro request hiển
th đầy đủ label custom. Sidebar widen w-72 xl:w-80 fit ~44 chars
1 dòng. Label cực dài fallback wrap multi-line natural CSS.
min-w-0 flex-1 + shrink-0 icon/chevron giữ responsive smooth. title
tooltip giữ (no harm — accessibility bonus). */}
<span className="flex min-w-0 flex-1 items-center gap-2">
<Icon className="h-4 w-4 shrink-0" />
<span className="truncate" title={effectiveLabel(node)}>{effectiveLabel(node)}</span>
<span title={effectiveLabel(node)}>{effectiveLabel(node)}</span>
</span>
<ChevronDown className={cn('h-3.5 w-3.5 shrink-0 text-slate-400 transition', !open && '-rotate-90')} />
</button>
@ -248,7 +254,9 @@ function MenuLeaf({ node, depth }: { node: MenuNode; depth: number }) {
)}
>
<Icon className={cn('shrink-0', isDeep ? 'h-3.5 w-3.5' : 'h-4 w-4')} />
<span className="truncate">{effectiveLabel(node)}</span>
{/* [Plan AA S24 t1] Revert truncate Plan U S23 t11 — fit full label hoặc
wrap natural. NavLink `title` (line 241) giữ tooltip accessibility. */}
<span>{effectiveLabel(node)}</span>
</NavLink>
)
}
@ -281,7 +289,10 @@ function StaticLeaf({ node }: { node: MenuNode }) {
}
>
<Icon className="h-4 w-4 shrink-0" />
<span className="truncate">{effectiveLabel(node)}</span>
{/* [Plan AA S24 t1] Revert truncate Plan U S23 t11 — StaticLeaf "Hộp thư"
label ngắn (7 chars) không bao giờ overflow, drop truncate cho
consistent với MenuLeaf + MenuGroup. */}
<span>{effectiveLabel(node)}</span>
</NavLink>
)
}
@ -322,7 +333,7 @@ export function Layout() {
return (
<AccordionContext.Provider value={accordionValue}>
<div className="flex h-screen">
<aside className="flex w-60 flex-col border-r border-slate-200 bg-white xl:w-72">
<aside className="flex w-72 flex-col border-r border-slate-200 bg-white xl:w-80">
<div className="flex h-16 items-center border-b border-slate-200 px-5">
<Link to="/dashboard" className="flex items-center gap-2.5">
<img src="/logo.png" alt="Solutions" className="h-8 w-auto" />