diff options
| author | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-06-05 01:53:35 +0000 |
|---|---|---|
| committer | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-06-05 01:53:35 +0000 |
| commit | 610d3bccf1cb640e2a21df28d8d2a954c2bf337e (patch) | |
| tree | e7e6d72fecf14ddcff1b5b52263d14119b7c488c /lib/vendor-document-list/table/enhanced-doc-table-toolbar-actions.tsx | |
| parent | 15969dfedffc4e215c81d507164bc2bb383974e5 (diff) | |
(대표님) 변경사항 0604 - OCR 관련 및 drizzle generated sqls
Diffstat (limited to 'lib/vendor-document-list/table/enhanced-doc-table-toolbar-actions.tsx')
| -rw-r--r-- | lib/vendor-document-list/table/enhanced-doc-table-toolbar-actions.tsx | 57 |
1 files changed, 44 insertions, 13 deletions
diff --git a/lib/vendor-document-list/table/enhanced-doc-table-toolbar-actions.tsx b/lib/vendor-document-list/table/enhanced-doc-table-toolbar-actions.tsx index fa1b957b..3960bbce 100644 --- a/lib/vendor-document-list/table/enhanced-doc-table-toolbar-actions.tsx +++ b/lib/vendor-document-list/table/enhanced-doc-table-toolbar-actions.tsx @@ -1,8 +1,7 @@ "use client" - import * as React from "react" import { type Table } from "@tanstack/react-table" -import { Download, Upload, Plus, Files } from "lucide-react" +import { Download, Upload, Plus, Files, RefreshCw } from "lucide-react" import { toast } from "sonner" import { exportTableToExcel } from "@/lib/export" @@ -13,6 +12,8 @@ import { DeleteDocumentsDialog } from "./delete-docs-dialog" import { BulkUploadDialog } from "./bulk-upload-dialog" import type { EnhancedDocument } from "@/types/enhanced-documents" import { SendToSHIButton } from "./send-to-shi-button" +import { ImportFromDOLCEButton } from "./import-from-dolce-button" +import { SWPWorkflowPanel } from "./swp-workflow-panel" interface EnhancedDocTableToolbarActionsProps { table: Table<EnhancedDocument> @@ -50,9 +51,17 @@ export function EnhancedDocTableToolbarActions({ }, 500) } + const handleImportComplete = () => { + // 가져오기 완료 후 테이블 새로고침 + table.resetRowSelection() + setTimeout(() => { + window.location.reload() + }, 500) + } + return ( <div className="flex items-center gap-2"> - {/* 기존 액션들 */} + {/* 삭제 버튼 */} {table.getFilteredSelectedRowModel().rows.length > 0 ? ( <DeleteDocumentsDialog documents={table @@ -62,14 +71,27 @@ export function EnhancedDocTableToolbarActions({ /> ) : null} - {/* ✅ AddDocumentListDialog에 필요한 props 전달 */} - <AddDocumentListDialog - projectType={projectType} - contractId={selectedPackageId} - onSuccess={handleDocumentAdded} // ✅ 성공 콜백 추가 - /> - - {/* 일괄 업로드 버튼 */} + {/* projectType에 따른 조건부 렌더링 */} + {projectType === "ship" ? ( + <> + {/* SHIP: DOLCE에서 목록 가져오기 */} + <ImportFromDOLCEButton + contractId={selectedPackageId} + onImportComplete={handleImportComplete} + /> + </> + ) : ( + <> + {/* PLANT: 수동 문서 추가 */} + <AddDocumentListDialog + projectType={projectType} + contractId={selectedPackageId} + onSuccess={handleDocumentAdded} + /> + </> + )} + + {/* 일괄 업로드 버튼 (공통) */} <Button variant="outline" onClick={() => setBulkUploadDialogOpen(true)} @@ -79,7 +101,7 @@ export function EnhancedDocTableToolbarActions({ 일괄 업로드 </Button> - {/* Export 버튼 */} + {/* Export 버튼 (공통) */} <Button variant="outline" size="sm" @@ -95,7 +117,7 @@ export function EnhancedDocTableToolbarActions({ <span className="hidden sm:inline">Export</span> </Button> - {/* ✅ 새로운 Send to SHI 버튼으로 교체 */} + {/* Send to SHI 버튼 (공통) - 내부 → 외부로 보내기 */} <SendToSHIButton contractId={selectedPackageId} documents={allDocuments} @@ -103,6 +125,15 @@ export function EnhancedDocTableToolbarActions({ projectType={projectType} /> + {/* SWP 전용 워크플로우 패널 */} + {projectType === "plant" && ( + <SWPWorkflowPanel + contractId={selectedPackageId} + documents={allDocuments} + onWorkflowUpdate={handleSyncComplete} + /> + )} + {/* 일괄 업로드 다이얼로그 */} <BulkUploadDialog open={bulkUploadDialogOpen} |
