<?php
/*==============================================
|| ############################################# 
|| Copyright Pike Admin - www.pikeadmin.com
|| ############################################# 
==============================================*/
session_start();
require("config.php");
require_once ABSPATH."/core/checklogin.php";
require_once ABSPATH."/core/functions.php";

$page = filter_input(INPUT_GET, 'page', FILTER_SANITIZE_STRING);
if(!$page) 
	$page = 'inicio';
$msg = filter_input(INPUT_GET, 'msg', FILTER_SANITIZE_STRING);
$pagenum = filter_input(INPUT_GET, 'pagenum', FILTER_SANITIZE_NUMBER_INT);
?>
<!DOCTYPE html>
<html>
<head>
<title>Moversa</title>
<meta name="description" content="Free Bootstrap 4 Admin Theme | Pike Admin">
<meta name="keywords" content="Bootstrap 4, admin, theme, template, pike admin">
<?php include ("global-head.php");?>
</head>

<body class="adminbody-void">

<div id="main" class="forced">

	<?php include ("navigation.php");?>
	
	<?php
	
		$user = json_decode($_SESSION['user']);
		
		echo $_SESSION['user'];
		
		echo $user->rol;
		
		if($user->rol == 3){
			include ("sidebarCliente.php");
		}else{
			include ("sidebar.php");
		}
		
		//document.getElementById('spanNombre').innerHTML = "hola";
		$nombre = $user->rol;
	?>
	
	<script>
	
	
	var json_request = {
		tipoOperacion: "consultaNombre" 
	};
	
	$.ajax({
		type: "POST",
		data: json_request,
		url: "/facturacion/dataAccess/login.php",
		dataType: "json",
		async: true,
		success: function (resp) {
			$("#spanNombre").text(resp.datos[0].nombre +" " + resp.datos[0].paterno);
		},
		error: function (xhr, ajaxOptions, thrownError) {
			console.log(xhr);
			console.log(ajaxOptions);
			console.log(thrownError);
			
		}
	});	
	
		
	</script>
	
    <div class="content-page">
	
		<!-- Start content -->
        <div class="content">
            
			<div class="container-fluid">

				<?php 				
				// ADMIN pages
				switch ($page)
					{       

						case $page:
							include ("formas/".$page.".php");
							break;					
													
						default:
							include ("formas/inicio.php");
							break;						
					}
				?>

            </div>
			<!-- END container-fluid -->

		</div>
		<!-- END content -->

    </div>
	<!-- END content-page -->
    
	

</div>
<!-- END main -->

<?php include ("global-footer.php");?>

</body>
</html>