From ef4c533ebacc2cdc97e518f30e9a9350004fcdfb Mon Sep 17 00:00:00 2001 From: dujinkim Date: Mon, 28 Apr 2025 02:13:30 +0000 Subject: ~20250428 작업사항 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/rfqs/cbe-table/cbe-table-columns.tsx | 92 +++++++++++++++++++------------- 1 file changed, 55 insertions(+), 37 deletions(-) (limited to 'lib/rfqs/cbe-table/cbe-table-columns.tsx') diff --git a/lib/rfqs/cbe-table/cbe-table-columns.tsx b/lib/rfqs/cbe-table/cbe-table-columns.tsx index 325b0465..bc16496f 100644 --- a/lib/rfqs/cbe-table/cbe-table-columns.tsx +++ b/lib/rfqs/cbe-table/cbe-table-columns.tsx @@ -34,8 +34,9 @@ interface GetColumnsProps { React.SetStateAction | null> > router: NextRouter - openCommentSheet: (vendorId: number) => void - openFilesDialog: (cbeId:number , vendorId: number) => void + openCommentSheet: (responseId: number) => void + openVendorContactsDialog: (vendorId: number, vendor: VendorWithCbeFields) => void // 수정된 시그니처 + } /** @@ -45,7 +46,7 @@ export function getColumns({ setRowAction, router, openCommentSheet, - openFilesDialog + openVendorContactsDialog }: GetColumnsProps): ColumnDef[] { // ---------------------------------------------------------------- // 1) Select 컬럼 (체크박스) @@ -104,6 +105,30 @@ export function getColumns({ // 1) 필드값 가져오기 const val = getValue() + if (cfg.id === "vendorName") { + const vendor = row.original; + const vendorId = vendor.vendorId; + + // 협력업체 이름을 클릭할 수 있는 버튼으로 렌더링 + const handleVendorNameClick = () => { + if (vendorId) { + openVendorContactsDialog(vendorId, vendor); // vendor 전체 객체 전달 + } else { + toast.error("협력업체 ID를 찾을 수 없습니다."); + } + }; + + return ( + + ); + } + if (cfg.id === "vendorStatus") { const statusVal = row.original.vendorStatus if (!statusVal) return null @@ -116,8 +141,8 @@ export function getColumns({ } - if (cfg.id === "rfqVendorStatus") { - const statusVal = row.original.rfqVendorStatus + if (cfg.id === "responseStatus") { + const statusVal = row.original.responseStatus if (!statusVal) return null // const Icon = getStatusIcon(statusVal) const variant = statusVal ==="INVITED"?"default" :statusVal ==="DECLINED"?"destructive":statusVal ==="ACCEPTED"?"secondary":"outline" @@ -128,8 +153,8 @@ export function getColumns({ ) } - // 예) TBE Updated (날짜) - if (cfg.id === "cbeUpdated") { + // 예) CBE Updated (날짜) + if (cfg.id === "respondedAt" ) { const dateVal = val as Date | undefined if (!dateVal) return null return formatDate(dateVal) @@ -172,39 +197,32 @@ const commentsColumn: ColumnDef = { function handleClick() { // rowAction + openCommentSheet setRowAction({ row, type: "comments" }) - openCommentSheet(vendor.cbeId ?? 0) + openCommentSheet(vendor.responseId ?? 0) } return ( -
- - {/* - {commCount > 0 ? `${commCount} Comments` : "Add Comment"} - */} -
+ ) }, enableSorting: false, -- cgit v1.2.3