<?php
require_once("config/conexion.php");
if (isset($_POST["enviar"]) and $_POST["enviar"] == "si") {
    require_once("models/Usuario.php");    
    $usuario = new Usuario();
    $usuario->login();    
}
?>
<!DOCTYPE html>
<html lang="es">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title>IST CEMLAD : SIED</title>

        <!-- Google Font: Source Sans Pro -->
        <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback">
        <!-- Font Awesome -->
        <link rel="stylesheet" href="public/lib/fontawesome-free/css/all.min.css">
        <!-- icheck bootstrap -->
        <link rel="stylesheet" href="public/lib/icheck-bootstrap/icheck-bootstrap.min.css">
        <!-- Theme style -->
        <link rel="stylesheet" href="public/css/adminlte.min.css">
    </head>
    <body class="hold-transition login-page">
        <div class="login-box">
            <div class="login-logo">
                <b>IST CEMLAD - SIED</b>
            </div>
            <!-- /.login-logo -->
            <div class="card">
                <div class="card-body login-card-body">
                    <p class="login-box-msg">Sistema de Información Educativo</p>

                    <form method="post">
                        <div class="login-wrapper wd-300 wd-xs-350 pd-25 pd-xs-40 bg-white rounded shadow-base">
                            <?php
                            if (isset($_GET["m"])) {
                                switch ($_GET["m"]) {
                                    case "1";
                                        ?>
                                        <div class="alert alert-warning" role="alert">
                                            <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                                                <span aria-hidden="true">&times;</span>
                                            </button>
                                            <strong class="d-block d-sm-inline-block-force">Error!</strong> Datos incorrectos
                                        </div>
                                        <?php
                                        break;
                                    case "2";
                                        ?>
                                        <div class="alert alert-warning" role="alert">
                                            <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                                                <span aria-hidden="true">&times;</span>
                                            </button>
                                            <strong class="d-block d-sm-inline-block-force">Error!</strong> Campos vacios
                                        </div>
                                        <?php
                                        break;
                                    case "3";
                                        ?>
                                        <div class="alert alert-warning" role="alert">
                                            <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                                                <span aria-hidden="true">&times;</span>
                                            </button>
                                            <strong class="d-block d-sm-inline-block-force">Error!</strong> Usuario bloqueado por intentos fallidos
                                        </div>
                                        <?php
                                        break;
                                }
                            }
                            ?>                             
                            <div class="input-group mb-3">                          
                                <input type="text" id="nickname" name="nickname" class="form-control" placeholder="Ingrese su usuario">
                                <div class="input-group-append">
                                    <div class="input-group-text">
                                        <span class="fas fa-envelope"></span>
                                    </div>
                                </div>
                            </div>
                            <div class="input-group mb-3">
                                <input type="password" id="clave" name="clave" class="form-control" placeholder="Ingrese su clave">
                                <div class="input-group-append">
                                    <div class="input-group-text">
                                        <span class="fas fa-lock"></span>
                                    </div>
                                </div>
                            </div>
                            <input type="hidden" name="enviar" class="form-control" value="si">
                            <div class="row">
                                <div class="col-12">
                                    <button type="submit" class="btn btn-success btn-block">Acceder</button>
                                </div>
                            </div>
                        </div>
                    </form>
                    <!-- /.social-auth-links -->

<!--                    <p class="mb-1">
                        <a href="view/RecPass/Rec_Pass.php" id="recuperar">¿Olvido su nombre de Usuario o su Contraseña?</a>
                    </p>-->
                </div>
                <!-- /.login-card-body -->
            </div>
        </div>
        <!-- /.login-box -->

        <!-- jQuery -->
        <script src="public/lib/jquery/jquery.min.js"></script>
        <!-- Bootstrap 4 -->
        <script src="public/lib/bootstrap/js/bootstrap.bundle.min.js"></script>
        <!-- AdminLTE App -->
        <script src="public/js/adminlte.min.js"></script>
    </body>
</html>
