Fix modal close last step
This commit is contained in:
parent
b67a39532a
commit
0881e803d2
@ -504,6 +504,14 @@ var ac = new Vue({
|
|||||||
};
|
};
|
||||||
|
|
||||||
loadDealData(function() {
|
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_bg").fadeIn(500);
|
||||||
$("#del_client").toggle(10);
|
$("#del_client").toggle(10);
|
||||||
$("#del_client").find('input[name="id_funnel_client"]').val(ac.step.funnel_id);
|
$("#del_client").find('input[name="id_funnel_client"]').val(ac.step.funnel_id);
|
||||||
|
|||||||
20
js/main.js
20
js/main.js
@ -4159,17 +4159,23 @@ $(document).ready(function() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
$("body").on('click', '.delClientAgent', function() {
|
$("body").on('click', '.delClientAgent', function() {
|
||||||
console.log('kotsss');
|
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);
|
$("#del_client_bg").fadeIn(500);
|
||||||
|
|
||||||
$("#del_client").toggle(10);
|
$("#del_client").toggle(10);
|
||||||
|
|
||||||
var id = $(this).attr('data-id');
|
|
||||||
|
|
||||||
var req_id = 0;
|
|
||||||
|
|
||||||
if ($(this).attr("data-req")) req_id = $(this).attr("data-req");
|
|
||||||
|
|
||||||
$("#del_client").find('input[name="id_del_client"]').val(id);
|
$("#del_client").find('input[name="id_del_client"]').val(id);
|
||||||
|
|
||||||
$("#del_client #id_del_req").val(req_id);
|
$("#del_client #id_del_req").val(req_id);
|
||||||
|
|||||||
@ -4195,8 +4195,9 @@ $user_id = $_SESSION['id'];
|
|||||||
});
|
});
|
||||||
|
|
||||||
$('#luck').on('change', function() {
|
$('#luck').on('change', function() {
|
||||||
|
var hasDeal = window.dealCloseData && window.dealCloseData.id;
|
||||||
if ($(this).is(':checked')) {
|
if ($(this).is(':checked')) {
|
||||||
if (window.dealCloseData && window.dealCloseData.id) {
|
if (hasDeal) {
|
||||||
renderDealCloseContent();
|
renderDealCloseContent();
|
||||||
$('#deal_close_block').show();
|
$('#deal_close_block').show();
|
||||||
$('#datazaklgr').hide();
|
$('#datazaklgr').hide();
|
||||||
@ -4213,6 +4214,19 @@ $user_id = $_SESSION['id'];
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
function resetDealCloseModal() {
|
||||||
|
$('#luck').prop('checked', false);
|
||||||
|
$('#deal_close_content').empty();
|
||||||
|
$('#deal_close_block').hide();
|
||||||
|
$('#datazaklgr').hide();
|
||||||
|
$('#summa_sdelki').hide();
|
||||||
|
$('#summa_sdelki').val('');
|
||||||
|
$('#datazakl').val('');
|
||||||
|
$("#del_client_bg [name=reason]").val('');
|
||||||
|
$("#del_client #id_del_req").val(0);
|
||||||
|
$("#del_client input[name='id_del_client']").val(0);
|
||||||
|
}
|
||||||
|
|
||||||
function renderDealCloseContent() {
|
function renderDealCloseContent() {
|
||||||
var d = window.dealCloseData;
|
var d = window.dealCloseData;
|
||||||
if (!d) { console.log('[DEAL_CLOSE] dealCloseData is null/undefined'); return; }
|
if (!d) { console.log('[DEAL_CLOSE] dealCloseData is null/undefined'); return; }
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user