diff options
| author | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-08-22 08:20:45 +0000 |
|---|---|---|
| committer | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-08-22 08:20:45 +0000 |
| commit | d38877eef87917087a4a217bea32ae84d6738a7d (patch) | |
| tree | 8713d9239e6fb34c4ca0704129906044784b30e5 /lib/techsales-rfq | |
| parent | e9b1bf22cf2f45a7db8152f7ba83af7799ed71a5 (diff) | |
(최겸) 인포메이션 첨부파일 뷰어 추가
Diffstat (limited to 'lib/techsales-rfq')
| -rw-r--r-- | lib/techsales-rfq/service.ts | 2 | ||||
| -rw-r--r-- | lib/techsales-rfq/table/detail-table/rfq-detail-table.tsx | 37 |
2 files changed, 36 insertions, 3 deletions
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 발송 핸들러
|
