diff --git a/fe-admin/src/pages/pe/PurchaseEvaluationsListPage.tsx b/fe-admin/src/pages/pe/PurchaseEvaluationsListPage.tsx index 76e1bbe..57a9147 100644 --- a/fe-admin/src/pages/pe/PurchaseEvaluationsListPage.tsx +++ b/fe-admin/src/pages/pe/PurchaseEvaluationsListPage.tsx @@ -33,10 +33,25 @@ export function PurchaseEvaluationsListPage() { const pendingMe = sp.get('pendingMe') === '1' const search = sp.get('q') ?? '' const phase = sp.get('phase') ?? '' + const approvalWorkflowId = sp.get('awId') ?? '' // Mig 23 — filter quy trình const selectedId = sp.get('id') + // Mig 23 — list quy trình duyệt V2 cho dropdown filter (filter theo type screen) + const approvalWorkflows = useQuery({ + queryKey: ['approval-workflows-v2-filter', typeFilter], + queryFn: async () => { + if (!typeFilter) return [] + const res = await api.get<{ types: { applicableType: number; history: { id: string; code: string; version: number; name: string; isActive: boolean }[] }[] }>( + '/approval-workflows-v2', + { params: { applicableType: typeFilter } }, + ) + return res.data.types.find(t => t.applicableType === typeFilter)?.history ?? [] + }, + enabled: !!typeFilter, + }) + const list = useQuery({ - queryKey: ['pe-list', { typeFilter, pendingMe, search, phase }], + queryKey: ['pe-list', { typeFilter, pendingMe, search, phase, approvalWorkflowId }], queryFn: async () => { if (pendingMe) { const res = await api.get('/purchase-evaluations/inbox', { @@ -50,6 +65,7 @@ export function PurchaseEvaluationsListPage() { search: search || undefined, type: typeFilter ?? undefined, phase: phase || undefined, + approvalWorkflowId: approvalWorkflowId || undefined, }, }) return res.data @@ -119,6 +135,17 @@ export function PurchaseEvaluationsListPage() { className="pl-8" /> + {/* Mig 23 — 2 dropdown tách: Quy trình duyệt + Trạng thái */} + {!pendingMe && ( + + )} setParam('awId', e.target.value)}> + + {approvalWorkflows.data?.map(w => ( + + ))} + + )}