| 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/imobles/application/plugins/modulo_fiscal/js/ |
Upload File : |
$(document).ready(function () {
$(".progress").hide();
$("#emsg").hide();
//não exibe a div de mensagem de erro
var _url = $("#_url").val();
////////////////cidade endereço////////////////////////////////
//função para listar cidades do estado selecionado
$('#company_state').on('change', function () {
buscaCity($(this).val(),"city");
});
//habilita select 2
$(".select2").select2({
theme: "bootstrap"
});
//carega a cidade no alterar
buscaCity( $('#company_state').val(),$('#city_id').val());
//zip busca de zip
$('#company_zip').blur(function (e) {
e.preventDefault();
//esmaece a div e coloca o loading
//vai esse block_msg nao sei da onde, mas fica o loading
$("#form_company").block({message: block_msg});
//cria o bootbox para cadastrar novo grupo
$.post(_url + "ajax/zip", {zip: $("#company_zip").val()})
.done(function (data) {
if(data[0].status=='OK'){
$('#company_state').select2("val",data[0].state_id);
$("#company_address").val(data[0].address);
$("#company_neighborhood").val(data[0].neighborhood);
buscaCity(data[0].state_id,data[0].city_id);
}else{
alert(data[0].status);
}
$('#form_company').unblock();
});
});
//action por ajax
$("#submit").click(function (e) {
e.preventDefault();
$('#form_company').block({message: block_msg});
var _url = $("#_url").val();
$.ajax(
{
type: 'POST',
url:_url + 'modulo_fiscal/configuration/company-post',
data: new FormData($("#form_company")[0]),
processData: false,
contentType: false,
success: function(data){
if ($.trim(data)==="OK") {
location.reload();
} else {
$('#form_company').unblock();
var body = $("html, body");
body.animate({scrollTop: 0}, '1000', 'swing');
$("#emsgbody").html(data);
$("#emsg").show("slow");
}
}
});
});
//busca a cidade
function buscaCity(state,valor){
if(state){
$.getJSON($("#_url").val() + 'ajax/city', {state_id: state}, function (j) {
var options = '<option value="city">' + $('#select_city').val() + '</option>';
for (var i = 0; i < j.length; i++) {
options += '<option value="' + j[i].id + '">' + j[i].city_name + '</option>';
}
$('#company_city').html(options);
$('#company_city').select2("val",valor);
});
} else {
//select_state contem o texto padrão campo hidden na page
$('#company_city').html('<option value="state">' + $('#select_state').val() + '</option>');
$('#company_city').select2("val","state");
}
}
});