From c228a89c2834ee63b209bad608837c39643f350e Mon Sep 17 00:00:00 2001 From: dujinkim Date: Mon, 28 Jul 2025 11:44:16 +0000 Subject: (대표님) 의존성 docx 추가, basicContract API, gtc(계약일반조건), 벤더평가 esg 평가데이터 내보내기 개선, S-EDP 피드백 대응(CLS_ID, ITEM NO 등) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../table/gtc-clauses-table-toolbar-actions.tsx | 195 +++++++++++++++++++++ 1 file changed, 195 insertions(+) create mode 100644 lib/gtc-contract/gtc-clauses/table/gtc-clauses-table-toolbar-actions.tsx (limited to 'lib/gtc-contract/gtc-clauses/table/gtc-clauses-table-toolbar-actions.tsx') diff --git a/lib/gtc-contract/gtc-clauses/table/gtc-clauses-table-toolbar-actions.tsx b/lib/gtc-contract/gtc-clauses/table/gtc-clauses-table-toolbar-actions.tsx new file mode 100644 index 00000000..2a7452ef --- /dev/null +++ b/lib/gtc-contract/gtc-clauses/table/gtc-clauses-table-toolbar-actions.tsx @@ -0,0 +1,195 @@ +"use client" + +import * as React from "react" +import { type Table } from "@tanstack/react-table" +import { + Download, + Upload, + Settings2, + ArrowUpDown, + Edit, + Eye, + FileText, + Wand2 +} from "lucide-react" + +import { Button } from "@/components/ui/button" +import { + DropdownMenu, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuSeparator, + DropdownMenuTrigger, +} from "@/components/ui/dropdown-menu" +import { + Tooltip, + TooltipContent, + TooltipProvider, + TooltipTrigger, +} from "@/components/ui/tooltip" + +import { type GtcClauseTreeView } from "@/db/schema/gtc" +import { CreateGtcClauseDialog } from "./create-gtc-clause-dialog" +import { PreviewDocumentDialog } from "./preview-document-dialog" +import { DeleteGtcClausesDialog } from "./delete-gtc-clauses-dialog" + +interface GtcClausesTableToolbarActionsProps { + table: Table + documentId: number + document: any +} + +export function GtcClausesTableToolbarActions({ + table, + documentId, + document, +}: GtcClausesTableToolbarActionsProps) { + const [showCreateDialog, setShowCreateDialog] = React.useState(false) + const [showReorderDialog, setShowReorderDialog] = React.useState(false) + const [showBulkUpdateDialog, setShowBulkUpdateDialog] = React.useState(false) + const [showGenerateVariablesDialog, setShowGenerateVariablesDialog] = React.useState(false) + const [showPreviewDialog, setShowPreviewDialog] = React.useState(false) // ✅ 미리보기 다이얼로그 상태 + + const selectedRows = table.getSelectedRowModel().rows + const selectedCount = selectedRows.length + + // ✅ 테이블의 모든 데이터 가져오기 + const allClauses = table.getRowModel().rows.map(row => row.original) + + const handleExportToExcel = () => { + // Excel 내보내기 로직 + console.log("Export to Excel") + } + + const handleImportFromExcel = () => { + // Excel 가져오기 로직 + console.log("Import from Excel") + } + + const handlePreviewDocument = () => { + // ✅ 미리보기 다이얼로그 열기 + setShowPreviewDialog(true) + } + + const handleGenerateDocument = () => { + // 최종 문서 생성 + console.log("Generate final document") + } + + const handleReorderClauses = () => { + setShowReorderDialog(true) + } + + const handleBulkUpdate = () => { + setShowBulkUpdateDialog(true) + } + + const handleGenerateVariables = () => { + setShowGenerateVariablesDialog(true) + } + + const handleRefreshTable = () => { + // 테이블 새로고침 로직 + console.log("Refresh table after creation") + // table.reset() 또는 상위 컴포넌트의 refetch 함수 호출 + } + + return ( + <> +
+ {/* 조항 추가 버튼 */} + + + {/* 선택된 항목이 있을 때 표시되는 액션들 */} + {selectedCount > 0 && ( + <> + table.toggleAllRowsSelected(false)} + + /> + + )} + + {/* 관리 도구 드롭다운 */} + + + + + + {/* + + 조항 순서 변경 + + + + + PDFTron 변수명 일괄 생성 + */} + + + + + + Excel로 내보내기 + + + + + Excel에서 가져오기 + + + + + + + 문서 미리보기 + + + {/* + + 최종 문서 생성 + */} + + + + {/* 조건부로 표시되는 다이얼로그들 */} + {showReorderDialog && ( +
+ {/* ReorderGtcClausesDialog 컴포넌트가 여기에 올 예정 */} +
+ )} + + {showBulkUpdateDialog && ( +
+ {/* BulkUpdateGtcClausesDialog 컴포넌트가 여기에 올 예정 */} +
+ )} + + {showGenerateVariablesDialog && ( +
+ {/* GenerateVariableNamesDialog 컴포넌트가 여기에 올 예정 */} +
+ )} +
+ + {/* ✅ 미리보기 다이얼로그 */} + { + console.log("Export from preview dialog") + }} + /> + + ) +} \ No newline at end of file -- cgit v1.2.3