From 535de26b9cf3242c04543d6891d78352b9593a60 Mon Sep 17 00:00:00 2001 From: dujinkim Date: Tue, 11 Nov 2025 09:22:58 +0000 Subject: (최겸) 구매 수정사항 개발 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../general-contracts-table-toolbar-actions.tsx | 124 --------------------- 1 file changed, 124 deletions(-) delete mode 100644 lib/general-contracts_old/main/general-contracts-table-toolbar-actions.tsx (limited to 'lib/general-contracts_old/main/general-contracts-table-toolbar-actions.tsx') diff --git a/lib/general-contracts_old/main/general-contracts-table-toolbar-actions.tsx b/lib/general-contracts_old/main/general-contracts-table-toolbar-actions.tsx deleted file mode 100644 index f16b759a..00000000 --- a/lib/general-contracts_old/main/general-contracts-table-toolbar-actions.tsx +++ /dev/null @@ -1,124 +0,0 @@ -"use client" - -import * as React from "react" -import { type Table } from "@tanstack/react-table" -import { - Download, FileSpreadsheet, - Trash2, -} from "lucide-react" -import { deleteContract } from "../service" -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 { GeneralContractListItem } from "./general-contracts-table-columns" -import { CreateGeneralContractDialog } from "./create-general-contract-dialog" - -interface GeneralContractsTableToolbarActionsProps { - table: Table -} - -export function GeneralContractsTableToolbarActions({ table }: GeneralContractsTableToolbarActionsProps) { - const [isExporting, setIsExporting] = React.useState(false) - - // 선택된 계약들 - const selectedContracts = React.useMemo(() => { - return table - .getFilteredSelectedRowModel() - .rows - .map(row => row.original) - }, [table.getFilteredSelectedRowModel().rows]) - - const handleExport = async () => { - try { - setIsExporting(true) - await exportTableToExcel(table, { - filename: "general-contracts", - excludeColumns: ["select", "actions"], - }) - toast.success("계약 목록이 성공적으로 내보내졌습니다.") - } catch (error) { - toast.error("내보내기 중 오류가 발생했습니다.") - } finally { - setIsExporting(false) - } - } - - - const handleDelete = async () => { - if (selectedContracts.length === 0) { - toast.error("계약폐기할 계약을 선택해주세요.") - return - } - - // // 계약폐기 확인 - // const confirmed = window.confirm( - // `선택한 ${selectedContracts.length}개 계약을 폐기하시겠습니까?\n계약폐기 후에는 복구할 수 없습니다.` - // ) - - // if (!confirmed) return - - try { - // 선택된 모든 계약을 폐기 처리 - const deletePromises = selectedContracts.map(contract => - deleteContract(contract.id) - ) - - await Promise.all(deletePromises) - - toast.success(`${selectedContracts.length}개 계약이 폐기되었습니다.`) - - // 테이블 새로고침 - } catch (error) { - console.error('Error deleting contracts:', error) - toast.error("계약폐기 중 오류가 발생했습니다.") - } - } - - return ( -
- {/* 신규 등록 */} - - - {/* 계약폐기 */} - - - {/* Export */} - - - - - - - - 계약 목록 내보내기 - - - -
- ) -} -- cgit v1.2.3