diff options
Diffstat (limited to 'lib/bidding/vendor')
| -rw-r--r-- | lib/bidding/vendor/partners-bidding-pre-quote.tsx | 51 |
1 files changed, 38 insertions, 13 deletions
diff --git a/lib/bidding/vendor/partners-bidding-pre-quote.tsx b/lib/bidding/vendor/partners-bidding-pre-quote.tsx index 6a76ffa1..6b9f956b 100644 --- a/lib/bidding/vendor/partners-bidding-pre-quote.tsx +++ b/lib/bidding/vendor/partners-bidding-pre-quote.tsx @@ -325,6 +325,17 @@ export function PartnersBiddingPreQuote({ biddingId, companyId }: PartnersBiddin return } + // 사전견적 상태 체크 + const isPreQuoteStatus = biddingStatus === 'request_for_quotation' || biddingStatus === 'received_quotation' + if (!isPreQuoteStatus) { + toast({ + title: "접근 제한", + description: "사전견적 단계가 아니므로 임시저장이 불가능합니다.", + variant: "destructive", + }) + return + } + if (!userId) { toast({ title: '임시저장 실패', @@ -347,11 +358,11 @@ export function PartnersBiddingPreQuote({ biddingId, companyId }: PartnersBiddin proposedContractDeliveryDate: responseData.proposedContractDeliveryDate, proposedShippingPort: responseData.proposedShippingPort, proposedDestinationPort: responseData.proposedDestinationPort, - priceAdjustmentResponse: responseData.priceAdjustmentResponse, - isInitialResponse: responseData.isInitialResponse, + priceAdjustmentResponse: responseData.priceAdjustmentResponse || false, // 체크 안하면 false로 설정 + isInitialResponse: responseData.isInitialResponse || false, // 체크 안하면 false로 설정 sparePartResponse: responseData.sparePartResponse, additionalProposals: responseData.additionalProposals, - priceAdjustmentForm: responseData.priceAdjustmentResponse ? { + priceAdjustmentForm: (responseData.priceAdjustmentResponse || false) ? { itemName: priceAdjustmentForm.itemName, adjustmentReflectionPoint: priceAdjustmentForm.adjustmentReflectionPoint, majorApplicableRawMaterial: priceAdjustmentForm.majorApplicableRawMaterial, @@ -440,6 +451,17 @@ export function PartnersBiddingPreQuote({ biddingId, companyId }: PartnersBiddin 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() @@ -509,11 +531,11 @@ export function PartnersBiddingPreQuote({ biddingId, companyId }: PartnersBiddin proposedContractDeliveryDate: responseData.proposedContractDeliveryDate, proposedShippingPort: responseData.proposedShippingPort, proposedDestinationPort: responseData.proposedDestinationPort, - priceAdjustmentResponse: responseData.priceAdjustmentResponse, - isInitialResponse: responseData.isInitialResponse, + priceAdjustmentResponse: responseData.priceAdjustmentResponse || false, // 체크 안하면 false로 설정 + isInitialResponse: responseData.isInitialResponse || false, // 체크 안하면 false로 설정 sparePartResponse: responseData.sparePartResponse, additionalProposals: responseData.additionalProposals, - priceAdjustmentForm: responseData.priceAdjustmentResponse ? { + priceAdjustmentForm: (responseData.priceAdjustmentResponse || false) ? { itemName: priceAdjustmentForm.itemName, adjustmentReflectionPoint: priceAdjustmentForm.adjustmentReflectionPoint, majorApplicableRawMaterial: priceAdjustmentForm.majorApplicableRawMaterial, @@ -1145,12 +1167,12 @@ export function PartnersBiddingPreQuote({ biddingId, companyId }: PartnersBiddin </div> <div className="space-y-2"> - <Label htmlFor="additionalProposals">사유</Label> + <Label htmlFor="additionalProposals">변경사유</Label> <Textarea id="additionalProposals" value={responseData.additionalProposals} onChange={(e) => setResponseData({...responseData, additionalProposals: e.target.value})} - placeholder="사유를 입력하세요" + placeholder="변경사유를 입력하세요" rows={4} /> </div> @@ -1351,15 +1373,18 @@ export function PartnersBiddingPreQuote({ biddingId, companyId }: PartnersBiddin )} <div className="flex justify-end gap-2 pt-4"> - <Button - variant="outline" - onClick={handleTempSave} - disabled={isSaving || isPending} + <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}> + <Button + onClick={handleSubmitResponse} + disabled={isPending || isSaving || (biddingDetail && !['request_for_quotation', 'received_quotation'].includes(biddingDetail.status))} + > <Send className="w-4 h-4 mr-2" /> 사전견적 제출 </Button> |
