From 1dc24d48e52f2e490f5603ceb02842586ecae533 Mon Sep 17 00:00:00 2001
From: dujinkim <dujin.kim@dtsolution.co.kr>
Date: Thu, 24 Jul 2025 11:06:32 +0000
Subject: (대표님) 정기평가 피드백 반영, 설계 피드백 반영, (최겸) 기술영업
 피드백 반영
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../table/evaluation-targets-toolbar-actions.tsx   | 32 ++++++++++++++++++++--
 1 file changed, 30 insertions(+), 2 deletions(-)

(limited to 'lib/evaluation-target-list/table/evaluation-targets-toolbar-actions.tsx')

diff --git a/lib/evaluation-target-list/table/evaluation-targets-toolbar-actions.tsx b/lib/evaluation-target-list/table/evaluation-targets-toolbar-actions.tsx
index d1c7e500..6a493d8e 100644
--- a/lib/evaluation-target-list/table/evaluation-targets-toolbar-actions.tsx
+++ b/lib/evaluation-target-list/table/evaluation-targets-toolbar-actions.tsx
@@ -10,7 +10,8 @@ import {
   Download,
   Upload,
   RefreshCw,
-  Settings
+  Settings,
+  Trash2
 } from "lucide-react"
 import { toast } from "sonner"
 import { useRouter } from "next/navigation"
@@ -30,6 +31,7 @@ import {
   ExcludeTargetsDialog,
   RequestReviewDialog
 } from "./evaluation-target-action-dialogs"
+import { DeleteTargetsDialog } from "./delete-targets-dialog"
 import { EvaluationTargetWithDepartments } from "@/db/schema"
 import { exportTableToExcel } from "@/lib/export"
 import { autoGenerateEvaluationTargets } from "../service" // 서버 액션 import
@@ -49,6 +51,7 @@ export function EvaluationTargetsTableToolbarActions({
   const [confirmDialogOpen, setConfirmDialogOpen] = React.useState(false)
   const [excludeDialogOpen, setExcludeDialogOpen] = React.useState(false)
   const [reviewDialogOpen, setReviewDialogOpen] = React.useState(false)
+  const [deleteDialogOpen, setDeleteDialogOpen] = React.useState(false)
   const router = useRouter()
   const { data: session } = useSession()
 
@@ -137,7 +140,8 @@ export function EvaluationTargetsTableToolbarActions({
       consensusNull,
       canConfirm: pending > 0 && consensusTrue > 0,
       canExclude: pending > 0,
-      canRequestReview: pending > 0
+      canRequestReview: pending > 0,
+      canDelete: pending > 0 // 삭제는 PENDING 상태인 것만 가능
     }
   }, [
     pendingTargets.length,
@@ -308,6 +312,22 @@ export function EvaluationTargetsTableToolbarActions({
               </Button>
             )}
 
+            {/* 삭제 버튼 */}
+            {selectedStats.canDelete && (
+              <Button
+                variant="destructive"
+                size="sm"
+                className="gap-2"
+                onClick={() => setDeleteDialogOpen(true)}
+                disabled={isLoading}
+              >
+                <Trash2 className="size-4" aria-hidden="true" />
+                <span className="hidden sm:inline">
+                  삭제 ({selectedStats.pending})
+                </span>
+              </Button>
+            )}
+
             {/* 의견 요청 버튼 */}
             {selectedStats.canRequestReview && (
               <Button
@@ -369,6 +389,14 @@ export function EvaluationTargetsTableToolbarActions({
             targets={selectedTargets}
             onSuccess={handleActionSuccess}
           />
+
+          {/* 삭제 컨펌 다이얼로그 */}
+          <DeleteTargetsDialog
+            open={deleteDialogOpen}
+            onOpenChange={setDeleteDialogOpen}
+            targets={pendingTargets} // PENDING 상태인 타겟들만 전달
+            onSuccess={handleActionSuccess}
+          />
         </>
       )}
     </>
-- 
cgit v1.2.3

