From f2fafe555b65f9207c2c6e216b7d7b2ff83af866 Mon Sep 17 00:00:00 2001 From: dujinkim Date: Mon, 3 Nov 2025 10:15:45 +0000 Subject: (최겸) 구매 PQ/실사 수정 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pq/pq-review-table-new/vendors-table.tsx | 32 +++++++++++++++++++++------- 1 file changed, 24 insertions(+), 8 deletions(-) (limited to 'lib/pq/pq-review-table-new/vendors-table.tsx') diff --git a/lib/pq/pq-review-table-new/vendors-table.tsx b/lib/pq/pq-review-table-new/vendors-table.tsx index e55da8c5..56bfb22c 100644 --- a/lib/pq/pq-review-table-new/vendors-table.tsx +++ b/lib/pq/pq-review-table-new/vendors-table.tsx @@ -42,6 +42,7 @@ export function PQSubmissionsTable({ promises, className }: PQSubmissionsTablePr const [selectedInvestigation, setSelectedInvestigation] = React.useState(null) const [isVendorInfoViewDialogOpen, setIsVendorInfoViewDialogOpen] = React.useState(false) const [selectedSiteVisitRequestId, setSelectedSiteVisitRequestId] = React.useState(null) + const [selectedInvestigationId, setSelectedInvestigationId] = React.useState(null) // 실사 정보 수정 다이얼로그 상태 const [isEditInvestigationDialogOpen, setIsEditInvestigationDialogOpen] = React.useState(false) @@ -95,13 +96,23 @@ export function PQSubmissionsTable({ promises, className }: PQSubmissionsTablePr inspectionDuration: number requestedStartDate: Date requestedEndDate: Date - shiAttendees: Record + shiAttendees: { + [key: string]: { + checked: boolean; + attendees: Array<{ + name: string; + department?: string; + email?: string; + }>; + }; + } shiAttendeeDetails?: string vendorRequests: Record otherVendorRequests?: string additionalRequests?: string }, attachments?: File[]) => { try { + console.log("data", data) const result = await createSiteVisitRequestAction({ investigationId: selectedInvestigation?.investigation?.id || 0, ...data, @@ -123,14 +134,15 @@ export function PQSubmissionsTable({ promises, className }: PQSubmissionsTablePr // 방문실사 다이얼로그 열기 const handleOpenSiteVisitDialog = async (investigation: PQSubmission) => { try { - // 기존 방문실사 요청이 있는지 확인 - const existingRequest = await getSiteVisitRequestAction(investigation.investigation?.id || 0) - - if (existingRequest.success && existingRequest.data) { - toast.error("이미 방문실사 요청이 존재합니다. 추가 요청은 불가능합니다.") - return - } + // // 기존 방문실사 요청이 있는지 확인 + // const existingRequest = await getSiteVisitRequestAction(investigation.investigation?.id || 0) + // if (existingRequest.success && existingRequest.data) { + // toast.error("이미 방문실사 요청이 존재합니다. 추가 요청은 불가능합니다.") + // return + // } + + console.log("investigation", investigation) setSelectedInvestigation(investigation) setIsSiteVisitDialogOpen(true) } catch (error) { @@ -190,6 +202,7 @@ export function PQSubmissionsTable({ promises, className }: PQSubmissionsTablePr } else if (rowAction?.type === "vendor-info-view") { // 협력업체 정보 조회 다이얼로그 열기 setSelectedSiteVisitRequestId(rowAction.row.siteVisitRequestId || null) + setSelectedInvestigationId(rowAction.row.investigation?.id || null) setIsVendorInfoViewDialogOpen(true) setRowAction(null) } else if (rowAction?.type === "update") { @@ -450,6 +463,7 @@ export function PQSubmissionsTable({ promises, className }: PQSubmissionsTablePr id: selectedInvestigation.investigation?.id || 0, investigationMethod: selectedInvestigation.investigation?.investigationMethod || "", investigationAddress: selectedInvestigation.investigation?.investigationAddress || "", + investigationNotes: selectedInvestigation.investigation?.investigationNotes || "", vendorName: selectedInvestigation.vendorName, vendorCode: selectedInvestigation.vendorCode, projectName: selectedInvestigation.projectName || undefined, @@ -465,8 +479,10 @@ export function PQSubmissionsTable({ promises, className }: PQSubmissionsTablePr onClose={() => { setIsVendorInfoViewDialogOpen(false) setSelectedSiteVisitRequestId(null) + setSelectedInvestigationId(null) }} siteVisitRequestId={selectedSiteVisitRequestId} + investigationId={selectedInvestigationId} /> {/* 실사 정보 수정 다이얼로그 */} -- cgit v1.2.3