"use client" import * as React from "react" import { type Table } from "@tanstack/react-table" // import { Download, FileDown } from "lucide-react" // import { toast } from "sonner" // import { exportTableToExcel } from "@/lib/export" // import { Button } from "@/components/ui/button" // import { // DropdownMenu, // DropdownMenuContent, // DropdownMenuItem, // DropdownMenuTrigger, // } from "@/components/ui/dropdown-menu" import { DeletePqsDialog } from "./delete-pqs-dialog" import { AddPqDialog } from "./add-pq-dialog" import { PqCriterias } from "@/db/schema/pq" import { toast } from "sonner" // import { ImportPqButton } from "./import-pq-button" // import { exportPqTemplate } from "./pq-excel-template" interface PqTableToolbarActionsProps { table: Table pqListId: number pqListInfo: Awaited> } export function PqTableToolbarActions({ table, pqListId, pqListInfo }: PqTableToolbarActionsProps) { // PQ 리스트가 ACTIVE 상태인지 확인 const isActive = pqListInfo.success && pqListInfo.data.status === "ACTIVE"; // ACTIVE 상태일 때 기능 제한 const handleRestrictedAction = () => { toast.error("활성화된 PQ 목록은 수정할 수 없습니다. 먼저 PQ 목록을 비활성화해주세요."); }; return (
{table.getFilteredSelectedRowModel().rows.length > 0 ? ( isActive ? ( ) : ( row.original)} onSuccess={() => table.toggleAllRowsSelected(false)} /> ) ) : null} {isActive ? ( ) : ( )} {/* Import 버튼 */} {/* */} {/* Export 드롭다운 메뉴 */} {/* exportTableToExcel(table, { filename: `pq-list-${pqListId}-criteria`, excludeColumns: ["select", "actions"], }) } > 현재 데이터 내보내기 exportPqTemplate()}> 템플릿 다운로드 */}
) }