diff --git a/fe-admin/src/pages/pe/PurchaseEvaluationsListPage.tsx b/fe-admin/src/pages/pe/PurchaseEvaluationsListPage.tsx index 39167b0..694ddd2 100644 --- a/fe-admin/src/pages/pe/PurchaseEvaluationsListPage.tsx +++ b/fe-admin/src/pages/pe/PurchaseEvaluationsListPage.tsx @@ -169,6 +169,7 @@ export function PurchaseEvaluationsListPage() { type ProjectGroup = { projectId: string | null projectName: string + projectCode: string workItems: WorkItemGroup[] totalCount: number } @@ -192,7 +193,7 @@ export function PurchaseEvaluationsListPage() { const projName = p.projectName?.trim() || '(Dự án đã xoá)' let pg = yg.projects.find(g => (g.projectId ?? '__no_project__') === projKey) if (!pg) { - pg = { projectId: p.projectId ?? null, projectName: projName, workItems: [], totalCount: 0 } + pg = { projectId: p.projectId ?? null, projectName: projName, projectCode: p.projectCode || '', workItems: [], totalCount: 0 } yg.projects.push(pg) } const wiKey = p.workItemId ?? '__no_workitem__' @@ -209,7 +210,7 @@ export function PurchaseEvaluationsListPage() { const arr = Array.from(yearMap.values()) arr.sort((a, b) => b.year - a.year) for (const yg of arr) { - yg.projects.sort((a, b) => a.projectName.localeCompare(b.projectName, 'vi')) + yg.projects.sort((a, b) => (a.projectCode || a.projectName).localeCompare(b.projectCode || b.projectName, 'vi')) for (const pg of yg.projects) { // S59 — numeric:true vì tên PMH bắt đầu bằng STT không pad ("2 Mat…" < "10 Mat…") pg.workItems.sort((a, b) => a.workItemName.localeCompare(b.workItemName, 'vi', { numeric: true })) @@ -449,7 +450,7 @@ export function PurchaseEvaluationsListPage() { 📁 - {pg.projectName} + {pg.projectCode || pg.projectName} {pg.totalCount}
diff --git a/fe-admin/src/types/purchaseEvaluation.ts b/fe-admin/src/types/purchaseEvaluation.ts index c1fa9dc..66ffd70 100644 --- a/fe-admin/src/types/purchaseEvaluation.ts +++ b/fe-admin/src/types/purchaseEvaluation.ts @@ -113,6 +113,7 @@ export type PeListItem = { phase: number projectId: string projectName: string + projectCode: string // S57bis — Hạng mục công việc (nullable cho phiếu cũ). BE list DTO trả workItemName. workItemId: string | null workItemName: string | null diff --git a/fe-user/src/pages/pe/PurchaseEvaluationsListPage.tsx b/fe-user/src/pages/pe/PurchaseEvaluationsListPage.tsx index 39167b0..694ddd2 100644 --- a/fe-user/src/pages/pe/PurchaseEvaluationsListPage.tsx +++ b/fe-user/src/pages/pe/PurchaseEvaluationsListPage.tsx @@ -169,6 +169,7 @@ export function PurchaseEvaluationsListPage() { type ProjectGroup = { projectId: string | null projectName: string + projectCode: string workItems: WorkItemGroup[] totalCount: number } @@ -192,7 +193,7 @@ export function PurchaseEvaluationsListPage() { const projName = p.projectName?.trim() || '(Dự án đã xoá)' let pg = yg.projects.find(g => (g.projectId ?? '__no_project__') === projKey) if (!pg) { - pg = { projectId: p.projectId ?? null, projectName: projName, workItems: [], totalCount: 0 } + pg = { projectId: p.projectId ?? null, projectName: projName, projectCode: p.projectCode || '', workItems: [], totalCount: 0 } yg.projects.push(pg) } const wiKey = p.workItemId ?? '__no_workitem__' @@ -209,7 +210,7 @@ export function PurchaseEvaluationsListPage() { const arr = Array.from(yearMap.values()) arr.sort((a, b) => b.year - a.year) for (const yg of arr) { - yg.projects.sort((a, b) => a.projectName.localeCompare(b.projectName, 'vi')) + yg.projects.sort((a, b) => (a.projectCode || a.projectName).localeCompare(b.projectCode || b.projectName, 'vi')) for (const pg of yg.projects) { // S59 — numeric:true vì tên PMH bắt đầu bằng STT không pad ("2 Mat…" < "10 Mat…") pg.workItems.sort((a, b) => a.workItemName.localeCompare(b.workItemName, 'vi', { numeric: true })) @@ -449,7 +450,7 @@ export function PurchaseEvaluationsListPage() { 📁 - {pg.projectName} + {pg.projectCode || pg.projectName} {pg.totalCount}
diff --git a/fe-user/src/types/purchaseEvaluation.ts b/fe-user/src/types/purchaseEvaluation.ts index bca5b48..7de399e 100644 --- a/fe-user/src/types/purchaseEvaluation.ts +++ b/fe-user/src/types/purchaseEvaluation.ts @@ -117,6 +117,7 @@ export type PeListItem = { phase: number projectId: string projectName: string + projectCode: string // S57bis — Hạng mục công việc (nullable cho phiếu cũ). BE list DTO trả workItemName. workItemId: string | null workItemName: string | null diff --git a/src/Backend/SolutionErp.Application/PurchaseEvaluations/CreateContractFromEvaluationFeatures.cs b/src/Backend/SolutionErp.Application/PurchaseEvaluations/CreateContractFromEvaluationFeatures.cs index f84bc4d..0a6671d 100644 --- a/src/Backend/SolutionErp.Application/PurchaseEvaluations/CreateContractFromEvaluationFeatures.cs +++ b/src/Backend/SolutionErp.Application/PurchaseEvaluations/CreateContractFromEvaluationFeatures.cs @@ -177,7 +177,7 @@ public class ListApprovedPurchaseEvaluationsQueryHandler(IApplicationDbContext d orderby e.CreatedAt descending select new PurchaseEvaluationListItemDto( e.Id, e.MaPhieu, e.TenGoiThau, e.Type, e.Phase, - e.ProjectId, p.Name, + e.ProjectId, p.Name, p.Code, e.WorkItemId, wi != null ? wi.Name : null, wi != null ? wi.Code : null, e.SelectedSupplierId, s != null ? s.Name : null, e.ContractId, e.SlaDeadline, e.CreatedAt, e.UpdatedAt, diff --git a/src/Backend/SolutionErp.Application/PurchaseEvaluations/Dtos/PurchaseEvaluationDtos.cs b/src/Backend/SolutionErp.Application/PurchaseEvaluations/Dtos/PurchaseEvaluationDtos.cs index 5007d10..2457705 100644 --- a/src/Backend/SolutionErp.Application/PurchaseEvaluations/Dtos/PurchaseEvaluationDtos.cs +++ b/src/Backend/SolutionErp.Application/PurchaseEvaluations/Dtos/PurchaseEvaluationDtos.cs @@ -11,6 +11,8 @@ public record PurchaseEvaluationListItemDto( PurchaseEvaluationPhase Phase, Guid ProjectId, string ProjectName, + // [S93 anh Kiệt FDC] Mã dự án — tree node 📁 Dự án hiện CODE (ngắn) thay tên dài. + string ProjectCode, // [Mig 49 S57bis] Hạng mục công việc — loose-Guid resolve LEFT join WorkItems // (mirror ProjectName). Nullable cho 4 phiếu cũ chưa gắn hạng mục. Guid? WorkItemId, diff --git a/src/Backend/SolutionErp.Application/PurchaseEvaluations/PurchaseEvaluationFeatures.cs b/src/Backend/SolutionErp.Application/PurchaseEvaluations/PurchaseEvaluationFeatures.cs index 87a909f..2ef7b77 100644 --- a/src/Backend/SolutionErp.Application/PurchaseEvaluations/PurchaseEvaluationFeatures.cs +++ b/src/Backend/SolutionErp.Application/PurchaseEvaluations/PurchaseEvaluationFeatures.cs @@ -604,7 +604,8 @@ public class ListPurchaseEvaluationsQueryHandler( q = q.Where(x => (x.e.MaPhieu != null && x.e.MaPhieu.Contains(s)) || x.e.TenGoiThau.Contains(s) || - x.p.Name.Contains(s)); + x.p.Name.Contains(s) || + x.p.Code.Contains(s)); } // S23 t2 UAT: sort theo "phiếu vừa update" — UpdatedAt fallback CreatedAt @@ -620,7 +621,7 @@ public class ListPurchaseEvaluationsQueryHandler( .Skip((request.Page - 1) * request.PageSize).Take(request.PageSize) .Select(x => new PurchaseEvaluationListItemDto( x.e.Id, x.e.MaPhieu, x.e.TenGoiThau, x.e.Type, x.e.Phase, - x.e.ProjectId, x.p.Name, + x.e.ProjectId, x.p.Name, x.p.Code, x.e.WorkItemId, x.wi != null ? x.wi.Name : null, x.wi != null ? x.wi.Code : null, x.e.SelectedSupplierId, x.s != null ? x.s.Name : null, x.e.ContractId, x.e.SlaDeadline, x.e.CreatedAt, x.e.UpdatedAt, @@ -737,7 +738,7 @@ public class GetMyPurchaseEvaluationInboxQueryHandler( .OrderByDescending(x => x.e.UpdatedAt ?? x.e.CreatedAt) .Select(x => new PurchaseEvaluationListItemDto( x.e.Id, x.e.MaPhieu, x.e.TenGoiThau, x.e.Type, x.e.Phase, - x.e.ProjectId, x.p.Name, + x.e.ProjectId, x.p.Name, x.p.Code, x.e.WorkItemId, x.wi != null ? x.wi.Name : null, x.wi != null ? x.wi.Code : null, x.e.SelectedSupplierId, x.s != null ? x.s.Name : null, x.e.ContractId, x.e.SlaDeadline, x.e.CreatedAt, x.e.UpdatedAt,