diff options
Diffstat (limited to 'lib/tbe-last/table')
| -rw-r--r-- | lib/tbe-last/table/evaluation-dialog.tsx | 50 | ||||
| -rw-r--r-- | lib/tbe-last/table/tbe-last-table.tsx | 5 |
2 files changed, 28 insertions, 27 deletions
diff --git a/lib/tbe-last/table/evaluation-dialog.tsx b/lib/tbe-last/table/evaluation-dialog.tsx index ac1d923b..7843a92e 100644 --- a/lib/tbe-last/table/evaluation-dialog.tsx +++ b/lib/tbe-last/table/evaluation-dialog.tsx @@ -90,6 +90,28 @@ export function EvaluationDialog({ const watchEvaluationResult = form.watch("evaluationResult") const isFormValid = form.formState.isValid + const fetchVendorDocuments = React.useCallback(async () => { + if (!selectedSession?.tbeSessionId) return + + setIsLoadingDocs(true) + try { + // 서버 액션 호출 + const result = await getTbeVendorDocuments(selectedSession.tbeSessionId) + + if (result.success) { + setVendorDocuments(result.documents || []) + } else { + console.error("Failed to fetch vendor documents:", result.error) + toast.error(result.error || "벤더 문서 정보를 불러오는데 실패했습니다") + } + } catch (error) { + console.error("Failed to fetch vendor documents:", error) + toast.error("벤더 문서 정보를 불러오는데 실패했습니다") + } finally { + setIsLoadingDocs(false) + } + }, [selectedSession?.tbeSessionId]) + // 벤더 문서 리뷰 상태 가져오기 React.useEffect(() => { if (open && selectedSession?.tbeSessionId) { @@ -101,7 +123,7 @@ export function EvaluationDialog({ evaluationResult: selectedSession.evaluationResult as any, conditionalRequirements: selectedSession.conditionalRequirements || "", conditionsFulfilled: selectedSession.conditionsFulfilled || false, - overallRemarks: selectedSession.overallRemarks || "", + overallRemarks: (selectedSession as any).overallRemarks || "", }) } else { // 기존 평가 데이터가 없으면 초기화 @@ -122,29 +144,7 @@ export function EvaluationDialog({ }) setVendorDocuments([]) } - }, [open, selectedSession]) - - const fetchVendorDocuments = async () => { - if (!selectedSession?.tbeSessionId) return - - setIsLoadingDocs(true) - try { - // 서버 액션 호출 - const result = await getTbeVendorDocuments(selectedSession.tbeSessionId) - - if (result.success) { - setVendorDocuments(result.documents || []) - } else { - console.error("Failed to fetch vendor documents:", result.error) - toast.error(result.error || "벤더 문서 정보를 불러오는데 실패했습니다") - } - } catch (error) { - console.error("Failed to fetch vendor documents:", error) - toast.error("벤더 문서 정보를 불러오는데 실패했습니다") - } finally { - setIsLoadingDocs(false) - } - } + }, [open, selectedSession?.tbeSessionId, selectedSession?.evaluationResult, selectedSession?.conditionalRequirements, selectedSession?.conditionsFulfilled, fetchVendorDocuments, form]) const getReviewStatusIcon = (status: string) => { switch (status) { @@ -316,7 +316,7 @@ export function EvaluationDialog({ <FormLabel> 평가 결과 <span className="text-red-500">*</span> </FormLabel> - <Select onValueChange={field.onChange} defaultValue={field.value}> + <Select onValueChange={field.onChange} value={field.value}> <FormControl> <SelectTrigger> <SelectValue placeholder="평가 결과를 선택하세요" /> diff --git a/lib/tbe-last/table/tbe-last-table.tsx b/lib/tbe-last/table/tbe-last-table.tsx index fbb334d0..49e00cf4 100644 --- a/lib/tbe-last/table/tbe-last-table.tsx +++ b/lib/tbe-last/table/tbe-last-table.tsx @@ -343,8 +343,9 @@ export function TbeLastTable({ promises }: TbeLastTableProps) { open={evaluationOpen} onOpenChange={setEvaluationOpen} selectedSession={selectedSession} - sessionDetail={sessionDetail} - + onSuccess={() => { + router.refresh() + }} /> </> ) |
