Fix modal close last step

This commit is contained in:
mac 2026-07-07 08:56:43 +03:00
parent 0881e803d2
commit 40c8c104b4
2 changed files with 30 additions and 10 deletions

View File

@ -503,14 +503,8 @@ var ac = new Vue({
.catch(function() { callback(); });
};
loadDealData(function() {
// Обновляем ac.reqId из скрытого поля (мог быть изменён через .delClientAgent)
var currentReqId = parseInt($('#del_client #id_del_req').val()) || 0;
if (currentReqId > 0) {
ac.reqId = currentReqId;
}
resetDealCloseModal();
loadDealData(function() {
$("#del_client_bg").fadeIn(500);
$("#del_client").toggle(10);

View File

@ -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);