[CLAUDE] PE-Lịch sử: chỉ hiện events Trả lại + Gửi duyệt lại
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 3m11s
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 3m11s
User UAT 2026-05-08: bỏ "trạng thái duyệt" (Cấp 1 → 2 → DaDuyet) + bỏ thay đổi trước Trả lại lần đầu. Chỉ giữ: - Workflow transition về TraLai (Reject) - Workflow transition từ TraLai → ChoDuyet (Drafter gửi lại) - Mọi sửa nội dung khi phaseAtChange = TraLai (giai đoạn chờ gửi lại) Filter ở FE (PeDetailTabs HistoryTab). BE giữ audit data đầy đủ — chỉ thay logic display, reversible. Mirror fe-admin + fe-user. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@ -1520,10 +1520,27 @@ function HistoryTab({ ev }: { ev: PeDetailBundle }) {
|
|||||||
queryFn: async () => (await api.get<PeChangelog[]>(`/purchase-evaluations/${ev.id}/changelogs`)).data,
|
queryFn: async () => (await api.get<PeChangelog[]>(`/purchase-evaluations/${ev.id}/changelogs`)).data,
|
||||||
})
|
})
|
||||||
if (logs.isLoading) return <p className="text-sm text-slate-500">Đang tải…</p>
|
if (logs.isLoading) return <p className="text-sm text-slate-500">Đang tải…</p>
|
||||||
if (!logs.data || logs.data.length === 0) return <p className="text-sm text-slate-500">Chưa có lịch sử.</p>
|
// User UAT 2026-05-08: chỉ track events liên quan Trả lại + Gửi duyệt lại.
|
||||||
|
// Bỏ trạng thái duyệt (Cấp 1 → Cấp 2 → DaDuyet) + bỏ thay đổi trước Trả lại.
|
||||||
|
// Filter giữ:
|
||||||
|
// - Workflow transition về TraLai (phaseAtChange = TraLai = 98)
|
||||||
|
// - Workflow transition từ TraLai → khác (Drafter gửi lại — summary chứa "TraLai →")
|
||||||
|
// - Mọi thay đổi nội dung khi phaseAtChange = TraLai (sửa trong giai đoạn chờ gửi lại)
|
||||||
|
// BE giữ data đầy đủ (audit trail) — chỉ filter ở UI, reversible.
|
||||||
|
const PE_PHASE_TRALAI = 98
|
||||||
|
const PE_ENTITY_WORKFLOW = 5
|
||||||
|
const filtered = (logs.data ?? []).filter(l => {
|
||||||
|
if (l.entityType === PE_ENTITY_WORKFLOW) {
|
||||||
|
if (l.phaseAtChange === PE_PHASE_TRALAI) return true
|
||||||
|
if (l.summary?.includes('TraLai →')) return true
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return l.phaseAtChange === PE_PHASE_TRALAI
|
||||||
|
})
|
||||||
|
if (filtered.length === 0) return <p className="text-sm text-slate-500">Chưa có lịch sử trả lại / gửi duyệt lại.</p>
|
||||||
return (
|
return (
|
||||||
<ol className="space-y-1.5 text-sm">
|
<ol className="space-y-1.5 text-sm">
|
||||||
{logs.data.map(l => (
|
{filtered.map(l => (
|
||||||
<li key={l.id} className="border-l-2 border-slate-200 pl-3 py-1">
|
<li key={l.id} className="border-l-2 border-slate-200 pl-3 py-1">
|
||||||
<div className="flex items-center justify-between text-xs text-slate-500">
|
<div className="flex items-center justify-between text-xs text-slate-500">
|
||||||
<span>{l.userName ?? 'Hệ thống'}</span>
|
<span>{l.userName ?? 'Hệ thống'}</span>
|
||||||
|
|||||||
@ -1520,10 +1520,27 @@ function HistoryTab({ ev }: { ev: PeDetailBundle }) {
|
|||||||
queryFn: async () => (await api.get<PeChangelog[]>(`/purchase-evaluations/${ev.id}/changelogs`)).data,
|
queryFn: async () => (await api.get<PeChangelog[]>(`/purchase-evaluations/${ev.id}/changelogs`)).data,
|
||||||
})
|
})
|
||||||
if (logs.isLoading) return <p className="text-sm text-slate-500">Đang tải…</p>
|
if (logs.isLoading) return <p className="text-sm text-slate-500">Đang tải…</p>
|
||||||
if (!logs.data || logs.data.length === 0) return <p className="text-sm text-slate-500">Chưa có lịch sử.</p>
|
// User UAT 2026-05-08: chỉ track events liên quan Trả lại + Gửi duyệt lại.
|
||||||
|
// Bỏ trạng thái duyệt (Cấp 1 → Cấp 2 → DaDuyet) + bỏ thay đổi trước Trả lại.
|
||||||
|
// Filter giữ:
|
||||||
|
// - Workflow transition về TraLai (phaseAtChange = TraLai = 98)
|
||||||
|
// - Workflow transition từ TraLai → khác (Drafter gửi lại — summary chứa "TraLai →")
|
||||||
|
// - Mọi thay đổi nội dung khi phaseAtChange = TraLai (sửa trong giai đoạn chờ gửi lại)
|
||||||
|
// BE giữ data đầy đủ (audit trail) — chỉ filter ở UI, reversible.
|
||||||
|
const PE_PHASE_TRALAI = 98
|
||||||
|
const PE_ENTITY_WORKFLOW = 5
|
||||||
|
const filtered = (logs.data ?? []).filter(l => {
|
||||||
|
if (l.entityType === PE_ENTITY_WORKFLOW) {
|
||||||
|
if (l.phaseAtChange === PE_PHASE_TRALAI) return true
|
||||||
|
if (l.summary?.includes('TraLai →')) return true
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return l.phaseAtChange === PE_PHASE_TRALAI
|
||||||
|
})
|
||||||
|
if (filtered.length === 0) return <p className="text-sm text-slate-500">Chưa có lịch sử trả lại / gửi duyệt lại.</p>
|
||||||
return (
|
return (
|
||||||
<ol className="space-y-1.5 text-sm">
|
<ol className="space-y-1.5 text-sm">
|
||||||
{logs.data.map(l => (
|
{filtered.map(l => (
|
||||||
<li key={l.id} className="border-l-2 border-slate-200 pl-3 py-1">
|
<li key={l.id} className="border-l-2 border-slate-200 pl-3 py-1">
|
||||||
<div className="flex items-center justify-between text-xs text-slate-500">
|
<div className="flex items-center justify-between text-xs text-slate-500">
|
||||||
<span>{l.userName ?? 'Hệ thống'}</span>
|
<span>{l.userName ?? 'Hệ thống'}</span>
|
||||||
|
|||||||
Reference in New Issue
Block a user