"use client" import * as React from "react" import { useDataTable } from "@/hooks/use-data-table" import { DataTable } from "@/components/data-table/data-table" import { Button } from "@/components/ui/button" import { toast } from "sonner" import { columns } from "./columns-detail" import type { AvlDetailItem } from "../types" import { BackButton } from "@/components/ui/back-button" interface AvlDetailTableProps { data: AvlDetailItem[] pageCount?: number avlType?: '프로젝트AVL' | '선종별표준AVL' // AVL 타입 projectInfo?: { code?: string pspid?: string OWN_NM?: string kunnrNm?: string } // 프로젝트 정보 businessType?: string // 사업 유형 (예: 조선/해양) } export function AvlDetailTable({ data, pageCount, avlType, projectInfo, businessType, }: AvlDetailTableProps) { // 액션 핸들러 const handleAction = React.useCallback(async (action: string) => { switch (action) { case 'vendor-pool': window.open('/evcp/vendor-pool', '_blank') break case 'download': toast.info("데이터를 다운로드 중입니다.") // TODO: 데이터 다운로드 로직 구현 break case 'avl-form': toast.info("AVL 양식을 준비 중입니다.") // TODO: AVL 양식 다운로드 로직 구현 break default: toast.error(`알 수 없는 액션: ${action}`) } }, []) // 테이블 메타 설정 const tableMeta = React.useMemo(() => ({ onAction: handleAction, }), [handleAction]) // 데이터 테이블 설정 const { table } = useDataTable({ data, columns, pageCount: pageCount ?? 1, initialState: { sorting: [{ id: "no", desc: false }], pagination: { pageIndex: 0, pageSize: 10, }, }, getRowId: (row) => String(row.id), meta: tableMeta, }) return (