diff options
| author | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-07-15 00:50:39 +0000 |
|---|---|---|
| committer | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-07-15 00:50:39 +0000 |
| commit | 15c3ae6536c264db0508e4fc4aaa59c3e6d1af30 (patch) | |
| tree | 8e2ad5e6a06999bfaaf00ab4ee30083a87050bad /lib/welding/table/ocr-table-toolbar-actions.tsx | |
| parent | d5d27847a7eded9db59462fa744b76772bc9ce1d (diff) | |
(대표님) 기본계약 및 정기평가 작업사항, OCR 변경사항
Diffstat (limited to 'lib/welding/table/ocr-table-toolbar-actions.tsx')
| -rw-r--r-- | lib/welding/table/ocr-table-toolbar-actions.tsx | 22 |
1 files changed, 21 insertions, 1 deletions
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> |
