From 40c8c104b4479f38a1f6181788ae2f41bc681754 Mon Sep 17 00:00:00 2001 From: mac Date: Tue, 7 Jul 2026 08:56:43 +0300 Subject: [PATCH] Fix modal close last step --- js/crm_vue.js | 8 +------- js/main.js | 32 +++++++++++++++++++++++++++++--- 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/js/crm_vue.js b/js/crm_vue.js index 47b0fc7..98027c8 100644 --- a/js/crm_vue.js +++ b/js/crm_vue.js @@ -503,14 +503,8 @@ var ac = new Vue({ .catch(function() { callback(); }); }; + resetDealCloseModal(); loadDealData(function() { - // Обновляем ac.reqId из скрытого поля (мог быть изменён через .delClientAgent) - var currentReqId = parseInt($('#del_client #id_del_req').val()) || 0; - if (currentReqId > 0) { - ac.reqId = currentReqId; - } - - resetDealCloseModal(); $("#del_client_bg").fadeIn(500); $("#del_client").toggle(10); diff --git a/js/main.js b/js/main.js index f26cc5e..3d116e4 100644 --- a/js/main.js +++ b/js/main.js @@ -4162,18 +4162,44 @@ $(document).ready(function() { var req_id = 0; if ($(this).attr("data-req")) req_id = $(this).attr("data-req"); - // Получаем client_id из заявки если data-id не задан var id = $(this).attr('data-id') || 0; if (id == 'undefined' || !id) id = 0; console.log('[delClientAgent] id:', id, 'req_id:', req_id); - // Обновляем ac.reqId в Vue-компоненте если он доступен if (typeof ac !== 'undefined') ac.reqId = parseInt(req_id) || 0; resetDealCloseModal(); - $("#del_client_bg").fadeIn(500); + // Загружаем данные сделки для отображения информации + $.ajax({ + url: '/ajax/ajax_vue_requisitions.php', + type: 'POST', + contentType: 'application/json', + data: JSON.stringify({ request: 'get_deal_by_req', req_id: req_id }), + success: function(response) { + var res = typeof response === 'string' ? JSON.parse(response) : response; + if (res && res.deal_id) { + $.ajax({ + url: '/ajax/ajax_vue_requisitions.php', + type: 'POST', + contentType: 'application/json', + data: JSON.stringify({ request: 'get_deal_data', deal_id: res.deal_id }), + success: function(dealRes) { + var dealData = dealRes && dealRes.deal; + var currentReqId = $('#del_client #id_del_req').val(); + if (dealData && currentReqId == req_id) { + window.dealCloseData = dealData; + } + } + }); + } else { + window.dealCloseData = null; + } + } + }); + + $("#del_client_bg").fadeIn(500); $("#del_client").toggle(10); $("#del_client").find('input[name="id_del_client"]').val(id);