From aa86729f9a2ab95346a2851e3837de1c367aae17 Mon Sep 17 00:00:00 2001
From: dujinkim <dujin.kim@dtsolution.co.kr>
Date: Fri, 20 Jun 2025 11:37:31 +0000
Subject: (대표님) 20250620 작업사항
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../table/project-gtc-table-toolbar-actions.tsx    | 74 ++++++++++++++++++++++
 1 file changed, 74 insertions(+)
 create mode 100644 lib/project-gtc/table/project-gtc-table-toolbar-actions.tsx

(limited to 'lib/project-gtc/table/project-gtc-table-toolbar-actions.tsx')

diff --git a/lib/project-gtc/table/project-gtc-table-toolbar-actions.tsx b/lib/project-gtc/table/project-gtc-table-toolbar-actions.tsx
new file mode 100644
index 00000000..ec6ba053
--- /dev/null
+++ b/lib/project-gtc/table/project-gtc-table-toolbar-actions.tsx
@@ -0,0 +1,74 @@
+"use client"
+
+import * as React from "react"
+import { useRouter } from "next/navigation"
+import { type Table } from "@tanstack/react-table"
+import { Download, Plus } from "lucide-react"
+
+import { exportTableToExcel } from "@/lib/export"
+import { Button } from "@/components/ui/button"
+import { DeleteGtcFileDialog } from "./delete-gtc-file-dialog"
+import { AddProjectDialog } from "./add-project-dialog"
+import { ProjectGtcView } from "@/db/schema"
+
+interface ProjectGtcTableToolbarActionsProps {
+  table: Table<ProjectGtcView>
+}
+
+export function ProjectGtcTableToolbarActions({ table }: ProjectGtcTableToolbarActionsProps) {
+  const router = useRouter()
+  const [showAddProjectDialog, setShowAddProjectDialog] = React.useState(false)
+
+  return (
+    <div className="flex items-center gap-2">
+      {/** 1) 선택된 로우가 있으면 삭제 다이얼로그 */}
+      {table.getFilteredSelectedRowModel().rows.length > 0 ? (
+        <DeleteGtcFileDialog
+          projects={table
+            .getFilteredSelectedRowModel()
+            .rows.map((row) => row.original)}
+          onSuccess={() => {
+            table.toggleAllRowsSelected(false)
+            router.refresh()
+          }}
+        />
+      ) : null}
+
+      {/** 2) GTC 추가 버튼 */}
+      <Button
+      variant="outline"
+        size="sm"
+        onClick={() => setShowAddProjectDialog(true)}
+        className="gap-2"
+      >
+        <Plus className="size-4" aria-hidden="true" />
+        <span className="hidden sm:inline">GTC 추가</span>
+      </Button>
+
+      {/** 3) Export 버튼 */}
+      <Button
+        variant="outline"
+        size="sm"
+        onClick={() =>
+          exportTableToExcel(table, {
+            filename: "project-gtc-list",
+            excludeColumns: ["select", "download", "actions"],
+          })
+        }
+        className="gap-2"
+      >
+        <Download className="size-4" aria-hidden="true" />
+        <span className="hidden sm:inline">Export</span>
+      </Button>
+
+      {/** 4) 프로젝트 추가 다이얼로그 */}
+      <AddProjectDialog
+        open={showAddProjectDialog}
+        onOpenChange={setShowAddProjectDialog}
+        onSuccess={() => {
+          router.refresh()
+        }}
+      />
+    </div>
+  )
+} 
\ No newline at end of file
-- 
cgit v1.2.3

