diff options
Diffstat (limited to 'lib/tbe-last/table/tbe-last-table.tsx')
| -rw-r--r-- | lib/tbe-last/table/tbe-last-table.tsx | 91 |
1 files changed, 72 insertions, 19 deletions
diff --git a/lib/tbe-last/table/tbe-last-table.tsx b/lib/tbe-last/table/tbe-last-table.tsx index c18768cd..fbb334d0 100644 --- a/lib/tbe-last/table/tbe-last-table.tsx +++ b/lib/tbe-last/table/tbe-last-table.tsx @@ -45,6 +45,8 @@ export function TbeLastTable({ promises }: TbeLastTableProps) { const [selectedSession, setSelectedSession] = React.useState<TbeLastView | null>(null) const [sessionDetail, setSessionDetail] = React.useState<any>(null) const [isLoadingDetail, setIsLoadingDetail] = React.useState(false) + // PR Items count overrides per sessionId (sourced from dialog detail) + const [prItemsCountsBySessionId, setPrItemsCountsBySessionId] = React.useState<Record<number, { total: number, major: number }>>({}) // Load session detail when needed const loadSessionDetail = React.useCallback(async (sessionId: number) => { @@ -52,6 +54,14 @@ export function TbeLastTable({ promises }: TbeLastTableProps) { try { const detail = await getTBESessionDetail(sessionId) setSessionDetail(detail) + // Update PR items count override for this session + if (detail?.session?.tbeSessionId) { + const sid = detail.session.tbeSessionId as number + const items = Array.isArray(detail?.prItems) ? detail.prItems : [] + const total = items.length + const major = items.filter((it: any) => it?.majorYn === true).length + setPrItemsCountsBySessionId(prev => ({ ...prev, [sid]: { total, major } })) + } } catch (error) { console.error("Failed to load session detail:", error) } finally { @@ -72,10 +82,10 @@ export function TbeLastTable({ promises }: TbeLastTableProps) { loadSessionDetail(sessionId) }, [loadSessionDetail]) - const handleOpenPrItems = React.useCallback((rfqId: number) => { - setSelectedRfqId(rfqId) + const handleOpenPrItems = React.useCallback((sessionId: number) => { + setSelectedSessionId(sessionId) setPrItemsOpen(true) - loadSessionDetail(rfqId) + loadSessionDetail(sessionId) }, [loadSessionDetail]) const handleOpenEvaluation = React.useCallback((session: TbeLastView) => { @@ -85,9 +95,7 @@ export function TbeLastTable({ promises }: TbeLastTableProps) { }, []) - const handleRefresh = React.useCallback(() => { - router.refresh() - }, [router]) + // Refresh 기능 제거됨 // Table columns const columns = React.useMemo( @@ -97,13 +105,64 @@ export function TbeLastTable({ promises }: TbeLastTableProps) { onOpenDocuments: handleOpenDocuments, onOpenPrItems: handleOpenPrItems, onOpenEvaluation: handleOpenEvaluation, + getPrCountsOverride: (sessionId: number) => prItemsCountsBySessionId[sessionId] }), - [handleOpenSessionDetail, handleOpenDocuments, handleOpenPrItems, handleOpenEvaluation] + [handleOpenSessionDetail, handleOpenDocuments, handleOpenPrItems, handleOpenEvaluation, prItemsCountsBySessionId] ) // Filter fields const filterFields: DataTableAdvancedFilterField<TbeLastView>[] = [ { + id: "sessionCode", + label: "TBE Code", + type: "text", + }, + { + id: "rfqCode", + label: "RFQ Code", + type: "text", + }, + { + id: "rfqTitle", + label: "RFQ Title", + type: "text", + }, + { + id: "rfqDueDate", + label: "Due Date", + type: "date", + }, + { + id: "packageNo", + label: "Package No", + type: "text", + }, + { + id: "projectCode", + label: "Project", + type: "text", + }, + { + id: "vendorCode", + label: "Vendor Code", + type: "text", + }, + { + id: "vendorName", + label: "Vendor Name", + type: "text", + }, + { + id: "picName", + label: "구매담당자", + type: "text", + }, + { + id: "EngPicName", + label: "설계담당자", + type: "text", + }, + { id: "sessionStatus", label: "Status", type: "select", @@ -120,9 +179,10 @@ export function TbeLastTable({ promises }: TbeLastTableProps) { label: "Result", type: "select", options: [ - { label: "Pass", value: "pass" }, - { label: "Conditional Pass", value: "conditional_pass" }, - { label: "Non-Pass", value: "non_pass" }, + { label: "Acceptable", value: "Acceptable" }, + { label: "Conditional", value: "Acceptable with Comment" }, + { label: "Not Acceptable", value: "Not Acceptable" }, + { label: "Pending", value: "" }, ], }, ] @@ -234,15 +294,7 @@ export function TbeLastTable({ promises }: TbeLastTableProps) { 선택된 항목 TBE 요청 ({table.getFilteredSelectedRowModel().rows.length}) </Button> )} - <Button - variant="outline" - size="sm" - onClick={handleRefresh} - className="gap-2" - > - <RefreshCw className="size-4" /> - <span>Refresh</span> - </Button> + {/* Refresh 버튼 제거됨 */} <Button variant="outline" size="sm" @@ -250,6 +302,7 @@ export function TbeLastTable({ promises }: TbeLastTableProps) { exportTableToExcel(table, { filename: "tbe-sessions", excludeColumns: ["select", "actions"], + useGroupHeader: true }) } className="gap-2" |
