| Server IP : 162.214.74.102 / Your IP : 216.73.217.111 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/ui/lib/ |
Upload File : |
Dropzone.autoDiscover = false;
$(document).ready(function () {
$('[data-toggle="datepicker"]').datepicker();
$("#account").select2({
theme: "bootstrap",
language: {
noResults: function () {
return $("#_lan_no_results_found").val();
}
}
}
);
$("#cats").select2({
theme: "bootstrap",
language: {
noResults: function () {
return $("#_lan_no_results_found").val();
}
}
}
);
$("#pmethod").select2({
theme: "bootstrap",
language: {
noResults: function () {
return $("#_lan_no_results_found").val();
}
}
}
);
// Select2 de accounts
$("#payer").select2({
theme: "bootstrap",
placeholder: 'Selecione um contato',
allowClear: true,
language: {
noResults: function () {
return $("#_lan_no_results_found").val();
}
},
ajax: {
url: $("#_url").val() + 'module_billing/billing/ajax_accounts',
dataType: 'json',
delay: 150,
method: "POST",
data: function (params) {
var queryParameters = {
term: params.term
};
return queryParameters;
},
processResults: function (data) {
return {
results: $.map(data, function (item) {
return {
text: item.account,
id: item.id
}
})
};
},
cache: true
}
});
$('#tags').select2({
tags: true,
tokenSeparators: [','],
theme: "bootstrap",
language: {
noResults: function () {
return $("#_lan_no_results_found").val();
}
}
});
//$('.amount').autoNumeric('init');
$("#a_hide").hide();
$("#emsg").hide();
$("#a_toggle").click(function(e){
e.preventDefault();
$("#a_hide").toggle( "slow" );
});
/*
* File upload
* */
//Dropzone.options.myAwesomeDropzone = {
//
// autoProcessQueue: false,
// uploadMultiple: true,
// parallelUploads: 100,
// maxFiles: 100,
//
// // Dropzone settings
// init: function() {
// var myDropzone = this;
//
// this.element.querySelector("button[type=submit]").addEventListener("click", function(e) {
// e.preventDefault();
// e.stopPropagation();
// myDropzone.processQueue();
// });
// this.on("sendingmultiple", function() {
// });
// this.on("successmultiple", function(files, response) {
// });
// this.on("errormultiple", function(files, response) {
// });
// }
//
//}
var _url = $("#_url").val();
// $('#tags').select2({
// tags: true,
// tokenSeparators: [','],
// createSearchChoice: function (term) {
// return {
// id: $.trim(term),
// text: $.trim(term) + ' (new tag)'
// };
// },
// ajax: {
// url: _url+'tags/income/',
// dataType: 'json',
// data: function(term, page) {
// return {
// q: term
// };
// },
// results: function(data, page) {
// return {
// results: data
// };
// }
// },
//
// // Take default tags from the input value
// initSelection: function (element, callback) {
// var data = [];
//
// function splitVal(string, separator) {
// var val, i, l;
// if (string === null || string.length < 1) return [];
// val = string.split(separator);
// for (i = 0, l = val.length; i < l; i = i + 1) val[i] = $.trim(val[i]);
// return val;
// }
//
// $(splitVal(element.val(), ",")).each(function () {
// data.push({
// id: this,
// text: this
// });
// });
//
// callback(data);
// },
//
// // Some nice improvements:
//
// // max tags is 3
// maximumSelectionSize: 15,
//
// // override message for max tags
// formatSelectionTooBig: function (limit) {
// return "Max tags is " + limit;
// }
//});
var upload_resp;
var $ib_form_submit = $("#submit");
var ib_file = new Dropzone("#upload_container",
{
url: _url + "transactions/handle_attachment/",
maxFiles: 1,
acceptedFiles: "image/*,application/pdf"
}
);
ib_file.on("sending", function() {
$ib_form_submit.prop('disabled', true);
});
ib_file.on("success", function(file,response) {
$ib_form_submit.prop('disabled', false);
upload_resp = response;
if(upload_resp.success == 'Yes'){
toastr.success(upload_resp.msg);
// $file_link.val(upload_resp.file);
// files.push(upload_resp.file);
//
// console.log(files);
$('#attachments').val(function(i,val) {
return val + (!val ? '' : ',') + upload_resp.file;
});
}
else{
toastr.error(upload_resp.msg);
}
});
$ib_form_submit.click(function (e) {
e.preventDefault();
$('#ibox_form').block({ message: null });
var _url = $("#_url").val();
$.post(_url + 'transactions/deposit-post/', {
account: $('#account').val(),
date: $('#date').val(),
amount: $('#amount').val(),
cats: $('#cats').val(),
id_cost_center: $('#id_cost_center').val(),
description: $('#description').val(),
attachments: $('#attachments').val(),
tags: $('#tags').val(),
payer: $('#payer').val(),
pmethod: $('#pmethod').val(),
ref: $('#ref').val()
})
.done(function (data) {
var sbutton = $("#submit");
var _url = $("#_url").val();
if ($.isNumeric(data)) {
location.reload();
}
else {
$('#ibox_form').unblock();
var body = $("html, body");
body.animate({scrollTop:0}, '1000', 'swing');
$("#emsgbody").html(data);
$("#emsg").show("slow");
}
});
});
select2CostCenter();
openModalCostCenter();
});
function select2CostCenter() {
// Select2 de category
$("#id_cost_center").select2({
theme: "bootstrap",
width: "100%",
ajax: {
url: $("#_url").val() + 'module_billing/cost_center/ajax-cost-center',
dataType: 'json',
delay: 250,
method: "POST",
data: function (params) {
var queryParameters = {
term: params.term
};
return queryParameters;
},
processResults: function (data) {
return {
results: $.map(data, function (item) {
return {
text: item.name,
id: item.id
}
})
};
},
cache: true
}
});
}
function openModalCostCenter() {
$(".progress").hide();
$("#emsg").hide();
var _url = $("#_url").val();
var $modal2 = $('#ajax-modal-2');
$(".cost_center_add").click(function(e){
e.preventDefault();
// create the backdrop and wait for next modal to be triggered
$('body').modalmanager('loading');
setTimeout(function () {
$modal2.load(_url + 'module_billing/cost_center/modal_add_cost_center/', '', function () {
$modal2.modal();
$('#modal_cost_center_submit').on('click', function() {
var name = $('#name');
$.ajax({
url: _url + "module_billing/cost_center/ajax_add_post",
method: "post",
dataType: 'json',
data: {"name": name.val()}
}).done(function(data) {
$modal2.modal('toggle');
}).fail(function(jqxhr, textStatus, errorThrown) {
name.val('');
$(".text-danger").remove();
$("<p class='text-danger'>" + jqxhr.responseText + "</p>").insertAfter(name);
});
});
});
}, 1000);
});
}