1jQuery(document).ready(function($){ 2 3 let dir_url_model = 'https://apm.org.br/wp-content/themes/themeApm/model/'; 4 5 // =========== FORMULÃRIO DE CONTATO ================ 6 // ================================================== 7 8 $('#form_contato').submit(function (evt) { 9 evt.preventDefault(); 10 11 // CHECAGEM DE CAMPOS VAZIOS 12 var checaCampos = true; 13 14 $(".campo-obrigatorio").each(function() { 15 if(!$(this).val()){ 16 // VOLTA PARA O CAMPO VAZIO 17 $(this).focus(); 18 checaCampos = false; 19 return false; 20 } 21 }); 22 23 if(!checaCampos){ 24 return false; 25 } 26 // CHECAGEM DE CAMPOS VAZIOS 27 28 var formData = new FormData($(this).get(0)); 29 30 let botao = $(this).find(':submit'); 31 let spinner = $(this).find(".spinner"); 32 let retorno_form = $(this).find(".retorno_form"); 33 34 spinner.show(); 35 36 // VER SE CAMPOS ESTÃO SENDO CAPTADOS 37 console.log(...formData); 38 39 $.ajax({ 40 type : 'POST', 41 url: '../../wp-content/themes/themeApm/model/contato/inserir.php', 42 data : formData, 43 dataType: 'json', 44 contentType: false, 45 processData: false, 46 beforeSend: function() 47 { 48 spinner.show(); 49 botao.attr("disabled", true); 50 botao.val("Enviando..."); 51 }, 52 success : function(response){ 53 54 console.log(response); 55 56 if(response.status == "sucesso"){ 57 retorno_form.removeClass("alert-danger"); 58 retorno_form.addClass("alert-success"); 59 retorno_form.text("Contato recebido com sucesso!"); 60 retorno_form.show(); 61 62 // retorno_form.focus(); 63 64 // $('html, body').animate({ scrollTop: retorno_form.offset().top }, 'slow'); 65 66 spinner.hide(); 67 botao.attr("disabled", false); 68 $('#form_contato').trigger("reset"); 69 70 setTimeout(function(){ 71 retorno_form.hide(); 72 }, 5000); 73 74 }else{ 75 // SE FOR UM ERRO ESPECÃFICO DE UM CAMPO 76 if(typeof response.campo !== 'undefined') { 77 $("#aviso_label_"+response.campo).text(response.erro); 78 $("#aviso_label_"+response.campo).show(); 79 $('#'+response.campo).focus(); 80 spinner.hide(); 81 botao.attr("disabled", false); 82 botao.val("Enviar"); 83 84 setTimeout(function(){ 85 $("#aviso_label_"+response.campo).hide(); 86 }, 3000); 87 88 return false; 89 }else{ 90 // SE FOR UM ERRO MAIS GENÃRICO 91 retorno_form.removeClass("alert-success"); 92 retorno_form.addClass("alert-danger"); 93 retorno_form.text("Ocorre um erro. Detalhes: " + response.erro); 94 retorno_form.show(); 95 // $('html, body').animate({ scrollTop: retorno_form.offset().top }, 'slow'); 96 spinner.hide(); 97 botao.attr("disabled", false); 98 botao.val("Enviar"); 99 100 setTimeout(function(){ 101 retorno_form.hide(); 102 }, 3000); 103 } 104 } 105 106 } 107 }); 108 109 });
110 // FIM FORMULÃRIO DE CONTATO 111 112 // =========== FORMULÃRIO DE Apoio ================ 113 // ================================================== 114 115 $('#form_solicitacao_de_apoio').submit(function (evt) { 116 evt.preventDefault(); 117 118 // CHECAGEM DE CAMPOS VAZIOS 119 var checaCampos = true; 120 121 $(".campo-obrigatorio").each(function() { 122 if(!$(this).val()){ 123 // VOLTA PARA O CAMPO VAZIO 124 $(this).focus(); 125 checaCampos = false; 126 return false; 127 } 128 }); 129 130 if(!checaCampos){ 131 return false; 132 } 133 // CHECAGEM DE CAMPOS VAZIOS 134 135 var formData = new FormData($(this).get(0)); 136 137 let botao = $(this).find(':submit'); 138 let spinner = $(this).find(".spinner"); 139 let retorno_form = $(this).find(".retorno_form"); 140 141 spinner.show(); 142 143 // VER SE CAMPOS ESTÃO SENDO CAPTADOS 144 console.log(...formData); 145 146 $.ajax({ 147 type : 'POST', 148 url: '../../wp-content/themes/themeApm/model/solicitacao-apoio/inserir.php', 149 data : formData, 150 dataType: 'json', 151 contentType: false, 152 processData: false, 153 beforeSend: function() 154 { 155 spinner.show(); 156 botao.attr("disabled", true); 157 botao.val("Enviando..."); 158 }, 159 success : function(response){ 160 161 console.log(response); 162 163 if(response.status == "sucesso"){ 164 retorno_form.removeClass("alert-danger"); 165 retorno_form.addClass("alert-success"); 166 retorno_form.text("Solicitação recebida com sucesso!"); 167 retorno_form.show(); 168 169 // retorno_form.focus(); 170 171 // $('html, body').animate({ scrollTop: retorno_form.offset().top }, 'slow'); 172 173 spinner.hide(); 174 botao.attr("disabled", false); 175 // $('#form_solicitacao_de_apoio').trigger("reset"); 176 177 setTimeout(function(){ 178 retorno_form.hide(); 179 }, 7000); 180 181 }else{ 182 // SE FOR UM ERRO ESPECÃFICO DE UM CAMPO 183 if(typeof response.campo !== 'undefined') { 184 $("#aviso_label_"+response.campo).text(response.erro); 185 $("#aviso_label_"+response.campo).show(); 186 $('#'+response.campo).focus(); 187 spinner.hide(); 188 botao.attr("disabled", false); 189 botao.val("Enviar"); 190 191 setTimeout(function(){ 192 $("#aviso_label_"+response.campo).hide(); 193 }, 7000); 194 195 return false; 196 }else{ 197 // SE FOR UM ERRO MAIS GENÃRICO 198 retorno_form.removeClass("alert-success"); 199 retorno_form.addClass("alert-danger"); 200 retorno_form.text("Ocorreu um erro. Detalhes: " + response.erro); 201 retorno_form.show(); 202 // $('html, body').animate({ scrollTop: retorno_form.offset().top }, 'slow'); 203 spinner.hide(); 204 botao.attr("disabled", false); 205 botao.val("Enviar"); 206 207 setTimeout(function(){ 208 retorno_form.hide(); 209 }, 7000); 210 } 211 } 212 213 }, 214 215 error: function(response){ 216 console.log(response); 217 218 retorno_form.removeClass("alert-success"); 219 retorno_form.addClass("alert-danger"); 220 retorno_form.text("Ocorreu um erro inesperado."); 221 retorno_form.show(); 222 223 spinner.hide(); 224 botao.attr("disabled", false); 225 botao.val("Enviar"); 226 227 setTimeout(function(){ 228 retorno_form.hide(); 229 }, 7000); 230 231 // save_log(response); 232 } 233 }); 234 235 });
236 // FIM FORMULÃRIO DE Apoio 237 238 // ========================== 239 240 // =========== FORMULÃRIO PARA CADASTRAR CLASSIFICADO PELO USUÃRIO ================ 241 // ================================================== 242 243 $('#form_class_painel').submit(function (evt) { 244 evt.preventDefault(); 245 246 // CHECAGEM DE CAMPOS VAZIOS 247 var checaCampos = true; 248 249 $(".campo-obrigatorio").each(function() { 250 if(!$(this).val()){ 251 // VOLTA PARA O CAMPO VAZIO 252 $(this).focus(); 253 checaCampos = false; 254 return false; 255 } 256 }); 257 258 if(!checaCampos){ 259 return false; 260 } 261 // CHECAGEM DE CAMPOS VAZIOS 262 263 var formData = new FormData($(this).get(0)); 264 265 let botao = $(this).find(':submit'); 266 let spinner = $(this).find(".spinner"); 267 let retorno_form = $(this).find(".retorno_form"); 268 269 spinner.show(); 270 271 // VER SE CAMPOS ESTÃO SENDO CAPTADOS 272 console.log(...formData); 273 274 $.ajax({ 275 type : 'POST', 276 url : dir_url_model+$(this).attr('action')+'.php', 277 url: '../../wp-content/themes/themeApm/model/classificados/inserir.php', 278 data : formData, 279 dataType: 'json', 280 contentType: false, 281 processData: false, 282 beforeSend: function() 283 { 284 spinner.show(); 285 botao.attr("disabled", true); 286 botao.val("Enviando..."); 287 }, 288 success : function(response){ 289 290 console.log(response); 291 292 if(response.status == "sucesso"){ 293 retorno_form.removeClass("alert-danger"); 294 retorno_form.addClass("alert-success"); 295 retorno_form.text("Classificado enviado para avaliação."); 296 setTimeout(function(){ 297 retorno_form.show(); 298 spinner.hide(); 299 botao.attr("disabled", false); 300 $('#form_class_painel').trigger("reset"); 301 }, 2000); 302 303 setTimeout(function(){ 304 retorno_form.hide(); 305 }, 8000); 306 307 }else{ 308 // SE FOR UM ERRO ESPECÃFICO DE UM CAMPO 309 if(typeof response.campo !== 'undefined') { 310 $("#aviso_label_"+response.campo).text(response.erro); 311 $("#aviso_label_"+response.campo).show(); 312 $('#'+response.campo).focus(); 313 spinner.hide(); 314 botao.attr("disabled", false); 315 botao.val("Enviar"); 316 317 setTimeout(function(){ 318 $("#aviso_label_"+response.campo).hide(); 319 }, 3000); 320 321 return false; 322 }else{ 323 // SE FOR UM ERRO MAIS GENÃRICO 324 retorno_form.removeClass("alert-success"); 325 retorno_form.addClass("alert-danger"); 326 retorno_form.text("Ocorreu um erro. Detalhes: " + response.erro); 327 retorno_form.show(); 328 spinner.hide(); 329 botao.attr("disabled", false); 330 botao.val("Enviar"); 331 332 setTimeout(function(){ 333 retorno_form.hide(); 334 }, 3000); 335 } 336 } 337 338 } 339 }); 340 341 }); 342 343});
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.