From 535de26b9cf3242c04543d6891d78352b9593a60 Mon Sep 17 00:00:00 2001 From: dujinkim Date: Tue, 11 Nov 2025 09:22:58 +0000 Subject: (최겸) 구매 수정사항 개발 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../rfq-history-table/rfq-history-table.tsx | 4 +- lib/vendors/table/request-pq-dialog.tsx | 67 ++++++++++++++++++---- 2 files changed, 58 insertions(+), 13 deletions(-) (limited to 'lib/vendors') diff --git a/lib/vendors/rfq-history-table/rfq-history-table.tsx b/lib/vendors/rfq-history-table/rfq-history-table.tsx index 11a4bf9d..c618cbc9 100644 --- a/lib/vendors/rfq-history-table/rfq-history-table.tsx +++ b/lib/vendors/rfq-history-table/rfq-history-table.tsx @@ -98,7 +98,7 @@ export function VendorRfqHistoryTable({ promises, lng, vendorId }: RfqHistoryTab label: "견적상태", options: [ { label: "ITB 발송", value: "ITB 발송" }, - { label: "Short List 확정", value: "Short List 확정" }, + { label: "TBE 요청", value: "TBE 요청" }, { label: "최종업체선정", value: "최종업체선정" }, { label: "견적접수", value: "견적접수" }, { label: "견적평가중", value: "견적평가중" }, @@ -143,7 +143,7 @@ export function VendorRfqHistoryTable({ promises, lng, vendorId }: RfqHistoryTab type: "multi-select", options: [ { label: "ITB 발송", value: "ITB 발송" }, - { label: "Short List 확정", value: "Short List 확정" }, + { label: "TBE 요청", value: "TBE 요청" }, { label: "최종업체선정", value: "최종업체선정" }, { label: "견적접수", value: "견적접수" }, { label: "견적평가중", value: "견적평가중" }, diff --git a/lib/vendors/table/request-pq-dialog.tsx b/lib/vendors/table/request-pq-dialog.tsx index 07057dbe..83eab201 100644 --- a/lib/vendors/table/request-pq-dialog.tsx +++ b/lib/vendors/table/request-pq-dialog.tsx @@ -40,7 +40,7 @@ import { Badge } from "@/components/ui/badge" import { Progress } from "@/components/ui/progress" import { Vendor } from "@/db/schema/vendors" import { requestBasicContractInfo, requestPQVendors, sendBasicContractEmail } from "../service" -import { getProjectsWithPQList } from "@/lib/pq/service" +import { getProjectsWithPQList, getNonInspectionPQLists } from "@/lib/pq/service" import type { Project } from "@/lib/pq/service" import { useSession } from "next-auth/react" import { DatePicker } from "@/components/ui/date-picker" @@ -84,12 +84,16 @@ export function RequestPQDialog({ vendors, showTrigger = true, onSuccess, ...pro const [agreements, setAgreements] = React.useState>({}) const [extraNote, setExtraNote] = React.useState("") const [pqItems, setPqItems] = React.useState([]) - + // PQ 품목 선택 관련 상태는 MaterialGroupSelectorDialogMulti에서 관리됨 const [isLoadingProjects, setIsLoadingProjects] = React.useState(false) const [basicContractTemplates, setBasicContractTemplates] = React.useState([]) const [selectedTemplateIds, setSelectedTemplateIds] = React.useState([]) const [isLoadingTemplates, setIsLoadingTemplates] = React.useState(false) + + // 미실사 PQ 관련 상태 + const [activeNonInspectionPQList, setActiveNonInspectionPQList] = React.useState(null) + const [isLoadingNonInspectionPQ, setIsLoadingNonInspectionPQ] = React.useState(false) // 비밀유지 계약서 첨부파일 관련 상태 const [ndaAttachments, setNdaAttachments] = React.useState([]) @@ -110,6 +114,19 @@ export function RequestPQDialog({ vendors, showTrigger = true, onSuccess, ...pro setIsLoadingProjects(true) getProjectsWithPQList().then(setProjects).catch(() => toast.error("프로젝트 로딩 실패")) .finally(() => setIsLoadingProjects(false)) + } else if (type === "NON_INSPECTION") { + setIsLoadingNonInspectionPQ(true) + // 활성화된 미실사 PQ 리스트 조회 + getNonInspectionPQLists().then(result => { + if (result.success) { + setActiveNonInspectionPQList(result.data) + } else { + setActiveNonInspectionPQList(null) + } + }).catch(() => { + toast.error("미실사 PQ 리스트 로딩 실패") + setActiveNonInspectionPQList(null) + }).finally(() => setIsLoadingNonInspectionPQ(false)) } }, [type]) @@ -221,6 +238,8 @@ export function RequestPQDialog({ vendors, showTrigger = true, onSuccess, ...pro setShowProgress(false) setPqHistory({}) setIsLoadingHistory(false) + setActiveNonInspectionPQList(null) + setIsLoadingNonInspectionPQ(false) } }, [props.open]) @@ -261,6 +280,7 @@ export function RequestPQDialog({ vendors, showTrigger = true, onSuccess, ...pro const onApprove = () => { if (!type) return toast.error("PQ 유형을 선택하세요.") if (type === "PROJECT" && !selectedProjectId) return toast.error("프로젝트를 선택하세요.") + if (type === "NON_INSPECTION" && !activeNonInspectionPQList) return toast.error("활성화된 미실사 PQ 리스트가 없습니다.") if (!dueDate) return toast.error("마감일을 선택하세요.") if (pqItems.length === 0) return toast.error("PQ 대상 품목을 선택하세요.") if (!session?.user?.id) return toast.error("인증 실패") @@ -639,7 +659,7 @@ export function RequestPQDialog({ vendors, showTrigger = true, onSuccess, ...pro }) if (emailResult.success) { - toast.success(`${templateIds.length}개 템플릿에 대한 기본계약서가 생성되었고, ${vendorIds.length}개 협력업체에 이메일이 발송되었습니다`) + toast.success(`${vendorIds.length}개 협력업체에 이메일이 발송되었습니다`) } else { toast.warning(`계약서는 생성되었으나 일부 이메일 발송 실패: ${emailResult.error}`) } @@ -793,6 +813,31 @@ export function RequestPQDialog({ vendors, showTrigger = true, onSuccess, ...pro )} + {type === "NON_INSPECTION" && ( +
+ + {isLoadingNonInspectionPQ ? ( +
로딩 중...
+ ) : activeNonInspectionPQList ? ( +
+
+ 미실사 PQ + {activeNonInspectionPQList.name} +
+
+ 활성화된 미실사 PQ 리스트를 기준으로 요청합니다. +
+
+ ) : ( +
+
+ 활성화된 미실사 PQ 리스트가 없습니다. 먼저 PQ 관리에서 미실사 PQ 리스트를 생성하고 활성화해주세요. +
+
+ )} +
+ )} + {/* 마감일 입력 */}
@@ -875,7 +920,7 @@ export function RequestPQDialog({ vendors, showTrigger = true, onSuccess, ...pro )}
)} - {selectedTemplateIds.length > 0 && ( + {/* {selectedTemplateIds.length > 0 && (
{selectedTemplateIds.length}개 템플릿이 선택되었습니다. {vendors.length > 0 && vendors.every(v => v.country !== 'KR') && @@ -883,7 +928,7 @@ export function RequestPQDialog({ vendors, showTrigger = true, onSuccess, ...pro {vendors.length > 0 && vendors.every(v => v.country === 'KR') && " (내자 벤더 - 자동 선택됨)"}
- )} + )} */} {/* 비밀유지 계약서 첨부파일 */} @@ -1013,9 +1058,9 @@ export function RequestPQDialog({ vendors, showTrigger = true, onSuccess, ...pro - -