From a50bc9baea332f996e6bc3a5d70c69f6d2d0f194 Mon Sep 17 00:00:00 2001
From: dujinkim <dujin.kim@dtsolution.co.kr>
Date: Wed, 23 Jul 2025 09:08:03 +0000
Subject: (대표님, 최겸) 기본계약 템플릿 및 에디터, 기술영업 벤더정보, 파일
 보안다운로드, 벤더 document sync 상태 서비스, 메뉴 Config, 기술영업 미사용
 제거
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../template/basic-contract-template-columns.tsx   | 78 +++++++++-------------
 1 file changed, 31 insertions(+), 47 deletions(-)

(limited to 'lib/basic-contract/template/basic-contract-template-columns.tsx')

diff --git a/lib/basic-contract/template/basic-contract-template-columns.tsx b/lib/basic-contract/template/basic-contract-template-columns.tsx
index 3be46791..b7c2fa08 100644
--- a/lib/basic-contract/template/basic-contract-template-columns.tsx
+++ b/lib/basic-contract/template/basic-contract-template-columns.tsx
@@ -3,7 +3,7 @@
 import * as React from "react"
 import { type DataTableRowAction } from "@/types/table"
 import { type ColumnDef } from "@tanstack/react-table"
-import { Download, Ellipsis, Paperclip, CheckCircle, XCircle } from "lucide-react"
+import { Download, Ellipsis, Paperclip, CheckCircle, XCircle, Eye } from "lucide-react"
 import { toast } from "sonner"
 
 import { getErrorMessage } from "@/lib/handle-error"
@@ -29,28 +29,20 @@ import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/comp
 import { DataTableColumnHeaderSimple } from "@/components/data-table/data-table-column-simple-header"
 import { scopeHelpers } from "@/config/basicContractColumnsConfig"
 import { BasicContractTemplate } from "@/db/schema"
+import { quickDownload } from "@/lib/file-download"
+import { useRouter } from "next/navigation"
 
 interface GetColumnsProps {
   setRowAction: React.Dispatch<React.SetStateAction<DataTableRowAction<BasicContractTemplate> | null>>
+  router: ReturnType<typeof useRouter>
 }
 
 /**
- * 파일 다운로드 함수
+ * 파일 다운로드 함수 (공용 유틸리티 사용)
  */
-const handleFileDownload = (filePath: string, fileName: string) => {
+const handleFileDownload = async (filePath: string, fileName: string) => {
   try {
-    // 전체 URL 생성
-    const fullUrl = `${window.location.origin}${filePath}`;
-
-    // a 태그를 생성하여 다운로드 실행
-    const link = document.createElement('a');
-    link.href = fullUrl;
-    link.download = fileName; // 다운로드될 파일명 설정
-    document.body.appendChild(link);
-    link.click();
-    document.body.removeChild(link);
-
-    toast.success("파일 다운로드를 시작합니다.");
+    await quickDownload(filePath, fileName);
   } catch (error) {
     console.error("파일 다운로드 오류:", error);
     toast.error("파일 다운로드 중 오류가 발생했습니다.");
@@ -60,7 +52,7 @@ const handleFileDownload = (filePath: string, fileName: string) => {
 /**
  * tanstack table 컬럼 정의 (중첩 헤더 버전)
  */
-export function getColumns({ setRowAction }: GetColumnsProps): ColumnDef<BasicContractTemplate>[] {
+export function getColumns({ setRowAction, router }: GetColumnsProps): ColumnDef<BasicContractTemplate>[] {
   // ----------------------------------------------------------------
   // 1) select 컬럼 (체크박스)
   // ----------------------------------------------------------------
@@ -126,6 +118,10 @@ export function getColumns({ setRowAction }: GetColumnsProps): ColumnDef<BasicCo
       const [isUpdatePending, startUpdateTransition] = React.useTransition()
       const template = row.original;
 
+      const handleViewDetails = () => {
+        router.push(`/evcp/basic-contract-template/${template.id}`);
+      };
+
       return (
         <DropdownMenu>
           <DropdownMenuTrigger asChild>
@@ -138,6 +134,13 @@ export function getColumns({ setRowAction }: GetColumnsProps): ColumnDef<BasicCo
             </Button>
           </DropdownMenuTrigger>
           <DropdownMenuContent align="end" className="w-40">
+            <DropdownMenuItem onSelect={handleViewDetails}>
+              <Eye className="mr-2 h-4 w-4" />
+              View Details
+            </DropdownMenuItem>
+            
+            <DropdownMenuSeparator />
+            
             <DropdownMenuItem
               onSelect={() => setRowAction({ row, type: "update" })}
             >
@@ -201,45 +204,26 @@ export function getColumns({ setRowAction }: GetColumnsProps): ColumnDef<BasicCo
       header: ({ column }) => <DataTableColumnHeaderSimple column={column} title="계약문서명" />,
       cell: ({ row }) => {
         const template = row.original;
-        const scopeText = scopeHelpers.getScopeDisplayText(template);
+        
+        const handleClick = () => {
+          router.push(`/evcp/basic-contract-template/${template.id}`);
+        };
+
         return (
           <div className="flex flex-col min-w-0">
-            <span className="truncate">{template.templateName}</span>
-            <TooltipProvider>
-              <Tooltip>
-                <TooltipTrigger asChild>
-                  <span className="text-xs text-muted-foreground cursor-help truncate">
-                    {scopeText}
-                  </span>
-                </TooltipTrigger>
-                <TooltipContent>
-                  <div className="space-y-1">
-                    <p className="font-medium">적용 범위:</p>
-                    {scopeHelpers.getApplicableScopeLabels(template).map(label => (
-                      <p key={label} className="text-xs">• {label}</p>
-                    ))}
-                  </div>
-                </TooltipContent>
-              </Tooltip>
-            </TooltipProvider>
+            <button
+              onClick={handleClick}
+              className="truncate text-left hover:text-blue-600 hover:underline cursor-pointer transition-colors"
+              title="클릭하여 상세보기"
+            >
+              {template.templateName}
+            </button>
           </div>
         );
       },
       size: 250,
       enableResizing: true,
     },
-    {
-      accessorKey: "templateCode",
-      header: ({ column }) => <DataTableColumnHeaderSimple column={column} title="계약문서 번호" />,
-      cell: ({ row }) => {
-        const template = row.original;
-        return (
-            <span className="font-medium">{template.templateCode}</span>
-        );
-      },
-      size: 120,
-      enableResizing: true,
-    },
     {
       accessorKey: "revision",
       header: ({ column }) => <DataTableColumnHeaderSimple column={column} title="Rev." />,
-- 
cgit v1.2.3

