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/vendor-po-columns.tsx | 511 ++++++++++++++++++++++++++++++ 1 file changed, 511 insertions(+) create mode 100644 lib/po/vendor-table/vendor-po-columns.tsx (limited to 'lib/po/vendor-table/vendor-po-columns.tsx') diff --git a/lib/po/vendor-table/vendor-po-columns.tsx b/lib/po/vendor-table/vendor-po-columns.tsx new file mode 100644 index 00000000..1a655b0c --- /dev/null +++ b/lib/po/vendor-table/vendor-po-columns.tsx @@ -0,0 +1,511 @@ +"use client" + +import * as React from "react" +import { type ColumnDef } from "@tanstack/react-table" +import { + FileTextIcon, + MoreHorizontalIcon, + EyeIcon, + PrinterIcon, + FileXIcon, + PlusIcon, + EditIcon +} from "lucide-react" +import { Button } from "@/components/ui/button" +import { Badge } from "@/components/ui/badge" +import { Checkbox } from "@/components/ui/checkbox" +import { + Tooltip, + TooltipContent, + TooltipProvider, + TooltipTrigger, +} from "@/components/ui/tooltip" +import { + DropdownMenu, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuLabel, + DropdownMenuSeparator, + DropdownMenuTrigger, +} from "@/components/ui/dropdown-menu" +import { DataTableColumnHeaderSimple } from "@/components/data-table/data-table-column-simple-header" +import { VendorPO, VendorPOActionType } from "./types" + +// 벤더 PO용 행 액션 타입 +type VendorPORowAction = { + row: { original: VendorPO } + type: VendorPOActionType +} + +interface GetVendorColumnsProps { + setRowAction: React.Dispatch> + selectedRows?: number[] + onRowSelect?: (id: number, selected: boolean) => void +} + +export function getVendorColumns({ setRowAction, selectedRows = [], onRowSelect }: GetVendorColumnsProps): ColumnDef[] { + return [ + // 선택 체크박스 (1개만 선택 가능) + { + id: "select", + header: () =>
선택
, + cell: ({ row }) => ( +
+ { + if (onRowSelect) { + 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: () =>
액션
, + cell: function Cell({ row }) { + return ( +
+ {/* 상세품목 버튼 */} + + + + + + + 상세품목 보기 + + + + + {/* 드롭다운 메뉴 */} + + + + + + 액션 + setRowAction({ row, type: "view-items" })} + > + + 상세품목 보기 + + + setRowAction({ row, type: "pcr-create" })} + > + + PCR생성 + + + + + setRowAction({ row, type: "approve" })} + > + 승인 + + + setRowAction({ row, type: "cancel-approve" })} + > + 승인취소 + + + setRowAction({ row, type: "reject-contract" })} + className="text-red-600" + > + + 계약거절 + + + + + setRowAction({ row, type: "print-contract" })} + > + + 계약서출력 + + + setRowAction({ row, type: "contract-detail" })} + > + + 계약상세 + + + setRowAction({ row, type: "po-note" })} + > + + PO Note + + + setRowAction({ row, type: "price-index" })} + > + 연동표입력 + + + +
+ ); + }, + size: 120, + minSize: 100, + }, + ] +} \ No newline at end of file -- cgit v1.2.3