diff options
| author | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-05-15 01:34:49 +0000 |
|---|---|---|
| committer | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-05-15 01:34:49 +0000 |
| commit | ed864fa46c7ce0aac2de4c5ba5d311ebfd7e6a88 (patch) | |
| tree | b04695b9c8a4d2b03ed1f44f318fa38d8c490364 /lib/vendors | |
| parent | 9beaabc8d1e0ac3a5c54c8202d3c690577bdbd39 (diff) | |
(대표님) 벤더 문서 관련 개발사항
Diffstat (limited to 'lib/vendors')
| -rw-r--r-- | lib/vendors/table/vendors-table-columns.tsx | 45 | ||||
| -rw-r--r-- | lib/vendors/validations.ts | 2 |
2 files changed, 30 insertions, 17 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 ( diff --git a/lib/vendors/validations.ts b/lib/vendors/validations.ts index e01fa8b9..10ea3e78 100644 --- a/lib/vendors/validations.ts +++ b/lib/vendors/validations.ts @@ -172,7 +172,7 @@ export const createVendorSchema = z .min(1, "국가 선택은 필수입니다.") .max(100, "Max length 100"), phone: z.string().max(50, "Max length 50").optional(), - website: z.string().url("Invalid URL").max(255).optional(), + website: z.string().url("유효하지 않은 URL입니다. https:// 혹은 http:// 로 시작하는 주소를 입력해주세요.").max(255).optional(), attachedFiles: z.any() .refine( |
