diff options
| author | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-09-26 09:57:24 +0000 |
|---|---|---|
| committer | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-09-26 09:57:24 +0000 |
| commit | 8b23b471638a155fd1bfa3a8c853b26d9315b272 (patch) | |
| tree | 47353e9dd342011cb2f1dcd24b09661707a8421b /lib/vendors/contacts-table/contact-table.tsx | |
| parent | d62368d2b68d73da895977e60a18f9b1286b0545 (diff) | |
(대표님) 권한관리, 문서업로드, rfq첨부, SWP문서룰 등
(최겸) 입찰
Diffstat (limited to 'lib/vendors/contacts-table/contact-table.tsx')
| -rw-r--r-- | lib/vendors/contacts-table/contact-table.tsx | 25 |
1 files changed, 25 insertions, 0 deletions
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 |
