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 | |
| parent | 9beaabc8d1e0ac3a5c54c8202d3c690577bdbd39 (diff) | |
(대표님) 벤더 문서 관련 개발사항
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/form-list/table/formLists-table-toolbar-actions.tsx | 4 | ||||
| -rw-r--r-- | lib/vendor-document-list/table/doc-table.tsx | 2 | ||||
| -rw-r--r-- | lib/vendor-document/table/doc-table-column.tsx | 13 | ||||
| -rw-r--r-- | lib/vendors/table/vendors-table-columns.tsx | 45 | ||||
| -rw-r--r-- | lib/vendors/validations.ts | 2 |
5 files changed, 45 insertions, 21 deletions
diff --git a/lib/form-list/table/formLists-table-toolbar-actions.tsx b/lib/form-list/table/formLists-table-toolbar-actions.tsx index cf874985..97db9a91 100644 --- a/lib/form-list/table/formLists-table-toolbar-actions.tsx +++ b/lib/form-list/table/formLists-table-toolbar-actions.tsx @@ -98,13 +98,13 @@ export function FormListsTableToolbarActions({ table }: ItemsTableToolbarActions ) // 테이블 데이터 업데이트 - 전체 페이지 새로고침 대신 데이터만 갱신 - table.resetRowSelection() + // table.resetRowSelection() // 여기서 테이블 데이터를 다시 불러오는 함수를 호출 // 예: refetchTableData() // 또는 SWR/React Query 등을 사용하고 있다면 mutate() 호출 // 리로드가 꼭 필요하다면 아래 주석 해제 - // window.location.reload() + window.location.reload() } else if (data.status === 'failed') { // 에러 처리 if (pollingRef.current) { diff --git a/lib/vendor-document-list/table/doc-table.tsx b/lib/vendor-document-list/table/doc-table.tsx index f70ce365..db5dc409 100644 --- a/lib/vendor-document-list/table/doc-table.tsx +++ b/lib/vendor-document-list/table/doc-table.tsx @@ -31,8 +31,6 @@ export function DocumentsTable({ // 1) 데이터를 가져옴 (server component -> use(...) pattern) const [{ data, pageCount }] = React.use(promises) - console.log(data) - const [rowAction, setRowAction] = React.useState<DataTableRowAction<DocumentStagesView> | null>(null) diff --git a/lib/vendor-document/table/doc-table-column.tsx b/lib/vendor-document/table/doc-table-column.tsx index e53b03b9..20d43fff 100644 --- a/lib/vendor-document/table/doc-table-column.tsx +++ b/lib/vendor-document/table/doc-table-column.tsx @@ -76,6 +76,19 @@ export function getColumns({ size: 160, }, { + accessorKey: "pic", + header: ({ column }) => ( + <DataTableColumnHeaderSimple column={column} title="SHI PIC" /> + ), + cell: ({ row }) => <div>{row.getValue("pic")}</div>, + meta: { + excelHeader: "SHI PIC" + }, + enableResizing: true, + minSize: 100, + size: 160, + }, + { accessorKey: "latestStageName", header: ({ column }) => ( <DataTableColumnHeaderSimple column={column} title="Latest Stage Name" /> 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( |
