From f79ee8be875280d03bd41547db3c67237c3601df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B6=8C=ED=98=81=EC=84=B1?= Date: Mon, 26 Jan 2026 15:29:52 +0900 Subject: [PATCH] =?UTF-8?q?feat(WEB):=20=EA=B2=AC=EC=A0=81=20=EC=83=81?= =?UTF-8?q?=EC=84=B8=20item=5Ftype=20=EA=B3=B5=ED=86=B5=EC=BD=94=EB=93=9C?= =?UTF-8?q?=20=ED=91=9C=EC=8B=9C=20=EA=B0=9C=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - getItemTypeCodes API 호출로 공통코드 조회 - 하드코딩된 RM/SM/CS 대신 코드명 동적 표시 --- .../sales/quote-management/[id]/page.tsx | 26 ++++++++++++++++--- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/src/app/[locale]/(protected)/sales/quote-management/[id]/page.tsx b/src/app/[locale]/(protected)/sales/quote-management/[id]/page.tsx index 5eb745a5..1a167b2c 100644 --- a/src/app/[locale]/(protected)/sales/quote-management/[id]/page.tsx +++ b/src/app/[locale]/(protected)/sales/quote-management/[id]/page.tsx @@ -30,6 +30,7 @@ import { } from "@/components/quotes"; import { getCompanyInfo } from "@/components/settings/CompanyInfoManagement/actions"; import type { CompanyFormData } from "@/components/settings/CompanyInfoManagement/types"; +import { getItemTypeCodes, type CommonCode } from "@/lib/api/common-codes"; import { toast } from "sonner"; import { Button } from "@/components/ui/button"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; @@ -79,6 +80,9 @@ export default function QuoteDetailPage() { // BOM 자재 상세 펼침/접힘 상태 const [isBomExpanded, setIsBomExpanded] = useState(true); + // 공통 코드 (item_type) + const [itemTypeCodes, setItemTypeCodes] = useState([]); + // 견적 데이터 조회 const fetchQuote = useCallback(async () => { setIsLoading(true); @@ -137,10 +141,26 @@ export default function QuoteDetailPage() { } }, []); + // 공통 코드 조회 + const fetchItemTypeCodes = useCallback(async () => { + const result = await getItemTypeCodes(); + if (result.success && result.data) { + setItemTypeCodes(result.data); + } + }, []); + + // item_type 코드 → 이름 변환 헬퍼 + const getItemTypeLabel = useCallback((code: string | undefined | null): string => { + if (!code) return '-'; + const found = itemTypeCodes.find(item => item.code === code); + return found?.name || code; + }, [itemTypeCodes]); + useEffect(() => { fetchQuote(); fetchCompanyInfo(); - }, [fetchQuote, fetchCompanyInfo]); + fetchItemTypeCodes(); + }, [fetchQuote, fetchCompanyInfo, fetchItemTypeCodes]); const handleBack = () => { router.push("/sales/quote-management"); @@ -559,9 +579,7 @@ export default function QuoteDetailPage() { {material.itemName} - {material.itemType === 'RM' ? '원자재' : - material.itemType === 'SM' ? '부자재' : - material.itemType === 'CS' ? '소모품' : material.itemType} + {getItemTypeLabel(material.itemType)} {material.specification || '-'}