<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
        <meta name="description" content="">
        <meta name="author" content="">
        <title>Login</title>
        <link href="css/style.default.css" rel="stylesheet">
    </head>
    <body class="signin">
        <section>
            <div class="panel panel-signin">
                <div class="panel-body">
                    <div class="logo text-center">
                        <a href="http://www.itodoslossantos.cl" target="_parent">
                        <img  src="images/logo-inmobiliaria-small.png" alt="Chain Logo" >
                    </a>
                    </div>
                    <h4 class="text-center" style="font-family: 'Lato', sans-serif;  font-weight: 300;line-height: 120%;color: #0099da;margin: 20px 0 17px 0;"><strong>Iniciar sesión con tu  cuenta</strong></h4>
                    <div class="mb30"></div>
                        <form id="login" >
                            <input type="hidden" name="id_cliente" id="id_cliente">
                            <div  id="error" class="errorForm"></div>
                            <div class="input-group mb15">
                                <span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
                                <input id="rut"  onchange="javascript:this.value=this.value.toUpperCase();Valida_Rut(this,'rut')" onkeypress="validacamposrut();" name="rut" type="text" maxlength="10" required class="form-control" placeholder="Rut : Ejemplo 142687194">
                            </div><!-- input-group -->
                            <div class="input-group mb15">
                                <span class="input-group-addon"><i class="glyphicon glyphicon-lock"></i></span>
                                <input id="contraseña" maxlength="10" name="contraseña" type="password" required class="form-control" placeholder="Contraseña">
                            </div><!-- input-group -->
                            
                            <div class="clearfix">
                                <div class="pull-left">
                                    <div class="ckbox ckbox-primary mt10">
                                        <input type="checkbox" id="rememberMe" value="1">
                                        <label for="rememberMe">Recordar Contraseña</label>
                                    </div>
                                </div>
                                <div class="pull-right">
                                    <button type="submit" class="btn btn-success">Ingresar <i class="fa fa-angle-right ml5"></i></button>
                                </div>
                            </div>                      
                        </form>   
                </div><!-- panel-body -->
                <div class="panel-footer">
                    <a href="vista/recuperacion" class="btn btn-primary btn-block"><i class="glyphicon glyphicon-lock"></i> Obtener Contraseña</a>
                    <a href="administracion" class="btn btn-warning btn-block"><i class="glyphicon glyphicon-user"></i> Administración</a>

                </div><!-- panel-footer -->
            </div><!-- panel -->   
        </section>

    <script src="js/jquery-1.11.1.min.js"></script>
    <script src="js/jquery-migrate-1.2.1.min.js"></script>
    <script src="js/jquery-ui-1.10.3.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <script src="js/modernizr.min.js"></script>
    <script src="js/pace.min.js"></script>
    <script src="js/retina.min.js"></script>
    <script src="js/jquery.cookies.js"></script>
    <script src="js/select2.min.js"></script>
    <script src="js/jquery.validate.min.js"></script>
    <script src="js/custom.js"></script>
    <script src="js/funciones.js" type="text/javascript"></script>

    <script type="text/javascript">
        $(document).ready(function() {

                 $('#login').on('submit',function(e){      
                    var usuario =$("#rut").val();
                     var pass =$('#contraseña').val();
                     if(usuario == "" ){
                         return false;
                     }
                     if(pass ==""){
                         return false;
                     }


                     
                        $('#error').html("");
                        $.post( "negocio/login", $('#login').serialize()+"&indice=getUsuarioCliente")
                            .done(function( data ) {
                                    if(data == 0){
                                        var error = "<label for='name' class='error'>Sus datos son incorrectos, verifique la información.</label>";
                                        $('#error').html(error);  
                                        return false;
                                     }else{

                                        $('#id_cliente').val(data);
                                        location.href="vista/proceso?"+data;
                                     }
                            });
                      return false;
                  });
        });        </script>
    </body>
</html>
