<?php 
	session_start();

	require_once("./backend/config/geral.php");
	
	if(@$_SESSION['logado'] == 1){
		header("Location: main");
    }
?>
<!DOCTYPE html>
<html lang="pt-br">
<head>
  <meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge" />
	<title><?php echo $CONFIG_GLOBAL['title']; ?></title>
	<meta content='width=device-width, initial-scale=1.0, shrink-to-fit=no' name='viewport' />
	<link rel="icon" href="./assets/img/icon.ico" type="image/x-icon"/>

	<!-- Fonts and icons -->
	<script src="./assets/js/plugin/webfont/webfont.min.js"></script>

	<!-- CSS Files -->
	<link rel="stylesheet" href="./assets/css/bootstrap.min.css">
	<link rel="stylesheet" href="./assets/css/atlantis.min.css">

	<!-- CSS Just for demo purpose, don't include it in your project -->
	<link rel="stylesheet" href="./assets/css/demo.css">
	<style>
		card-light{ padding: 10px; }
	</style>
</head>
<body>
	<div class="container">
      <div class="row justify-content-center">
        <div class="col-xs-10 col-sm-6 col-md-5 col-lg-4 text-center" style="margin-top: 5%;" >

            <a href="login"><img src="./assets/img/icon.png" width="40%" style="padding-bottom: 10px;padding-top: 10px;" /></a>
          
          <div class="card card-light box-shadow">
            <div class="card-heading text-center" style="padding: 10px;">
              <span title="Today" ><h4>Login de Usuário</h4><?php echo date('d/m/Y');?></span>              
            </div><!--.card-heading-->

            <div class="card-body">
                <form method="POST" id="form_login">
									<div class="form-group"> 
										  <div class="input-group">
											<div class="input-group-addon"><i class="glyphicon glyphicon-envelope"></i></div>
											<input type="text" name="email" id="email" class="form-control" placeholder="Email">
										  </div>
									</div>

									<div class="form-group">
										  <div class="input-group">
												<div class="input-group-addon"><i class="glyphicon glyphicon-lock"></i></div>
												<input type="password" name="senha" id="senha" class="form-control" placeholder="Senha" current-password>
												<input type="hidden" name="ip" value="<?= $_SERVER["REMOTE_ADDR"] ?>">
										  </div>
									</div>
									<div class="form-group">
										<div class="checkbox">
											<label><input type="checkbox" value="" name="lem" id="lem">Lembre-me <a href="reset" class="btn btn-xs btn-link" style="padding-bottom: 4px;" >Esqueçeu a Senha?</a></label>
										</div>
									</div>
									<button id="btn_form" class="btn btn-block btn-primary" name="btn-login">Entrar</button>
									<div class="alerta d1">
										<span id="text_erro"></span>
										<i class="far fa-times-circle" id="ic_close"></i>
									</div>
               </form>
            </div>
          </div><!--.card-->
        </div><!--.cols-->
      </div><!--.row-->
	  <div class="row justify-content-center">
      	  <div class="col-xs-10 col-sm-6 col-md-5 col-lg-4 text-center">
		  
		  <p><?php echo date("Y")." ".$CONFIG_GLOBAL['empresa']; ?> - Todos direitos resevados</p>
		  
		  </div>
	  
	  </div>
    </div><!--.container--> 
	
	<!--   Core JS Files   -->
	<script src="./assets/js/core/jquery.3.2.1.min.js"></script>
	<script src="./assets/js/core/popper.min.js"></script>
	<script src="./assets/js/core/bootstrap.min.js"></script>
	<script src="./assets/js/core/login.js"></script>
	<!-- jQuery UI -->
	<script src="./assets/js/plugin/jquery-ui-1.12.1.custom/jquery-ui.min.js"></script>
	<script src="./assets/js/plugin/jquery-ui-touch-punch/jquery.ui.touch-punch.min.js"></script>
	<script src="./assets/js/plugin/bootstrap-notify/bootstrap-notify.min.js"></script>
	
    <script>
		 $(document).ready(function(){
			let msg = localStorage.getItem("msg");
			if(msg == "ativa"){
				func(localStorage.getItem("status"),localStorage.getItem("texto"));
			}
			
			$('.fechar').click(function(){
				$('.alert').fadeOut(1000);
			}); 
		 });
		function func(cor,texto){
					var placementFrom = "top";
					var placementAlign = "left";
					var state = cor;
					var style = "plain";
					var content = {};

					content.message = texto;
					content.title = 'Unidos Importados';
					if (style == "withicon") {
						content.icon = 'fa fa-bell';
					} else {
						content.icon = 'none';
					}
					content.url = '#';
					content.target = '_blank';

					$.notify(content,{
						type: state,
						placement: {
							from: placementFrom,
							align: placementAlign
						},
						time: 100,
					});
					localStorage.setItem("status", "");
					localStorage.setItem("msg", "negativo");
					localStorage.setItem("texto", "");
		}
	</script>
</body>
</html>