summaryrefslogtreecommitdiff
path: root/lib/techsales-rfq/table/project-detail-dialog.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'lib/techsales-rfq/table/project-detail-dialog.tsx')
-rw-r--r--lib/techsales-rfq/table/project-detail-dialog.tsx87
1 files changed, 87 insertions, 0 deletions
diff --git a/lib/techsales-rfq/table/project-detail-dialog.tsx b/lib/techsales-rfq/table/project-detail-dialog.tsx
index 00202501..b2a14efa 100644
--- a/lib/techsales-rfq/table/project-detail-dialog.tsx
+++ b/lib/techsales-rfq/table/project-detail-dialog.tsx
@@ -1,6 +1,7 @@
"use client"
import * as React from "react"
+import { toast } from "sonner"
import {
Dialog,
DialogContent,
@@ -10,6 +11,8 @@ import {
} from "@/components/ui/dialog"
import { Badge } from "@/components/ui/badge"
import { Button } from "@/components/ui/button"
+import { type ProjectSeries } from "@/db/schema/projects"
+import { getProjectSeriesForProject } from "@/lib/bidding-projects/service"
// 기본적인 RFQ 타입 정의 (rfq-table.tsx와 일치)
interface TechSalesRfq {
@@ -41,6 +44,25 @@ interface TechSalesRfq {
quotationCount: number
}
+// K/L 날짜를 4분기로 변환하는 함수
+function convertKLToQuarter(klDate: string | null): string {
+ if (!klDate) return "정보 없음"
+
+ try {
+ // YYYYMMDD 형식의 날짜를 파싱
+ const year = parseInt(klDate.substring(0, 4))
+ const month = parseInt(klDate.substring(4, 6))
+
+ // 4분기 계산 (1-3월: 1Q, 4-6월: 2Q, 7-9월: 3Q, 10-12월: 4Q)
+ const quarter = Math.ceil(month / 3)
+
+ return `${year} ${quarter}Q`
+ } catch (error) {
+ console.error("K/L 날짜 변환 오류:", error)
+ return "날짜 오류"
+ }
+}
+
interface ProjectDetailDialogProps {
open: boolean
onOpenChange: (open: boolean) => void
@@ -52,6 +74,30 @@ export function ProjectDetailDialog({
onOpenChange,
selectedRfq,
}: ProjectDetailDialogProps) {
+ const [projectSeries, setProjectSeries] = React.useState<ProjectSeries[]>([])
+ const [isLoadingSeries, setIsLoadingSeries] = React.useState(false)
+
+ React.useEffect(() => {
+ async function loadSeries() {
+ if (!selectedRfq?.pspid) return
+
+ setIsLoadingSeries(true)
+ try {
+ const result = await getProjectSeriesForProject(selectedRfq.pspid)
+ setProjectSeries(result)
+ } catch (error) {
+ console.error("프로젝트 시리즈 로드 오류:", error)
+ toast.error("프로젝트 시리즈 로드 실패")
+ } finally {
+ setIsLoadingSeries(false)
+ }
+ }
+
+ if (open && selectedRfq) {
+ loadSeries()
+ }
+ }, [selectedRfq, open])
+
if (!selectedRfq) {
return null
}
@@ -104,6 +150,47 @@ export function ProjectDetailDialog({
</div>
</div>
</div>
+
+ {/* 시리즈 정보 */}
+ <div className="space-y-4">
+ <h3 className="text-lg font-semibold">시리즈 정보</h3>
+ <div className="bg-gray-50 rounded-lg p-4">
+ {isLoadingSeries ? (
+ <div className="text-center py-4 text-gray-500">
+ 시리즈 정보 로딩 중...
+ </div>
+ ) : projectSeries.length > 0 ? (
+ <div className="grid grid-cols-1 gap-3">
+ {projectSeries.map((series) => (
+ <div key={series.sersNo} className="bg-white rounded border p-3">
+ <div className="grid grid-cols-1 md:grid-cols-4 gap-4 text-sm">
+ <div>
+ <span className="font-medium text-gray-700">시리즈번호:</span>
+ <div className="text-gray-900">{series.sersNo}</div>
+ </div>
+ <div>
+ <span className="font-medium text-gray-700">K/L (Keel Laying):</span>
+ <div className="text-gray-900">{convertKLToQuarter(series.klDt)}</div>
+ </div>
+ <div>
+ <span className="font-medium text-gray-700">도크코드:</span>
+ <div className="text-gray-900">{series.dockNo || "N/A"}</div>
+ </div>
+ <div>
+ <span className="font-medium text-gray-700">도크명:</span>
+ <div className="text-gray-900">{series.dockNm || "N/A"}</div>
+ </div>
+ </div>
+ </div>
+ ))}
+ </div>
+ ) : (
+ <div className="text-center py-4 text-gray-500">
+ 시리즈 데이터가 없습니다.
+ </div>
+ )}
+ </div>
+ </div>
</div>
{/* 닫기 버튼 */}