From 53ad72732f781e6c6d5ddb3776ea47aec010af8e Mon Sep 17 00:00:00 2001
From: dujinkim <dujin.kim@dtsolution.co.kr>
Date: Mon, 4 Aug 2025 09:39:21 +0000
Subject: (최겸) PQ/실사 수정 및 개발
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 lib/pq/table/pq-lists-toolbar.tsx | 61 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 61 insertions(+)
 create mode 100644 lib/pq/table/pq-lists-toolbar.tsx

(limited to 'lib/pq/table/pq-lists-toolbar.tsx')

diff --git a/lib/pq/table/pq-lists-toolbar.tsx b/lib/pq/table/pq-lists-toolbar.tsx
new file mode 100644
index 00000000..3a85327d
--- /dev/null
+++ b/lib/pq/table/pq-lists-toolbar.tsx
@@ -0,0 +1,61 @@
+"use client"
+
+import * as React from "react"
+import { Button } from "@/components/ui/button"
+import { Trash, CopyPlus, Plus } from "lucide-react"
+import { type Table } from "@tanstack/react-table"
+import type { PQList } from "./pq-lists-columns"
+// import { PqListForm } from "./add-pq-list-dialog"
+
+interface PQListsToolbarActionsProps {
+  table: Table<PQList>;
+  onAddClick: () => void;
+  onCopyClick: () => void;
+  onToggleActive: (rows: PQList[], newIsDeleted: boolean) => void;
+}
+
+export function PQListsToolbarActions({
+  table,
+  onAddClick,
+  onCopyClick,
+  onToggleActive,
+}: PQListsToolbarActionsProps) {
+  const selected = table.getFilteredSelectedRowModel().rows.map(r => r.original);
+  const allActive = selected.length > 0 && selected.every(item => !item.isDeleted);
+  const allDeleted = selected.length > 0 && selected.every(item => item.isDeleted);
+  
+  let toggleLabel = "";
+  let newState: boolean | undefined;
+  if (selected.length > 0) {
+    if (allActive) {
+      toggleLabel = "비활성화";
+      newState = true;
+    } else if (allDeleted) {
+      toggleLabel = "활성화";
+      newState = false;
+    }
+  }
+  
+  return (
+    <div className="flex items-center gap-2">
+      {selected.length > 0 && (allActive || allDeleted) && newState !== undefined && (
+        <Button
+          variant="outline"
+          size="sm"
+          onClick={() => onToggleActive(selected, newState!)}
+        >
+          <Trash className="mr-2 h-4 w-4" />
+          {toggleLabel}
+        </Button>
+      )}
+      <Button size="sm" onClick={onAddClick}>
+        <Plus className="mr-2 h-4 w-4" />
+        추가
+      </Button>
+      <Button size="sm" variant="outline" onClick={onCopyClick}>
+        <CopyPlus className="mr-2 h-4 w-4" />
+        복사
+      </Button>
+    </div>
+  );
+}
-- 
cgit v1.2.3

