From 8b23b471638a155fd1bfa3a8c853b26d9315b272 Mon Sep 17 00:00:00 2001
From: dujinkim <dujin.kim@dtsolution.co.kr>
Date: Fri, 26 Sep 2025 09:57:24 +0000
Subject: (대표님) 권한관리, 문서업로드, rfq첨부, SWP문서룰 등 (최겸) 입찰
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 lib/vendors/contacts-table/contact-table.tsx | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

(limited to 'lib/vendors/contacts-table/contact-table.tsx')

diff --git a/lib/vendors/contacts-table/contact-table.tsx b/lib/vendors/contacts-table/contact-table.tsx
index 2991187e..65b12451 100644
--- a/lib/vendors/contacts-table/contact-table.tsx
+++ b/lib/vendors/contacts-table/contact-table.tsx
@@ -16,6 +16,7 @@ import { getColumns } from "./contact-table-columns"
 import { getVendorContacts,  } from "../service"
 import { VendorContact, vendors } from "@/db/schema/vendors"
 import { VendorsTableToolbarActions } from "./contact-table-toolbar-actions"
+import { EditContactDialog } from "./edit-contact-dialog"
 
 interface VendorsTableProps {
   promises: Promise<
@@ -33,6 +34,23 @@ export function VendorContactsTable({ promises , vendorId}: VendorsTableProps) {
   const [{ data, pageCount }] = React.use(promises)
 
   const [rowAction, setRowAction] = React.useState<DataTableRowAction<VendorContact> | null>(null)
+  const [editDialogOpen, setEditDialogOpen] = React.useState(false)
+  const [selectedContact, setSelectedContact] = React.useState<VendorContact | null>(null)
+
+  // Edit 액션 처리
+  React.useEffect(() => {
+    if (rowAction?.type === "update") {
+      setSelectedContact(rowAction.row.original)
+      setEditDialogOpen(true)
+      setRowAction(null)
+    }
+  }, [rowAction])
+
+  // 데이터 새로고침 함수
+  const handleEditSuccess = React.useCallback(() => {
+    // 페이지를 새로고침하거나 데이터를 다시 가져오기
+    window.location.reload()
+  }, [])
 
   // getColumns() 호출 시, router를 주입
   const columns = React.useMemo(
@@ -82,6 +100,13 @@ export function VendorContactsTable({ promises , vendorId}: VendorsTableProps) {
           <VendorsTableToolbarActions table={table} vendorId={vendorId} />
         </DataTableAdvancedToolbar>
       </DataTable>
+
+      <EditContactDialog
+        contact={selectedContact}
+        open={editDialogOpen}
+        onOpenChange={setEditDialogOpen}
+        onSuccess={handleEditSuccess}
+      />
     </>
   )
 }
\ No newline at end of file
-- 
cgit v1.2.3

