From d38877eef87917087a4a217bea32ae84d6738a7d Mon Sep 17 00:00:00 2001 From: dujinkim Date: Fri, 22 Aug 2025 08:20:45 +0000 Subject: (최겸) 인포메이션 첨부파일 뷰어 추가 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/techsales-rfq/service.ts | 2 +- .../table/detail-table/rfq-detail-table.tsx | 37 ++++++++++++++++++++-- 2 files changed, 36 insertions(+), 3 deletions(-) (limited to 'lib/techsales-rfq') diff --git a/lib/techsales-rfq/service.ts b/lib/techsales-rfq/service.ts index 5ec02f63..3736bf76 100644 --- a/lib/techsales-rfq/service.ts +++ b/lib/techsales-rfq/service.ts @@ -1758,7 +1758,7 @@ export async function processTechSalesRfqAttachments(params: { // 1. 삭제할 첨부파일 처리 if (deleteAttachmentIds.length > 0) { const attachmentsToDelete = await tx.query.techSalesAttachments.findMany({ - where: sql`${techSalesAttachments.id} IN (${deleteAttachmentIds.join(',')})` + where: inArray(techSalesAttachments.id, deleteAttachmentIds) }); for (const attachment of attachmentsToDelete) { diff --git a/lib/techsales-rfq/table/detail-table/rfq-detail-table.tsx b/lib/techsales-rfq/table/detail-table/rfq-detail-table.tsx index 249a2c74..6ef0f221 100644 --- a/lib/techsales-rfq/table/detail-table/rfq-detail-table.tsx +++ b/lib/techsales-rfq/table/detail-table/rfq-detail-table.tsx @@ -177,8 +177,41 @@ export function RfqDetailTables({ selectedRfq, maxHeight }: RfqDetailTablesProps return; } - // contact selection dialog 열기 - setContactSelectionDialogOpen(true); + // 선택된 벤더들의 담당자 존재 여부 확인 + try { + const vendorIds = selectedRows.map(row => row.vendorId).filter(Boolean) as number[]; + + if (vendorIds.length === 0) { + toast.error("유효한 벤더가 선택되지 않았습니다."); + return; + } + + // 벤더별 담당자 조회 + const { getTechVendorsContacts } = await import("@/lib/techsales-rfq/service"); + const contactsResult = await getTechVendorsContacts(vendorIds); + + if (contactsResult.error) { + toast.error("벤더 담당자 정보를 불러오는 중 오류가 발생했습니다."); + return; + } + + // 담당자가 없는 벤더 확인 + const vendorsWithoutContacts = vendorIds.filter(vendorId => { + const vendorContacts = contactsResult.data[vendorId]; + return !vendorContacts || vendorContacts.contacts.length === 0; + }); + + if (vendorsWithoutContacts.length > 0) { + toast.error("담당자가 지정되지 않은 협력업체가 있습니다."); + return; + } + + // contact selection dialog 열기 + setContactSelectionDialogOpen(true); + } catch (error) { + console.error("벤더 담당자 확인 오류:", error); + toast.error("벤더 담당자 정보를 확인하는 중 오류가 발생했습니다."); + } }, [selectedRows, selectedRfqId]); // contact 기반 RFQ 발송 핸들러 -- cgit v1.2.3