[CLAUDE] PurchaseEvaluation FE-Admin FE-User: Chunk L5 — PE list UX: ngày tạo thay SLA countdown + sort UpdatedAt DESC
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 3m10s
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 3m10s
Bro UAT S23 t2 yêu cầu 2 UX changes PE list:
1. Đổi "Còn N ngày Mh" (SlaTimer countdown) → "DD/MM/YYYY HH:mm" (ngày giờ tạo phiếu).
2. Sort: phiếu vừa update (Tạo / Gửi duyệt / Trả lại) đưa lên đầu, phiếu cũ phía dưới.
BE changes:
- PurchaseEvaluationListItemDto +UpdatedAt: DateTime? field (auto AuditingInterceptor refresh
mọi SaveChanges — covers Insert/Update/Transition events natural).
- ListPurchaseEvaluationsQueryHandler sort: OrderByDescending(UpdatedAt ?? CreatedAt)
(was: OrderByDescending(CreatedAt)).
- GetMyPurchaseEvaluationInboxQueryHandler sort: OrderByDescending(UpdatedAt ?? CreatedAt)
(was: OrderBy(SlaDeadline ?? MaxValue) — SLA priority deprecated).
- CreateContractFromEvaluationFeatures.cs: +UpdatedAt arg trong DTO ctor (compile fix
consumer downstream).
- Select projection 3 callsites populate UpdatedAt.
FE × 2 app (mirror rule §3.9):
- PeListItem type +updatedAt: string | null (optional — null khi phiếu chưa Update).
- PurchaseEvaluationsListPage: replace <SlaTimer deadline={p.slaDeadline} ... /> với
Vietnamese date format "{DD/MM/YYYY HH:mm}" qua Intl.DateTimeFormat (vi-VN locale,
full date+time options). title tooltip hiện full timestamp.
- Remove SlaTimer import (unused warning).
UpdatedAt sort logic insight: AuditingInterceptor (Infrastructure) auto-refresh
UpdatedAt mọi SaveChanges → mọi event tự nhiên (Drafter tạo / Gửi duyệt từ Workspace
/ Approver duyệt Cấp tiếp / Approver trả lại / Admin override) đều bump UpdatedAt
→ phiếu vừa action lên đầu list. Phiếu mới Insert UpdatedAt=null → fallback CreatedAt
→ vẫn lên đầu (vì CreatedAt vừa now).
Verify:
- dotnet build production projects clean (0 err, 2 pre-existing warn)
- dotnet test SolutionErp.slnx 104/104 PASS (DTO change KHÔNG impact test — tests
don't construct ListItemDto)
- npm run build × 2 app pass clean
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@ -140,6 +140,6 @@ public class ListApprovedPurchaseEvaluationsQueryHandler(IApplicationDbContext d
|
||||
e.Id, e.MaPhieu, e.TenGoiThau, e.Type, e.Phase,
|
||||
e.ProjectId, p.Name,
|
||||
e.SelectedSupplierId, s != null ? s.Name : null,
|
||||
e.ContractId, e.SlaDeadline, e.CreatedAt)).ToListAsync(ct);
|
||||
e.ContractId, e.SlaDeadline, e.CreatedAt, e.UpdatedAt)).ToListAsync(ct);
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,7 +16,11 @@ public record PurchaseEvaluationListItemDto(
|
||||
string? SelectedSupplierName,
|
||||
Guid? ContractId,
|
||||
DateTime? SlaDeadline,
|
||||
DateTime CreatedAt);
|
||||
DateTime CreatedAt,
|
||||
// S23 t2 UAT: bro UI polish PE list — display "Ngày giờ tạo" thay SLA countdown,
|
||||
// sort theo "phiếu vừa update" (Tạo / Gửi duyệt / Trả lại). UpdatedAt được
|
||||
// AuditingInterceptor auto-set mỗi SaveChanges → covers cả 3 event tự nhiên.
|
||||
DateTime? UpdatedAt);
|
||||
|
||||
public record PurchaseEvaluationSupplierDto(
|
||||
Guid Id,
|
||||
|
||||
@ -504,7 +504,13 @@ public class ListPurchaseEvaluationsQueryHandler(
|
||||
x.p.Name.Contains(s));
|
||||
}
|
||||
|
||||
q = request.SortDesc ? q.OrderByDescending(x => x.e.CreatedAt) : q.OrderBy(x => x.e.CreatedAt);
|
||||
// S23 t2 UAT: sort theo "phiếu vừa update" — UpdatedAt fallback CreatedAt
|
||||
// (phiếu mới Insert UpdatedAt=null → CreatedAt làm proxy). Latest event lên
|
||||
// đầu (Tạo / Gửi duyệt / Trả lại / Approve advance pointer — mọi SaveChanges
|
||||
// AuditingInterceptor refresh UpdatedAt). SortDesc=true default (mới đầu).
|
||||
q = request.SortDesc
|
||||
? q.OrderByDescending(x => x.e.UpdatedAt ?? x.e.CreatedAt)
|
||||
: q.OrderBy(x => x.e.UpdatedAt ?? x.e.CreatedAt);
|
||||
|
||||
var total = await q.CountAsync(ct);
|
||||
var items = await q
|
||||
@ -513,7 +519,7 @@ public class ListPurchaseEvaluationsQueryHandler(
|
||||
x.e.Id, x.e.MaPhieu, x.e.TenGoiThau, x.e.Type, x.e.Phase,
|
||||
x.e.ProjectId, x.p.Name,
|
||||
x.e.SelectedSupplierId, x.s != null ? x.s.Name : null,
|
||||
x.e.ContractId, x.e.SlaDeadline, x.e.CreatedAt))
|
||||
x.e.ContractId, x.e.SlaDeadline, x.e.CreatedAt, x.e.UpdatedAt))
|
||||
.ToListAsync(ct);
|
||||
|
||||
return new PagedResult<PurchaseEvaluationListItemDto>(items, total, request.Page, request.PageSize);
|
||||
@ -584,13 +590,14 @@ public class GetMyPurchaseEvaluationInboxQueryHandler(
|
||||
if (request.ApprovalWorkflowId is not null)
|
||||
q = q.Where(x => x.e.ApprovalWorkflowId == request.ApprovalWorkflowId);
|
||||
|
||||
// S23 t2 UAT: Inbox cũng sort theo "vừa update" lên đầu (mirror List sort).
|
||||
return await q
|
||||
.OrderBy(x => x.e.SlaDeadline ?? DateTime.MaxValue)
|
||||
.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.SelectedSupplierId, x.s != null ? x.s.Name : null,
|
||||
x.e.ContractId, x.e.SlaDeadline, x.e.CreatedAt))
|
||||
x.e.ContractId, x.e.SlaDeadline, x.e.CreatedAt, x.e.UpdatedAt))
|
||||
.Take(100)
|
||||
.ToListAsync(ct);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user