<?php 
$install = file_exists(__DIR__ . '/conexao/index.php');

if ($install == false) {

    header("location:config/install/index.php");

}else{
	include_once 'conexao/index.php';
}
?>
<!DOCTYPE html>
<html>
<head>
	<title>iVone ERP - Login</title>
	<meta charset="utf-8">
	<meta name="viewport" content="width-device-width, initial-scale=1">
	<link rel="shorcut icon"  href="img/config/iCone.png">
	<link rel="stylesheet" type="text/css" href="css/login.css">
	<script type="text/javascript" src="js/jquery-3.3.1.min.js"></script>
</head>
<body>
<div class="principal">
	<div class="esquerda" >
		
	</div>
	<div class="direita">
		<div class="dentro">
			<img src="img/ERP.png" style="max-width: 100%;width: 40%;">
		</div>
		<form class="form" method="POST" action="dao/login/login.php">
			<select name="user" id="user" style="border: 1px solid #268FC1;width: 95%;">
				<option>Selecionar usuário</option>
				<?php 
					$sql = "SELECT * FROM users";
					$rs = mysqli_query($db, $sql) or die(mysqli_error($db));
					while($dados = mysqli_fetch_array($rs)){
				?>
					<option value="<?php echo $dados['user'] ?>"><?php echo $dados['nome'] ?></option>
				<?php
					}
				?>
			</select>
			<input type="password" id="pass" name="pass" style="border: 1px solid #268FC1;width: 95%;">
			<br>
			<div class="parte">
				<div class="btns">
					<button class="botao" type="button">
						<a>7</a>
					</button>
					<button class="botao" type="button">
						<a>8</a>
					</button>
					<button class="botao" type="button">
						<a>9</a>
					</button>
					<button class="botao" type="button">
						<a>4</a>
					</button>
					<button class="botao" type="button">
						<a>5</a>
					</button>
					<button class="botao" type="button">
						<a>6</a>
					</button>
					<button class="botao" type="button">
						<a>1</a>
					</button>
					<button class="botao" type="button">
						<a>2</a>
					</button>
					<button class="botao" type="button">
						<a>3</a>
					</button>
					<button class="botao" type="button">
						<a>0</a>
					</button>
				</div>
				<div class="submt">
					<button type="reset">
						C
					</button>
					<button type="submit">
						Entrar
					</button>
				</div>
			</div>
		</form>
	</div>
</div>

<script type="text/javascript">
	$(function() {
		$(".botao").on('click', function() {
			var valor = $(this).children().text();
			var existe = $("#pass").val();
			var ja = existe+""+valor;
			$("#pass").val(ja);
		});
		
		$("img").click(function() {
			openFullscreen();
		});
		/* Get the documentElement (<html>) to display the page in fullscreen */
		var elem = document.documentElement;

		/* View in fullscreen */
		function openFullscreen() {
		  if (elem.requestFullscreen) {
		    elem.requestFullscreen();
		  } else if (elem.webkitRequestFullscreen) { /* Safari */
		    elem.webkitRequestFullscreen();
		  } else if (elem.msRequestFullscreen) { /* IE11 */
		    elem.msRequestFullscreen();
		  }
		}

		/* Close fullscreen */
		function closeFullscreen() {
		  if (document.exitFullscreen) {
		    document.exitFullscreen();
		  } else if (document.webkitExitFullscreen) { /* Safari */
		    document.webkitExitFullscreen();
		  } else if (document.msExitFullscreen) { /* IE11 */
		    document.msExitFullscreen();
		  }
		}
	});
</script>
</body>
</html>