From 50ae0b8f02c034e60d4cbb504620dfa1575a836f Mon Sep 17 00:00:00 2001
From: dujinkim <dujin.kim@dtsolution.co.kr>
Date: Mon, 28 Jul 2025 09:19:42 +0000
Subject: (박서영) 설계 document Numbering Rule 개발-최겸 업로드
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../table/code-groups-table-toolbar.tsx            | 38 ++++++++++++++++++++++
 1 file changed, 38 insertions(+)
 create mode 100644 lib/docu-list-rule/code-groups/table/code-groups-table-toolbar.tsx

(limited to 'lib/docu-list-rule/code-groups/table/code-groups-table-toolbar.tsx')

diff --git a/lib/docu-list-rule/code-groups/table/code-groups-table-toolbar.tsx b/lib/docu-list-rule/code-groups/table/code-groups-table-toolbar.tsx
new file mode 100644
index 00000000..d2d9efb4
--- /dev/null
+++ b/lib/docu-list-rule/code-groups/table/code-groups-table-toolbar.tsx
@@ -0,0 +1,38 @@
+"use client"
+
+import * as React from "react"
+import { type Table } from "@tanstack/react-table"
+
+import { DeleteCodeGroupsDialog } from "./delete-code-groups-dialog"
+import { CodeGroupsAddDialog } from "./code-groups-add-dialog"
+import { codeGroups } from "@/db/schema/codeGroups"
+
+interface CodeGroupsTableToolbarActionsProps<TData> {
+  table: Table<TData>
+  onSuccess?: () => void
+}
+
+export function CodeGroupsTableToolbarActions<TData>({
+  table,
+  onSuccess,
+}: CodeGroupsTableToolbarActionsProps<TData>) {
+  const selectedRows = table.getFilteredSelectedRowModel().rows
+  const selectedCodeGroups = selectedRows.map((row) => row.original as typeof codeGroups.$inferSelect)
+
+  return (
+    <div className="flex items-center gap-2">
+      {/** 1) 선택된 로우가 있으면 삭제 다이얼로그 */}
+      {selectedCodeGroups.length > 0 ? (
+        <DeleteCodeGroupsDialog
+          codeGroups={selectedCodeGroups}
+          onSuccess={() => {
+            table.toggleAllRowsSelected(false)
+            onSuccess?.()
+          }}
+        />
+      ) : null}
+
+      <CodeGroupsAddDialog onSuccess={onSuccess} />
+    </div>
+  )
+} 
\ No newline at end of file
-- 
cgit v1.2.3

