948
| <![CDATA[<script>
function maskIt(w,e,m,r,a){ // Cancela se o evento for Backspace
if (!e) var e = window.event
if (e.keyCode) code = e.keyCode;
else if (e.which) code = e.which; // Variáveis da função
var txt = (!r) ? w.value.replace(/[^\d]+/gi,'') : w.value.replace(/[^\d]+/gi,'').reverse();
var mask = (!r) ? m : m.reverse();
var pre = (a ) ? a.pre : "";
var pos = (a ) ? a.pos : "";
var ret = "";
if(code == 9 || code == 8 || txt.length == mask.replace(/[^#]+/g,'').length)
return false; // Loop na máscara para aplicar os caracteres
for(var x=0,y=0, z=mask.length;x<z && y<txt.length;){
if(mask.charAt(x)!='#'){
ret += mask.charAt(x); x++;
}else{
ret += txt.charAt(y); y++; x++;
}
}
// Retorno da função
ret = (!r) ? ret : ret.reverse()
w.value = pre+ret+pos;
}
$( document ).ready(function(){
$("#btn-pesquisar").on("click", function(){
$("#frm_busca").submit();
});
$("#optionsRadios1").on("click", function(){
$("#pfName").show(500);
$("#pfDoc").show(500);
$("#pjName").hide(500);
$("#pjDoc").hide(500);
$("#pjOpt").hide(500);
$("#pjPrc").hide(500);
});
$("#optionsRadios2").on("click", function(){
$("#pfName").hide(500);
$("#pfDoc").hide(500);
$("#pjName").show(500);
$("#pjDoc").show(500);
$("#pjOpt").show(500);
$("#pjPrc").hide(500);
$("#seletor").val(1);
});
$("#seletor").on("change", function(){
if($(this).val() == '3'){
$("#pjPrc").show(500);
}else{
$("#pjPrc").hide(500);
}
});
$("#form-contact").on("click", function(){
var form = $("#contactForm").serialize();
var email = $("#email").val();
var emailFilter=/^.+@.+\..{2,}$/;
if($("#razaos").val()=="" && $("#nome").val()==""){
var valid = false;
}
var illegalChars= /[\(\)\<\>\,\;\:\\\/\"\[\]]/;
if(!(emailFilter.test(email))||email.match(illegalChars) || valid==false ){
swal(
'Atenção',
'Prencha os campos obrigatórios.',
'error'
);
$("#nome").css("background-color", "#ff4d4d");
$("#razaosocial").css("background-color", "#ff4d4d");
$("#email").css("background-color", "#ff4d4d");
}else{
$('.btn-enviar').button('loading');
jQuery.ajax({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
type : "POST",
url : "/sendcontato",
data : form,
success: function(res){
console.log(res);
if(res.success){
swal(
'Seu Email foi Enviado!',
'Logo iremos responder.',
'success'
);
$('.btn-enviar').button("reset");
document.getElementById("contactForm").reset();
}else{
swal(
'Erro ao enviar email!',
'Tente novamente mais tarde.',
'error'
);
}
}
});
}
});
});
var swiper = new Swiper('.swiper-container', {
fadeEffect: {
crossFade: true
},
slidesPerView: 1,
spaceBetween: 0,
autoplay: {
delay: 4500,
disableOnInteraction: false,
},
loop: true,
pagination: {
el: '.swiper-pagination',
clickable: true,
},
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
},
});
</script>]]>
|