
<!DOCTYPE html>
<html lang="en">
<head>



  
    <script src="//cdn.jsdelivr.net/npm/sweetalert2@11"></script> 


    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Login </title>
    <link rel="shortcut icon" href="img/LogoBG.png">
    <link href="bootstrap.min.css" ref="stylesheet">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-gH2yIJqKdNHPEq0n4Mqa/HGKIhSkIHeL5AyhkYV8i59U5AR6csBvApHHNl/vI1Bx" crossorigin="anonymous">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js"></script>


    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>


    <script type="text/javascript" src="js/sweetalert2.js"></script>
    <script type="text/javascript" src="js/sweetalert2.min.js"></script>
    <link rel="stylesheet" href="css/sweetalert2.css" type="text/css">
    <link rel="stylesheet" href="css/sweetalert2.min.css" type="text/css">
    <script src="js/jquery-2.1.4.min.js"></script>
    <style>
        body{
            background: #ffe259;
            background: linear-gradient(to right, #ffa751, #ffe259);
        }
        .bg{
            background-image: url(img/Logo_Solo.png);
            background-position: center center ;
            background-size: cover;
        }
    </style>
</head>
<body>

<!-- <script type="text/javascript">


    function enviar(){
        var user= document.getElementById('email').value;
        var clave= document.getElementById('password').value;

        var dataen = 'user='+user+'&clave='+clave;

        $.ajax({
            type:'post',
            url:'validadores/proceso.php',
            data:dataen,
            success:function(data){
                
                // $('#validacion').html(data);
                $("#validacion").fadeOut(1);
                // setTimeout("location.href='home.php'");
                if(data=='Ingresando...'){
                    $("#validacion").fadeIn(1000);
                    $('#validacion').html(data);
                    setTimeout("location.href='../../../DesertGraphicsLtda/flujoDatos_StoGlobal/dashboard/'",4000);
                    
                }if(data=='Datos incorrectos!'){
                   $("#validacion").fadeIn(800);
                   $('#validacion').html(data);
                   document.getElementById("formulario").reset();
                }
                // if(resp=='Algo va mal...'){
                //     $("#respa").html(resp);
                    
                //     document.getElementById("formss").reset();
                //     $("#respa").fadeOut(3000);
                // }
                // if(resp=='Ingresnado...'){
                //     $("#respas").html(resp);
                //     setTimeout("location.href='index.php'",1500);
                    
                // }
                
            }
        });
        return false;
    }
    
</script> -->





    <div class="container w-75 bg-primary mt-5 rounded shadow">
        <div class="row align-items-stretch">
            <div class="col bg d-none d-lg-block col-md-5 col-lg-5 col-xl-6 rounded">

            </div>
            <div class="col bg-white p-5 rounded-end">
                <div class="text-end">
                    <!-- <img src="img/bosque.jpg" width="48" alt=""> -->
                </div>

                <h2 class="fw-bold text-center py-5">Bienvenido</h2>

                <!-- Login -->

                <form id="formulario" class="formulario"  >
                    <div class="mb-4">
                        <label for="email" class="form-label">Mail</label>
                        <input type="email" class="form-control" name="email" id="email" >
                    </div>
                    <div class="mb-4">
                        <label for="password" class="form-label">Clave</label>
                        <input type="password" class="form-control" name="password" id="password">
                    </div>
                    <div class="mb-4 form-check">
                        <!-- <input type="checkbox" class="form-check-input" name="connected"> -->
                        <label for="connected" class="form-check-label" id="validacion"></label>
                    </div>

                    <div class="d-grid ">
                        <button type="submit" class="btn btn-primary">Iniciar Sesión</button>
                    </div>

                    
                </form>
            </div>
        </div>

    </div>


</body>
</html>

<script type="text/javascript">

              $(document).ready(function () {
                  $('#formulario').submit(function (e) {
                      e.preventDefault();
                      var datos=$(this).serialize();
                      $.ajax({
                          type:"POST",
                          url:"validadores/proceso.php",
                          data:datos,
                          dataType: 'json',
                            success:function(data){
                              
                                if (data.success==true) {
                                  const Toast = Swal.mixin({
                                    toast: true,
                                    position: 'top-end',
                                    showConfirmButton: false,
                                    timer: 1500,
                                    timerProgressBar: true,
                                    didOpen: (toast) => {
                                      toast.addEventListener('mouseenter', Swal.stopTimer)
                                      toast.addEventListener('mouseleave', Swal.resumeTimer)
                                    }
                                  })

                                  Toast.fire({
                                    icon: 'success',
                                    title: 'Signed in successfully'
                                  })
                                  document.getElementById("formulario").reset();
                                    setTimeout("location.href='flujoDatos_StoGlobal/dashboard/index.php'",2000);
                                }
                                if(data.success==false) {
                                  Swal.fire({
                                    title: 'Error!',
                                    text: 'Datos Incorrectos!',
                                    icon: 'error',
                                    timer: 2500,
                                    confirmButtonText: 'ok'
                                  })
                          
                                }
                                
                            }     
                      });
                  });
              });
            </script>

<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-A3rJD856KowSb7dwlZdYEkO39Gagi7vIsF0jrRAoQmDKKtQBHUuLZ9AsSv4jD4Xa" crossorigin="anonymous"></script>

