From 7548e2ad6948f1c6aa102fcac408bc6c9c0f9796 Mon Sep 17 00:00:00 2001
From: dujinkim <dujin.kim@dtsolution.co.kr>
Date: Wed, 27 Aug 2025 12:06:26 +0000
Subject: (대표님, 최겸) 기본계약, 입찰, 파일라우트, 계약서명라우트,
 인포메이션, 메뉴설정, PQ(메일템플릿 관련)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 lib/basic-contract/status/basic-contract-table.tsx | 44 +++++++++++-----------
 1 file changed, 21 insertions(+), 23 deletions(-)

(limited to 'lib/basic-contract/status/basic-contract-table.tsx')

diff --git a/lib/basic-contract/status/basic-contract-table.tsx b/lib/basic-contract/status/basic-contract-table.tsx
index 22845144..07707ff0 100644
--- a/lib/basic-contract/status/basic-contract-table.tsx
+++ b/lib/basic-contract/status/basic-contract-table.tsx
@@ -14,9 +14,9 @@ import type {
 import { toast } from "sonner";
 import { getColumns } from "./basic-contract-columns";
 import { getBasicContracts } from "../service";
-import { BasicContractView } from "@/db/schema";
+import { BasicContractTemplateStatsView } from "@/db/schema";
 import { BasicContractTableToolbarActions } from "./basicContract-table-toolbar-actions";
-
+import { useRouter } from "next/navigation"
 
 interface BasicTemplateTableProps {
   promises: Promise<
@@ -26,38 +26,36 @@ interface BasicTemplateTableProps {
   >
 }
 
-
 export function BasicContractsTable({ promises }: BasicTemplateTableProps) {
 
-
   const [rowAction, setRowAction] =
-    React.useState<DataTableRowAction<BasicContractView> | null>(null)
-
+    React.useState<DataTableRowAction<BasicContractTemplateStatsView> | null>(null)
+    const router = useRouter()
 
   const [{ data, pageCount }] =
     React.use(promises)
 
   // 컬럼 설정 - 외부 파일에서 가져옴
   const columns = React.useMemo(
-    () => getColumns({ setRowAction }),
-    [setRowAction]
+    () => getColumns({ setRowAction,router }),
+    [setRowAction,router]
   )
 
   // config 기반으로 필터 필드 설정
-  const advancedFilterFields: DataTableAdvancedFilterField<BasicContractView>[] = [
+  const advancedFilterFields: DataTableAdvancedFilterField<BasicContractTemplateStatsView>[] = [
     { id: "templateName", label: "템플릿명", type: "text" },
-    {
-      id: "status", label: "상태", type: "select", options: [
-        { label: "활성", value: "ACTIVE" },
-        { label: "비활성", value: "INACTIVE" },
-      ]
-    },
-    { id: "userName", label: "요청자", type: "text" },
-    { id: "vendorName", label: "업체명", type: "text" },
-    { id: "vendorCode", label: "업체코드", type: "text" },
-    { id: "vendorEmail", label: "업체대표이메일", type: "text" },
-    { id: "createdAt", label: "생성일", type: "date" },
-    { id: "updatedAt", label: "수정일", type: "date" },
+    { id: "revision", label: "리비전", type: "number" },
+    { id: "validityPeriod", label: "유효기간(개월)", type: "number" },
+    { id: "totalSentCount", label: "발송건수", type: "number" },
+    { id: "overdueCount", label: "지연건수", type: "number" },
+    { id: "unsignedCount", label: "미서명건수", type: "number" },
+    { id: "legalRequestCount", label: "법무요청건수", type: "number" },
+    { id: "legalCompletedCount", label: "법무완료건수", type: "number" },
+    { id: "contractCompletedCount", label: "계약완료건수", type: "number" },
+    { id: "rejectedCount", label: "거절건수", type: "number" },
+    { id: "avgProcessingDays", label: "평균처리일", type: "number" },
+    { id: "templateCreatedAt", label: "템플릿 생성일", type: "date" },
+    { id: "lastActivityDate", label: "최근활동일", type: "date" },
   ];
 
   const { table } = useDataTable({
@@ -68,10 +66,10 @@ export function BasicContractsTable({ promises }: BasicTemplateTableProps) {
     enablePinning: true,
     enableAdvancedFilter: true,
     initialState: {
-      sorting: [{ id: "createdAt", desc: true }],
+      sorting: [{ id: "lastActivityDate", desc: true }],
       columnPinning: { right: ["actions"] },
     },
-    getRowId: (originalRow) => String(originalRow.id),
+    getRowId: (originalRow) => String(originalRow.templateId),
     shallow: false,
     clearOnDefault: true,
   })
-- 
cgit v1.2.3

