| Server IP : 162.214.74.102 / Your IP : 216.73.217.103 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/www/lrsys_apps/erp/ui/theme/lrsys/lib/ |
Upload File : |
$(document).ready(function () {
$(".cdelete").click(function (e) {
e.preventDefault();
var id = this.id;
var lan_msg = $("#_lan_are_you_sure").val();
bootbox.confirm(lan_msg, function(result) {
if(result){
var _url = $("#_url").val();
window.location.href = _url + "accounts/delete/" + id + '/';
}
});
});
$("#search").click(function (e) {
e.preventDefault();
$("#result").hide();
$('.progress').show();
$('.progress .progress-bar').progressbar();
$(this).html("Searching...");
$(this).addClass("btn-danger");
var _url = $("#_url").val();
$.post(_url + 'search/ps/', {
txtsearch: $('#txtsearch').val(),
stype: $('#stype').val()
})
.done(function (data) {
setTimeout(function () {
var sbutton = $("#search");
var result = $("#result");
sbutton.html('Search');
sbutton.removeClass("btn-danger");
$('.progress').hide();
result.html(data);
result.show();
}, 2000);
});
});
accountForm();
modalAddBankSlipData();
});
function accountForm() {
$('#bank_code').mask('999');
}
function modalAddBankSlipData() {
$('.progress').hide();
$('#emsg').hide();
var _url = $('#_url').val();
var $modal = $('#ajax-modal');
$('.add-bank-slip-data').on('click', function(event) {
event.preventDefault();
var id_account = $(this).data('id_account');
setTimeout(function() {
$modal.load(_url + 'accounts/modal-add-bank-slip-data/' + id_account + '/', '', function () {
$modal.modal();
maskFields();
$('#modal_submit').on('click', function() {
validateFields();
});
});
}, 600);
});
}
function validateFields() {
var inputs = $('#form_add_bank_slip_data').find('input:visible:not(#default)'),
valid = true;
$.each(inputs, function(i, el) {
$(el).parent().find('.help-block').text('');
var type = $(el).data('type'),
size = $(el).data('size'),
value = $(el).val();
if(type == 'INT') {
// Verifica se o número não é um inteiro
// if(/^0/.test(value) || (Number.isInteger(parseInt(value, 10)) == false)) {
if(jQuery.isNumeric(value) == false || (Number.isInteger(parseInt(value, 10)) == false)) {
$(el).parent().find('.help-block').text(_L['The value must be an integer']);
valid = false;
return false;
}
// Verifica se o número não é um inteiro
if(value.length <= 0 || value.length > size) {
$(el).parent().find('.help-block').text(_L['Value must be greater than and zero and less than or equal to'] +" "+ size);
valid = false;
return false;
}
}
if(type == 'VARCHAR') {
// Verifica se o número não é um inteiro
if(value.length <= 0 || value.length > size) {
console.info(value.length, value.length > 0, value.length <= size);
$(el).parent().find('.help-block').text(_L['Value must be greater than and zero and less than or equal to'] +" "+ size);
valid = false;
return false;
}
}
});
// Se tudo estiver correto faz o submit
if(valid) {
$('#form_add_bank_slip_data').submit();
}
}
function maskFields() {
var inputs = $('#form_add_bank_slip_data').find('input:visible:not(#default)');
$.each(inputs, function(i, el) {
var type = $(el).data('type'),
size = $(el).data('size'),
value = $(el).val();
if(type == 'INT') {
$(el).mask('?' + '9'.repeat(size));
}
if(type == 'VARCHAR') {
$(el).mask('?' + '*'.repeat(size));
}
});
}