import { Checkbox } from "@/components/ui/checkbox" import { Button } from "@/components/ui/button" import { Trash2 } from "lucide-react" import { type ColumnDef } from "@tanstack/react-table" import { DataTableColumnHeaderSimple } from "@/components/data-table/data-table-column-simple-header" import { EditableCell } from "@/components/data-table/editable-cell" // 수정 여부 확인 헬퍼 함수 const getIsModified = (table: any, rowId: string, fieldName: string) => { const pendingChanges = table.options.meta?.getPendingChanges?.() || {} return String(rowId) in pendingChanges && fieldName in pendingChanges[String(rowId)] } // vendor-pool 테이블 메타 타입 (복사본) interface VendorPoolTableMeta { onCellUpdate?: (id: string | number, field: string, newValue: any) => Promise onCellCancel?: (id: string | number, field: string) => void onAction?: (action: string, data?: any) => void onSaveEmptyRow?: (tempId: string) => Promise onCancelEmptyRow?: (tempId: string) => void isEmptyRow?: (id: string) => boolean } // Vendor Pool 데이터 타입 - 스키마 기반 + 테이블용 추가 필드 import type { VendorPool } from "@/db/schema/avl/vendor-pool" import { DisciplineCode, EngineeringDisciplineSelector } from "@/components/common/discipline" import { MaterialGroupSelectorDialogSingle } from "@/components/common/material/material-group-selector-dialog-single" import type { MaterialSearchItem } from "@/lib/material/material-group-service" import { VendorTierSelector } from "@/components/common/selectors/vendor-tier/vendor-tier-selector" import { VendorSelectorDialogSingle } from "@/components/common/vendor/vendor-selector-dialog-single" import type { VendorSearchItem } from "@/components/common/vendor/vendor-service" import { PlaceOfShippingSelectorDialogSingle } from "@/components/common/selectors/place-of-shipping/place-of-shipping-selector" import { NationSelector, NationCode } from "@/components/common/selectors/nation" export type VendorPoolItem = Omit & { id: string | number // temp-로 시작하는 경우 string, 실제 데이터는 number no: number // 테이블 표시용 순번 selected: boolean // 테이블 선택 상태 registrationDate: string // 표시용 string으로 변환 lastModifiedDate: string // 표시용 string으로 변환 } // 테이블 컬럼 정의 export const columns: ColumnDef[] = [ { id: "select", header: ({ table }) => ( table.toggleAllPageRowsSelected(!!value)} aria-label="Select all" /> ), cell: ({ row }) => ( row.toggleSelected(!!value)} aria-label="Select row" /> ), enableSorting: false, enableHiding: false, size: 40, }, { accessorKey: "id", header: ({ column }) => ( ), cell: ({ row }) => { const id = String(row.original.id) // 빈 행의 경우 신규 표시 if (id.startsWith('temp-')) { return
신규
} // 실제 ID 표시 return
{id}
}, size: 60, }, { accessorKey: "constructionSector", header: ({ column }) => ( 공사부문 *} /> ), cell: ({ row, table }) => { const value = row.getValue("constructionSector") const isEmptyRow = String(row.original.id).startsWith('temp-') const onSave = async (newValue: any) => { const meta = table.options.meta as VendorPoolTableMeta if (meta?.onCellUpdate) { await meta.onCellUpdate(row.original.id, "constructionSector", newValue) } } // 수정 여부 확인 const isModified = getIsModified(table, row.original.id, "constructionSector") return ( ) }, size: 100, }, { accessorKey: "htDivision", header: ({ column }) => ( H/T *} /> ), cell: ({ row, table }) => { const value = row.getValue("htDivision") const isEmptyRow = String(row.original.id).startsWith('temp-') const onSave = async (newValue: any) => { if (table.options.meta?.onCellUpdate) { await table.options.meta.onCellUpdate(row.original.id, "htDivision", newValue) } } // 수정 여부 확인 const isModified = getIsModified(table, row.original.id, "htDivision") return ( ) }, size: 80, }, { accessorKey: "designCategory", header: ({ column }) => ( 설계기능(공종) *} /> ), cell: ({ row, table }) => { const designCategoryCode = row.original.designCategoryCode as string const designCategory = row.original.designCategory as string // 현재 선택된 discipline 구성 const selectedDiscipline: DisciplineCode | undefined = designCategoryCode && designCategory ? { CD: designCategoryCode, USR_DF_CHAR_18: designCategory } : undefined const onDisciplineSelect = async (discipline: DisciplineCode) => { console.log('선택된 설계공종:', discipline) console.log('행 ID:', row.original.id) // 설계기능코드와 설계기능(공종) 필드 모두 업데이트 if (table.options.meta?.onCellUpdate) { await table.options.meta.onCellUpdate(row.original.id, "designCategoryCode", discipline.CD) await table.options.meta.onCellUpdate(row.original.id, "designCategory", discipline.USR_DF_CHAR_18) } else { console.error('onCellUpdate가 정의되지 않음') } } return ( ) }, size: 260, }, { accessorKey: "equipBulkDivision", header: ({ column }) => ( ), cell: ({ row, table }) => { const value = row.getValue("equipBulkDivision") const onSave = async (newValue: any) => { if (table.options.meta?.onCellUpdate) { await table.options.meta.onCellUpdate(row.original.id, "equipBulkDivision", newValue) } } return ( ) }, size: 120, }, { accessorKey: "packageCode", header: ({ column }) => ( ), cell: ({ row, table }) => { const value = row.getValue("packageCode") const onSave = async (newValue: any) => { if (table.options.meta?.onCellUpdate) { await table.options.meta.onCellUpdate(row.original.id, "packageCode", newValue) } } // 수정 여부 확인 const isModified = getIsModified(table, row.original.id, "packageCode") return ( ) }, size: 120, }, { accessorKey: "packageName", header: ({ column }) => ( ), cell: ({ row, table }) => { const value = row.getValue("packageName") const isEmptyRow = String(row.original.id).startsWith('temp-') const onSave = async (newValue: any) => { if (table.options.meta?.onCellUpdate) { await table.options.meta.onCellUpdate(row.original.id, "packageName", newValue) } } // 수정 여부 확인 const isModified = getIsModified(table, row.original.id, "packageName") return ( ) }, size: 200, }, { accessorKey: "materialGroupName", header: ({ column }) => ( 자재그룹 *} /> ), cell: ({ row, table }) => { const materialGroupCode = row.original.materialGroupCode as string const materialGroupName = row.original.materialGroupName as string // 현재 선택된 material 구성 const selectedMaterial: MaterialSearchItem | null = materialGroupCode && materialGroupName ? { materialGroupCode, materialGroupDescription: materialGroupName, displayText: `${materialGroupCode} - ${materialGroupName}` } : null const onMaterialSelect = async (material: MaterialSearchItem | null) => { console.log('선택된 자재그룹:', material) if (material) { // 자재그룹코드와 자재그룹명 필드 모두 업데이트 if (table.options.meta?.onCellUpdate) { await table.options.meta.onCellUpdate(row.original.id, "materialGroupCode", material.materialGroupCode) await table.options.meta.onCellUpdate(row.original.id, "materialGroupName", material.materialGroupDescription) } } else { // 선택 해제 시 빈 값으로 설정 if (table.options.meta?.onCellUpdate) { await table.options.meta.onCellUpdate(row.original.id, "materialGroupCode", "") await table.options.meta.onCellUpdate(row.original.id, "materialGroupName", "") } } } return ( ) }, size: 400, }, { accessorKey: "smCode", header: ({ column }) => ( ), cell: ({ row, table }) => { const value = row.getValue("smCode") const onSave = async (newValue: any) => { if (table.options.meta?.onCellUpdate) { await table.options.meta.onCellUpdate(row.original.id, "smCode", newValue) } } return ( ) }, size: 200, }, { accessorKey: "similarMaterialNamePurchase", header: ({ column }) => ( // 이전에는 컬럼명이 '유사자재명(구매외)' 였음. ), cell: ({ row, table }) => { const value = row.getValue("similarMaterialNamePurchase") const onSave = async (newValue: any) => { if (table.options.meta?.onCellUpdate) { await table.options.meta.onCellUpdate(row.original.id, "similarMaterialNamePurchase", newValue) } } return ( ) }, size: 250, }, { accessorKey: "similarMaterialNameOther", header: ({ column }) => ( ), cell: ({ row, table }) => { const value = row.getValue("similarMaterialNameOther") const onSave = async (newValue: any) => { if (table.options.meta?.onCellUpdate) { await table.options.meta.onCellUpdate(row.original.id, "similarMaterialNameOther", newValue) } } return ( ) }, size: 140, }, { accessorKey: "vendorSelector", header: ({ column }) => ( ), cell: ({ row, table }) => { const vendorCode = row.original.vendorCode as string const vendorName = row.original.vendorName as string // 현재 선택된 vendor 구성 const selectedVendor: VendorSearchItem | null = vendorCode && vendorName ? { id: 0, // 실제로는 vendorId가 있어야 하지만 여기서는 임시로 0 사용 vendorName, vendorCode: vendorCode || null, taxId: null, // 사업자번호는 vendor-pool에서 관리하지 않음 status: "ACTIVE", // 임시 값 displayText: vendorName + (vendorCode ? ` (${vendorCode})` : "") } : null const onVendorSelect = async (vendor: VendorSearchItem | null) => { console.log('선택된 협력업체:', vendor) if (vendor) { // 협력업체코드, 협력업체명 필드 업데이트 if (table.options.meta?.onCellUpdate) { await table.options.meta.onCellUpdate(row.original.id, "vendorCode", vendor.vendorCode || "") await table.options.meta.onCellUpdate(row.original.id, "vendorName", vendor.vendorName) } } else { // 선택 해제 시 빈 값으로 설정 if (table.options.meta?.onCellUpdate) { await table.options.meta.onCellUpdate(row.original.id, "vendorCode", "") await table.options.meta.onCellUpdate(row.original.id, "vendorName", "") } } } return ( ) }, size: 150, }, { accessorKey: "vendorCode", header: ({ column }) => ( ), cell: ({ row, table }) => { const value = row.getValue("vendorCode") const onSave = async (newValue: any) => { if (table.options.meta?.onCellUpdate) { await table.options.meta.onCellUpdate(row.original.id, "vendorCode", newValue) } } // 수정 여부 확인 const isModified = getIsModified(table, row.original.id, "vendorCode") return ( ) }, size: 130, }, { accessorKey: "vendorName", header: ({ column }) => ( 협력업체 명 *} /> ), cell: ({ row, table }) => { const value = row.getValue("vendorName") const isEmptyRow = String(row.original.id).startsWith('temp-') const onSave = async (newValue: any) => { if (table.options.meta?.onCellUpdate) { await table.options.meta.onCellUpdate(row.original.id, "vendorName", newValue) } } // 수정 여부 확인 const isModified = getIsModified(table, row.original.id, "vendorName") return ( ) }, size: 130, }, { accessorKey: "faTarget", header: "FA대상", cell: ({ row, table }) => { const value = row.getValue("faTarget") as boolean const onSave = async (newValue: any) => { if (table.options.meta?.onCellUpdate) { await table.options.meta.onCellUpdate(row.original.id, "faTarget", newValue) } } // 수정 여부 확인 const isModified = getIsModified(table, row.original.id, "faTarget") return ( ) }, enableSorting: false, size: 80, }, { accessorKey: "faStatus", header: ({ column }) => ( ), cell: ({ row }) => { const value = row.original.faStatus as string // 'O'인 경우에만 'O'를 표시, 그 외에는 빈 셀 const displayValue = value === "O" ? "O" : "" return (
{displayValue}
) }, size: 120, }, // { // accessorKey: "faRemark", // header: ({ column }) => ( // // ), // cell: ({ row, table }) => { // const value = row.getValue("faRemark") // const onSave = async (newValue: any) => { // if (table.options.meta?.onCellUpdate) { // await table.options.meta.onCellUpdate(row.original.id, "faRemark", newValue) // } // } // return ( // // ) // }, // size: 120, // }, { accessorKey: "tier", header: ({ column }) => ( 등급 *} /> ), cell: ({ row, table }) => { const value = row.original.tier as string const onValueChange = async (newValue: string) => { if (table.options.meta?.onCellUpdate) { await table.options.meta.onCellUpdate(row.original.id, "tier", newValue) } } return ( ) }, size: 120, }, { accessorKey: "isAgent", header: "Agent 여부", cell: ({ row, table }) => { const value = row.getValue("isAgent") as boolean const onSave = async (newValue: any) => { if (table.options.meta?.onCellUpdate) { await table.options.meta.onCellUpdate(row.original.id, "isAgent", newValue) } } return ( ) }, enableSorting: false, size: 100, }, { accessorKey: "contractSignerCode", header: ({ column }) => ( ), cell: ({ row, table }) => { const value = row.getValue("contractSignerCode") const onSave = async (newValue: any) => { if (table.options.meta?.onCellUpdate) { await table.options.meta.onCellUpdate(row.original.id, "contractSignerCode", newValue) } } // 수정 여부 확인 const isModified = getIsModified(table, row.original.id, "contractSignerCode") return ( ) }, size: 120, }, { accessorKey: "contractSignerSelector", header: ({ column }) => ( ), cell: ({ row, table }) => { const contractSignerCode = row.original.contractSignerCode as string const contractSignerName = row.original.contractSignerName as string // 현재 선택된 contract signer 구성 const selectedVendor: VendorSearchItem | null = contractSignerCode && contractSignerName ? { id: 0, // 실제로는 vendorId가 있어야 하지만 여기서는 임시로 0 사용 vendorName: contractSignerName, vendorCode: contractSignerCode || null, taxId: null, // 사업자번호는 vendor-pool에서 관리하지 않음 status: "ACTIVE", // 임시 값 displayText: contractSignerName + (contractSignerCode ? ` (${contractSignerCode})` : "") } : null const onVendorSelect = async (vendor: VendorSearchItem | null) => { console.log('선택된 계약서명주체:', vendor) if (vendor) { // 계약서명주체코드와 계약서명주체명 필드 업데이트 if (table.options.meta?.onCellUpdate) { await table.options.meta.onCellUpdate(row.original.id, "contractSignerCode", vendor.vendorCode || "") await table.options.meta.onCellUpdate(row.original.id, "contractSignerName", vendor.vendorName) } } else { // 선택 해제 시 빈 값으로 설정 if (table.options.meta?.onCellUpdate) { await table.options.meta.onCellUpdate(row.original.id, "contractSignerCode", "") await table.options.meta.onCellUpdate(row.original.id, "contractSignerName", "") } } } return ( ) }, size: 150, }, { accessorKey: "contractSignerName", header: ({ column }) => ( 계약서명주체 명 *} /> ), cell: ({ row, table }) => { const value = row.getValue("contractSignerName") const onSave = async (newValue: any) => { if (table.options.meta?.onCellUpdate) { await table.options.meta.onCellUpdate(row.original.id, "contractSignerName", newValue) } } // 수정 여부 확인 const isModified = getIsModified(table, row.original.id, "contractSignerName") return ( ) }, size: 120, }, { accessorKey: "headquarterLocation", header: ({ column }) => ( 본사 위치 *} /> ), cell: ({ row, table }) => { const headquarterLocation = row.original.headquarterLocation as string // 현재 선택된 국가명으로부터 국가 코드를 찾기 위해 임시로 null 설정 // 실제로는 국가명에서 국가코드를 역추적해야 하지만, 여기서는 단순화 const selectedNation: NationCode | undefined = undefined const onNationSelect = async (nation: NationCode) => { console.log('선택된 국가:', nation) if (table.options.meta?.onCellUpdate) { // CDNM 값(한국어 국가명)을 저장 await table.options.meta.onCellUpdate(row.original.id, "headquarterLocation", nation.CDNM) } } return ( ) }, size: 180, }, { accessorKey: "manufacturingLocation", header: ({ column }) => ( 제작/선적지 *} /> ), cell: ({ row, table }) => { const manufacturingLocation = row.original.manufacturingLocation as string // 현재 선택된 장소 구성 (description은 알 수 없으므로 null로 설정) const selectedPlace = null // 선택된 장소 표시를 위해 null로 설정 const onPlaceSelect = async (place: { code: string; description: string } | null) => { console.log('선택된 제작/선적지:', place) if (table.options.meta?.onCellUpdate) { await table.options.meta.onCellUpdate(row.original.id, "manufacturingLocation", place?.code || "") } } return ( ) }, size: 200, }, { accessorKey: "avlVendorName", header: ({ column }) => ( AVL 등재업체명 *} /> ), cell: ({ row, table }) => { const value = row.getValue("avlVendorName") const onSave = async (newValue: any) => { if (table.options.meta?.onCellUpdate) { await table.options.meta.onCellUpdate(row.original.id, "avlVendorName", newValue) } } return ( ) }, size: 140, }, { accessorKey: "similarVendorName", header: ({ column }) => ( // 이전에는 컬럼명이 '유사업체명' 였음. ), cell: ({ row, table }) => { const value = row.getValue("similarVendorName") const onSave = async (newValue: any) => { if (table.options.meta?.onCellUpdate) { await table.options.meta.onCellUpdate(row.original.id, "similarVendorName", newValue) } } return ( ) }, size: 130, }, { accessorKey: "hasAvl", header: "AVL", cell: ({ row, table }) => { const value = row.getValue("hasAvl") as boolean const onSave = async (newValue: any) => { if (table.options.meta?.onCellUpdate) { await table.options.meta.onCellUpdate(row.original.id, "hasAvl", newValue) } } return ( ) }, enableSorting: false, size: 60, }, { accessorKey: "isBlacklist", header: "Blacklist", cell: ({ row, table }) => { const value = row.getValue("isBlacklist") as boolean const onSave = async (newValue: any) => { if (table.options.meta?.onCellUpdate) { await table.options.meta.onCellUpdate(row.original.id, "isBlacklist", newValue) } } return ( ) }, enableSorting: false, size: 60, }, { accessorKey: "isBcc", header: "BCC", cell: ({ row, table }) => { const value = row.getValue("isBcc") as boolean const onSave = async (newValue: any) => { if (table.options.meta?.onCellUpdate) { await table.options.meta.onCellUpdate(row.original.id, "isBcc", newValue) } } return ( ) }, enableSorting: false, size: 60, }, { accessorKey: "purchaseOpinion", header: ({ column }) => ( ), cell: ({ row, table }) => { const value = row.getValue("purchaseOpinion") const onSave = async (newValue: any) => { if (table.options.meta?.onCellUpdate) { await table.options.meta.onCellUpdate(row.original.id, "purchaseOpinion", newValue) } } return ( ) }, size: 300, }, { accessorKey: "shipTypeCommon", header: "공통", cell: ({ row, table }) => { const value = row.getValue("shipTypeCommon") as boolean const onSave = async (newValue: any) => { if (table.options.meta?.onCellUpdate) { await table.options.meta.onCellUpdate(row.original.id, "shipTypeCommon", newValue) } } return ( ) }, enableSorting: false, size: 80, }, { accessorKey: "shipTypeAmax", header: "A-max", cell: ({ row, table }) => { const value = row.getValue("shipTypeAmax") as boolean const onSave = async (newValue: any) => { if (table.options.meta?.onCellUpdate) { await table.options.meta.onCellUpdate(row.original.id, "shipTypeAmax", newValue) } } return ( ) }, enableSorting: false, size: 60, }, { accessorKey: "shipTypeSmax", header: "S-max", cell: ({ row, table }) => { const value = row.getValue("shipTypeSmax") as boolean const onSave = async (newValue: any) => { if (table.options.meta?.onCellUpdate) { await table.options.meta.onCellUpdate(row.original.id, "shipTypeSmax", newValue) } } return ( ) }, enableSorting: false, size: 60, }, { accessorKey: "shipTypeVlcc", header: "VLCC", cell: ({ row, table }) => { const value = row.getValue("shipTypeVlcc") as boolean const onSave = async (newValue: any) => { if (table.options.meta?.onCellUpdate) { await table.options.meta.onCellUpdate(row.original.id, "shipTypeVlcc", newValue) } } return ( ) }, enableSorting: false, size: 60, }, { accessorKey: "shipTypeLngc", header: "LNGC", cell: ({ row, table }) => { const value = row.getValue("shipTypeLngc") as boolean const onSave = async (newValue: any) => { if (table.options.meta?.onCellUpdate) { await table.options.meta.onCellUpdate(row.original.id, "shipTypeLngc", newValue) } } return ( ) }, size: 60, }, { accessorKey: "shipTypeCont", header: "CONT", cell: ({ row, table }) => { const value = row.getValue("shipTypeCont") as boolean const onSave = async (newValue: any) => { if (table.options.meta?.onCellUpdate) { await table.options.meta.onCellUpdate(row.original.id, "shipTypeCont", newValue) } } return ( ) }, size: 60, }, { accessorKey: "offshoreTypeCommon", header: "공통", cell: ({ row, table }) => { const value = row.getValue("offshoreTypeCommon") as boolean const onSave = async (newValue: any) => { if (table.options.meta?.onCellUpdate) { await table.options.meta.onCellUpdate(row.original.id, "offshoreTypeCommon", newValue) } } return ( ) }, size: 60, }, { accessorKey: "offshoreTypeFpso", header: "FPSO", cell: ({ row, table }) => { const value = row.getValue("offshoreTypeFpso") as boolean const onSave = async (newValue: any) => { if (table.options.meta?.onCellUpdate) { await table.options.meta.onCellUpdate(row.original.id, "offshoreTypeFpso", newValue) } } return ( ) }, size: 60, }, { accessorKey: "offshoreTypeFlng", header: "FLNG", cell: ({ row, table }) => { const value = row.getValue("offshoreTypeFlng") as boolean const onSave = async (newValue: any) => { if (table.options.meta?.onCellUpdate) { await table.options.meta.onCellUpdate(row.original.id, "offshoreTypeFlng", newValue) } } return ( ) }, size: 60, }, { accessorKey: "offshoreTypeFpu", header: "FPU", cell: ({ row, table }) => { const value = row.getValue("offshoreTypeFpu") as boolean const onSave = async (newValue: any) => { if (table.options.meta?.onCellUpdate) { await table.options.meta.onCellUpdate(row.original.id, "offshoreTypeFpu", newValue) } } return ( ) }, size: 60, }, { accessorKey: "offshoreTypePlatform", header: "Platform", cell: ({ row, table }) => { const value = row.getValue("offshoreTypePlatform") as boolean const onSave = async (newValue: any) => { if (table.options.meta?.onCellUpdate) { await table.options.meta.onCellUpdate(row.original.id, "offshoreTypePlatform", newValue) } } return ( ) }, size: 60, }, { accessorKey: "offshoreTypeWtiv", header: "WTIV", cell: ({ row, table }) => { const value = row.getValue("offshoreTypeWtiv") as boolean const onSave = async (newValue: any) => { if (table.options.meta?.onCellUpdate) { await table.options.meta.onCellUpdate(row.original.id, "offshoreTypeWtiv", newValue) } } return ( ) }, size: 60, }, { accessorKey: "offshoreTypeGom", header: "GOM", cell: ({ row, table }) => { const value = row.getValue("offshoreTypeGom") as boolean const onSave = async (newValue: any) => { if (table.options.meta?.onCellUpdate) { await table.options.meta.onCellUpdate(row.original.id, "offshoreTypeGom", newValue) } } return ( ) }, size: 60, }, { accessorKey: "picName", header: ({ column }) => ( // 이전에는 컬럼명이 PIC(담당자) 였음. ), cell: ({ row, table }) => { const value = row.getValue("picName") const onSave = async (newValue: any) => { if (table.options.meta?.onCellUpdate) { await table.options.meta.onCellUpdate(row.original.id, "picName", newValue) } } return ( ) }, size: 120, }, { accessorKey: "picEmail", header: ({ column }) => ( // 이전에는 컬럼명이 PIC(E-mail) 였음. ), cell: ({ row, table }) => { const value = row.getValue("picEmail") const onSave = async (newValue: any) => { if (table.options.meta?.onCellUpdate) { await table.options.meta.onCellUpdate(row.original.id, "picEmail", newValue) } } return ( ) }, size: 140, }, { accessorKey: "picPhone", header: ({ column }) => ( // 이전에는 컬럼명이 PIC(Phone) 였음. ), cell: ({ row, table }) => { const value = row.getValue("picPhone") const onSave = async (newValue: any) => { if (table.options.meta?.onCellUpdate) { await table.options.meta.onCellUpdate(row.original.id, "picPhone", newValue) } } return ( ) }, size: 120, }, { accessorKey: "agentName", header: ({ column }) => ( ), cell: ({ row, table }) => { const value = row.getValue("agentName") const onSave = async (newValue: any) => { if (table.options.meta?.onCellUpdate) { await table.options.meta.onCellUpdate(row.original.id, "agentName", newValue) } } return ( ) }, size: 120, }, { accessorKey: "agentEmail", header: ({ column }) => ( ), cell: ({ row, table }) => { const value = row.getValue("agentEmail") const onSave = async (newValue: any) => { if (table.options.meta?.onCellUpdate) { await table.options.meta.onCellUpdate(row.original.id, "agentEmail", newValue) } } return ( ) }, size: 140, }, { accessorKey: "agentPhone", header: ({ column }) => ( ), cell: ({ row, table }) => { const value = row.getValue("agentPhone") const onSave = async (newValue: any) => { if (table.options.meta?.onCellUpdate) { await table.options.meta.onCellUpdate(row.original.id, "agentPhone", newValue) } } return ( ) }, size: 120, }, { accessorKey: "recentQuoteDate", header: ({ column }) => ( ), cell: ({ row }) => { const value = row.getValue("recentQuoteDate") as string return (
{value || "-"}
) }, size: 120, }, { accessorKey: "recentQuoteNumber", header: ({ column }) => ( ), cell: ({ row }) => { const value = row.getValue("recentQuoteNumber") as string return (
{value || "-"}
) }, size: 130, }, { accessorKey: "recentOrderDate", header: ({ column }) => ( ), cell: ({ row }) => { const value = row.getValue("recentOrderDate") as string return (
{value || "-"}
) }, size: 120, }, { accessorKey: "recentOrderNumber", header: ({ column }) => ( ), cell: ({ row }) => { const value = row.getValue("recentOrderNumber") as string return (
{value || "-"}
) }, size: 130, }, { accessorKey: "registrationDate", header: ({ column }) => ( ), size: 120, }, { accessorKey: "registrant", header: ({ column }) => ( ), cell: ({ row }) => { const value = row.getValue("registrant") as string return
{value || ""}
}, size: 100, }, { accessorKey: "lastModifiedDate", header: ({ column }) => ( ), size: 120, }, { accessorKey: "lastModifier", header: ({ column }) => ( ), cell: ({ row }) => { const value = row.getValue("lastModifier") as string return
{value || ""}
}, size: 120, }, // 액션 그룹 { id: "actions", header: "액션", cell: ({ row, table }) => { const data = row.original const isEmptyRow = (table.options.meta as any)?.isEmptyRow?.(String(data.id)) if (isEmptyRow) { // 빈 행의 경우 저장/취소 버튼 표시 return (
) } // 일반 행의 경우 기존 액션 버튼들 표시 return (
) }, size: 120, enableSorting: false, enableHiding: false, }, ]