<?php

require_once($_SERVER['DOCUMENT_ROOT']."/hrm/config/config.php");
require_once($_SERVER['DOCUMENT_ROOT']."/hrm/base/recruit.php");
if (isset($_POST["reg"])){
    //echo "Register";

    $name= $_POST["firstname"]." ".$_POST['midname']." ".$_POST['lastname'];
    createCanditate($name, $_POST['email'], $_POST['password'], $_POST['password1']);
    
}
if(isset($_POST["login"])){
    clogin($_POST['username'], $_POST['password']);
}
?>

<!doctype html>
<html lang="en">
  <head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link href="https://fonts.googleapis.com/css?family=Roboto:300,400&display=swap" rel="stylesheet">

    <link rel="stylesheet" href="/hrm/loginUI/fonts/icomoon/style.css">

    <link rel="stylesheet" href="/hrm/loginUI/css/owl.carousel.min.css">

    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="/hrm/loginUI/css/bootstrap.min.css">
    
    <!-- Style -->
    <link rel="stylesheet" href="/hrm/loginUI/css/style.css">

    <title>Login</title>
  </head>
  <body>
  

  
  <div class="content">
    <div class="container">
      <div class="row">
        <div class="col-md-6">
          <img src="/hrm/loginUI/images/undraw_remotely_2j6y.svg" alt="Image" class="img-fluid">
        </div>
        <div class="col-md-6 contents">
          <div class="row justify-content-center">
            <div class="col-md-8">

        <div id="login">
              <div class="mb-4">
              <h3>Sign In</h3>
              <!-- <p class="mb-4">Lorem ipsum dolor sit amet elit. Sapiente sit aut eos consectetur adipisicing.</p> -->

              <?php
              errorsP($errors);
              ?>
            </div>
            <form action="" method="post">
              <div class="form-group first">
                <label for="username">Username</label>
                <input type="text" class="form-control" id="username" name="username">

              </div>
              <div class="form-group last mb-4">
                <label for="password">Password</label>
                <input type="password" class="form-control" id="password" name="password">
                
              </div>
              
              <div class="d-flex mb-5 align-items-center">
                <label class="control control--checkbox mb-0"><span class="caption">Remember me</span>
                  <input type="checkbox" checked="checked"/>
                  <div class="control__indicator"></div>
                </label>
                <span class="ml-auto"><a href="#" class="forgot-pass">Forgot Password</a></span> 
              </div>

              <input type="submit" id="login" value="Log In" class="btn btn-block btn-primary" name="login" >
              </form>
                <br>
              <input type="button" id="signup" value="Sign Up" class="btn btn-block btn-info" onclick="login2()">
        </div>
            <!-- hghgjgjgjg -->
              <div id="register" style="display: none">
              <div class="mb-4">
              <h3>Sign Up</h3>
            </div>

              <form action="" method="post">
              <div class="form-group first">
                <label for="username">first name</label>
                <input type="text" class="form-control" id="firstname" name="fistname" required>
               
              </div>

              <div class="form-group first">
                <label for="username">middle name</label>
                <input type="text" class="form-control" id="midname" name="midname">
               
              </div>

              <div class="form-group first">
                <label for="username">last name</label>
                <input type="text" class="form-control" id="lastname" name="lastname">
               
              </div>
              <br>

              <div class="form-group first">
                <label for="email">email</label>
                <input type="text" class="form-control" id="email" name="email">

              </div>
              <br>

              <div class="form-group last mb-4">
                <label for="password">Password</label>
                <input type="password" class="form-control" id="password" name="password">
                
              </div>
              <br>

              <div class="form-group last mb-4">
                <label for="password1">Repeat-Password</label>
                <input type="password" class="form-control" id="password1" name="password1">
                
              </div>
              <br>
              

              <input type="submit" id="reg" value="Sign Up" class="btn btn-block btn-primary"  name="reg">
              </div>

              <!-- <span class="d-block text-left my-4 text-muted">&mdash; or login with &mdash;</span> -->
              
              <!-- <div class="social-login">
                <a href="#" class="facebook">
                  <span class="icon-facebook mr-3"></span> 
                </a>
                <a href="#" class="twitter">
                  <span class="icon-twitter mr-3"></span> 
                </a>
                <a href="#" class="google">
                  <span class="icon-google mr-3"></span> 
                </a>
              </div> -->
            </form>
            </div>
          </div>
          
        </div>
        
      </div>
    </div>
  </div>

  <script>
    function login2(){
	document.getElementById("login").style.display="none";
    document.getElementById("register").style.display="block";
    }
  </script>
    <script src="/hrm/loginUI/js/jquery-3.3.1.min.js"></script>
    <script src="/hrm/loginUI/js/popper.min.js"></script>
    <script src="/hrm/loginUI/js/bootstrap.min.js"></script>
    <script src="/hrm/loginUI/js/main.js"></script>
  </body>
</html>