diff --git a/src/components/business/construction/estimates/EstimateDetailForm.tsx b/src/components/business/construction/estimates/EstimateDetailForm.tsx index 2284a569..d70a718b 100644 --- a/src/components/business/construction/estimates/EstimateDetailForm.tsx +++ b/src/components/business/construction/estimates/EstimateDetailForm.tsx @@ -113,11 +113,11 @@ export default function EstimateDetailForm({ console.log('π [handleConfirmSave] formData.priceAdjustmentData:', formData.priceAdjustmentData); console.log('π [handleConfirmSave] formData μ 체:', formData); - // νμ¬ μ¬μ©μ μ΄λ¦μ 견μ μλ‘ μ€μ νκ³ , μνλ₯Ό 견μ μλ£λ‘ λ³κ²½νμ¬ μ μ₯ + // νμ¬ μ¬μ©μ μ΄λ¦μ 견μ μλ‘ μ€μ νκ³ μ μ₯ (μνλ μ¬μ©μ μ νκ° μ μ§) const result = await updateEstimate(estimateId, { ...formData, estimatorName: currentUser!.name, - status: 'completed', // μ μ₯ μ 견μ μλ£ μνλ‘ λ³κ²½ (μ μ°°μμ μ‘°ν κ°λ₯) + // statusλ formDataμ ν¬ν¨λμ΄ μμΌλ―λ‘ μ¬μ©μκ° μ νν κ° κ·Έλλ‘ μ μ‘ }); if (result.success) { diff --git a/src/components/business/construction/estimates/actions.ts b/src/components/business/construction/estimates/actions.ts index 718e1725..9c93703d 100644 --- a/src/components/business/construction/estimates/actions.ts +++ b/src/components/business/construction/estimates/actions.ts @@ -247,6 +247,14 @@ interface ApiBidDocument { * κΈ°μ‘΄ νλ‘ νΈμλ νμ κ³Ό νΈνμ± μ μ§ */ function transformQuoteToEstimate(apiData: ApiQuote): Estimate { + const status = mapQuoteStatusToEstimateStatus(apiData.status); + + // μλ£ μνμΈ κ²½μ° updated_atμ μλ£μΌλ‘ μ¬μ© + // (μνκ° μλ£λ‘ λ³κ²½λ λ updated_atμ΄ κ°±μ λλ―λ‘) + const completedDate = status === 'completed' && apiData.updated_at + ? apiData.updated_at.split('T')[0] // ISO νμμμ λ μ§λ§ μΆμΆ + : null; + return { id: String(apiData.id), estimateCode: apiData.quote_number || '', @@ -259,9 +267,9 @@ function transformQuoteToEstimate(apiData: ApiQuote): Estimate { estimateCompanyManagerContact: '', // APIμμ μ 곡 μ λ§€ν νμ itemCount: apiData.items?.length || 0, estimateAmount: Number(apiData.total_amount) || 0, - completedDate: null, + completedDate, bidDate: apiData.registration_date || null, - status: mapQuoteStatusToEstimateStatus(apiData.status), + status, createdAt: apiData.created_at || '', updatedAt: apiData.updated_at || '', createdBy: apiData.created_by ? String(apiData.created_by) : '', diff --git a/src/components/business/construction/estimates/sections/EstimateInfoSection.tsx b/src/components/business/construction/estimates/sections/EstimateInfoSection.tsx index 0b5a556b..edb16fb5 100644 --- a/src/components/business/construction/estimates/sections/EstimateInfoSection.tsx +++ b/src/components/business/construction/estimates/sections/EstimateInfoSection.tsx @@ -15,8 +15,8 @@ import { } from '@/components/ui/select'; import { FileDropzone } from '@/components/ui/file-dropzone'; import { FileList, type ExistingFile } from '@/components/ui/file-list'; -import type { EstimateDetailFormData } from '../types'; -import { STATUS_STYLES, STATUS_LABELS, VAT_TYPE_OPTIONS } from '../types'; +import type { EstimateDetailFormData, EstimateStatus } from '../types'; +import { STATUS_STYLES, STATUS_LABELS, VAT_TYPE_OPTIONS, ESTIMATE_STATUS_OPTIONS } from '../types'; import { formatAmount } from '../utils'; interface EstimateInfoSectionProps { @@ -66,8 +66,8 @@ export function EstimateInfoSection({ - {/* 3ν: 견μ κΈμ‘, μν */} -