From 25b916d040a512cd5248dff319d727ae144d0652 Mon Sep 17 00:00:00 2001 From: dujinkim Date: Mon, 15 Sep 2025 03:24:12 +0000 Subject: (최겸) 구매 PCR 개발(po -> pcr, ecc pcr-confirm test 필) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pcr/table/detail-table/pcr-detail-column.tsx | 333 +++++++++++++++++++++++ 1 file changed, 333 insertions(+) create mode 100644 lib/pcr/table/detail-table/pcr-detail-column.tsx (limited to 'lib/pcr/table/detail-table/pcr-detail-column.tsx') diff --git a/lib/pcr/table/detail-table/pcr-detail-column.tsx b/lib/pcr/table/detail-table/pcr-detail-column.tsx new file mode 100644 index 00000000..664f37ef --- /dev/null +++ b/lib/pcr/table/detail-table/pcr-detail-column.tsx @@ -0,0 +1,333 @@ +import { ColumnDef } from "@tanstack/react-table" +import { Badge } from "@/components/ui/badge" +import { Button } from "@/components/ui/button" +import { DataTableColumnHeaderSimple } from "@/components/data-table/data-table-column-simple-header" +import { PcrPrData } from "@/lib/pcr/types" +import { FileIcon, Download } from "lucide-react" +import { downloadFile } from "@/lib/file-download" + +export function getPcrDetailColumns(): ColumnDef[] { + return [ + { + accessorKey: "materialNumber", + header: ({ column }) => ( + + ), + cell: ({ row }) => { + const value = row.getValue("materialNumber") as string + return ( +
+ {value || "-"} +
+ ) + }, + }, + { + accessorKey: "materialDetails", + header: ({ column }) => ( + + ), + cell: ({ row }) => { + const value = row.getValue("materialDetails") as string + return ( +
+ {value || "-"} +
+ ) + }, + }, + { + accessorKey: "quantityBefore", + header: ({ column }) => ( + + ), + cell: ({ row }) => { + const value = row.getValue("quantityBefore") as number + return ( +
+ {value ? value.toLocaleString() : "-"} +
+ ) + }, + }, + { + accessorKey: "quantityAfter", + header: ({ column }) => ( + + ), + cell: ({ row }) => { + const value = row.getValue("quantityAfter") as number + return ( +
+ {value ? value.toLocaleString() : "-"} +
+ ) + }, + }, + { + accessorKey: "weightBefore", + header: ({ column }) => ( + + ), + cell: ({ row }) => { + const value = row.getValue("weightBefore") as number + return ( +
+ {value ? `${value.toLocaleString()} kg` : "-"} +
+ ) + }, + }, + { + accessorKey: "weightAfter", + header: ({ column }) => ( + + ), + cell: ({ row }) => { + const value = row.getValue("weightAfter") as number + return ( +
+ {value ? `${value.toLocaleString()} kg` : "-"} +
+ ) + }, + }, + { + accessorKey: "subcontractorWeightBefore", + header: ({ column }) => ( + + ), + cell: ({ row }) => { + const value = row.getValue("subcontractorWeightBefore") as number + return ( +
+ {value ? `${value.toLocaleString()} kg` : "-"} +
+ ) + }, + }, + { + accessorKey: "subcontractorWeightAfter", + header: ({ column }) => ( + + ), + cell: ({ row }) => { + const value = row.getValue("subcontractorWeightAfter") as number + return ( +
+ {value ? `${value.toLocaleString()} kg` : "-"} +
+ ) + }, + }, + { + accessorKey: "supplierWeightBefore", + header: ({ column }) => ( + + ), + cell: ({ row }) => { + const value = row.getValue("supplierWeightBefore") as number + return ( +
+ {value ? `${value.toLocaleString()} kg` : "-"} +
+ ) + }, + }, + { + accessorKey: "supplierWeightAfter", + header: ({ column }) => ( + + ), + cell: ({ row }) => { + const value = row.getValue("supplierWeightAfter") as number + return ( +
+ {value ? `${value.toLocaleString()} kg` : "-"} +
+ ) + }, + }, + { + id: "attachments", + header: ({ column }) => ( + + ), + cell: ({ row }) => { + const attachments = row.original.attachments || [] + const beforeAttachment = attachments.find(att => att.type === 'BEFORE') + const afterAttachment = attachments.find(att => att.type === 'AFTER') + + if (!beforeAttachment && !afterAttachment) { + return ( +
+ +
+ ) + } + + return ( +
+ {/* 변경전 첨부파일 */} + {beforeAttachment && ( + + )} + + {/* 변경후 첨부파일 */} + {afterAttachment && ( + + )} +
+ ) + }, + }, + { + accessorKey: "initialPoContractDate", + header: ({ column }) => ( + + ), + cell: ({ row }) => { + const value = row.getValue("initialPoContractDate") as Date + if (!value) return "-" + + return ( +
+ {value.toLocaleDateString('ko-KR', { + year: 'numeric', + month: '2-digit', + day: '2-digit' + })} +
+ ) + }, + }, + { + accessorKey: "specChangeDate", + header: ({ column }) => ( + + ), + cell: ({ row }) => { + const value = row.getValue("specChangeDate") as Date + if (!value) return "-" + + return ( +
+ {value.toLocaleDateString('ko-KR', { + year: 'numeric', + month: '2-digit', + day: '2-digit' + })} +
+ ) + }, + }, + { + accessorKey: "poContractModifiedDate", + header: ({ column }) => ( + + ), + cell: ({ row }) => { + const value = row.getValue("poContractModifiedDate") as Date + if (!value) return "-" + + return ( +
+ {value.toLocaleDateString('ko-KR', { + year: 'numeric', + month: '2-digit', + day: '2-digit' + })} +
+ ) + }, + }, + { + accessorKey: "confirmationDate", + header: ({ column }) => ( + + ), + cell: ({ row }) => { + const value = row.getValue("confirmationDate") as Date + if (!value) return "-" + + return ( +
+ {value.toLocaleDateString('ko-KR', { + year: 'numeric', + month: '2-digit', + day: '2-digit' + })} +
+ ) + }, + }, + { + accessorKey: "designManager", + header: ({ column }) => ( + + ), + cell: ({ row }) => { + const value = row.getValue("designManager") as string + return ( +
+ {value || "-"} +
+ ) + }, + }, + { + accessorKey: "poContractNumber", + header: ({ column }) => ( + + ), + cell: ({ row }) => { + const value = row.getValue("poContractNumber") as string + return ( +
+ {value || "-"} +
+ ) + }, + }, + { + accessorKey: "createdAt", + header: ({ column }) => ( + + ), + cell: ({ row }) => { + const value = row.getValue("createdAt") as Date + if (!value) return "-" + + return ( +
+ {value.toLocaleDateString('ko-KR', { + year: 'numeric', + month: '2-digit', + day: '2-digit' + })} +
+ ) + }, + }, + ] +} -- cgit v1.2.3