<?php
if (!isset($_SESSION["Usuario"]) || ($_SESSION["Grupo"] != GRUPO_ADMINS && $_SESSION["Grupo"] != GRUPO_SUPERVISORES)) {
    header('Location: /' . RUTA_MAESTRA);
}
$idioma = "es";
if (isset($_COOKIE["idioma"])) {
    $idioma = isset($_COOKIE["idioma"]) ? $_COOKIE["idioma"] : "es";
}
?>
<!DOCTYPE html>
<html translate="no" lang="es">
<head>
	<?php require_once UTILS_PATH . "meta.php";?>
    <script src="<?=JS_ADMIN;?>gettext.js" type="text/javascript"></script>
<script src="<?=JS_ADMIN;?>traduccion.js?version=<?= md5_file(RUTA_APP . "public/homeAdmin/js/traduccion.js"); ?>" type="text/javascript"></script>
<script>seleccionarIdioma("<?=$idioma;?>")</script>
</head>
<body id="layouts-horizontal" class="">
	<div id="main" v-cloak>
	<header id="header" class="page-topbar">
		<div class="navbar-fixed">
            <!-- Barra superior -->
                <?php require_once UTILS_PATH . "toolBar.php";?>
            <!-- Barra superior -->
            <script>document.getElementById("<?=$idioma;?>").selected=true;</script>
            <!-- Barra que contiene los menus -->
                <?php require_once UTILS_PATH . "navigationBar.php";?>
            <!-- Barra que contiene los menus -->
		</div>
		<script>
			document.addEventListener('DOMContentLoaded', function () {
				var elems = document.querySelectorAll('.dropdown-trigger');
				var instances = M.Dropdown.init(elems, {
					'hover': true,coverTrigger: false
				});
			});
			var white =
				"linear-gradient(to right, #ece9e6, #ffffff)";
			var black =
				"linear-gradient(to right, #000000, #434343)"
			var backSwitch = localStorage.getItem('background');
			if (backSwitch == null) {
				localStorage.setItem('background', 'white');backSwitch='white';
			}
			if (backSwitch == 'white') {
				document.body.style.background = white;
				document.getElementById("backgroundSwitch").checked = true;
			}
			if (backSwitch == 'black') {

				document.body.style.background = black;
				document.getElementById("backgroundSwitch").checked = false;
			}
			document.getElementById("backgroundSwitch").addEventListener("click", switchBack);

			function switchBack() {
				var checkBox = document.getElementById("backgroundSwitch");
				if (localStorage.getItem('background') == "white") {

					localStorage.setItem('background', 'black');
					location.reload();
				} else if (localStorage.getItem('background') == "black") {

					localStorage.setItem('background', 'white')
					location.reload();
				}
			}

			function hideBar() {
				var y = document.getElementById('horizontal-nav');
				if (y.style.display === "none") {
					$('#horizontal-nav').removeClass('animated')
					$('#horizontal-nav').removeClass('slideOutUp')
					$('#horizontal-nav').addClass('animated slideInDown faster')
					setTimeout(function () {
						y.style.display = "block";
					}, 500)
				} else {
					$('#horizontal-nav').removeClass('animated')
					$('#horizontal-nav').removeClass('slideInDown')
					$('#horizontal-nav').addClass('animated slideOutUp faster')
					setTimeout(function () {
						y.style.display = "none";
					}, 500)
				}
			}
		</script>
    </header>
    <!--HTML de menus en la barra de navegacion, para Materialize -->
    <?php require_once UTILS_PATH . 'htmlMenu.php';?>
    <!--HTML de menus en la barra de navegacion, para Materialize -->
		<!-- START WRAPPER -->
		<div class="wrapper">
			<!-- START LEFT SIDEBAR NAV-->