<?php if($USUARIO=='') echo '<script>self.location="'.PATH_HOME.'";</script>'; 
 $Ubicacion = new DB();
 $sqlUbicacion = "SELECT * FROM rol_usuarios us, inventarios_ubicaciones ubi
 WHERE us.ubica_codigo = ubi.ubica_codigo
 AND us.us_id = '$USID';"; 
 $Ubicacion->dbSQL($sqlUbicacion);
 if($Ubicacion->next())
 	$ubica_nombre = $Ubicacion->dbField('ubica_nombre');
 else
	$ubica_nombre = 'Central';
?>
<div class="main-header">
			<div class="logo-header" data-background-color="blue2">				
				<a href="<?php echo PATH_HOME.'admin/'.uniqid() ?>" class="logo">
					<img src='<?php echo PATH_HOME.'assets/img/logo.png' ?>' class="navbar-brand">
				</a>	
            <button class="navbar-toggler sidenav-toggler ml-auto" type="button" data-toggle="collapse" data-target="collapse" aria-expanded="false" aria-label="Toggle navigation">
					<span class="navbar-toggler-icon">
						<i class="icon-menu"></i>
					</span>
				</button>
				<button class="topbar-toggler more"><i class="icon-options-vertical"></i></button>
				<div class="nav-toggle">
					<button class="btn btn-toggle toggle-sidebar">
						<i class="icon-menu"></i>
					</button>
				</div>			
			</div>

			<!-- Navbar Header -->
			<nav class="navbar navbar-header navbar-expand-lg" data-background-color="blue2">
				
				<div class="container-fluid">		
					<div class="collapse" id="search-nav">
						<div style='color:white'>
							<b>Administrador: </b><?php echo $USUARIO ?>
							<br>
							<b>Ubicación: </b><?php echo $ubica_nombre ?>
						</div>						
					</div>				
					<ul class="navbar-nav topbar-nav ml-md-auto align-items-center">												
						<li class="nav-item dropdown hidden-caret">
							<a class="dropdown-toggle profile-pic" data-toggle="dropdown" href="#" aria-expanded="false">
								<div class="avatar-sm">
									<img src="<?php echo PATH_HOME ?>assets/img/profile.jpg" alt="..." class="avatar-img rounded-circle">
								</div>
							</a>
							<ul class="dropdown-menu dropdown-user animated fadeIn">
								<div class="dropdown-user-scroll scrollbar-outer">
									<li>
										<div class="user-box">
											<div class="avatar-lg"><img src="<?php echo PATH_HOME ?>assets/img/profile.jpg" alt="image profile" class="avatar-img rounded"></div>
											<div class="u-text">
												<h4><?php echo $USUARIO ?></h4>
												<p class="text-muted">Administrador <?php echo AppName ?></p>
											</div>
										</div>
									</li>
									<li>
										<div class="dropdown-divider"></div>
										<a class="dropdown-item" href="#" id='LogOut'>Cerrar sesión</a>
									</li>
								</div>
							</ul>
						</li>
					</ul>
				</div>
			</nav>
</div>
<div class="sidebar sidebar-style-1" data-background-color="blue">			
			<div class="sidebar-wrapper scrollbar scrollbar-inner">
				<div class="sidebar-content">					
					<ul class="nav nav-primary">																														
						<li class="nav-item">
							<a href="<?php echo PATH_HOME.'productos/'; ?>">
							<i class="fas fa-th-list"></i>
								<p>Productos</p>
							</a>							
						</li>	
						<li class="nav-item">
							<a href="<?php echo PATH_HOME.'ubicaciones/'; ?>">
							<i class="fas fa-th-list"></i>
								<p>Ubicaciones</p>
							</a>							
						</li>
						<li class="nav-item">
							<a href="<?php echo PATH_HOME.'usuarios/'; ?>">
							<i class="fas fa-th-list"></i>
								<p>Usuarios</p>
							</a>							
						</li>
						<li class="nav-item">
							<a href="<?php echo PATH_HOME.'traspasos/'; ?>">
							<i class="fas fa-th-list"></i>
								<p>Traspasos</p>
							</a>							
						</li>	
						<li class="nav-item">
							<a href="<?php echo PATH_HOME.'ventas/'; ?>">
							<i class="fas fa-th-list"></i>
								<p>Ventas</p>
							</a>							
						</li>							
						<li class="nav-item">
							<a href="<?php echo PATH_HOME.'reportes/ver'; ?>">
							<i class="fas fa-th-list"></i>
								<p>Reportes por fechas</p>
							</a>							
						</li>		
						<li class="nav-item">
							<a href="<?php echo PATH_HOME.'rep-almacenes/ver'; ?>">
							<i class="fas fa-th-list"></i>
								<p>Reportes por Almacen</p>
							</a>							
						</li>			
					</ul>
				</div>
			</div>
</div>
<div id='logout'></div>
<script>
$('#LogOut').click(function(){
	$.post('<?php echo PATH_HOME.'indlogout/'.md5(uniqid()); ?>',{
    'coder': '<?php echo md5(uniqid()); ?>'
  },function(data){
    $('#logout').html(data);
  });
});
</script>