<?php
//$session = session();
//$sessionTest = $session->get();
//echo "<pre>";
//print_r($sessionTest);
//?>

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

<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>RBT Ringba</title>

    <!-- Custom fonts for this template-->
    <link href="<?= $template ?>vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css">
    <link
            href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i"
            rel="stylesheet">

    <!-- Custom styles for this template-->
    <link href="<?= $template ?>css/sb-admin-2.min.css" rel="stylesheet">

    <!-- Bootstrap core JavaScript-->
    <script src="<?= $template ?>vendor/jquery/jquery.min.js"></script>
    <script src="<?= $template ?>vendor/bootstrap/js/bootstrap.bundle.min.js"></script>

    <!-- Core plugin JavaScript-->
    <script src="<?= $template ?>vendor/jquery-easing/jquery.easing.min.js"></script>

    <!-- Custom scripts for all pages-->
    <script src="<?= $template ?>js/sb-admin-2.min.js"></script>
    <script src="<?= $template ?>custom.js"></script>
    <script type="text/javascript" charset="utf-8">
        localStorage.setItem('path', '<?= $path ?>');
        localStorage.setItem('template', '<?= $template ?>');
    </script>

    <script src="<?= $template ?>jquery_validator/jquery.validationEngine.js" type="text/javascript"
            charset="utf-8"></script>
    <script src="<?= $template ?>jquery_validator/jquery.validationEngine-en.js" type="text/javascript"
            charset="utf-8"></script>
    <link rel="stylesheet" href="<?= $template ?>jquery_validator/validationEngine.jquery.css"
</head>

<body class="bg-gradient-primary">
<div class="container">

    <!-- Outer Row -->
    <div class="row justify-content-center">

        <div class="col-xl-10 col-lg-12 col-md-9">

            <div class="card o-hidden border-0 shadow-lg my-5">
                <div class="card-body p-0">
                    <div class="row">
                        <div class="col-lg-7 d-none d-lg-block text-center"
                             style="background-image: none; padding-top: 15px;">
                            <img src="<?= $template ?>login-bg.jpg" width="100%">
                        </div>
                        <div class="col-lg-5">
                            <div class="p-5">
                                <div class="text-center">
                                    <h1 class="h4 text-gray-900 mb-4">RBT Ringba</h1>
                                </div>
                                <form class="user validate" method="post" id="UserForm" name="UserForm">
                                    <div class="form-group">
                                        <input type="email" class="form-control form-control-user validate[required] "
                                               id="username" name="username" aria-describedby="emailHelp"
                                               placeholder="Enter User Name...">
                                    </div>
                                    <div class="form-group">
                                        <input type="password" class="form-control form-control-user validate[required]"
                                               id="password" name="password" placeholder="Password">
                                    </div>
                                    <a href="javascript:void(0);" onclick="SubmitLogin()"
                                       class="btn btn-primary btn-user btn-block">
                                        Login
                                    </a>
                                </form>
                                <div class="text-center" id="Status">
                                </div>

                            </div>
                        </div>
                        <div class="clearfix mb-2"><br></div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script>
    function SubmitLogin() {

        // var validate = $("form#UserForm").validationEngine('validate');
        // if (validate == false) {
        //     return false;
        // }

        var phpdata = $("form#UserForm").serialize();
        var response = AjaxResponse("admin-submit", phpdata);
        if (response.status == 'success') {
            setTimeout(function () {
                $("#Status").html('<div class="text-center alert alert-success mb-4 mt-4" role="alert">  <strong>' + response.message + '</strong> </div>');
                window.location.href = '<?= $path ?>admin';
            }, 1000);
        } else {
            $("#Status").html('<div class="text-center alert alert-danger mb-4 mt-4" role="alert">  <strong>' + response.message + '</strong> </div>');
        }
    }


</script>


</body>

</html>
