summaryrefslogtreecommitdiff
path: root/lib/bidding/vendor/partners-bidding-pre-quote.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'lib/bidding/vendor/partners-bidding-pre-quote.tsx')
-rw-r--r--lib/bidding/vendor/partners-bidding-pre-quote.tsx1413
1 files changed, 0 insertions, 1413 deletions
diff --git a/lib/bidding/vendor/partners-bidding-pre-quote.tsx b/lib/bidding/vendor/partners-bidding-pre-quote.tsx
deleted file mode 100644
index 8a157c5f..00000000
--- a/lib/bidding/vendor/partners-bidding-pre-quote.tsx
+++ /dev/null
@@ -1,1413 +0,0 @@
-'use client'
-
-import * as React from 'react'
-import { useRouter } from 'next/navigation'
-import { Button } from '@/components/ui/button'
-import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
-import { Badge } from '@/components/ui/badge'
-import { Input } from '@/components/ui/input'
-import { Label } from '@/components/ui/label'
-import { Textarea } from '@/components/ui/textarea'
-import { Checkbox } from '@/components/ui/checkbox'
-import {
- Select,
- SelectContent,
- SelectItem,
- SelectTrigger,
- SelectValue,
-} from '@/components/ui/select'
-import {
- ArrowLeft,
- Calendar,
- Building2,
- Package,
- User,
- FileText,
- Users,
- Send,
- CheckCircle,
- XCircle,
- Save
-} from 'lucide-react'
-
-import { formatDate } from '@/lib/utils'
-import {
- getBiddingCompaniesForPartners,
- submitPreQuoteResponse,
- getPrItemsForBidding,
- getSavedPrItemQuotations,
- savePreQuoteDraft,
- setPreQuoteParticipation
-} from '../pre-quote/service'
-import { getBiddingConditions } from '../service'
-import { getPriceAdjustmentFormByBiddingCompanyId } from '../detail/service'
-import { getIncotermsForSelection, getPaymentTermsForSelection, getPlaceOfShippingForSelection, getPlaceOfDestinationForSelection } from '@/lib/procurement-select/service'
-import { TAX_CONDITIONS, getTaxConditionName } from '@/lib/tax-conditions/types'
-import { PrItemsPricingTable } from './components/pr-items-pricing-table'
-import { SimpleFileUpload } from './components/simple-file-upload'
-import {
- biddingStatusLabels,
-} from '@/db/schema'
-import { useToast } from '@/hooks/use-toast'
-import { useTransition } from 'react'
-import { useSession } from 'next-auth/react'
-
-interface PartnersBiddingPreQuoteProps {
- biddingId: number
- companyId: number
-}
-
-interface BiddingDetail {
- id: number
- biddingNumber: string
- revision: number | null
- projectName: string | null
- itemName: string | null
- title: string
- description: string | null
- content: string | null
- contractType: string
- biddingType: string
- awardCount: string
- contractStartDate: Date | null
- contractEndDate: Date | null
- preQuoteDate: string | null
- biddingRegistrationDate: string | null
- submissionStartDate: string | null
- submissionEndDate: string | null
- evaluationDate: string | null
- currency: string
- budget: number | null
- targetPrice: number | null
- status: string
- managerName: string | null
- managerEmail: string | null
- managerPhone: string | null
- biddingCompanyId: number | null
- biddingId: number // bidding의 ID 추가
- invitationStatus: string | null
- preQuoteAmount: string | null
- preQuoteSubmittedAt: string | null
- preQuoteDeadline: string | null
- isPreQuoteSelected: boolean | null
- isAttendingMeeting: boolean | null
- // companyConditionResponses에서 가져온 조건들 (제시된 조건과 응답 모두)
- paymentTermsResponse: string | null
- taxConditionsResponse: string | null
- incotermsResponse: string | null
- proposedContractDeliveryDate: string | null
- proposedShippingPort: string | null
- proposedDestinationPort: string | null
- priceAdjustmentResponse: boolean | null
- sparePartResponse: string | null
- isInitialResponse: boolean | null
- additionalProposals: string | null
-}
-
-export function PartnersBiddingPreQuote({ biddingId, companyId }: PartnersBiddingPreQuoteProps) {
- const router = useRouter()
- const { toast } = useToast()
- const [isPending, startTransition] = useTransition()
- const session = useSession()
- const [biddingDetail, setBiddingDetail] = React.useState<BiddingDetail | null>(null)
- const [isLoading, setIsLoading] = React.useState(true)
- const [biddingConditions, setBiddingConditions] = React.useState<any | null>(null)
-
- // Procurement 데이터 상태들
- const [paymentTermsOptions, setPaymentTermsOptions] = React.useState<Array<{code: string, description: string}>>([])
- const [incotermsOptions, setIncotermsOptions] = React.useState<Array<{code: string, description: string}>>([])
- const [shippingPlaces, setShippingPlaces] = React.useState<Array<{code: string, description: string}>>([])
- const [destinationPlaces, setDestinationPlaces] = React.useState<Array<{code: string, description: string}>>([])
-
- // 품목별 견적 관련 상태
- const [prItems, setPrItems] = React.useState<any[]>([])
- const [prItemQuotations, setPrItemQuotations] = React.useState<any[]>([])
- const [totalAmount, setTotalAmount] = React.useState(0)
- const [isSaving, setIsSaving] = React.useState(false)
-
- // 사전견적 폼 상태
- const [responseData, setResponseData] = React.useState({
- preQuoteAmount: '',
- paymentTermsResponse: '',
- taxConditionsResponse: '',
- incotermsResponse: '',
- proposedContractDeliveryDate: '',
- proposedShippingPort: '',
- proposedDestinationPort: '',
- priceAdjustmentResponse: false,
- isInitialResponse: false,
- sparePartResponse: '',
- additionalProposals: '',
- isAttendingMeeting: false,
- })
-
- // 사전견적 참여의사 상태
- const [participationDecision, setParticipationDecision] = React.useState<boolean | null>(null)
-
- // 연동제 폼 상태
- const [priceAdjustmentForm, setPriceAdjustmentForm] = React.useState({
- itemName: '',
- adjustmentReflectionPoint: '',
- majorApplicableRawMaterial: '',
- adjustmentFormula: '',
- rawMaterialPriceIndex: '',
- referenceDate: '',
- comparisonDate: '',
- adjustmentRatio: '',
- notes: '',
- adjustmentConditions: '',
- majorNonApplicableRawMaterial: '',
- adjustmentPeriod: '',
- contractorWriter: '',
- adjustmentDate: '',
- nonApplicableReason: '',
- })
- const userId = session.data?.user?.id || ''
-
- // Procurement 데이터 로드 함수들
- const loadPaymentTerms = React.useCallback(async () => {
- try {
- const data = await getPaymentTermsForSelection();
- setPaymentTermsOptions(data);
- } catch (error) {
- console.error("Failed to load payment terms:", error);
- }
- }, []);
-
- const loadIncoterms = React.useCallback(async () => {
- try {
- const data = await getIncotermsForSelection();
- setIncotermsOptions(data);
- } catch (error) {
- console.error("Failed to load incoterms:", error);
- }
- }, []);
-
- const loadShippingPlaces = React.useCallback(async () => {
- try {
- const data = await getPlaceOfShippingForSelection();
- setShippingPlaces(data);
- } catch (error) {
- console.error("Failed to load shipping places:", error);
- }
- }, []);
-
- const loadDestinationPlaces = React.useCallback(async () => {
- try {
- const data = await getPlaceOfDestinationForSelection();
- setDestinationPlaces(data);
- } catch (error) {
- console.error("Failed to load destination places:", error);
- }
- }, []);
-
- // 데이터 로드
- React.useEffect(() => {
- const loadData = async () => {
- try {
- setIsLoading(true)
-
- // 모든 필요한 데이터를 병렬로 로드
- const [result, conditions, prItemsData] = await Promise.all([
- getBiddingCompaniesForPartners(biddingId, companyId),
- getBiddingConditions(biddingId),
- getPrItemsForBidding(biddingId)
- ])
-
- if (result) {
- setBiddingDetail(result as BiddingDetail)
-
- // 저장된 품목별 견적 정보가 있으면 로드
- if (result.biddingCompanyId) {
- const savedQuotations = await getSavedPrItemQuotations(result.biddingCompanyId)
- setPrItemQuotations(savedQuotations)
-
- // 총 금액 계산
- const calculatedTotal = savedQuotations.reduce((sum: number, item: any) => sum + item.bidAmount, 0)
- setTotalAmount(calculatedTotal)
-
- // 저장된 연동제 정보가 있으면 로드
- if (result.priceAdjustmentResponse) {
- const savedPriceAdjustmentForm = await getPriceAdjustmentFormByBiddingCompanyId(result.biddingCompanyId)
- if (savedPriceAdjustmentForm) {
- setPriceAdjustmentForm({
- itemName: savedPriceAdjustmentForm.itemName || '',
- adjustmentReflectionPoint: savedPriceAdjustmentForm.adjustmentReflectionPoint || '',
- majorApplicableRawMaterial: savedPriceAdjustmentForm.majorApplicableRawMaterial || '',
- adjustmentFormula: savedPriceAdjustmentForm.adjustmentFormula || '',
- rawMaterialPriceIndex: savedPriceAdjustmentForm.rawMaterialPriceIndex || '',
- referenceDate: savedPriceAdjustmentForm.referenceDate ? new Date(savedPriceAdjustmentForm.referenceDate).toISOString().split('T')[0] : '',
- comparisonDate: savedPriceAdjustmentForm.comparisonDate ? new Date(savedPriceAdjustmentForm.comparisonDate).toISOString().split('T')[0] : '',
- adjustmentRatio: savedPriceAdjustmentForm.adjustmentRatio?.toString() || '',
- notes: savedPriceAdjustmentForm.notes || '',
- adjustmentConditions: savedPriceAdjustmentForm.adjustmentConditions || '',
- majorNonApplicableRawMaterial: savedPriceAdjustmentForm.majorNonApplicableRawMaterial || '',
- adjustmentPeriod: savedPriceAdjustmentForm.adjustmentPeriod || '',
- contractorWriter: savedPriceAdjustmentForm.contractorWriter || '',
- adjustmentDate: savedPriceAdjustmentForm.adjustmentDate ? new Date(savedPriceAdjustmentForm.adjustmentDate).toISOString().split('T')[0] : '',
- nonApplicableReason: savedPriceAdjustmentForm.nonApplicableReason || '',
- })
- }
- }
- }
-
- // 기존 응답 데이터로 폼 초기화
- setResponseData({
- preQuoteAmount: result.preQuoteAmount?.toString() || '',
- paymentTermsResponse: result.paymentTermsResponse || '',
- taxConditionsResponse: result.taxConditionsResponse || '',
- incotermsResponse: result.incotermsResponse || '',
- proposedContractDeliveryDate: result.proposedContractDeliveryDate || '',
- proposedShippingPort: result.proposedShippingPort || '',
- proposedDestinationPort: result.proposedDestinationPort || '',
- priceAdjustmentResponse: result.priceAdjustmentResponse || false,
- isInitialResponse: result.isInitialResponse || false,
- sparePartResponse: result.sparePartResponse || '',
- additionalProposals: result.additionalProposals || '',
- isAttendingMeeting: result.isAttendingMeeting || false,
- })
-
- // 사전견적 참여의사 초기화
- setParticipationDecision(result.isPreQuoteParticipated)
- }
-
- if (conditions) {
- // BiddingConditionsEdit와 같은 방식으로 raw 데이터 사용
- setBiddingConditions(conditions)
- }
-
- if (prItemsData) {
- setPrItems(prItemsData)
- }
-
- // Procurement 데이터 로드
- await Promise.all([
- loadPaymentTerms(),
- loadIncoterms(),
- loadShippingPlaces(),
- loadDestinationPlaces()
- ])
- } catch (error) {
- console.error('Failed to load bidding company:', error)
- toast({
- title: '오류',
- description: '입찰 정보를 불러오는데 실패했습니다.',
- variant: 'destructive',
- })
- } finally {
- setIsLoading(false)
- }
- }
-
- loadData()
- }, [biddingId, companyId, toast, loadPaymentTerms, loadIncoterms, loadShippingPlaces, loadDestinationPlaces])
-
- // 임시저장 기능
- const handleTempSave = () => {
- if (!biddingDetail || !biddingDetail.biddingCompanyId) {
- toast({
- title: '임시저장 실패',
- description: '입찰 정보가 올바르지 않습니다.',
- variant: 'destructive',
- })
- return
- }
- // 입찰 마감 상태 체크
- const biddingStatus = biddingDetail.status
- const isClosed = biddingStatus === 'bidding_closed' || biddingStatus === 'vendor_selected' || biddingStatus === 'bidding_disposal'
-
- if (isClosed) {
- toast({
- title: "접근 제한",
- description: "입찰이 마감되어 더 이상 사전견적을 제출할 수 없습니다.",
- variant: "destructive",
- })
- router.back()
- return
- }
-
- // 사전견적 상태 체크
- const isPreQuoteStatus = biddingStatus === 'request_for_quotation' || biddingStatus === 'received_quotation'
- if (!isPreQuoteStatus) {
- toast({
- title: "접근 제한",
- description: "사전견적 단계가 아니므로 임시저장이 불가능합니다.",
- variant: "destructive",
- })
- return
- }
-
- if (!userId) {
- toast({
- title: '임시저장 실패',
- description: '사용자 정보를 확인할 수 없습니다. 다시 로그인해주세요.',
- variant: 'destructive',
- })
- return
- }
-
- setIsSaving(true)
- startTransition(async () => {
- try {
- const result = await savePreQuoteDraft(
- biddingDetail.biddingCompanyId!,
- {
- prItemQuotations,
- paymentTermsResponse: responseData.paymentTermsResponse,
- taxConditionsResponse: responseData.taxConditionsResponse,
- incotermsResponse: responseData.incotermsResponse,
- proposedContractDeliveryDate: responseData.proposedContractDeliveryDate,
- proposedShippingPort: responseData.proposedShippingPort,
- proposedDestinationPort: responseData.proposedDestinationPort,
- priceAdjustmentResponse: responseData.priceAdjustmentResponse || false, // 체크 안하면 false로 설정
- isInitialResponse: responseData.isInitialResponse || false, // 체크 안하면 false로 설정
- sparePartResponse: responseData.sparePartResponse,
- additionalProposals: responseData.additionalProposals,
- priceAdjustmentForm: (responseData.priceAdjustmentResponse || false) ? {
- itemName: priceAdjustmentForm.itemName,
- adjustmentReflectionPoint: priceAdjustmentForm.adjustmentReflectionPoint,
- majorApplicableRawMaterial: priceAdjustmentForm.majorApplicableRawMaterial,
- adjustmentFormula: priceAdjustmentForm.adjustmentFormula,
- rawMaterialPriceIndex: priceAdjustmentForm.rawMaterialPriceIndex,
- referenceDate: priceAdjustmentForm.referenceDate,
- comparisonDate: priceAdjustmentForm.comparisonDate,
- adjustmentRatio: priceAdjustmentForm.adjustmentRatio ? parseFloat(priceAdjustmentForm.adjustmentRatio) : undefined,
- notes: priceAdjustmentForm.notes,
- adjustmentConditions: priceAdjustmentForm.adjustmentConditions,
- majorNonApplicableRawMaterial: priceAdjustmentForm.majorNonApplicableRawMaterial,
- adjustmentPeriod: priceAdjustmentForm.adjustmentPeriod,
- contractorWriter: priceAdjustmentForm.contractorWriter,
- adjustmentDate: priceAdjustmentForm.adjustmentDate,
- nonApplicableReason: priceAdjustmentForm.nonApplicableReason,
- } : undefined
- },
- userId
- )
-
- if (result.success) {
- toast({
- title: '임시저장 완료',
- description: result.message,
- })
- } else {
- toast({
- title: '임시저장 실패',
- description: result.error,
- variant: 'destructive',
- })
- }
- } catch (error) {
- console.error('Temp save error:', error)
- toast({
- title: '임시저장 실패',
- description: '서버 오류가 발생했습니다. 잠시 후 다시 시도해주세요.',
- variant: 'destructive',
- })
- } finally {
- setIsSaving(false)
- }
- })
- }
-
- // 사전견적 참여의사 설정 함수
- const handleParticipationDecision = async (participate: boolean) => {
- if (!biddingDetail?.biddingCompanyId) return
-
- startTransition(async () => {
- const result = await setPreQuoteParticipation(
- biddingDetail.biddingCompanyId!,
- participate
- )
-
- if (result.success) {
- setParticipationDecision(participate)
- toast({
- title: '설정 완료',
- description: `사전견적 ${participate ? '참여' : '미참여'}로 설정되었습니다.`,
- })
- } else {
- toast({
- title: '설정 실패',
- description: result.error,
- variant: 'destructive',
- })
- }
- })
- }
-
- const handleSubmitResponse = () => {
- if (!biddingDetail) return
-
- // 입찰 마감 상태 체크
- const biddingStatus = biddingDetail.status
- const isClosed = biddingStatus === 'bidding_closed' || biddingStatus === 'vendor_selected' || biddingStatus === 'bidding_disposal'
-
- if (isClosed) {
- toast({
- title: "접근 제한",
- description: "입찰이 마감되어 더 이상 사전견적을 제출할 수 없습니다.",
- variant: "destructive",
- })
- router.back()
- return
- }
-
- // 사전견적 상태 체크
- const isPreQuoteStatus = biddingStatus === 'request_for_quotation' || biddingStatus === 'received_quotation'
- if (!isPreQuoteStatus) {
- toast({
- title: "접근 제한",
- description: "사전견적 단계가 아니므로 견적 제출이 불가능합니다.",
- variant: "destructive",
- })
- return
- }
-
- // 견적마감일 체크
- if (biddingDetail.preQuoteDeadline) {
- const now = new Date()
- const deadline = new Date(biddingDetail.preQuoteDeadline)
- if (deadline < now) {
- toast({
- title: '견적 마감',
- description: '견적 마감일이 지나 제출할 수 없습니다.',
- variant: 'destructive',
- })
- return
- }
- }
-
- // 필수값 검증
- if (prItemQuotations.length === 0 || totalAmount === 0) {
- toast({
- title: '유효성 오류',
- description: '품목별 견적을 입력해주세요.',
- variant: 'destructive',
- })
- return
- }
-
- // 품목별 납품일 검증
- if (prItemQuotations.length > 0) {
- for (const quotation of prItemQuotations) {
- if (!quotation.proposedDeliveryDate?.trim()) {
- const prItem = prItems.find(item => item.id === quotation.prItemId)
- toast({
- title: '유효성 오류',
- description: `품목 ${prItem?.itemNumber || quotation.prItemId}의 납품예정일을 입력해주세요.`,
- variant: 'destructive',
- })
- return
- }
- }
- }
-
- const requiredFields = [
- { value: responseData.proposedContractDeliveryDate, name: '제안 납품일' },
- { value: responseData.paymentTermsResponse, name: '응답 지급조건' },
- { value: responseData.taxConditionsResponse, name: '응답 세금조건' },
- { value: responseData.incotermsResponse, name: '응답 운송조건' },
- { value: responseData.proposedShippingPort, name: '제안 선적지' },
- { value: responseData.proposedDestinationPort, name: '제안 하역지' },
- { value: responseData.sparePartResponse, name: '스페어파트 응답' },
- ]
-
- const missingField = requiredFields.find(field => !field.value?.trim())
- if (missingField) {
- toast({
- title: '유효성 오류',
- description: `${missingField.name}을(를) 입력해주세요.`,
- variant: 'destructive',
- })
- return
- }
-
- startTransition(async () => {
- const submissionData = {
- preQuoteAmount: totalAmount, // 품목별 계산된 총 금액 사용
- prItemQuotations, // 품목별 견적 데이터 추가
- paymentTermsResponse: responseData.paymentTermsResponse,
- taxConditionsResponse: responseData.taxConditionsResponse,
- incotermsResponse: responseData.incotermsResponse,
- proposedContractDeliveryDate: responseData.proposedContractDeliveryDate,
- proposedShippingPort: responseData.proposedShippingPort,
- proposedDestinationPort: responseData.proposedDestinationPort,
- priceAdjustmentResponse: responseData.priceAdjustmentResponse || false, // 체크 안하면 false로 설정
- isInitialResponse: responseData.isInitialResponse || false, // 체크 안하면 false로 설정
- sparePartResponse: responseData.sparePartResponse,
- additionalProposals: responseData.additionalProposals,
- priceAdjustmentForm: (responseData.priceAdjustmentResponse || false) ? {
- itemName: priceAdjustmentForm.itemName,
- adjustmentReflectionPoint: priceAdjustmentForm.adjustmentReflectionPoint,
- majorApplicableRawMaterial: priceAdjustmentForm.majorApplicableRawMaterial,
- adjustmentFormula: priceAdjustmentForm.adjustmentFormula,
- rawMaterialPriceIndex: priceAdjustmentForm.rawMaterialPriceIndex,
- referenceDate: priceAdjustmentForm.referenceDate,
- comparisonDate: priceAdjustmentForm.comparisonDate,
- adjustmentRatio: priceAdjustmentForm.adjustmentRatio ? parseFloat(priceAdjustmentForm.adjustmentRatio) : undefined,
- notes: priceAdjustmentForm.notes,
- adjustmentConditions: priceAdjustmentForm.adjustmentConditions,
- majorNonApplicableRawMaterial: priceAdjustmentForm.majorNonApplicableRawMaterial,
- adjustmentPeriod: priceAdjustmentForm.adjustmentPeriod,
- contractorWriter: priceAdjustmentForm.contractorWriter,
- adjustmentDate: priceAdjustmentForm.adjustmentDate,
- nonApplicableReason: priceAdjustmentForm.nonApplicableReason,
- } : undefined
- }
-
- const result = await submitPreQuoteResponse(
- biddingDetail.biddingCompanyId!,
- submissionData,
- userId
- )
-
- console.log('제출 결과:', result)
-
- if (result.success) {
- toast({
- title: '성공',
- description: result.message,
- })
-
- // 데이터 새로고침 및 폼 상태 업데이트
- const updatedDetail = await getBiddingCompaniesForPartners(biddingId, companyId)
- console.log('업데이트된 데이터:', updatedDetail)
-
- if (updatedDetail) {
- setBiddingDetail(updatedDetail as BiddingDetail)
-
- // 폼 상태도 업데이트된 데이터로 다시 설정
- setResponseData({
- preQuoteAmount: updatedDetail.preQuoteAmount?.toString() || '',
- paymentTermsResponse: updatedDetail.paymentTermsResponse || '',
- taxConditionsResponse: updatedDetail.taxConditionsResponse || '',
- incotermsResponse: updatedDetail.incotermsResponse || '',
- proposedContractDeliveryDate: updatedDetail.proposedContractDeliveryDate || '',
- proposedShippingPort: updatedDetail.proposedShippingPort || '',
- proposedDestinationPort: updatedDetail.proposedDestinationPort || '',
- priceAdjustmentResponse: updatedDetail.priceAdjustmentResponse || false,
- isInitialResponse: updatedDetail.isInitialResponse || false,
- sparePartResponse: updatedDetail.sparePartResponse || '',
- additionalProposals: updatedDetail.additionalProposals || '',
- isAttendingMeeting: updatedDetail.isAttendingMeeting || false,
- })
-
- // 연동제 데이터도 다시 로드
- if (updatedDetail.biddingCompanyId && updatedDetail.priceAdjustmentResponse) {
- const savedPriceAdjustmentForm = await getPriceAdjustmentFormByBiddingCompanyId(updatedDetail.biddingCompanyId)
- if (savedPriceAdjustmentForm) {
- setPriceAdjustmentForm({
- itemName: savedPriceAdjustmentForm.itemName || '',
- adjustmentReflectionPoint: savedPriceAdjustmentForm.adjustmentReflectionPoint || '',
- majorApplicableRawMaterial: savedPriceAdjustmentForm.majorApplicableRawMaterial || '',
- adjustmentFormula: savedPriceAdjustmentForm.adjustmentFormula || '',
- rawMaterialPriceIndex: savedPriceAdjustmentForm.rawMaterialPriceIndex || '',
- referenceDate: savedPriceAdjustmentForm.referenceDate ? new Date(savedPriceAdjustmentForm.referenceDate).toISOString().split('T')[0] : '',
- comparisonDate: savedPriceAdjustmentForm.comparisonDate ? new Date(savedPriceAdjustmentForm.comparisonDate).toISOString().split('T')[0] : '',
- adjustmentRatio: savedPriceAdjustmentForm.adjustmentRatio?.toString() || '',
- notes: savedPriceAdjustmentForm.notes || '',
- adjustmentConditions: savedPriceAdjustmentForm.adjustmentConditions || '',
- majorNonApplicableRawMaterial: savedPriceAdjustmentForm.majorNonApplicableRawMaterial || '',
- adjustmentPeriod: savedPriceAdjustmentForm.adjustmentPeriod || '',
- contractorWriter: savedPriceAdjustmentForm.contractorWriter || '',
- adjustmentDate: savedPriceAdjustmentForm.adjustmentDate ? new Date(savedPriceAdjustmentForm.adjustmentDate).toISOString().split('T')[0] : '',
- nonApplicableReason: savedPriceAdjustmentForm.nonApplicableReason || '',
- })
- }
- }
- }
- } else {
- toast({
- title: '오류',
- description: result.error,
- variant: 'destructive',
- })
- }
- })
- }
-
-
- if (isLoading) {
- return (
- <div className="flex items-center justify-center py-12">
- <div className="text-center">
- <div className="animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"></div>
- <p className="text-muted-foreground">입찰 정보를 불러오는 중...</p>
- </div>
- </div>
- )
- }
-
- if (!biddingDetail) {
- return (
- <div className="text-center py-12">
- <p className="text-muted-foreground">입찰 정보를 찾을 수 없습니다.</p>
- <Button onClick={() => router.back()} className="mt-4">
- <ArrowLeft className="w-4 h-4 mr-2" />
- 돌아가기
- </Button>
- </div>
- )
- }
-
- return (
- <div className="space-y-6">
- {/* 헤더 */}
- <div className="flex items-center justify-between">
- <div className="flex items-center gap-4">
- <Button variant="outline" onClick={() => router.back()}>
- <ArrowLeft className="w-4 h-4 mr-2" />
- 목록으로
- </Button>
- <div>
- <h1 className="text-2xl font-semibold">{biddingDetail.title}</h1>
- <div className="flex items-center gap-2 mt-1">
- <Badge variant="outline" className="font-mono">
- {biddingDetail.biddingNumber}
- {biddingDetail.revision && biddingDetail.revision > 0 && ` Rev.${biddingDetail.revision}`}
- </Badge>
- <Badge variant={
- biddingDetail.status === 'bidding_disposal' ? 'destructive' :
- biddingDetail.status === 'vendor_selected' ? 'default' :
- 'secondary'
- }>
- {biddingStatusLabels[biddingDetail.status]}
- </Badge>
- </div>
- </div>
- </div>
-
- </div>
-
- {/* 입찰 공고 섹션 */}
- <Card>
- <CardHeader>
- <CardTitle className="flex items-center gap-2">
- <FileText className="w-5 h-5" />
- 입찰 공고
- </CardTitle>
- </CardHeader>
- <CardContent className="space-y-4">
- <div className="grid grid-cols-1 md:grid-cols-2 gap-4">
- <div>
- <Label className="text-sm font-medium text-muted-foreground">프로젝트</Label>
- <div className="flex items-center gap-2 mt-1">
- <Building2 className="w-4 h-4" />
- <span>{biddingDetail.projectName}</span>
- </div>
- </div>
- <div>
- <Label className="text-sm font-medium text-muted-foreground">품목</Label>
- <div className="flex items-center gap-2 mt-1">
- <Package className="w-4 h-4" />
- <span>{biddingDetail.itemName}</span>
- </div>
- </div>
- {/* <div>
- <Label className="text-sm font-medium text-muted-foreground">계약구분</Label>
- <div className="mt-1">{contractTypeLabels[biddingDetail.contractType]}</div>
- </div>
- <div>
- <Label className="text-sm font-medium text-muted-foreground">입찰유형</Label>
- <div className="mt-1">{biddingTypeLabels[biddingDetail.biddingType]}</div>
- </div>
- <div>
- <Label className="text-sm font-medium text-muted-foreground">낙찰수</Label>
- <div className="mt-1">{biddingDetail.awardCount === 'single' ? '단수' : '복수'}</div>
- </div> */}
- <div>
- <Label className="text-sm font-medium text-muted-foreground">담당자</Label>
- <div className="flex items-center gap-2 mt-1">
- <User className="w-4 h-4" />
- <span>{biddingDetail.managerName}</span>
- </div>
- </div>
- </div>
-
- {/* {biddingDetail.budget && (
- <div>
- <Label className="text-sm font-medium text-muted-foreground">예산</Label>
- <div className="flex items-center gap-2 mt-1">
- <DollarSign className="w-4 h-4" />
- <span className="font-semibold">{formatCurrency(biddingDetail.budget)}</span>
- </div>
- </div>
- )} */}
-
- {/* 일정 정보 */}
- {/* <div className="pt-4 border-t">
- <Label className="text-sm font-medium text-muted-foreground mb-2 block">일정 정보</Label>
- <div className="grid grid-cols-1 md:grid-cols-2 gap-2 text-sm">
- {biddingDetail.submissionStartDate && biddingDetail.submissionEndDate && (
- <div>
- <span className="font-medium">제출기간:</span> {formatDate(biddingDetail.submissionStartDate, 'KR')} ~ {formatDate(biddingDetail.submissionEndDate, 'KR')}
- </div>
- )}
- {biddingDetail.evaluationDate && (
- <div>
- <span className="font-medium">평가일:</span> {formatDate(biddingDetail.evaluationDate, 'KR')}
- </div>
- )}
- </div>
- </div> */}
-
- {/* 견적마감일 정보 */}
- {biddingDetail.preQuoteDeadline && (
- <div className="pt-4 border-t">
- <Label className="text-sm font-medium text-muted-foreground mb-2 block">견적 마감 정보</Label>
- {(() => {
- const now = new Date()
- const deadline = new Date(biddingDetail.preQuoteDeadline)
- const isExpired = deadline < now
- const timeLeft = deadline.getTime() - now.getTime()
- const daysLeft = Math.floor(timeLeft / (1000 * 60 * 60 * 24))
- const hoursLeft = Math.floor((timeLeft % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60))
-
- return (
- <div className={`p-3 rounded-lg border-2 ${
- isExpired
- ? 'border-red-200 bg-red-50'
- : daysLeft <= 1
- ? 'border-orange-200 bg-orange-50'
- : 'border-green-200 bg-green-50'
- }`}>
- <div className="flex items-center justify-between">
- <div className="flex items-center gap-2">
- <Calendar className="w-5 h-5" />
- <span className="font-medium">견적 마감일:</span>
- <span className="text-lg font-semibold">
- {formatDate(biddingDetail.preQuoteDeadline, 'KR')}
- </span>
- </div>
- {isExpired ? (
- <Badge variant="destructive" className="ml-2">
- 마감됨
- </Badge>
- ) : daysLeft <= 1 ? (
- <Badge variant="secondary" className="ml-2 bg-orange-100 text-orange-800">
- {daysLeft === 0 ? `${hoursLeft}시간 남음` : `${daysLeft}일 남음`}
- </Badge>
- ) : (
- <Badge variant="secondary" className="ml-2 bg-green-100 text-green-800">
- {daysLeft}일 남음
- </Badge>
- )}
- </div>
- {isExpired && (
- <div className="mt-2 text-sm text-red-600">
- ⚠️ 견적 마감일이 지났습니다. 견적 제출이 불가능합니다.
- </div>
- )}
- </div>
- )
- })()}
- </div>
- )}
- </CardContent>
- </Card>
-
- {/* 현재 설정된 조건 섹션 */}
- {biddingConditions && (
- <Card>
- <CardHeader>
- <CardTitle>현재 설정된 입찰 조건</CardTitle>
- </CardHeader>
- <CardContent>
- <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 text-sm">
- <div>
- <Label className="text-muted-foreground">지급조건</Label>
- <div className="mt-1 p-3 bg-muted rounded-md">
- <p className="font-medium">{biddingConditions.paymentTerms || "미설정"}</p>
- </div>
- </div>
-
- <div>
- <Label className="text-muted-foreground">세금조건</Label>
- <div className="mt-1 p-3 bg-muted rounded-md">
- <p className="font-medium">
- {biddingConditions.taxConditions
- ? getTaxConditionName(biddingConditions.taxConditions)
- : "미설정"
- }
- </p>
- </div>
- </div>
-
- <div>
- <Label className="text-muted-foreground">운송조건</Label>
- <div className="mt-1 p-3 bg-muted rounded-md">
- <p className="font-medium">{biddingConditions.incoterms || "미설정"}</p>
- </div>
- </div>
-
- <div>
- <Label className="text-muted-foreground">계약 납기일</Label>
- <div className="mt-1 p-3 bg-muted rounded-md">
- <p className="font-medium">
- {biddingConditions.contractDeliveryDate
- ? formatDate(biddingConditions.contractDeliveryDate, 'KR')
- : "미설정"
- }
- </p>
- </div>
- </div>
-
- <div>
- <Label className="text-muted-foreground">선적지</Label>
- <div className="mt-1 p-3 bg-muted rounded-md">
- <p className="font-medium">{biddingConditions.shippingPort || "미설정"}</p>
- </div>
- </div>
-
- <div>
- <Label className="text-muted-foreground">하역지</Label>
- <div className="mt-1 p-3 bg-muted rounded-md">
- <p className="font-medium">{biddingConditions.destinationPort || "미설정"}</p>
- </div>
- </div>
-
- <div>
- <Label className="text-muted-foreground">연동제 적용</Label>
- <div className="mt-1 p-3 bg-muted rounded-md">
- <p className="font-medium">{biddingConditions.isPriceAdjustmentApplicable ? "적용 가능" : "적용 불가"}</p>
- </div>
- </div>
-
-
- <div >
- <Label className="text-muted-foreground">스페어파트 옵션</Label>
- <div className="mt-1 p-3 bg-muted rounded-md">
- <p className="font-medium">{biddingConditions.sparePartOptions}</p>
- </div>
- </div>
- </div>
- </CardContent>
- </Card>
- )}
-
- {/* 사전견적 참여의사 결정 섹션 */}
- <Card>
- <CardHeader>
- <CardTitle className="flex items-center gap-2">
- <Users className="w-5 h-5" />
- 사전견적 참여의사 결정
- </CardTitle>
- </CardHeader>
- <CardContent>
- {participationDecision === null ? (
- <div className="space-y-4">
- <p className="text-muted-foreground">
- 해당 입찰의 사전견적에 참여하시겠습니까?
- </p>
- <div className="flex gap-3">
- <Button
- onClick={() => handleParticipationDecision(true)}
- disabled={isPending}
- className="flex items-center gap-2"
- >
- <CheckCircle className="w-4 h-4" />
- 참여
- </Button>
- <Button
- variant="outline"
- onClick={() => handleParticipationDecision(false)}
- disabled={isPending}
- className="flex items-center gap-2"
- >
- <XCircle className="w-4 h-4" />
- 미참여
- </Button>
- </div>
- </div>
- ) : (
- <div className="space-y-4">
- <div className={`flex items-center gap-2 p-3 rounded-lg ${
- participationDecision ? 'bg-green-50 text-green-800' : 'bg-red-50 text-red-800'
- }`}>
- {participationDecision ? (
- <CheckCircle className="w-5 h-5" />
- ) : (
- <XCircle className="w-5 h-5" />
- )}
- <span className="font-medium">
- 사전견적 {participationDecision ? '참여' : '미참여'}로 설정되었습니다.
- </span>
- </div>
- {participationDecision === false && (
- <>
- <div className="p-4 bg-muted rounded-lg">
- <p className="text-muted-foreground">
- 미참여로 설정되어 견적 작성 섹션이 숨겨집니다. 참여하시려면 아래 버튼을 클릭해주세요.
- </p>
- </div>
-
- <Button
- variant="outline"
- size="sm"
- onClick={() => setParticipationDecision(null)}
- disabled={isPending}
- >
- 결정 변경하기
- </Button>
- </>
- )}
- </div>
- )}
- </CardContent>
- </Card>
-
- {/* 참여 결정 시에만 견적 작성 섹션들 표시 (단, 견적마감일이 지나지 않은 경우에만) */}
- {participationDecision === true && (() => {
- // 견적마감일 체크
- if (biddingDetail?.preQuoteDeadline) {
- const now = new Date()
- const deadline = new Date(biddingDetail.preQuoteDeadline)
- const isExpired = deadline < now
-
- if (isExpired) {
- return (
- <Card>
- <CardContent className="pt-6">
- <div className="text-center py-8">
- <XCircle className="w-12 h-12 text-red-500 mx-auto mb-4" />
- <h3 className="text-lg font-semibold text-red-700 mb-2">견적 마감</h3>
- <p className="text-muted-foreground">
- 견적 마감일({formatDate(biddingDetail.preQuoteDeadline, 'KR')})이 지나 견적 제출이 불가능합니다.
- </p>
- </div>
- </CardContent>
- </Card>
- )
- }
- }
-
- return true // 견적 작성 가능
- })() && (
- <>
- {/* 품목별 견적 작성 섹션 */}
- {prItems.length > 0 && (
- <PrItemsPricingTable
- prItems={prItems}
- initialQuotations={prItemQuotations}
- currency={biddingDetail?.currency || 'KRW'}
- onQuotationsChange={setPrItemQuotations}
- onTotalAmountChange={setTotalAmount}
- readOnly={false}
- />
- )}
-
- {/* 견적 문서 업로드 섹션 */}
- <SimpleFileUpload
- biddingId={biddingId}
- companyId={companyId}
- userId={userId}
- readOnly={false}
- />
-
- {/* 사전견적 폼 섹션 */}
- <Card>
- <CardHeader>
- <CardTitle className="flex items-center gap-2">
- <Send className="w-5 h-5" />
- 사전견적 제출하기
- </CardTitle>
- </CardHeader>
- <CardContent className="space-y-6">
- {/* 총 금액 표시 (읽기 전용) */}
- <div className="grid grid-cols-1 md:grid-cols-2 gap-6">
- <div className="space-y-2">
- <Label htmlFor="totalAmount">총 사전견적 금액 <span className="text-red-500">*</span></Label>
- <Input
- id="totalAmount"
- type="text"
- value={new Intl.NumberFormat('ko-KR', {
- style: 'currency',
- currency: biddingDetail?.currency || 'KRW',
- }).format(totalAmount)}
- readOnly
- className="bg-gray-50 font-semibold text-primary"
- />
- </div>
-
- <div className="space-y-2">
- <Label htmlFor="proposedContractDeliveryDate">제안 납품일 <span className="text-red-500">*</span></Label>
- <Input
- id="proposedContractDeliveryDate"
- type="date"
- value={responseData.proposedContractDeliveryDate}
- onChange={(e) => setResponseData({...responseData, proposedContractDeliveryDate: e.target.value})}
- title={biddingConditions?.contractDeliveryDate ? `참고 납기일: ${formatDate(biddingConditions.contractDeliveryDate, 'KR')}` : "납품일을 선택하세요"}
- />
- {biddingConditions?.contractDeliveryDate && (
- <p className="text-xs text-muted-foreground">
- 참고 납기일: {formatDate(biddingConditions.contractDeliveryDate, 'KR')}
- </p>
- )}
- </div>
- </div>
-
- <div className="grid grid-cols-1 md:grid-cols-2 gap-6">
- <div className="space-y-2">
- <Label htmlFor="paymentTermsResponse">응답 지급조건 <span className="text-red-500">*</span></Label>
- <Select
- value={responseData.paymentTermsResponse}
- onValueChange={(value) => setResponseData({...responseData, paymentTermsResponse: value})}
- >
- <SelectTrigger>
- <SelectValue placeholder={biddingConditions?.paymentTerms ? `참고: ${biddingConditions.paymentTerms}` : "지급조건 선택"} />
- </SelectTrigger>
- <SelectContent>
- {paymentTermsOptions.length > 0 ? (
- paymentTermsOptions.map((option) => (
- <SelectItem key={option.code} value={option.code}>
- {option.code} {option.description && `(${option.description})`}
- </SelectItem>
- ))
- ) : (
- <SelectItem value="loading" disabled>
- 데이터를 불러오는 중...
- </SelectItem>
- )}
- </SelectContent>
- </Select>
- </div>
-
- <div className="space-y-2">
- <Label htmlFor="taxConditionsResponse">응답 세금조건 <span className="text-red-500">*</span></Label>
- <Select
- value={responseData.taxConditionsResponse}
- onValueChange={(value) => setResponseData({...responseData, taxConditionsResponse: value})}
- >
- <SelectTrigger>
- <SelectValue placeholder={biddingConditions?.taxConditions ? `참고: ${getTaxConditionName(biddingConditions.taxConditions)}` : "세금조건 선택"} />
- </SelectTrigger>
- <SelectContent>
- {TAX_CONDITIONS.map((condition) => (
- <SelectItem key={condition.code} value={condition.code}>
- {condition.name}
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
- </div>
- </div>
-
- <div className="grid grid-cols-1 md:grid-cols-2 gap-6">
- <div className="space-y-2">
- <Label htmlFor="incotermsResponse">응답 운송조건 <span className="text-red-500">*</span></Label>
- <Select
- value={responseData.incotermsResponse}
- onValueChange={(value) => setResponseData({...responseData, incotermsResponse: value})}
- >
- <SelectTrigger>
- <SelectValue placeholder={biddingConditions?.incoterms ? `참고: ${biddingConditions.incoterms}` : "운송조건 선택"} />
- </SelectTrigger>
- <SelectContent>
- {incotermsOptions.length > 0 ? (
- incotermsOptions.map((option) => (
- <SelectItem key={option.code} value={option.code}>
- {option.code} {option.description && `(${option.description})`}
- </SelectItem>
- ))
- ) : (
- <SelectItem value="loading" disabled>
- 데이터를 불러오는 중...
- </SelectItem>
- )}
- </SelectContent>
- </Select>
- </div>
-
- <div className="space-y-2">
- <Label htmlFor="proposedShippingPort">제안 선적지 <span className="text-red-500">*</span></Label>
- <Select
- value={responseData.proposedShippingPort}
- onValueChange={(value) => setResponseData({...responseData, proposedShippingPort: value})}
- >
- <SelectTrigger>
- <SelectValue placeholder={biddingConditions?.shippingPort ? `참고: ${biddingConditions.shippingPort}` : "선적지 선택"} />
- </SelectTrigger>
- <SelectContent>
- {shippingPlaces.length > 0 ? (
- shippingPlaces.map((place) => (
- <SelectItem key={place.code} value={place.code}>
- {place.code} {place.description && `(${place.description})`}
- </SelectItem>
- ))
- ) : (
- <SelectItem value="loading" disabled>
- 데이터를 불러오는 중...
- </SelectItem>
- )}
- </SelectContent>
- </Select>
- </div>
- </div>
-
- <div className="grid grid-cols-1 md:grid-cols-2 gap-6">
- <div className="space-y-2">
- <Label htmlFor="proposedDestinationPort">제안 하역지 <span className="text-red-500">*</span></Label>
- <Select
- value={responseData.proposedDestinationPort}
- onValueChange={(value) => setResponseData({...responseData, proposedDestinationPort: value})}
- >
- <SelectTrigger>
- <SelectValue placeholder={biddingConditions?.destinationPort ? `참고: ${biddingConditions.destinationPort}` : "하역지 선택"} />
- </SelectTrigger>
- <SelectContent>
- {destinationPlaces.length > 0 ? (
- destinationPlaces.map((place) => (
- <SelectItem key={place.code} value={place.code}>
- {place.code} {place.description && `(${place.description})`}
- </SelectItem>
- ))
- ) : (
- <SelectItem value="loading" disabled>
- 데이터를 불러오는 중...
- </SelectItem>
- )}
- </SelectContent>
- </Select>
- </div>
-
- <div className="space-y-2">
- <Label htmlFor="sparePartResponse">스페어파트 응답 <span className="text-red-500">*</span></Label>
- <Input
- id="sparePartResponse"
- value={responseData.sparePartResponse}
- onChange={(e) => setResponseData({...responseData, sparePartResponse: e.target.value})}
- placeholder={biddingConditions?.sparePartOptions ? `참고: ${biddingConditions.sparePartOptions}` : "스페어파트 관련 응답을 입력하세요"}
- />
- </div>
- </div>
-
- <div className="space-y-2">
- <Label htmlFor="additionalProposals">변경사유</Label>
- <Textarea
- id="additionalProposals"
- value={responseData.additionalProposals}
- onChange={(e) => setResponseData({...responseData, additionalProposals: e.target.value})}
- placeholder="변경사유를 입력하세요"
- rows={4}
- />
- </div>
-
- <div className="space-y-4">
- <div className="flex items-center space-x-2">
- <Checkbox
- id="isInitialResponse"
- checked={responseData.isInitialResponse}
- onCheckedChange={(checked) =>
- setResponseData({...responseData, isInitialResponse: !!checked})
- }
- />
- <Label htmlFor="isInitialResponse">초도 공급입니다</Label>
- </div>
-
- <div className="flex items-center space-x-2">
- <Checkbox
- id="priceAdjustmentResponse"
- checked={responseData.priceAdjustmentResponse}
- onCheckedChange={(checked) =>
- setResponseData({...responseData, priceAdjustmentResponse: !!checked})
- }
- />
- <Label htmlFor="priceAdjustmentResponse">연동제 적용에 동의합니다</Label>
- </div>
- </div>
-
- {/* 연동제 상세 정보 (연동제 적용 시에만 표시) */}
- {responseData.priceAdjustmentResponse && (
- <Card className="mt-6">
- <CardHeader>
- <CardTitle className="text-lg">하도급대금등 연동표</CardTitle>
- </CardHeader>
- <CardContent className="space-y-4">
- <div className="grid grid-cols-1 md:grid-cols-2 gap-4">
- <div className="space-y-2">
- <Label htmlFor="itemName">품목등의 명칭</Label>
- <Input
- id="itemName"
- value={priceAdjustmentForm.itemName}
- onChange={(e) => setPriceAdjustmentForm({...priceAdjustmentForm, itemName: e.target.value})}
- placeholder="품목명을 입력하세요"
- />
- </div>
-
- <div className="space-y-2">
- <Label htmlFor="adjustmentReflectionPoint">조정대금 반영시점</Label>
- <Input
- id="adjustmentReflectionPoint"
- value={priceAdjustmentForm.adjustmentReflectionPoint}
- onChange={(e) => setPriceAdjustmentForm({...priceAdjustmentForm, adjustmentReflectionPoint: e.target.value})}
- placeholder="반영시점을 입력하세요"
- />
- </div>
-
- <div className="space-y-2">
- <Label htmlFor="adjustmentRatio">연동 비율 (%)</Label>
- <Input
- id="adjustmentRatio"
- type="number"
- step="0.01"
- value={priceAdjustmentForm.adjustmentRatio}
- onChange={(e) => setPriceAdjustmentForm({...priceAdjustmentForm, adjustmentRatio: e.target.value})}
- placeholder="비율을 입력하세요"
- />
- </div>
-
- <div className="space-y-2">
- <Label htmlFor="adjustmentPeriod">조정주기</Label>
- <Input
- id="adjustmentPeriod"
- value={priceAdjustmentForm.adjustmentPeriod}
- onChange={(e) => setPriceAdjustmentForm({...priceAdjustmentForm, adjustmentPeriod: e.target.value})}
- placeholder="조정주기를 입력하세요"
- />
- </div>
-
- <div className="space-y-2">
- <Label htmlFor="referenceDate">기준시점</Label>
- <Input
- id="referenceDate"
- type="date"
- value={priceAdjustmentForm.referenceDate}
- onChange={(e) => setPriceAdjustmentForm({...priceAdjustmentForm, referenceDate: e.target.value})}
- />
- </div>
-
- <div className="space-y-2">
- <Label htmlFor="comparisonDate">비교시점</Label>
- <Input
- id="comparisonDate"
- type="date"
- value={priceAdjustmentForm.comparisonDate}
- onChange={(e) => setPriceAdjustmentForm({...priceAdjustmentForm, comparisonDate: e.target.value})}
- />
- </div>
-
- <div className="space-y-2">
- <Label htmlFor="contractorWriter">수탁기업(협력사) 작성자</Label>
- <Input
- id="contractorWriter"
- value={priceAdjustmentForm.contractorWriter}
- onChange={(e) => setPriceAdjustmentForm({...priceAdjustmentForm, contractorWriter: e.target.value})}
- placeholder="작성자명을 입력하세요"
- />
- </div>
-
- <div className="space-y-2">
- <Label htmlFor="adjustmentDate">조정일</Label>
- <Input
- id="adjustmentDate"
- type="date"
- value={priceAdjustmentForm.adjustmentDate}
- onChange={(e) => setPriceAdjustmentForm({...priceAdjustmentForm, adjustmentDate: e.target.value})}
- />
- </div>
- </div>
-
- <div className="space-y-2">
- <Label htmlFor="majorApplicableRawMaterial">연동대상 주요 원재료</Label>
- <Textarea
- id="majorApplicableRawMaterial"
- value={priceAdjustmentForm.majorApplicableRawMaterial}
- onChange={(e) => setPriceAdjustmentForm({...priceAdjustmentForm, majorApplicableRawMaterial: e.target.value})}
- placeholder="연동 대상 원재료를 입력하세요"
- rows={3}
- />
- </div>
-
- <div className="space-y-2">
- <Label htmlFor="adjustmentFormula">하도급대금등 연동 산식</Label>
- <Textarea
- id="adjustmentFormula"
- value={priceAdjustmentForm.adjustmentFormula}
- onChange={(e) => setPriceAdjustmentForm({...priceAdjustmentForm, adjustmentFormula: e.target.value})}
- placeholder="연동 산식을 입력하세요"
- rows={3}
- />
- </div>
-
- <div className="space-y-2">
- <Label htmlFor="rawMaterialPriceIndex">원재료 가격 기준지표</Label>
- <Textarea
- id="rawMaterialPriceIndex"
- value={priceAdjustmentForm.rawMaterialPriceIndex}
- onChange={(e) => setPriceAdjustmentForm({...priceAdjustmentForm, rawMaterialPriceIndex: e.target.value})}
- placeholder="가격 기준지표를 입력하세요"
- rows={2}
- />
- </div>
-
- <div className="space-y-2">
- <Label htmlFor="adjustmentConditions">조정요건</Label>
- <Textarea
- id="adjustmentConditions"
- value={priceAdjustmentForm.adjustmentConditions}
- onChange={(e) => setPriceAdjustmentForm({...priceAdjustmentForm, adjustmentConditions: e.target.value})}
- placeholder="조정요건을 입력하세요"
- rows={2}
- />
- </div>
-
- <div className="space-y-2">
- <Label htmlFor="majorNonApplicableRawMaterial">연동 미적용 주요 원재료</Label>
- <Textarea
- id="majorNonApplicableRawMaterial"
- value={priceAdjustmentForm.majorNonApplicableRawMaterial}
- onChange={(e) => setPriceAdjustmentForm({...priceAdjustmentForm, majorNonApplicableRawMaterial: e.target.value})}
- placeholder="연동 미적용 원재료를 입력하세요"
- rows={2}
- />
- </div>
-
- <div className="space-y-2">
- <Label htmlFor="nonApplicableReason">연동 미적용 사유</Label>
- <Textarea
- id="nonApplicableReason"
- value={priceAdjustmentForm.nonApplicableReason}
- onChange={(e) => setPriceAdjustmentForm({...priceAdjustmentForm, nonApplicableReason: e.target.value})}
- placeholder="미적용 사유를 입력하세요"
- rows={2}
- />
- </div>
-
- <div className="space-y-2">
- <Label htmlFor="priceAdjustmentNotes">기타 사항</Label>
- <Textarea
- id="priceAdjustmentNotes"
- value={priceAdjustmentForm.notes}
- onChange={(e) => setPriceAdjustmentForm({...priceAdjustmentForm, notes: e.target.value})}
- placeholder="기타 사항을 입력하세요"
- rows={2}
- />
- </div>
- </CardContent>
- </Card>
- )}
-
- <div className="flex justify-end gap-2 pt-4">
- <Button
- variant="outline"
- onClick={handleTempSave}
- disabled={isSaving || isPending || (biddingDetail && !['request_for_quotation', 'received_quotation'].includes(biddingDetail.status))}
- >
- <Save className="w-4 h-4 mr-2" />
- {isSaving ? '저장중...' : '임시저장'}
- </Button>
- <Button
- onClick={handleSubmitResponse}
- disabled={isPending || isSaving || (biddingDetail && !['request_for_quotation', 'received_quotation'].includes(biddingDetail.status))}
- >
- <Send className="w-4 h-4 mr-2" />
- 사전견적 제출
- </Button>
- </div>
- </CardContent>
- </Card>
- </>
- )}
- </div>
- )
-}