diff options
| author | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-11-24 02:52:34 +0000 |
|---|---|---|
| committer | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-11-24 02:52:34 +0000 |
| commit | 58d700b925967bfe470c944b380b02b2140cab8a (patch) | |
| tree | e445dc37215f048759542e198cf6c5f41ebb0d5c /lib/techsales-rfq/table | |
| parent | 26365ef08588d53b8c5d9c7cfaefb244536e6743 (diff) | |
(최겸) 구매 기술영업 결재 개발, 입찰 수정
Diffstat (limited to 'lib/techsales-rfq/table')
| -rw-r--r-- | lib/techsales-rfq/table/detail-table/rfq-detail-table.tsx | 62 |
1 files changed, 47 insertions, 15 deletions
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 52758412..db2331af 100644 --- a/lib/techsales-rfq/table/detail-table/rfq-detail-table.tsx +++ b/lib/techsales-rfq/table/detail-table/rfq-detail-table.tsx @@ -259,26 +259,20 @@ export function RfqDetailTables({ selectedRfq, maxHeight }: RfqDetailTablesProps try {
setIsSendingRfq(true);
- // 기술영업 RFQ 발송 서비스 함수 호출 (contact 정보 포함)
- const vendorIds = selectedRows.map(row => row.vendorId).filter(Boolean);
- const { sendTechSalesRfqToVendors } = await import("@/lib/techsales-rfq/service");
+ // DRM 해제 여부 확인
+ const { checkTechSalesRfqHasDrmAttachments, sendTechSalesRfqToVendors } = await import("@/lib/techsales-rfq/service");
+ const drmCheck = await checkTechSalesRfqHasDrmAttachments(selectedRfqId);
- const result = await sendTechSalesRfqToVendors({
- rfqId: selectedRfqId,
- vendorIds: vendorIds as number[],
- selectedContacts: selectedContacts
- });
-
- // DRM 파일이 있어서 결재가 필요한 경우
- if (!result.success && result.requiresApproval) {
+ // DRM 파일이 걸려있으면 결재 프로세스 진행
+ if (drmCheck.hasDrm) {
// 결재 데이터 저장
setApprovalPreviewData({
vendors: selectedRows.map(row => ({
vendorId: row.vendorId!,
vendorName: row.vendorName || "",
})),
- drmAttachments: result.drmAttachments || [],
- drmAttachmentIds: result.drmAttachmentIds || [],
+ drmAttachments: drmCheck.drmAttachments,
+ drmAttachmentIds: drmCheck.drmAttachmentIds,
selectedContacts: selectedContacts,
});
@@ -288,6 +282,14 @@ export function RfqDetailTables({ selectedRfq, maxHeight }: RfqDetailTablesProps return;
}
+ // DRM 해제가 안 걸려있으면 바로 발송
+ const vendorIds = selectedRows.map(row => row.vendorId).filter(Boolean);
+ const result = await sendTechSalesRfqToVendors({
+ rfqId: selectedRfqId,
+ vendorIds: vendorIds as number[],
+ selectedContacts: selectedContacts
+ });
+
if (result.success) {
toast.success(result.message || `${selectedContacts.length}명의 연락처에게 RFQ가 발송되었습니다.`);
} else {
@@ -483,8 +485,7 @@ export function RfqDetailTables({ selectedRfq, maxHeight }: RfqDetailTablesProps applicationReason: reason,
});
- // 신청사유 다이얼로그 닫고 결재 미리보기 열기
- setShowApplicationReasonDialog(false);
+ // 결재 미리보기 열기
setShowApprovalPreview(true);
} catch (error) {
console.error("템플릿 변수 생성 실패:", error);
@@ -936,6 +937,37 @@ export function RfqDetailTables({ selectedRfq, maxHeight }: RfqDetailTablesProps quotationId={selectedQuotationForContacts?.id || null}
vendorName={selectedQuotationForContacts?.vendorName}
/>
+
+ {/* 신청사유 입력 다이얼로그 */}
+ {approvalPreviewData && (
+ <ApplicationReasonDialog
+ open={showApplicationReasonDialog}
+ onOpenChange={setShowApplicationReasonDialog}
+ onConfirm={handleApplicationReasonConfirm}
+ vendorCount={approvalPreviewData.vendors.length}
+ attachmentCount={approvalPreviewData.drmAttachmentIds.length}
+ />
+ )}
+
+ {/* 결재 미리보기 다이얼로그 */}
+ {approvalPreviewData && approvalPreviewData.templateVariables && (
+ <ApprovalPreviewDialog
+ open={showApprovalPreview}
+ onOpenChange={setShowApprovalPreview}
+ templateName="암호화해제 신청"
+ variables={approvalPreviewData.templateVariables}
+ title={`암호화해제 신청 - ${selectedRfq?.rfqCode || 'RFQ'}`}
+ currentUser={{
+ id: Number(session.data.user.id),
+ epId: session.data.user.epId,
+ name: session.data.user.name || undefined,
+ email: session.data.user.email || undefined,
+ }}
+ onConfirm={handleApprovalConfirm}
+ allowTitleEdit={false}
+ allowDescriptionEdit={false}
+ />
+ )}
</div>
)
}
\ No newline at end of file |
