From 1110427907bbe9c11a378da4c1a233b83b5ca3b1 Mon Sep 17 00:00:00 2001 From: joonhoekim <26rote@gmail.com> Date: Tue, 26 Aug 2025 12:09:39 +0000 Subject: (김준회) 구매정의서 구현 - PO (shi & vendor) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/po/vendor-table/shi-vendor-po-columns.tsx | 462 ++++++++++++++++++++++++++ 1 file changed, 462 insertions(+) create mode 100644 lib/po/vendor-table/shi-vendor-po-columns.tsx (limited to 'lib/po/vendor-table/shi-vendor-po-columns.tsx') diff --git a/lib/po/vendor-table/shi-vendor-po-columns.tsx b/lib/po/vendor-table/shi-vendor-po-columns.tsx new file mode 100644 index 00000000..041e0c05 --- /dev/null +++ b/lib/po/vendor-table/shi-vendor-po-columns.tsx @@ -0,0 +1,462 @@ +"use client" + +import * as React from "react" +import { type ColumnDef } from "@tanstack/react-table" +import { + SendIcon, + FileTextIcon, + MoreHorizontalIcon, +} from "lucide-react" + +import { Badge } from "@/components/ui/badge" +import { Button } from "@/components/ui/button" +import { Checkbox } from "@/components/ui/checkbox" +import { + DropdownMenu, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuLabel, + DropdownMenuSeparator, + DropdownMenuTrigger, +} from "@/components/ui/dropdown-menu" +import { + Tooltip, + TooltipContent, + TooltipProvider, + TooltipTrigger, +} from "@/components/ui/tooltip" +import { DataTableColumnHeaderSimple } from "@/components/data-table/data-table-column-simple-header" + +import { VendorPO } from "./types" + +// 서명 요청 전용 액션 타입 +type ShiVendorPORowAction = { + row: { original: VendorPO } + type: "view-items" | "signature-request" +} + +interface GetShiVendorColumnsProps { + setRowAction: React.Dispatch> + selectedRows: number[] + onRowSelect: (id: number, selected: boolean) => void +} + +export function getShiVendorColumns({ + setRowAction, + selectedRows, + onRowSelect, +}: GetShiVendorColumnsProps): ColumnDef[] { + return [ + // 선택 체크박스 (1개만 선택 가능) + { + id: "select", + header: () =>
선택
, + cell: ({ row }) => ( +
+ { + onRowSelect(row.original.id, !!checked) + }} + aria-label="행 선택" + /> +
+ ), + enableSorting: false, + enableHiding: false, + size: 40, + }, + + // No. (ID) + { + accessorKey: "id", + header: ({ column }) => ( + + ), + cell: ({ row }) => { + const id = row.getValue("id") as number + return
{id}
+ }, + size: 60, + }, + + // PO/계약번호 + { + accessorKey: "contractNo", + header: ({ column }) => ( + + ), + cell: ({ row }) => { + const contractNo = row.getValue("contractNo") as string + return ( +
+ {contractNo} +
+ ) + }, + size: 120, + }, + + // Rev. / 품번 (PO 버전) + { + accessorKey: "poVersion", + header: ({ column }) => ( + + ), + cell: ({ row }) => { + const version = row.getValue("poVersion") as number + return
{version || '-'}
+ }, + size: 80, + }, + + // 계약상태 + { + accessorKey: "contractStatus", + header: ({ column }) => ( + + ), + cell: ({ row }) => { + const status = row.getValue("contractStatus") as string + return ( + + {status || '-'} + + ) + }, + size: 100, + }, + + // 계약종류 + { + accessorKey: "contractType", + header: ({ column }) => ( + + ), + cell: ({ row }) => { + const type = row.getValue("contractType") as string + return {type || '-'} + }, + size: 100, + }, + + // 상세품목 (버튼) + { + id: "itemsAction", + header: () =>
상세품목
, + cell: ({ row }) => ( +
+ +
+ ), + enableSorting: false, + size: 80, + }, + + // 프로젝트 + { + accessorKey: "projectName", + header: ({ column }) => ( + + ), + cell: ({ row }) => { + const projectName = row.getValue("projectName") as string + return ( +
+ {projectName || '-'} +
+ ) + }, + size: 150, + }, + + // 계약명/자재내역 + { + accessorKey: "contractName", + header: ({ column }) => ( + + ), + cell: ({ row }) => { + const contractName = row.getValue("contractName") as string + return ( +
+ {contractName || '-'} +
+ ) + }, + size: 200, + }, + + // PO/계약기간 + { + accessorKey: "contractPeriod", + header: ({ column }) => ( + + ), + cell: ({ row }) => { + const period = row.getValue("contractPeriod") as string + return ( +
+ {period || '-'} +
+ ) + }, + size: 150, + }, + + // PO/계약금액 + { + accessorKey: "totalAmount", + header: ({ column }) => ( + + ), + cell: ({ row }) => { + const amount = row.getValue("totalAmount") as string | number + return
{amount || '-'}
+ }, + size: 120, + }, + + // 계약통화 + { + accessorKey: "currency", + header: ({ column }) => ( + + ), + cell: ({ row }) => { + const currency = row.getValue("currency") as string + return
{currency || '-'}
+ }, + size: 80, + }, + + // 지불조건 + { + accessorKey: "paymentTerms", + header: ({ column }) => ( + + ), + cell: ({ row }) => { + const terms = row.getValue("paymentTerms") as string + return ( +
+ {terms || '-'} +
+ ) + }, + size: 120, + }, + + // Tax + { + accessorKey: "tax", + header: ({ column }) => ( + + ), + cell: ({ row }) => { + const tax = row.getValue("tax") as string + return
{tax || '-'}
+ }, + size: 80, + }, + + // 환율 + { + accessorKey: "exchangeRate", + header: ({ column }) => ( + + ), + cell: ({ row }) => { + const rate = row.getValue("exchangeRate") as string + return
{rate || '-'}
+ }, + size: 100, + }, + + // 인도조건 + { + accessorKey: "deliveryTerms", + header: ({ column }) => ( + + ), + cell: ({ row }) => { + const terms = row.getValue("deliveryTerms") as string + return
{terms || '-'}
+ }, + size: 100, + }, + + // 구매/계약담당 + { + accessorKey: "purchaseManager", + header: ({ column }) => ( + + ), + cell: ({ row }) => { + const manager = row.getValue("purchaseManager") as string + return
{manager || '-'}
+ }, + size: 120, + }, + + // PO/계약수신일 + { + accessorKey: "poReceiveDate", + header: ({ column }) => ( + + ), + cell: ({ row }) => { + const date = row.getValue("poReceiveDate") as string + return
{date || '-'}
+ }, + size: 120, + }, + + // 계약체결일 + { + accessorKey: "contractDate", + header: ({ column }) => ( + + ), + cell: ({ row }) => { + const date = row.getValue("contractDate") as string + return
{date || '-'}
+ }, + size: 120, + }, + + // L/C No. + { + accessorKey: "lcNo", + header: ({ column }) => ( + + ), + cell: ({ row }) => { + const lcNo = row.getValue("lcNo") as string + return
{lcNo || '-'}
+ }, + size: 120, + }, + + // 납품대금 연동제 대상 + { + accessorKey: "priceIndexTarget", + header: ({ column }) => ( + + ), + cell: ({ row }) => { + const target = row.getValue("priceIndexTarget") as string | boolean + return
{target?.toString() || '-'}
+ }, + size: 140, + }, + + // 연계 PO/계약번호 + { + accessorKey: "linkedContractNo", + header: ({ column }) => ( + + ), + cell: ({ row }) => { + const linkedNo = row.getValue("linkedContractNo") as string + return
{linkedNo || '-'}
+ }, + size: 140, + }, + + // 최종수정일 + { + accessorKey: "lastModifiedDate", + header: ({ column }) => ( + + ), + cell: ({ row }) => { + const date = row.getValue("lastModifiedDate") as string + return
{date || '-'}
+ }, + size: 120, + }, + + // 최종수정자 + { + accessorKey: "lastModifiedBy", + header: ({ column }) => ( + + ), + cell: ({ row }) => { + const user = row.getValue("lastModifiedBy") as string + return
{user || '-'}
+ }, + size: 120, + }, + + // 액션 컬럼 (서명 요청 중심) + { + id: "actions", + enableHiding: false, + header: () =>
Actions
, + cell: ({ row }) => { + return ( +
+ {/* 서명 요청 버튼 */} + + + + + + + 벤더에게 전자서명 요청 + + + + + {/* 드롭다운 메뉴 (추가 액션) + + + + + + 액션 + setRowAction({ row, type: "view-items" })} + > + + 상세품목 보기 + + + setRowAction({ row, type: "signature-request" })} + className="text-blue-600" + > + + 서명 요청 + + + */} +
+ ) + }, + size: 160, + minSize: 160, + }, + ] +} \ No newline at end of file -- cgit v1.2.3