diff options
Diffstat (limited to 'lib/vendors/table/vendors-table-columns.tsx')
| -rw-r--r-- | lib/vendors/table/vendors-table-columns.tsx | 45 |
1 files changed, 29 insertions, 16 deletions
diff --git a/lib/vendors/table/vendors-table-columns.tsx b/lib/vendors/table/vendors-table-columns.tsx index c768b587..21086918 100644 --- a/lib/vendors/table/vendors-table-columns.tsx +++ b/lib/vendors/table/vendors-table-columns.tsx @@ -51,9 +51,12 @@ type NextRouter = ReturnType<typeof useRouter>; interface GetColumnsProps { setRowAction: React.Dispatch<React.SetStateAction<DataTableRowAction<VendorWithType> | null>>; router: NextRouter; - userId: number; + userId: number; } + + + /** * tanstack table 컬럼 정의 (중첩 헤더 버전) */ @@ -110,13 +113,13 @@ export function getColumns({ setRowAction, router, userId }: GetColumnsProps): C </Button> </DropdownMenuTrigger> <DropdownMenuContent align="end" className="w-56"> - {(isApproved ||afterApproved) && ( - <DropdownMenuItem - onSelect={() => setRowAction({ row, type: "update" })} - > - 레코드 편집 - </DropdownMenuItem> - )} + {(isApproved || afterApproved) && ( + <DropdownMenuItem + onSelect={() => setRowAction({ row, type: "update" })} + > + 레코드 편집 + </DropdownMenuItem> + )} <DropdownMenuItem onSelect={() => { @@ -130,10 +133,18 @@ export function getColumns({ setRowAction, router, userId }: GetColumnsProps): C 상세보기 </DropdownMenuItem> <DropdownMenuItem - onSelect={() => setRowAction({ row, type: "log" })} - > - 감사 로그 보기 - </DropdownMenuItem> + onSelect={() => { + // 새창으로 열기 위해 window.open() 사용 + window.open(`/evcp/vendors/${row.original.id}/info`, '_blank'); + }} + > + 상세보기(새창) + </DropdownMenuItem> + <DropdownMenuItem + onSelect={() => setRowAction({ row, type: "log" })} + > + 감사 로그 보기 + </DropdownMenuItem> <Separator /> <DropdownMenuSub> @@ -409,10 +420,12 @@ export function getColumns({ setRowAction, router, userId }: GetColumnsProps): C <DataTableColumnHeaderSimple column={column} title="" /> ), cell: ({ row }) => { - // hasAttachments 및 attachmentsList 속성이 추가되었다고 가정 - const hasAttachments = (row.original as VendorWithAttachments).hasAttachments; - const attachmentsList = (row.original as VendorWithAttachments).attachmentsList || []; - + const vendor = row.original as unknown as VendorWithAttachments; + + // 속성이 undefined일 수 있으므로 옵셔널 체이닝과 기본값 사용 + const hasAttachments = vendor.hasAttachments ?? false; + const attachmentsList = vendor.attachmentsList ?? []; + if (hasAttachments) { // 서버 액션을 사용하는 컴포넌트로 교체 return ( |
