| Server IP : 162.214.74.102 / Your IP : 216.73.217.80 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/dialogo/ui/lib/ |
Upload File : |
Dropzone.autoDiscover = false;
$(document).ready(function () {
//$('.amount').autoNumeric('init');
$("#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
$("#payee").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();
}
}
});
$("#a_hide").hide();
$("#emsg").hide();
$("#a_toggle").click(function(e){
e.preventDefault();
$("#a_hide").toggle( "slow" );
});
var _url = $("#_url").val();
// file attach
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/expense-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(),
payee: $('#payee').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);
});
}