diff options
| author | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-10-14 08:34:27 +0000 |
|---|---|---|
| committer | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-10-14 08:34:27 +0000 |
| commit | 80ab33adc277904e71dcf8c08e59390600226075 (patch) | |
| tree | cf6c754aca1bc33e7e0bd39fe7b182da5a974e13 /lib/rfq-last | |
| parent | 6892880c16af3eb0027a77c9695b2fe462b4761e (diff) | |
(최겸) 구매 견젹 협력업체 제출 간 오류 수정
Diffstat (limited to 'lib/rfq-last')
3 files changed, 78 insertions, 15 deletions
diff --git a/lib/rfq-last/vendor-response/editor/quotation-items-table.tsx b/lib/rfq-last/vendor-response/editor/quotation-items-table.tsx index 26c3808a..54866822 100644 --- a/lib/rfq-last/vendor-response/editor/quotation-items-table.tsx +++ b/lib/rfq-last/vendor-response/editor/quotation-items-table.tsx @@ -127,8 +127,38 @@ export default function QuotationItemsTable({ prItems }: QuotationItemsTableProp ) || 0 // 상세 정보 다이얼로그 - const ItemDetailDialog = ({ item, prItem, index }: any) => ( - <Dialog open={showDetail} onOpenChange={setShowDetail}> + const ItemDetailDialog = ({ item, prItem, index }: any) => { + const [localDeviationReason, setLocalDeviationReason] = useState("") + const [localItemRemark, setLocalItemRemark] = useState("") + const [localTechnicalCompliance, setLocalTechnicalCompliance] = useState(false) + const [localAlternativeProposal, setLocalAlternativeProposal] = useState("") + + // 다이얼로그가 열릴 때 기존 값으로 초기화 + useEffect(() => { + if (item) { + setLocalDeviationReason(item.deviationReason || "") + setLocalItemRemark(item.itemRemark || "") + setLocalTechnicalCompliance(item.technicalCompliance || false) + setLocalAlternativeProposal(item.alternativeProposal || "") + } + }, [item]) + + // 저장 버튼 클릭 핸들러 + const handleSaveDetail = () => { + setValue(`quotationItems.${index}.deviationReason`, localDeviationReason) + setValue(`quotationItems.${index}.itemRemark`, localItemRemark) + setValue(`quotationItems.${index}.technicalCompliance`, localTechnicalCompliance) + setValue(`quotationItems.${index}.alternativeProposal`, localAlternativeProposal) + setShowDetail(false) + } + + // 취소 버튼 클릭 핸들러 + const handleCancelDetail = () => { + setShowDetail(false) + } + + return ( + <Dialog open={showDetail} onOpenChange={(open) => !open && setShowDetail(false)}> <DialogContent className="max-w-3xl max-h-[80vh] overflow-y-auto"> <DialogHeader> <DialogTitle>견적 상세 정보</DialogTitle> @@ -221,24 +251,23 @@ export default function QuotationItemsTable({ prItems }: QuotationItemsTableProp <div className="flex items-center space-x-2"> <Checkbox id={`technicalCompliance-${index}`} - checked={watch(`quotationItems.${index}.technicalCompliance`)} - onCheckedChange={(checked) => - setValue(`quotationItems.${index}.technicalCompliance`, checked) - } + checked={localTechnicalCompliance} + onCheckedChange={(checked) => setLocalTechnicalCompliance(checked === true)} /> <Label htmlFor={`technicalCompliance-${index}`}> 기술 사양 준수 </Label> </div> - {!watch(`quotationItems.${index}.technicalCompliance`) && ( + {!localTechnicalCompliance && ( <div className="space-y-2"> <Label htmlFor={`alternativeProposal-${index}`}> 대안 제안 <span className="text-red-500">*</span> </Label> <Textarea id={`alternativeProposal-${index}`} - {...register(`quotationItems.${index}.alternativeProposal`)} + value={localAlternativeProposal} + onChange={(e) => setLocalAlternativeProposal(e.target.value)} placeholder="기술 사양을 준수하지 않는 경우 대안을 제시해주세요" className="min-h-[100px]" /> @@ -249,7 +278,8 @@ export default function QuotationItemsTable({ prItems }: QuotationItemsTableProp <Label htmlFor={`deviationReason-${index}`}>편차 사유</Label> <Textarea id={`deviationReason-${index}`} - {...register(`quotationItems.${index}.deviationReason`)} + value={localDeviationReason} + onChange={(e) => setLocalDeviationReason(e.target.value)} placeholder="요구사항과 다른 부분이 있는 경우 사유를 입력하세요" className="min-h-[80px]" /> @@ -300,16 +330,34 @@ export default function QuotationItemsTable({ prItems }: QuotationItemsTableProp </CardHeader> <CardContent> <Textarea - {...register(`quotationItems.${index}.itemRemark`)} + value={localItemRemark} + onChange={(e) => setLocalItemRemark(e.target.value)} placeholder="아이템별 비고사항을 입력하세요" className="min-h-[100px]" /> </CardContent> </Card> </div> + + <DialogFooter> + <Button + type="button" + variant="outline" + onClick={handleCancelDetail} + > + 취소 + </Button> + <Button + type="button" + onClick={handleSaveDetail} + > + 확인 + </Button> + </DialogFooter> </DialogContent> </Dialog> ) +} return ( <Card> @@ -358,7 +406,7 @@ export default function QuotationItemsTable({ prItems }: QuotationItemsTableProp <TableHead className="w-[50px]">No</TableHead> <TableHead className="w-[100px]">PR No</TableHead> <TableHead className="min-w-[150px]">자재코드</TableHead> - <TableHead className="min-w-[200px]">자재설명</TableHead> + <TableHead className="min-w-[200px]">자재명</TableHead> <TableHead className="text-right w-[100px]">수량</TableHead> <TableHead className="w-[150px]">단가</TableHead> <TableHead className="text-right w-[150px]">총액</TableHead> diff --git a/lib/rfq-last/vendor-response/editor/vendor-response-editor.tsx b/lib/rfq-last/vendor-response/editor/vendor-response-editor.tsx index 795431f6..48ebeb47 100644 --- a/lib/rfq-last/vendor-response/editor/vendor-response-editor.tsx +++ b/lib/rfq-last/vendor-response/editor/vendor-response-editor.tsx @@ -103,7 +103,6 @@ export default function VendorResponseEditor({ existingResponse, userId, basicContracts = [] // 추가 - }: VendorResponseEditorProps) { const router = useRouter() const [loading, setLoading] = useState(false) @@ -115,6 +114,9 @@ export default function VendorResponseEditor({ console.log(existingResponse,"existingResponse") + // 제출완료 상태 확인 + const isSubmitted = existingResponse?.status === "제출완료" || existingResponse?.submission?.submittedAt + // existingResponse가 변경될 때 existingAttachments 초기화 useEffect(() => { if (existingResponse?.attachments) { @@ -527,6 +529,7 @@ export default function VendorResponseEditor({ onExistingAttachmentsChange={handleExistingAttachmentsChange} responseId={existingResponse?.id} userId={userId} + isSubmitted={isSubmitted} /> </TabsContent> </Tabs> @@ -560,17 +563,23 @@ export default function VendorResponseEditor({ > 취소 </Button> + {!isSubmitted && ( <Button type="button" // submit에서 button으로 변경 variant="secondary" onClick={() => handleFormSubmit(false)} // 직접 핸들러 호출 - disabled={loading} + disabled={loading || isSubmitted} > {loading ? ( <> <div className="h-4 w-4 mr-2 animate-spin rounded-full border-2 border-current border-t-transparent" /> 처리중... </> + ) : isSubmitted ? ( + <> + <CheckCircle className="h-4 w-4 mr-2" /> + 제출완료 + </> ) : ( <> <Save className="h-4 w-4 mr-2" /> @@ -578,11 +587,12 @@ export default function VendorResponseEditor({ </> )} </Button> + )} <Button type="button" variant="default" onClick={() => handleFormSubmit(true)} // 직접 핸들러 호출 - disabled={loading || !allContractsSigned} + disabled={loading || !allContractsSigned || isSubmitted} > {!allContractsSigned ? ( <> @@ -594,6 +604,11 @@ export default function VendorResponseEditor({ <div className="h-4 w-4 mr-2 animate-spin rounded-full border-2 border-current border-t-transparent" /> 처리중... </> + ) : isSubmitted ? ( + <> + <CheckCircle className="h-4 w-4 mr-2" /> + 제출완료 + </> ) : ( <> <Send className="h-4 w-4 mr-2" /> diff --git a/lib/rfq-last/vendor/batch-update-conditions-dialog.tsx b/lib/rfq-last/vendor/batch-update-conditions-dialog.tsx index 70d5569f..c258293b 100644 --- a/lib/rfq-last/vendor/batch-update-conditions-dialog.tsx +++ b/lib/rfq-last/vendor/batch-update-conditions-dialog.tsx @@ -1110,7 +1110,7 @@ export function BatchUpdateConditionsDialog({ <FormLabel className={cn( !fieldsToUpdate.materialPrice && "text-muted-foreground" )}> - 연동제 적용 + 연동제 적용 요건문의 </FormLabel> <div className="text-sm text-muted-foreground"> 원자재 가격 연동 여부 |
