<?php
session_start();
include('../conexion.php'); 
include('../include/sesiones.php');
?>


<div class="modal fade" id="modal_box_sesion" tabindex="-1" role="dialog"  aria-hidden="true">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
           <button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
                <span aria-hidden="true">&times;</span>
            </button>
            <center>
                <div class="modal_body">
                    <div class="col-lg-10 col-md-10">
                        <div class="account_form">
                            <h2><center>INICIO SESION<center></h2>
                            <div  id="resultados_login"></div> 
                            <form id="form_login" name="form_login" method="post">
                                <div class="form_group">  
                                    <label>Email*</label>
                                    <input name="email" required>
                                </div>
                                 <div class="form_group">
                                    <label for="password">Contraseña*</label>
                                    <input id="password" type="password" name="password" required>
                                    <span class="fa fa-eye-slash icon" onclick="mostrarPassword()"></span> 
                                </div>
                                <div class="alert alert-warning alert-dismissible" role="alert">
                                  <a href="https://wa.me/<?php echo $suc_celular; ?>?text=Hola! Me interesa registrarme en su pagina web <?php echo utf8_decode($emp_nombre) ?> cuales serian los pasos a seguir? Gracias." target="_blank">
                                    <div class="box-content newleter-content">
                                        <label class="newletter-label"><strong>SIN USUARIO !</strong> Pulsa click AQUÍ un asesor 
                                        te dara indicaciones para tu registro.</label>
                                    </div>
                                  </a>
                                </div>   
                                <div class="login_submit">
                                    <?php  if(isset($_GET['voy'])) { ?>
                                    <input name="voy" type="hidden" id="voy" value="<?php echo $_GET['voy']; ?>" />                    
                                    <button type="submit" name="btn_login" id="btn_login" value="login">Ingresar</button>

                                    <?php } else if(isset($_GET['art_id'])) { ?>
                                      <input name="art_id" type="hidden" id="art_id" value="<?php echo $_GET['art_id']; ?>" />          
                                      <button type="submit" name="btn_login" id="btn_login" value="login">Ingresar</button>

                                     <?php } else if(isset($_GET['voy_deseo'])) { ?>
                                      <input name="voy_deseo" type="hidden" id="voy_deseo" value="<?php echo $_GET['voy_deseo']; ?>" />          
                                      <button type="submit" name="btn_login" id="btn_login" value="login">Ingresar</button>
                                    <?php } else { ?>
                                        <button type="submit" name="btn_login" id="btn_login" value="login">Ingresar</button>
                                         
                                    <?php } ?>
                                </div>
                            </form>
                         </div>    
                    </div> 
                </div>
            </center>
        </div>
    </div>
</div>

<script type="text/javascript">

 //login
$("#form_login" ).submit(function( event ) {;
    $('#btn_login').attr("disabled", true);
    var parametros = $(this).serialize();
    $.ajax({
        type: "POST",
        url: "./php_cuenta/iniciar_sesion.php",
        data: parametros,
        beforeSend: function(objeto){
            $('#resultados_login').html('<img src="../img/ajax-loader.gif" alt="" height="15px"  />').fadeOut(1000);
        },
        success: function(datos){
        $("#resultados_login").html(datos);
        $('#btn_login').attr("disabled", false);
        load(1);
        }
    });
    event.preventDefault();
    })

//mostrar password
function mostrarPassword(){
        var cambio = document.getElementById("password");
        if(cambio.type == "password"){
            cambio.type = "text";
            $('.icon').removeClass(' fa-eye-slash').addClass('fa fa-eye');
        }else{
            cambio.type = "password";
            $('.icon').removeClass(' fa-eye').addClass('fa fa-eye-slash');
        }
    } 
    $(document).ready(function () {
    $('#ShowPassword').click(function () {
        $('#Password').attr('type', $(this).is(':checked') ? 'text' : 'password');
    });
});



</script>

<!--- estilos de la notificación carrito y deseo --->
<style type="text/css">
#notification_count1 {
padding: 1px 8px 1px 8px;
background: #cc0000;
color: #ffffff;
font-weight: bold;
margin-left: 9px;
border-radius: 100px;
position: absolute;
margin-top: -12px;
font-size: 10px;
}

#notification_count2 {
padding: 1px 8px 1px 8px;
background: #cc0000;
color: #ffffff;
font-weight: bold;
margin-left: 9px;
border-radius: 100px;
position: absolute;
margin-top: -12px;
font-size: 10px;
}
</style>


