| Server IP : 162.214.74.102 / Your IP : 216.73.216.192 Web Server : Apache System : Linux dedi-4363141.lrsys.com.br 3.10.0-1160.119.1.el7.tuxcare.els25.x86_64 #1 SMP Wed Oct 1 17:37:27 UTC 2025 x86_64 User : lrsys ( 1015) PHP Version : 5.6.40 Disable Function : exec,passthru,shell_exec,system MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/lrsys/public_html/lrsys_apps/leo/application/plugins/module_imobles/assets/js/ |
Upload File : |
$(document).ready(function ()
{
var _url = $("#_url").val();
///DEALS
$("body").on('click', '.delete_crm_service', function (e) {
e.preventDefault();
var id = $(this).data('id');
var dialog = bootbox.confirm({
message: 'Tem certeza que deseja deletar essa tarefa?',
buttons: {
confirm: {
label: _L['Yes'],
className: "btn-primary"
},
cancel: {
label: _L['No'],
className: "btn-danger"
}
},
callback: function (result) {
if (result == true) {
$.post(_url + "module_imobles/leadshistory/delete_crm_control_deals", {id: id})
.done(function (data) {
if (data == "OK") {
$(".tr_deals_" + id).remove();
toastr.success('Atendimento deletado com sucesso.');
} else {
var body = $("html, body");
body.animate({scrollTop: 0}, '1000', 'swing');
$("#emsgbody").html(data);
$("#emsg").show("slow");
}
});
} else {
dialog.modal('hide');
return false;
}
}
});
});
//crm_joueney
$('#stages').select2({theme: "bootstrap",
width: '100%'});
$("#stages_id").on('change', function (e) {
e.preventDefault();
var id = $(this).data("deal_id");
var val = $(this).val();
if (val > 0) {
$.get(_url + 'module_imobles/deal/tasksStage/' + id + "/" + val, function (j) {
$("#deal_task").html(j);
});
} else {
$("#deal_task").html('');
}
});
$("body").on('click', '.add_next_stage', function (e) {
e.preventDefault();
var $modal = $('#ajax-modal');
$modal.load(_url + 'module_imobles/leadshistory/crm_journey_data_add/0/' + $("#module_imobles_crm_journey_stages_id").val() + "/" + $(this).data('crm_accounts_id'), function () {
$modal.modal();
$("#emsg-form-journey").hide();
$("#due_date").datepicker({
language: $("#_lan").val(),
autoclose: true,
dateFormat: $("#_formatDate").val()
});
$('#form-post-journey').find("[data-toggle='toggle']").bootstrapToggle();
});
});
$("body").on('click', '.submit_journey_form', function (e) {
e.preventDefault();
var id = $(this).data("id");
$.ajax(
{
type: 'POST',
url: _url + "module_imobles/leadshistory/post_crm_journey_task",
data: new FormData($("#form-post-journey")[0]),
processData: false,
contentType: false,
success: function (retorno) {
var data = JSON.parse(retorno);
if (data.status == "OK") {
if (id > 0) {
$(".tr_journey_task_" + id).remove();
}
if (data.closed == 1) {
$(".table-journeytasks_history").append(data.tr);
$(".crm_journey_stages_history").removeClass("hide");
if ($(".table-journeytasks tr").length == 1) {
$(".msg-journeytasks").removeClass("hide");
$(".table-journeytasks").addClass("hide");
}
} else {
$(".table-journeytasks").append(data.tr);
$(".msg-journeytasks").addClass("hide");
$(".table-journeytasks").removeClass("hide");
if ($(".table-journeytasks_history tr").length == 1) {
$(".crm_journey_stages_history").addClass("hide");
}
}
toastr.success(_L['module_imobles save']);
$(".cancel_journey_form").click();
} else {
$("#emsgbody-form-journey").html(data.msg);
$("#emsg-form-journey").show("slow");
}
}
});
});
$("body").on('click', ".edit_journey_task", function (e) {
e.preventDefault();
var $modal = $('#ajax-modal');
$modal.load(_url + 'module_imobles/leadshistory/crm_journey_data_add/' + $(this).data("id") + "/" + $("#module_imobles_crm_journey_stages_id").val(), function () {
$modal.modal();
$("#emsg-form-journey").hide();
$("#due_date").datepicker({
language: $("#_lan").val(),
autoclose: true,
dateFormat: $("#_formatDate").val()
});
$("[data-toggle='toggle']").bootstrapToggle();
});
});
$("body").on('click', '.delete_journey_task_form', function (e) {
e.preventDefault();
var id = $(this).data('id');
var dialog = bootbox.confirm({
message: _L['module_imobles Delete journey task?'],
buttons: {
confirm: {
label: _L['Yes'],
className: "btn-primary"
},
cancel: {
label: _L['No'],
className: "btn-danger"
}
},
callback: function (result) {
if (result == true) {
$.post(_url + "module_imobles/leadshistory/delete_crm_journey_task", {id: id})
.done(function (data) {
if (data == "OK") {
$(".tr_journey_task_" + id).remove();
toastr.success(_L['module imobles journey task delete success']);
if ($(".table-journeytasks tr").length == 1) {
$(".msg-journeytasks").removeClass("hide");
$(".table-journeytasks").addClass("hide");
}
if ($(".table-journeytasks_history tr").length == 1) {
$(".crm_journey_stages_history").addClass("hide");
}
} else {
toastr.error(data);
}
});
} else {
dialog.modal('hide');
return false;
}
}
});
});
scenariosLoaded = false;
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
var target = $(e.target).attr("href") // activated tab
if (target == '#crm_scenarios') {
if (!scenariosLoaded) {
scenariosLoaded = true;
var id = $(this).data("crm_accounts_id");
$.get(_url + 'module_imobles/leadshistory/crm_scenarios_data/' + id, function (j) {
$("#crm_scenarios_data").html(j);
});
}
}
});
$("body").on('click', ".add_scenario_comments", function (e) {
e.preventDefault();
var $modal = $('#ajax-modal');
$modal.load(_url + 'module_imobles/leadshistory/scenario_comments_add/' + $(this).data("id"), function () {
$modal.modal();
$("#emsg-form-scenario-comment").hide();
});
});
$("body").on('click', '.submit_scenario_comment', function (e) {
e.preventDefault();
var id = $(this).data("id");
$.ajax(
{
type: 'POST',
url: _url + "module_imobles/leadshistory/scenario_comments_post",
data: new FormData($("#form-scenario_comments")[0]),
processData: false,
contentType: false,
success: function (retorno) {
var data = JSON.parse(retorno);
if (data.status == "OK") {
if (data.unit_type_id == null) {
$("#ul_" + data.scenario_id).append(data.comment)
}
toastr.success(_L['module_imobles save']);
$(".cancel_scenario_comment").click();
} else {
$("#emsgbody-form-scenario-comment").html(data.msg);
$("#emsg-form-scenario-comment").show("slow");
}
}
});
});
$("body").on('click', '.delete_scenario', function (e) {
e.preventDefault();
var id = $(this).data('id');
var dialog = bootbox.confirm({
message: _L['module_imobles_crm_scenario_delete'],
buttons: {
confirm: {
label: _L['Yes'],
className: "btn-primary"
},
cancel: {
label: _L['No'],
className: "btn-danger"
}
},
callback: function (result) {
if (result == true) {
$.post(_url + "module_imobles/leadshistory/delete_scenario", {id: id})
.done(function (data) {
if (data == "OK") {
$(".tr_scenario_" + id).remove();
toastr.success(_L['module_imobles_crm_scenario_delete_success']);
if ($(".table-scenarios tr").length == 1) {
$(".msg-scenarios").removeClass("hide");
$(".table-scenarios").addClass("hide");
}
} else {
toastr.error(data);
}
});
} else {
dialog.modal('hide');
return false;
}
}
});
});
//regra usada no js crm_control-deal-form.js para quando voltar vir com a guia selecionada
var guia = localStorage.getItem('guia_client_lead_control');
localStorage.setItem('guia_client_lead_control',null);
if (guia) {
$("#" + guia).click();
}
});
function send_to_client(scenario, event) {
event.preventDefault();
$("body").block({message: block_msg});
$("#form_send_scenario").html("");
$("#form_send_scenario").append('<input type="hidden" name="scenario_id" value="' + $(scenario).data('id') + '">');
$("#form_send_scenario").append('<input type="hidden" name="id" value="' + $(scenario).data('unit_type_ids') + '">');
$("#form_send_scenario").append('<input type="hidden" name="send_scenario" value="1">');
$.post($("#_url").val() + "module_imobles/typeunity/viewSendPdfClient", $("#form_send_scenario").serialize())
.done(function (data) {
$("body").unblock();
var $modal = $('#ajax-modal');
$modal.html(data);
$modal.modal();
$modal.find(".money").maskMoney({
thousands: ".",
decimal: ",",
precision: 2
});
$modal.find('#submit-group-typeunity').on("click", function (event) {
$("body").block({message: block_msg});
$.post($("#_url").val() + "module_imobles/typeunity/postSendTypeUnity", $("#send-pdf-type-unity-form").serialize())
.done(function (result) {
var data = JSON.parse(result);
if (data.status == 'OK') {
toastr.success(data.msg);
$modal.modal("hide");
} else if (data.status == 'REDIRECT') {
toastr.success(data.msg);
window.open(data.href, data.target);
$modal.modal("hide");
} else {
toastr.error(data.msg);
}
$("body").unblock();
}
);
});
$modal.find('#type_send').on("change", function (event) {
if ($(this).val() == 'jpg') {
$modal.find('#include_personal_shopper_img_row').show();
} else {
$modal.find('#include_personal_shopper_img_row').hide();
}
});
}
);
}