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 || '-'}