$(window).on('load', function () { $('.outer-loader').delay(1000).fadeOut('slow'); }); $( "#login-form" ).submit(function( event ) { event.preventDefault(); var parametros = $(this).serialize()+'&is_desktop='+localStorage.getItem('is_desktop')+'&timerExec='+configLogin.executeTime+'&system='+configLogin.IdentDomain+'&login='+configLogin.IdentLogin+'&logo='+configLogin.theme.logo+'&logoOs='+configLogin.theme.logoOs+'&favicon='+configLogin.theme.favicon; $('.btn_red_login').attr("disabled","true"); $.ajax({ async: true, type: "POST", url: "/api/gpp/"+configLogin.TokenConsultUnico+'/SingIn', data: parametros, beforeSend: function(objeto){ $('.LoginClient').html(''); $('.LoginClient').addClass('spinner-border spinner-border-sm'); }, success: function(datos){ var json_cli = eval("(" + datos + ")"); if (json_cli.code == 1) { $('.account-box').css('display',"none"); Swal.fire({ icon: 'success', title: json_cli.msj, showConfirmButton: false }) setTimeout("location.href = '/web/home';", 2000); }else{ $('.msj_log').html(''); $('.LoginClient').removeClass('spinner-border spinner-border-sm'); $('.LoginClient').html($('.LoginClient').attr('data')); $('.btn_red_login').removeAttr("disabled"); } }, error: function(result){ var json = JSON.parse(result.responseText); $('.msj_log').html(''); $('.LoginClient').removeClass('spinner-border spinner-border-sm'); $('.LoginClient').html($('.LoginClient').attr('data')); $('.btn_red_login').removeAttr("disabled"); } }); }) $( "#reset-form" ).submit(function( event ) { event.preventDefault(); var parametros = $(this).serialize()+'&res='+configLogin.IdentDomain+'&logo='+logoIconoLoader; $('.reset_form').attr("disabled","true"); $.ajax({ type: "POST", url: "/core/ajax/acount/resetAccounts", data: parametros, beforeSend: function(objeto){ $('.ResetClient').html(''); $('.ResetClient').addClass('spinner-border spinner-border-sm'); }, success: function(datos){ $('.result').html(datos); var json_cli = eval("(" + datos + ")"); if (json_cli.code == 1) { //$('.account-box').css('display',"none"); if (json_cli.mix_count == 1) { Swal.fire({ icon: 'success', title: json_cli.msj, showConfirmButton: false, timer: 3500 }) }else if(json_cli.mix_count == 0){ Swal.fire({ title: 'Ingrese codigo de local', input: 'text', inputAttributes: { autocapitalize: 'off' }, showCancelButton: true, confirmButtonText: 'Validar', showLoaderOnConfirm: true, preConfirm: (login) => { return fetch(`//api.github.com/users/${login}`) .then(response => { if (!response.ok) { throw new Error(response.statusText) } return response.json() }) .catch(error => { Swal.showValidationMessage( `Request failed: ${error}` ) }) }, allowOutsideClick: () => !Swal.isLoading() }).then((result) => { if (result.isConfirmed) { Swal.fire({ title: `${result.value.login}'s avatar`, imageUrl: result.value.avatar_url }) } }) } $("#reset-form")[0].reset(); //setTimeout("location.href = '/web/home';", 2000); }else{ Swal.fire({ icon: 'error', title: json_cli.msj, showConfirmButton: false, timer: 3500 }) } $('.ResetClient').removeClass('spinner-border spinner-border-sm'); $('.ResetClient').html($('.ResetClient').attr('data')); $('.reset_form').removeAttr("disabled"); } }); }) $('.ChangeLang').change(function() { var langPP = $(this).val(); window.location.href = '?&lang='+langPP; });