diff options
Diffstat (limited to 'app')
| -rw-r--r-- | app/[lng]/evcp/(evcp)/bid-projects/layout.tsx | 39 | ||||
| -rw-r--r-- | app/[lng]/evcp/(evcp)/bid-projects/page.tsx | 84 | ||||
| -rw-r--r-- | app/api/(S-ERP)/(ECC)/IF_ECC_EVCP_BIDDING_PROJECT/route.ts | 11 |
3 files changed, 84 insertions, 50 deletions
diff --git a/app/[lng]/evcp/(evcp)/bid-projects/layout.tsx b/app/[lng]/evcp/(evcp)/bid-projects/layout.tsx new file mode 100644 index 00000000..9c142df1 --- /dev/null +++ b/app/[lng]/evcp/(evcp)/bid-projects/layout.tsx @@ -0,0 +1,39 @@ +import * as React from "react" +import { BidProjectsContainer } from "@/components/bidding-projects/bid-projects-container" +import { Shell } from "@/components/shell" +import { DataTableSkeleton } from "@/components/data-table/data-table-skeleton" + +// Layout 컴포넌트는 서버 컴포넌트입니다 +export default function BidProjectsLayout({ + children, +}: { + children: React.ReactNode +}) { + // 프로젝트 타입 정의 + const projectTypes = [ + { id: "all", name: "전체" }, + { id: "SHIP", name: "조선" }, + { id: "TOP", name: "해양 TOP" }, + { id: "HULL", name: "해양 HULL" }, + ] + + return ( + <Shell className="gap-4"> + <React.Suspense + fallback={ + <DataTableSkeleton + columnCount={6} + searchableColumnCount={1} + filterableColumnCount={2} + cellWidths={["10rem", "40rem", "12rem", "12rem", "8rem", "8rem"]} + shrinkZero + /> + } + > + <BidProjectsContainer projectTypes={projectTypes}> + {children} + </BidProjectsContainer> + </React.Suspense> + </Shell> + ) +}
\ No newline at end of file diff --git a/app/[lng]/evcp/(evcp)/bid-projects/page.tsx b/app/[lng]/evcp/(evcp)/bid-projects/page.tsx index 55f90dbb..e98d391b 100644 --- a/app/[lng]/evcp/(evcp)/bid-projects/page.tsx +++ b/app/[lng]/evcp/(evcp)/bid-projects/page.tsx @@ -2,13 +2,11 @@ import * as React from "react" import { type SearchParams } from "@/types/table" import { getValidFilters } from "@/lib/data-table" -import { Skeleton } from "@/components/ui/skeleton" import { DataTableSkeleton } from "@/components/data-table/data-table-skeleton" -import { Shell } from "@/components/shell" import { getBidProjectLists } from "@/lib/bidding-projects/service" import { searchParamsBidProjectsCache } from "@/lib/bidding-projects/validation" import { BidProjectsTable } from "@/lib/bidding-projects/table/projects-table" -import { InformationButton } from "@/components/information/information-button" +import type { Filter } from "@/types/table" interface IndexPageProps { searchParams: Promise<SearchParams> @@ -18,60 +16,48 @@ export default async function IndexPage(props: IndexPageProps) { const searchParams = await props.searchParams const search = searchParamsBidProjectsCache.parse(searchParams) - const validFilters = getValidFilters(search.filters) + // URL에서 프로젝트 타입 가져오기 + const projectType = searchParams.type || "all" + + // 기존 필터에 프로젝트 타입 필터 추가 + let filters = search.filters || [] + + // 타입별 필터링 (전체가 아닌 경우만) + if (projectType !== "all") { + const typeFilter: Filter = { + id: "pjtType", + value: projectType, + type: "select", + operator: "eq" + } + + // 기존 pjtType 필터가 있으면 제거하고 새로 추가 + filters = filters.filter(f => f.id !== "pjtType") + filters = [...filters, typeFilter] + } + + const validFilters = getValidFilters(filters) const promises = Promise.all([ getBidProjectLists({ ...search, filters: validFilters, }), - ]) return ( - <Shell className="gap-2"> - <div className="flex items-center justify-between space-y-2"> - <div className="flex items-center justify-between space-y-2"> - <div> - <div className="flex items-center gap-2"> - <h2 className="text-2xl font-bold tracking-tight"> - 견적 프로젝트 리스트 - </h2> - <InformationButton pagePath="evcp/bid-projects" /> - </div> - <p className="text-muted-foreground"> - SAP(S-ERP)로부터 수신한 견적 프로젝트 데이터입니다. 기술영업의 Budgetary RFQ에서 사용됩니다. - {/* <span className="inline-flex items-center whitespace-nowrap"> - <Ellipsis className="size-3" /> - <span className="ml-1">버튼</span> - </span> - 을 통해 담당자 연락처, 입찰 이력, 계약 이력, 패키지 내용 등을 확인 할 수 있습니다. */} - </p> - </div> - </div> - </div> - - <React.Suspense fallback={<Skeleton className="h-7 w-52" />}> - {/* <DateRangePicker - triggerSize="sm" - triggerClassName="ml-auto w-56 sm:w-60" - align="end" - shallow={false} - /> */} - </React.Suspense> - <React.Suspense - fallback={ - <DataTableSkeleton - columnCount={6} - searchableColumnCount={1} - filterableColumnCount={2} - cellWidths={["10rem", "40rem", "12rem", "12rem", "8rem", "8rem"]} - shrinkZero - /> - } - > - <BidProjectsTable promises={promises} /> - </React.Suspense> - </Shell> + <React.Suspense + fallback={ + <DataTableSkeleton + columnCount={6} + searchableColumnCount={1} + filterableColumnCount={2} + cellWidths={["10rem", "40rem", "12rem", "12rem", "8rem", "8rem"]} + shrinkZero + /> + } + > + <BidProjectsTable promises={promises} /> + </React.Suspense> ) } diff --git a/app/api/(S-ERP)/(ECC)/IF_ECC_EVCP_BIDDING_PROJECT/route.ts b/app/api/(S-ERP)/(ECC)/IF_ECC_EVCP_BIDDING_PROJECT/route.ts index a63fff40..0c36974f 100644 --- a/app/api/(S-ERP)/(ECC)/IF_ECC_EVCP_BIDDING_PROJECT/route.ts +++ b/app/api/(S-ERP)/(ECC)/IF_ECC_EVCP_BIDDING_PROJECT/route.ts @@ -279,6 +279,14 @@ async function saveToDatabase(data: RequestData) { where: eq(biddingProjects.pspid, project.pspid) }); + // sector 값에 따라 pjtType 결정 + let pjtType: 'SHIP' | 'HULL' | null = null; + if (project.sector === 'S') { + pjtType = 'SHIP'; + } else if (project.sector === 'M') { + pjtType = 'HULL'; + } + const projectValues: NewBiddingProject = { pspid: project.pspid, projNm: project.projNm, @@ -296,7 +304,8 @@ async function saveToDatabase(data: RequestData) { pmodelUom: project.pmodelUom, txt04: project.txt04, txt30: project.txt30, - estmPm: project.estmPm + estmPm: project.estmPm, + pjtType: pjtType }; if (existingProject) { |
