<!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>
        <section>
             <section>
            <div class="panel panel-signin">
                <div class="panel-body">
                    <p class="text-center">Administración de Postventa</p>
                    <div class="mb30"></div>
                    <form id="login">
                        <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="usuario"  name="usuario" type="password" maxlength="20" required class="form-control" placeholder="Usuario">
                        </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="20" 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>    
                       <div class="panel-footer">
                           <a href="loginCiss" class="btn btn-danger btn-block"><i class="glyphicon glyphicon-circle-arrow-left"></i> Átras</a>
                       </div><!-- panel-footer -->                  
                    </form>    
                </div><!-- panel-body -->
    
            </div><!-- panel -->   
        </section>
        </section>
    </body>

    <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 =$("#usuario").val();
             var pass =$('#contraseña').val();
             if(usuario == "" ){
                 return false;
             }
             if(pass ==""){
                 return false;
             }
            $('#error').html("");
            $.post( "negocio/login", $('#login').serialize()+"&indice=getUsuarioAdministracion")
             .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);  
                     }else{
                          var res = data.split("-");
                          var id = $.trim(res[0])
                          var ruta = res[1];
                          if(id == 10){
                                location.href="vista/procesoterceros?"+ruta;
                          }else if(id == 6 || id == 8){
                                location.href="vista/dashboard?"+ruta;
                          } 
                     }
             });
                return false;
          });

        });
        </script>
    </body>
</html>
