From 15c3ae6536c264db0508e4fc4aaa59c3e6d1af30 Mon Sep 17 00:00:00 2001
From: dujinkim <dujin.kim@dtsolution.co.kr>
Date: Tue, 15 Jul 2025 00:50:39 +0000
Subject: (대표님) 기본계약 및 정기평가 작업사항, OCR 변경사항
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 lib/welding/table/ocr-table-toolbar-actions.tsx | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

(limited to 'lib/welding/table/ocr-table-toolbar-actions.tsx')

diff --git a/lib/welding/table/ocr-table-toolbar-actions.tsx b/lib/welding/table/ocr-table-toolbar-actions.tsx
index 03d8cab0..a6a38adc 100644
--- a/lib/welding/table/ocr-table-toolbar-actions.tsx
+++ b/lib/welding/table/ocr-table-toolbar-actions.tsx
@@ -2,7 +2,7 @@
 
 import * as React from "react"
 import { type Table } from "@tanstack/react-table"
-import { Download, RefreshCcw, Upload, FileText, Loader2, ChevronDown, X, Play, Pause, RotateCcw } from "lucide-react"
+import { Download, RefreshCcw, Upload, FileText, Loader2, ChevronDown, X, Play, Pause, RotateCcw, Trash } from "lucide-react"
 
 import { Button } from "@/components/ui/button"
 import { Input } from "@/components/ui/input"
@@ -48,6 +48,7 @@ import {
 } from "@/components/ui/file-list"
 import { getOcrAllRows } from "../service"
 import { exportOcrDataToExcel } from "./exporft-ocr-data"
+import { DeleteOcrRowsDialog } from "./delete-ocr-rows-dialog"
 
 interface OcrTableToolbarActionsProps {
   table: Table<OcrRow>
@@ -96,6 +97,9 @@ export function OcrTableToolbarActions({ table }: OcrTableToolbarActionsProps) {
   const [isPaused, setIsPaused] = React.useState(false)
   const batchControllerRef = React.useRef<AbortController | null>(null)
 
+  // 선택된 행들
+  const selectedRows = table.getFilteredSelectedRowModel().rows
+
   // 단일 파일 업로드 다이얼로그 닫기 핸들러
   const handleDialogOpenChange = (open: boolean) => {
     if (!open) {
@@ -522,6 +526,14 @@ export function OcrTableToolbarActions({ table }: OcrTableToolbarActionsProps) {
     }
   }
 
+  // 삭제 후 콜백 - 테이블 새로고침
+  const handleDeleteSuccess = () => {
+    // 선택 해제
+    table.resetRowSelection()
+    // 페이지 새로고침
+    window.location.reload()
+  }
+
   const getStatusBadgeVariant = (status: FileUploadItem['status']) => {
     switch (status) {
       case 'pending': return 'secondary'
@@ -554,6 +566,14 @@ export function OcrTableToolbarActions({ table }: OcrTableToolbarActionsProps) {
 
   return (
     <div className="flex items-center gap-2">
+      {/* 선택된 행이 있을 때만 삭제 버튼 표시 */}
+      {selectedRows.length > 0 && (
+        <DeleteOcrRowsDialog
+          ocrRows={selectedRows}
+          onSuccess={handleDeleteSuccess}
+        />
+      )}
+
       {/* 단일 파일 OCR 업로드 다이얼로그 */}
       <Dialog open={isUploadDialogOpen} onOpenChange={handleDialogOpenChange}>
         <DialogTrigger asChild>
-- 
cgit v1.2.3

