From 33743e6c3bf14bf8a0d7da24478e38a0a7e7ed93 Mon Sep 17 00:00:00 2001 From: dujinkim Date: Tue, 13 May 2025 03:07:03 +0000 Subject: (대표님) budgetary-ship MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../evcp/(evcp)/budgetary-ship/[id]/layout.tsx | 82 +++++++++++++++++++++ app/[lng]/evcp/(evcp)/budgetary-ship/[id]/page.tsx | 57 ++++++++++++++ app/[lng]/evcp/(evcp)/budgetary-ship/page.tsx | 86 ++++++++++++++++++++++ 3 files changed, 225 insertions(+) create mode 100644 app/[lng]/evcp/(evcp)/budgetary-ship/[id]/layout.tsx create mode 100644 app/[lng]/evcp/(evcp)/budgetary-ship/[id]/page.tsx create mode 100644 app/[lng]/evcp/(evcp)/budgetary-ship/page.tsx (limited to 'app') diff --git a/app/[lng]/evcp/(evcp)/budgetary-ship/[id]/layout.tsx b/app/[lng]/evcp/(evcp)/budgetary-ship/[id]/layout.tsx new file mode 100644 index 00000000..f2b2fa53 --- /dev/null +++ b/app/[lng]/evcp/(evcp)/budgetary-ship/[id]/layout.tsx @@ -0,0 +1,82 @@ +import { Metadata } from "next" +import Link from "next/link" +import { ArrowLeft } from "lucide-react" +import { Separator } from "@/components/ui/separator" +import { SidebarNav } from "@/components/layout/sidebar-nav" +import { RfqViewWithItems } from "@/db/schema/rfq" +import { findRfqById } from "@/lib/rfqs-ship/service" +import { formatDate } from "@/lib/utils" +import { Button } from "@/components/ui/button" + +export const metadata: Metadata = { + title: "Vendor Detail", +} + +export default async function RfqLayout({ + children, + params, +}: { + children: React.ReactNode + params: { lng: string, id: string } +}) { + + // 1) URL 파라미터에서 id 추출, Number로 변환 + const resolvedParams = await params + const lng = resolvedParams.lng + const id = resolvedParams.id + + const idAsNumber = Number(id) + // 2) DB에서 해당 협력업체 정보 조회 + const rfq: RfqViewWithItems | null = await findRfqById(idAsNumber) + + // 3) 사이드바 메뉴 + const sidebarNavItems = [ + { + title: "Vendors & CBE", + href: `/${lng}/evcp/budgetary/${id}`, + }, + ] + + return ( + <> +
+
+
+ {/* RFQ 목록으로 돌아가는 링크 추가 */} +
+ + + +
+ +
+ {/* 4) 협력업체 정보가 있으면 코드 + 이름 + "상세 정보" 표기 */} +

+ {rfq + ? `${rfq.projectCode ?? ""} ${rfq.rfqCode ?? ""} 관리` + : "Loading RFQ..."} +

+ +

+ {rfq + ? `${rfq.description ?? ""} ${rfq.lines.map(line => line.itemCode).join(", ")}` + : ""} +

+

Due Date:{rfq && rfq?.dueDate && {formatDate(rfq?.dueDate)}}

+
+ +
+ +
{children}
+
+
+
+
+ + ) +} \ No newline at end of file diff --git a/app/[lng]/evcp/(evcp)/budgetary-ship/[id]/page.tsx b/app/[lng]/evcp/(evcp)/budgetary-ship/[id]/page.tsx new file mode 100644 index 00000000..0dfc578e --- /dev/null +++ b/app/[lng]/evcp/(evcp)/budgetary-ship/[id]/page.tsx @@ -0,0 +1,57 @@ +import { Separator } from "@/components/ui/separator" +import { type SearchParams } from "@/types/table" +import { getValidFilters } from "@/lib/data-table" +import { getMatchedVendors } from "@/lib/rfqs-ship/service" +import { searchParamsMatchedVCache } from "@/lib/rfqs-ship/validations" +import { MatchedVendorsTable } from "@/lib/rfqs-ship/vendor-table/vendors-table" +import { RfqType } from "@/lib/rfqs-ship/validations" + +interface IndexPageProps { + // Next.js 13 App Router에서 기본으로 주어지는 객체들 + params: { + lng: string + id: string + } + searchParams: Promise + rfqType: RfqType +} + +export default async function RfqPage(props: IndexPageProps) { + const resolvedParams = await props.params + const id = resolvedParams.id + const rfqType = props.rfqType ?? RfqType.BUDGETARY // rfqType이 없으면 BUDGETARY로 설정 + + const idAsNumber = Number(id) + + // 2) SearchParams 파싱 (Zod) + const searchParams = await props.searchParams + const search = searchParamsMatchedVCache.parse(searchParams) + const validFilters = getValidFilters(search.filters) + + const promises = Promise.all([ + getMatchedVendors({ + ...search, + filters: validFilters, + }, + idAsNumber) + ]) + + // 4) 렌더링 + return ( +
+
+

+ Vendors & CBE +

+

+ 등록된 협력업체 중에서 이 RFQ 아이템에 매칭되는 업체를 선택하고 바로 CBE(상업적 견적) 요청을 발송할 수 있습니다.
+ 벤더를 선택한 후 "CBE 요청" 버튼을 클릭하면 첨부파일과 함께 CBE 요청이 해당 업체에 바로 발송됩니다. +

+
+ +
+ +
+
+ ) +} \ No newline at end of file diff --git a/app/[lng]/evcp/(evcp)/budgetary-ship/page.tsx b/app/[lng]/evcp/(evcp)/budgetary-ship/page.tsx new file mode 100644 index 00000000..baa2bdf9 --- /dev/null +++ b/app/[lng]/evcp/(evcp)/budgetary-ship/page.tsx @@ -0,0 +1,86 @@ +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 { searchParamsCache } from "@/lib/rfqs-ship/validations" +import { getRfqs, getRfqStatusCounts } from "@/lib/rfqs-ship/service" +import { RfqsTable } from "@/lib/rfqs-ship/table/rfqs-table" +import { getAllItems } from "@/lib/items/service" +import { RfqType } from "@/lib/rfqs-ship/validations" +import { Ellipsis } from "lucide-react" + +interface RfqPageProps { + searchParams: Promise; + rfqType: RfqType; + title: string; + description: string; +} + +export default async function RfqPage({ + searchParams, + rfqType = RfqType.BUDGETARY, + title = "Budgetary Quote", + description = "Budgetary Quote를 등록하여 요청 및 응답을 관리할 수 있습니다." +}: RfqPageProps) { + const search = searchParamsCache.parse(await searchParams) + + const validFilters = getValidFilters(search.filters) + + const promises = Promise.all([ + getRfqs({ + ...search, + filters: validFilters, + rfqType // 전달받은 rfqType 사용 + }), + getRfqStatusCounts(rfqType), // rfqType 전달 + getAllItems() + ]) + + return ( + +
+
+
+

+ {title} +

+

+ {description} + 기본적인 정보와 RFQ를 위한 아이템 등록 및 첨부를 한 후, + + + 버튼 + 을 클릭하면 "Proceed"를 통해 상세화면으로 이동하여 진행할 수 있습니다. +

+
+
+
+ + }> + {/* */} + + + } + > + + +
+ ) +} \ No newline at end of file -- cgit v1.2.3