From 25749225689c3934bc10ad1e8285e13020b61282 Mon Sep 17 00:00:00 2001
From: dujinkim <dujin.kim@dtsolution.co.kr>
Date: Thu, 4 Dec 2025 09:04:09 +0000
Subject: (최겸)구매 입찰, 계약 수정
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../list/biddings-table-toolbar-actions.tsx        | 54 ++++++++++++++++------
 1 file changed, 39 insertions(+), 15 deletions(-)

(limited to 'lib/bidding/list/biddings-table-toolbar-actions.tsx')

diff --git a/lib/bidding/list/biddings-table-toolbar-actions.tsx b/lib/bidding/list/biddings-table-toolbar-actions.tsx
index 33368218..b0007c8c 100644
--- a/lib/bidding/list/biddings-table-toolbar-actions.tsx
+++ b/lib/bidding/list/biddings-table-toolbar-actions.tsx
@@ -7,7 +7,7 @@ import {
 } from "lucide-react"
 import { toast } from "sonner"
 import { useSession } from "next-auth/react"
-import { exportTableToExcel } from "@/lib/export"
+import { exportBiddingsToExcel } from "./export-biddings-to-excel"
 import { Button } from "@/components/ui/button"
 import {
   DropdownMenu,
@@ -92,6 +92,23 @@ export function BiddingsTableToolbarActions({ table }: BiddingsTableToolbarActio
     return selectedBiddings.length === 1 && selectedBiddings[0].status === 'bidding_generated'
   }, [selectedBiddings])
 
+  // Excel 내보내기 핸들러
+  const handleExport = React.useCallback(async () => {
+    try {
+      setIsExporting(true)
+      await exportBiddingsToExcel(table, {
+        filename: "입찰목록",
+        onlySelected: false,
+      })
+      toast.success("Excel 파일이 다운로드되었습니다.")
+    } catch (error) {
+      console.error("Excel export error:", error)
+      toast.error("Excel 내보내기 중 오류가 발생했습니다.")
+    } finally {
+      setIsExporting(false)
+    }
+  }, [table])
+
   return (
     <>
       <div className="flex items-center gap-2">
@@ -100,6 +117,17 @@ export function BiddingsTableToolbarActions({ table }: BiddingsTableToolbarActio
           // 성공 시 테이블 새로고침 등 추가 작업
           // window.location.reload()
         }} />
+        {/* Excel 내보내기 버튼 */}
+        <Button
+          variant="outline"
+          size="sm"
+          onClick={handleExport}
+          disabled={isExporting}
+          className="gap-2"
+        >
+          <FileSpreadsheet className="size-4" aria-hidden="true" />
+          <span className="hidden sm:inline">{isExporting ? "내보내는 중..." : "Excel 내보내기"}</span>
+        </Button>
         {/* 전송하기 (업체선정 완료된 입찰만) */}
         <Button
           variant="default"
@@ -112,20 +140,16 @@ export function BiddingsTableToolbarActions({ table }: BiddingsTableToolbarActio
           <span className="hidden sm:inline">전송하기</span>
         </Button>
         {/* 삭제 버튼 */}
-
-          <Button
-            variant="destructive"
-            size="sm"
-            onClick={() => setIsDeleteDialogOpen(true)}
-            disabled={!canDelete}
-            className="gap-2"
-          >
-            <Trash className="size-4" aria-hidden="true" />
-            <span className="hidden sm:inline">삭제</span>
-          </Button>
-
-
-
+        <Button
+          variant="destructive"
+          size="sm"
+          onClick={() => setIsDeleteDialogOpen(true)}
+          disabled={!canDelete}
+          className="gap-2"
+        >
+          <Trash className="size-4" aria-hidden="true" />
+          <span className="hidden sm:inline">삭제</span>
+        </Button>
       </div>
 
       {/* 전송 다이얼로그 */}
-- 
cgit v1.2.3

