1(function($) { 2 3 var URL_ARQUIVO = "templates/portalTRF5/includes/consulta_cp.php"; 4 var URL_ARQUIVO_DADOS = "templates/portalTRF5/includes/consulta_cp_dados.php"; 5 var table = null; 6 var $boxResultado = $('#boxResultado'); 7 8 var $formNumeroProcesso = $('#formNumeroProcesso'); 9 var $formNomeParte = $('#formNomeParte'); 10 var $formNumeroOab = $('#formNumeroOab'); 11 var $formNumeroCpfCnpj = $('#formNumeroCpfCnpj'); 12 13 var $btnFechaResultado = $('#btnFechaResultado'); 14 var $loadImage = $('#loadImage'); 15 16 var $btnFecharModal = $('#btnFecharModal'); 17 18 $loadImage.hide(); 19 20 $btnFecharModal.on('click', function() { 21 $('#modalPesquisa').fadeOut(function() { 22 $('#modalBox').fadeOut(); 23 }); 24 }); 25 26 /**************************************** 27 * Consulta Processos Por Numero 28 ***************************************/ 29 $formNumeroProcesso.on('submit', function(e) { 30 e.preventDefault(); 31 if ($('#inputNumeroProcesso').val() !== "") { 32 esconderAbas(); 33 $loadImage.show(); 34 $.post(URL_ARQUIVO, $formNumeroProcesso.serialize(), function(data) { 35 pesquisa(data); 36 }); 37 } else { 38 alert('Informe o número do processo'); 39 $('#inputNumeroProcesso').focus(); 40 } 41 }); 42 43 /**************************************** 44 * Consulta Processos Pelo Nome da Parte 45 *****************************************/ 46 $formNomeParte.on('submit', function(e) { 47 e.preventDefault(); 48 if ($('#inputNomeParte').val() !== "") { 49 esconderAbas(); 50 $loadImage.show(); 51 $.post(URL_ARQUIVO, $formNomeParte.serialize(), function(data) { 52 pesquisa(data); 53 }); 54 } else { 55 alert('Informe o nome da parte'); 56 $('#inputNomeParte').focus(); 57 } 58 }); 59 60 /**************************************** 61 * Consulta Processos Pelo Numero da OAB 62 *****************************************/ 63 $formNumeroOab.on('submit', function(e) { 64 e.preventDefault(); 65 if ($('#inputOab').val() !== "" && $('#inputEstadoOab').val() !== "") { 66 esconderAbas(); 67 $loadImage.show(); 68 $.post(URL_ARQUIVO, $formNumeroOab.serialize(), function(data) { 69 pesquisa(data); 70 }); 71 } else { 72 alert('Informe o número da OAB e o Estado'); 73 $inputOab.focus(); 74 } 75 }); 76 77 /******************************************* 78 * Consulta Processos Pelo Numero do CPF/CNPJ 79 ********************************************/ 80 $formNumeroCpfCnpj.on('submit', function(e) { 81 e.preventDefault(); 82 if ($('#inputCpfCnpj').val() !== "") { 83 esconderAbas(); 84 $loadImage.show(); 85 $.post(URL_ARQUIVO, $formNumeroCpfCnpj.serialize(), function(data) { 86 pesquisa(data); 87 }); 88 } else { 89 alert('Informe o CPF ou CNPJ desejado'); 90 $('#inputCpfCnpj').focus(); 91 } 92 }); 93 94 /******************************************* 95 * Funcao para fechar a tela de resultados 96 ********************************************/ 97 $btnFechaResultado.on('click', function() { 98 limparCampos(); 99 $boxResultado.fadeOut(function() { 100 $('[data-aba-search="1"].aba').addClass('selected').fadeIn(); 101 }); 102 }); 103 104 function limparCampos() { 105 $('#inputNumeroProcesso').val(''); 106 $('#inputNomeParte').val(''); 107 $('#inputOab').val(''); 108 $('#inputEstadoOab').val(''); 109 $('#inputCpfCnpj').val(''); 110 } 111 112 function esconderAbas() { 113 $('.buscaprocessualb .aba').removeClass('selected'); 114 } 115 116 $('#inputCpfCnpj').on("blur", function(e){ 117 var valor = e.target.value 118 if (valor){ 119 var max = (valor.length <= 11)? 11: 14; 120 for (i=valor.length; i<max; i++) 121 valor = '0' + valor 122 e.target.value = valor 123 124 if (valor.length <= 11) 125 $('#inputCpfCnpj').mask('000.000.000-00', {reverse: true}) 126 else 127 $('#inputCpfCnpj').mask('00.000.000\/0000-00', {reverse: true}) 128 } 129 }); 130 131 $('#inputCpfCnpj').on("focus", function (e){ 132 $('#inputCpfCnpj').unmask() 133 }); 134 135 $('#inputNumeroOab').mask('000000X', { 136 translation: { 137 'X': { 138 pattern: /[a-zA-Z]/, optional: true 139 } 140 } 141 }); 142 143 var pesquisa = function(obj) { 144 145 if (obj === "") { 146 alert("Nenhum processo encontrado!"); 147 $loadImage.hide(); 148 limparCampos(); 149 $('[data-aba-search="1"].aba').addClass('selected').fadeIn(); 150 return; 151 } 152 153 var processos = []; 154 var res = obj.replace(/[\\]/g, ''); 155
156 JSON.parse(res).forEach(function(sistema) { 157 158 if (sistema.processos.length > 0) { 159 sistema.processos.forEach(function(processo){ 160 processos.push({ 161 orgao: sistema.orgao, 162 sistema: sistema.sistemaProcessual, 163 resultado: sistema.resultado.mensagem, 164 numero: processo.numero, 165 nomeParte: processo.nomeParte, 166 link: processo.link, 167 dataAutuacao: processo.dataAutuacao, 168 classeJudicial: processo.classeJudicial, 169 assunto: processo.assunto, 170 orgaoJulgador: processo.orgaoJulgador 171 }) 172 }) 173 } else { 174 processos.push({ 175 orgao: sistema.orgao, 176 sistema: sistema.sistemaProcessual, 177 resultado: sistema.resultado.mensagem, 178 numero: "Nenhum processo encontrado", 179 nomeParte: null, 180 link: null, 181 dataAutuacao: null, 182 classeJudicial: null, 183 assunto: null, 184 orgaoJulgador: null 185 }) 186 } 187 }); 188 189 tabela = $("#tabelaProcessos").DataTable({ 190 data: processos, 191 searching: false, 192 lengthChange: false, 193 destroy: true, 194 paginate: false, 195 info: false, 196 columns: [ 197 { 198 render: function(data, type, row, meta){ 199 var orgao = row.orgao.nome? row.orgao.nome: row.orgao.id 200 var sistema = row.sistema.descricao? row.sistema.descricao: row.sistema.id 201 return '<span title="' + orgao + ' - ' + sistema + '">' + row.orgao.id + '/' + row.sistema.id + '</span>' 202 } 203 }, 204 { 205 render: function(data, type, row, meta){ 206 return row.resultado 207 } 208 }, 209 { 210 render: function(data, type, row, meta){ 211 return "<a href='javascript: exibeDadosProcesso(\"" + row.orgao.id + "\", \"" + row.sistema.id + "\", \"" + row.numero + "\")' target='_blank'>" + row.numero + "</a>" 212 } 213 } 214 ] 215 }); 216 217 $loadImage.hide(); 218 esconderAbas(); 219 $boxResultado.fadeIn(); 220 } 221 222 exibeDadosProcesso = function(orgao, sistema, numero) { 223 $.get(URL_ARQUIVO_DADOS + "?orgao="+ orgao + "&sistema=" + sistema + "&numero=" + numero, function(obj) { 224 225 obj = JSON.parse(obj); 226 227 $("#info-numero").html(obj.numero); 228 229 //converte as nomes das partes do processo num objeto list 230 $("#info-nome-parte").html(converterNomeParteToList(obj.nomeParte)); 231 232 //converte as movimentacoes num objeto list 233 var lista = converterArrayMovToList(obj.movimentacoes); 234 235 $("#info-movimentacao").html(lista); 236 237 $("#info-link").html(obj.link ? '<a href="' + obj.link + '" target="_blank">Clique aqui</a>': 'Não'); 238 239 240 $('#modalBox').fadeIn(function() { 241 $('#modalPesquisa').fadeIn(); 242 }); 243 244 }).fail(function(){ 245 alert("erro ao consultar os dados do processo " + numero); //NOSONAR 246 }); 247 } 248 249 function converterNomeParteToList(partes){ 250 let list = $('<ul></ul>'); 251 list.addClass("list-group bordeless"); 252 253 if (partes) { 254 for(let x=0; x < partes.length;x++){ 255 if(partes[x].nomeParte != null){ 256 var li = $('<li></li>').addClass('list-group-item bordeless'); 257 var a = $('<a></a>').text(partes[x].nomeParte); 258 li.append(a); 259 list.append(li); 260 } 261 } 262 } 263 return list; 264 } 265 266 function converterArrayMovToList(vetor){ 267 let list = $('<ul></ul>'); 268 list.addClass('list-group bordeless'); 269 if(vetor!=null && vetor.length > 0){ 270 for(let x=0; x < vetor.length;x++){ 271 var li = $('<li></li>').addClass('list-group-item bordeless'); 272 var a = $('<a></a>').text(vetor[x].data + '-' + vetor[x].descricao); 273 li.append(a); 274 list.append(li); 275 } 276 } 277 return list; 278 } 279 280 281})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.