From b9f575f6110faabc7b062f84bf491d69d88a10a5 Mon Sep 17 00:00:00 2001 From: joonhoekim <26rote@gmail.com> Date: Mon, 17 Nov 2025 15:42:29 +0900 Subject: (김준회) swp: GetExternalInboxList를 메인 테이블로 변경 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/swp/table/swp-inbox-table-columns.tsx | 129 ++++++++++++++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 lib/swp/table/swp-inbox-table-columns.tsx (limited to 'lib/swp/table/swp-inbox-table-columns.tsx') diff --git a/lib/swp/table/swp-inbox-table-columns.tsx b/lib/swp/table/swp-inbox-table-columns.tsx new file mode 100644 index 00000000..bd740ca4 --- /dev/null +++ b/lib/swp/table/swp-inbox-table-columns.tsx @@ -0,0 +1,129 @@ +"use client"; + +import React from "react"; +import { ColumnDef } from "@tanstack/react-table"; +import { Badge } from "@/components/ui/badge"; +import type { SwpFileApiResponse } from "@/lib/swp/api-client"; + +export const swpInboxDocumentColumns: ColumnDef[] = [ + { + accessorKey: "STAT_NM", + header: "최신 리비전의 최신 파일 상태", + cell: ({ row }) => { + const statNm = row.original.STAT_NM; + const stat = row.original.STAT; + const displayStatus = statNm || stat || "-"; + + if (!stat) return displayStatus; + + // STAT 코드 기반 색상 결정 + const color = + stat === "SCW03" || stat === "SCW08" ? "bg-green-100 text-green-800" : // Complete, Checked + stat === "SCW02" ? "bg-blue-100 text-blue-800" : // Processing + stat === "SCW01" ? "bg-yellow-100 text-yellow-800" : // Standby + stat === "SCW04" || stat === "SCW05" || stat === "SCW06" ? "bg-red-100 text-red-800" : // Reject, Error Zip, Error Meta + stat === "SCW07" ? "bg-purple-100 text-purple-800" : // Send for Eng Verification + stat === "SCW09" ? "bg-gray-100 text-gray-800" : // Cancelled + stat === "SCW00" ? "bg-orange-100 text-orange-800" : // Upload + "bg-gray-100 text-gray-800"; // 기타 + + return ( + + {displayStatus} + + ); + }, + size: 120, + }, + { + accessorKey: "OWN_DOC_NO", + header: "OWN_DOC_NO", + cell: ({ row }) => ( +
{row.original.OWN_DOC_NO || "-"}
+ ), + size: 250, + }, + { + accessorKey: "FILE_NM", + header: "파일명", + cell: ({ row }) => ( +
+ {row.original.FILE_NM} +
+ ), + size: 300, + }, + { + accessorKey: "STAGE", + header: "스테이지", + cell: ({ row }) => { + const stage = row.original.STAGE; + if (!stage) return "-"; + + const color = + stage === "IFC" ? "bg-green-100 text-green-800" : + stage === "IFA" ? "bg-blue-100 text-blue-800" : + "bg-gray-100 text-gray-800"; + + return ( + + {stage} + + ); + }, + size: 80, + }, + { + accessorKey: "REV_NO", + header: "REV", + cell: ({ row }) => row.original.REV_NO || "-", + size: 80, + }, + { + accessorKey: "ACTV_NO", + header: "Activity", + cell: ({ row }) => { + const actvNo = row.original.ACTV_NO; + if (!actvNo) return -; + return
{actvNo}
; + }, + size: 120, + }, + { + accessorKey: "FILE_SZ", + header: "파일 크기", + cell: ({ row }) => { + const size = row.original.FILE_SZ; + if (!size) return "-"; + const bytes = parseInt(size); + if (isNaN(bytes)) return size; + + if (bytes < 1024) return `${bytes} B`; + if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`; + if (bytes < 1024 * 1024 * 1024) return `${(bytes / (1024 * 1024)).toFixed(1)} MB`; + return `${(bytes / (1024 * 1024 * 1024)).toFixed(1)} GB`; + }, + size: 100, + }, + { + accessorKey: "CRTE_DTM", + header: "생성일시", + cell: ({ row }) => { + const date = row.original.CRTE_DTM; + if (!date) return "-"; + try { + return new Date(date).toLocaleString("ko-KR", { + year: "numeric", + month: "2-digit", + day: "2-digit", + hour: "2-digit", + minute: "2-digit", + }); + } catch { + return date; + } + }, + size: 150, + }, +]; + -- cgit v1.2.3