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/delete-combo-box-settings-dialog.tsx     | 85 ++++++++++++++++++++++
 1 file changed, 85 insertions(+)
 create mode 100644 lib/docu-list-rule/combo-box-settings/table/delete-combo-box-settings-dialog.tsx

(limited to 'lib/docu-list-rule/combo-box-settings/table/delete-combo-box-settings-dialog.tsx')

diff --git a/lib/docu-list-rule/combo-box-settings/table/delete-combo-box-settings-dialog.tsx b/lib/docu-list-rule/combo-box-settings/table/delete-combo-box-settings-dialog.tsx
new file mode 100644
index 00000000..28788bd7
--- /dev/null
+++ b/lib/docu-list-rule/combo-box-settings/table/delete-combo-box-settings-dialog.tsx
@@ -0,0 +1,85 @@
+"use client"
+
+import * as React from "react"
+import { useRouter } from "next/navigation"
+import { AlertTriangle } from "lucide-react"
+
+import { Button } from "@/components/ui/button"
+import {
+  Dialog,
+  DialogContent,
+  DialogDescription,
+  DialogFooter,
+  DialogHeader,
+  DialogTitle,
+} from "@/components/ui/dialog"
+import { deleteCodeGroup } from "@/lib/docu-list-rule/code-groups/service"
+import { codeGroups } from "@/db/schema/codeGroups"
+
+interface DeleteComboBoxSettingsDialogProps {
+  codeGroups: typeof codeGroups.$inferSelect[]
+  onSuccess?: () => void
+}
+
+export function DeleteComboBoxSettingsDialog({
+  codeGroups,
+  onSuccess,
+}: DeleteComboBoxSettingsDialogProps) {
+  const router = useRouter()
+  const [isDeleting, setIsDeleting] = React.useState(false)
+
+  const handleDelete = React.useCallback(async () => {
+    if (codeGroups.length === 0) return
+
+    setIsDeleting(true)
+    try {
+      for (const codeGroup of codeGroups) {
+        await deleteCodeGroup(codeGroup.id)
+      }
+      
+      router.refresh()
+      onSuccess?.()
+    } catch (error) {
+      console.error("Error deleting code groups:", error)
+    } finally {
+      setIsDeleting(false)
+    }
+  }, [codeGroups, router, onSuccess])
+
+  if (codeGroups.length === 0) {
+    return null
+  }
+
+  return (
+    <Dialog>
+      <DialogContent>
+        <DialogHeader>
+          <DialogTitle className="flex items-center gap-2">
+            <AlertTriangle className="h-5 w-5 text-destructive" />
+            Code Group 삭제
+          </DialogTitle>
+          <DialogDescription>
+            선택한 Code Group{codeGroups.length > 1 ? "들" : ""}을 삭제하시겠습니까?
+            <br />
+            이 작업은 되돌릴 수 없습니다.
+          </DialogDescription>
+        </DialogHeader>
+        <DialogFooter>
+          <Button
+            variant="outline"
+            disabled={isDeleting}
+          >
+            취소
+          </Button>
+          <Button
+            variant="destructive"
+            onClick={handleDelete}
+            disabled={isDeleting}
+          >
+            {isDeleting ? "삭제 중..." : "삭제"}
+          </Button>
+        </DialogFooter>
+      </DialogContent>
+    </Dialog>
+  )
+} 
\ No newline at end of file
-- 
cgit v1.2.3

