diff --git a/fe-admin/src/components/pe/PeDetailTabs.tsx b/fe-admin/src/components/pe/PeDetailTabs.tsx index 1a1c6ec..ec92f04 100644 --- a/fe-admin/src/components/pe/PeDetailTabs.tsx +++ b/fe-admin/src/components/pe/PeDetailTabs.tsx @@ -1,6 +1,7 @@ -// Detail tabs cho 1 phiếu Duyệt NCC: Thông tin / NCC / Hạng mục + Báo giá / -// Duyệt / Lịch sử. Inline action dialog để add NCC, add Detail, upsert Quote, -// select winner. +// Detail content cho 1 phiếu Duyệt NCC. Flat render (no tabs): Thông tin + +// NCC + Hạng mục + Báo giá stack vertically trong 1 màn hình. +// Duyệt history + Lịch sử thay đổi → moved to Panel 3 (xem PeWorkflowPanel +// → PeApprovalsSection + PeHistorySection). import { useState } from 'react' import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query' import { useNavigate } from 'react-router-dom' @@ -27,10 +28,10 @@ import { } from '@/types/purchaseEvaluation' import type { Supplier } from '@/types/master' -type TabKey = 'info' | 'suppliers' | 'items' | 'approvals' | 'history' - const fmtMoney = (v: number) => v.toLocaleString('vi-VN') +// Main detail content — flat render 3 section không tabs. +// Tên giữ PeDetailTabs để không break callsite (rename gây churn). export function PeDetailTabs({ evaluation, onBack, @@ -40,7 +41,6 @@ export function PeDetailTabs({ onBack: () => void onDelete: () => void }) { - const [tab, setTab] = useState('info') const navigate = useNavigate() const isDraft = evaluation.phase === PurchaseEvaluationPhase.DangSoanThao @@ -83,42 +83,50 @@ export function PeDetailTabs({ - - -
- {tab === 'info' && } - {tab === 'suppliers' && } - {tab === 'items' && } - {tab === 'approvals' && } - {tab === 'history' && } +
+
+ +
+
+ +
+
+ +
) } +function Section({ title, children }: { title: string; children: React.ReactNode }) { + return ( +
+

{title}

+ {children} +
+ ) +} + +// ===== Exports cho Panel 3 — Approvals history + Changelog ===== + +export function PeApprovalsSection({ ev }: { ev: PeDetailBundle }) { + return ( +
+

Lịch sử duyệt ({ev.approvals.length})

+ +
+ ) +} + +export function PeHistorySection({ ev }: { ev: PeDetailBundle }) { + return ( +
+

Lịch sử thay đổi

+ +
+ ) +} + // ===== Tab: Thông tin ===== function InfoTab({ ev }: { ev: PeDetailBundle }) { const canCreateContract = ev.phase === PurchaseEvaluationPhase.DaDuyet && !ev.contractId && ev.selectedSupplierId diff --git a/fe-admin/src/components/pe/PeWorkflowPanel.tsx b/fe-admin/src/components/pe/PeWorkflowPanel.tsx index a2208cd..e8cc461 100644 --- a/fe-admin/src/components/pe/PeWorkflowPanel.tsx +++ b/fe-admin/src/components/pe/PeWorkflowPanel.tsx @@ -1,5 +1,7 @@ -// Panel 3: workflow + transition buttons. Pulls nextPhases từ BE bundle -// (single source of truth) → render per-phase action button. +// Panel 3: workflow timeline + transition buttons + approval history + changelog. +// Pulls nextPhases từ BE bundle (single source of truth) → render per-phase +// action button. Approvals + History moved here from PeDetailTabs (2 section +// dưới cùng) để Panel 2 tập trung hiển thị nội dung phiếu (Info + NCC + Items). import { useState } from 'react' import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' @@ -16,6 +18,7 @@ import { PurchaseEvaluationPhaseLabel, type PeDetailBundle, } from '@/types/purchaseEvaluation' +import { PeApprovalsSection, PeHistorySection } from './PeDetailTabs' export function PeWorkflowPanel({ evaluation }: { evaluation: PeDetailBundle }) { const [target, setTarget] = useState(null) @@ -112,6 +115,14 @@ export function PeWorkflowPanel({ evaluation }: { evaluation: PeDetailBundle })