<?php 
$title = ConfigurationData::getByPreffix("title")->val;

?>
<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <title>Restaurante Demo | Panel de Administracion</title>
    <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
    <!-- Bootstrap 3.3.4 -->
    <link href="plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <!-- Font Awesome Icons -->
    <link href="plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
    <!-- Theme style -->
    <link href="plugins/dist/css/AdminLTE.min.css" rel="stylesheet" type="text/css" />
    <link href="plugins/dist/css/skins/skin-blue-light.min.css" rel="stylesheet" type="text/css" />

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
        <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
          <script src="plugins/jquery/jquery-2.1.4.min.js"></script>
<script src="plugins/morris/raphael-min.js"></script>
<script src="plugins/morris/morris.js"></script>
  <link rel="stylesheet" href="plugins/morris/morris.css">
  <link rel="stylesheet" href="plugins/morris/example.css">
          <script src="plugins/jspdf/jspdf.min.js"></script>
          <script src="plugins/jspdf/jspdf.plugin.autotable.js"></script>

          <script src="plugins/jqui/jquery-ui.min.js"></script>

  </head>

  <body class="<?php if(isset($_SESSION["user_id"])):?>  skin-blue-light sidebar-mini <?php else:?>login-page<?php endif; ?>" >
    <div class="wrapper">
      <!-- Main Header -->
      <?php if(isset($_SESSION["user_id"])):?>
      <header class="main-header">
        <!-- Logo -->
        <a href="./" class="logo">
          <!-- mini logo for sidebar mini 50x50 pixels -->
          <span class="logo-mini"><b>T</b>M</span>
          <!-- logo for regular state and mobile devices -->
          <span class="logo-lg"><?php echo $title; ?></span>
        </a>

        <!-- Header Navbar -->
        <nav class="navbar navbar-static-top" role="navigation">
          <!-- Sidebar toggle button-->
          <a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
            <span class="sr-only">Toggle navigation</span>
          </a>
          <!-- Navbar Right Menu -->
          <div class="navbar-custom-menu">
            <ul class="nav navbar-nav">


              <!-- User Account Menu -->
              <li class="dropdown user user-menu">
                <!-- Menu Toggle Button -->
                <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                  <!-- The user image in the navbar-->
                  <!-- hidden-xs hides the username on small devices so only the image appears. -->
                  <span class=""><?php if(isset($_SESSION["user_id"]) ){ echo UserData::getById($_SESSION["user_id"])->name; 
$k = UserData::getById($_SESSION["user_id"])->kind;
switch ($k) {
  case 1: echo " (Administrador)";break;
  case 2: echo " (Mesero)";break;
  case 3: echo " (Cocinero)";break;
  case 4: echo " (Cajero)";break;
  
  default:
    # code...
    break;
}

                  }else if (isset($_SESSION["client_id"])){ echo PersonData::getById($_SESSION["client_id"])->name." (Cliente)" ;}?> </span>
                </a>
                <ul class="dropdown-menu">
                  <!-- The user image in the menu -->
                  
                  <!-- Menu Footer-->
                  <li class="user-footer">
                    <div class="pull-right">
                      <a href="./logout.php" class="btn btn-default btn-flat">Salir</a>
                    </div>
                  </li>
                </ul>
              </li>
              <!-- Control Sidebar Toggle Button -->
            </ul>
          </div>
        </nav>
      </header>
      <!-- Left side column. contains the logo and sidebar -->
      <aside class="main-sidebar">

        <!-- sidebar: style can be found in sidebar.less -->
        <section class="sidebar">
<!--
<div class="user-panel">
            <div class="pull-left image">
              <img src="1.jpg" class="img-circle" alt="User Image" />
            </div>
            <div class="pull-left info">
              <p>Alexander Pierce</p>

              <a href="#"><i class="fa fa-circle text-success"></i> Online</a>
            </div>
          </div>
          -->
          <!-- Sidebar Menu -->
          <ul class="sidebar-menu">
            <li class="header">ADMINISTRACION</li>
            <?php if(isset($_SESSION["user_id"])):?>
                        <li><a href="./index.php?view=home"><i class='fa fa-dashboard'></i> <span>Dashboard</span></a></li>

            <li class="treeview">
              <a href="#"><i class='fa fa-usd'></i> <span>Vender</span> <i class="fa fa-angle-left pull-right"></i></a>
              <ul class="treeview-menu">
                <li><a href="./?view=selldirect"><span>Favoritos</span></a></li>
                <li><a href="./?view=sell"><span>Venta Rapida</span></a></li>
                <li><a href="./?view=sellspending">Ventas Pendientes</a></li>
              </ul>
            </li>

            <li class="treeview">
              <a href="#"><i class='fa fa-cutlery'></i> <span>Secciones</span> <i class="fa fa-angle-left pull-right"></i></a>
              <ul class="treeview-menu">
                <li><a href="./?view=monitor">Monitor</a></li>
                <li><a href="./?view=kitchen">Cocina</a></li>
              </ul>
            </li>



            <li class="treeview <?php if(isset($_GET["view"]) && ($_GET["view"]=="sells"||$_GET["view"]=="bydeliver" ||$_GET["view"]=="bycob")){ echo "active"; }?>"   >
              <a href="#"><i class='fa fa-shopping-cart'></i> <span>Ventas</span> <i class="fa fa-angle-left pull-right"></i></a>
              <ul class="treeview-menu">
                <li><a href="./?view=sellstoday">Ventas Diarias</a></li>
                <li><a href="./?view=sells">Todas las ventas</a></li>
                <li><a href="./?view=bydeliver">Por Entregar</a></li>
                <li><a href="./?view=bycob">Por Cobrar</a></li>
              </ul>
            </li>
            <?php if($k==1):?>
            <li class="treeview">
              <a href="#"><i class='fa fa-clock-o'></i> <span>Compras</span> <i class="fa fa-angle-left pull-right"></i></a>
              <ul class="treeview-menu">
                <li><a href="./?view=res">Compras</a></li>
                <li><a href="./?view=byreceive">Por Recibir</a></li>
                <li><a href="./?view=topay">por Pagar</a></li>
              </ul>
            </li>
            <li class="treeview">
              <a href="#"><i class='fa fa-database'></i> <span>Datos</span> <i class="fa fa-angle-left pull-right"></i></a>
              <ul class="treeview-menu">
                <li><a href="./?view=products">Productos</a></li>
                <li><a href="./?view=ingredients">Ingredientes</a></li>
                <li><a href="./?view=providers">Proveedores</a></li>
                <li><a href="./?view=clients">Clientes</a></li>
<!--                <li><a href="./?view=units&opt=all">Unidad de medida</a></li>
                <li><a href="./?view=presentations&opt=all">Tipo Presentacion</a></li>
                -->
                <li><a href="./?view=categories">Categorias de Productos</a></li>
                <li><a href="./?view=categories2&opt=all">Categorias de Ingredientes</a></li>
                <li><a href="./?view=sections&opt=all">Secciones del Restaurante</a></li>
                <li><a href="./?view=ts">Medio de pagos</a></li>
                <li><a href="./?view=ds">Estado Entregas</a></li>
                <li><a href="./?view=ps">Tipo de Pagos</a></li>
<!--                <li><a href="./?view=banks&opt=all">Bancos</a></li>
                <li><a href="./?view=giros&opt=all">Giro comercial</a></li>
                <li><a href="./?view=cities&opt=all">Ciudades</a></li>
                <li><a href="./?view=comuns&opt=all">Comunas</a></li>
-->
              </ul>
            </li>
            <li class="treeview">
              <a href="#"><i class='fa fa-briefcase'></i> <span>Finanzas</span> <i class="fa fa-angle-left pull-right"></i></a>
              <ul class="treeview-menu">
                <li><a href="./?view=credit">Credito</a></li>
                <li><a href="./?view=balance">Balance</a></li>
                <li><a href="./?view=spends">Gastos</a></li>
                <li><a href="./?view=box">Caja</a></li>
              </ul>
            </li>
            <li class="treeview">
              <a href="#"><i class='fa fa-area-chart'></i> <span>Inventario</span> <i class="fa fa-angle-left pull-right"></i></a>
              <ul class="treeview-menu">
                <li><a href="./?view=inventary&stock=<?php echo StockData::getPrincipal()->id;?>">Inventario Principal</a></li>
                <li><a href="./?view=ingredientsinventary&stock=<?php echo StockData::getPrincipal()->id;?>">Inventario de Ingredientes</a></li>

<!--                <li><a href="./?view=stocks">Inventarios</a></li> -->
<!--                <li><a href="./?view=move">Mover</a></li>-->
<!--                <li><a href="./?view=dev">Devolucion</a></li> -->
                
                <li><a href="./?view=re">Ajustes</a></li>
                <li><a href="./?view=res">Abastecimientos</a></li>
              </ul>
            </li>
            <li class="treeview">
              <a href="#"><i class='fa fa-file-text-o'></i> <span>Reportes</span> <i class="fa fa-angle-left pull-right"></i></a>
              <ul class="treeview-menu">
                <li><a href="./?view=reports">Inventario</a></li>
                <li><a href="./?view=sellreports">Ventas</a></li>
                <li><a href="./?view=resreport">Compras</a></li>
                <li><a href="./?view=popularproductsreport">Productos Populares</a></li>
              </ul>
            </li>

            <li class="treeview">
              <a href="#"><i class='fa fa-cog'></i> <span>Administracion</span> <i class="fa fa-angle-left pull-right"></i></a>
              <ul class="treeview-menu">
                <li><a href="./?view=users">Usuarios</a></li>
                <li><a href="./?view=items&opt=all">Mesas</a></li>
                <li><a href="./?view=settings">Configuracion</a></li>
              </ul>
            </li>
          <?php endif; ?>
          <?php endif;?>

          </ul><!-- /.sidebar-menu -->
        </section>
        <!-- /.sidebar -->
      </aside>
    <?php endif;?>

      <!-- Content Wrapper. Contains page content -->
      <?php if(isset($_SESSION["user_id"])):?>
      <div class="content-wrapper">
        <?php View::load("index");?>
      </div><!-- /.content-wrapper -->

        <footer class="main-footer">
        <div class="pull-right hidden-xs">
          <b>Version</b> 3.0
        </div>
        <strong>Copyright &copy; 2022 <a href="http://www.grupo44publicidad.com/" target="_blank">GRUPO 44</a></strong>
      </footer>
      <?php else:?>
        <?php if(isset($_GET["view"]) && $_GET["view"]=="waiteraccess"):?>
        <?php else:?>
<div class="login-box">
      <div class="login-logo">
        <a href="./"><b>RESTAURANTE</b>DEMO</a>
      </div><!-- /.login-logo -->
      <div class="login-box-body">
        <form action="./?action=processlogin" method="post">
          <div class="form-group has-feedback">
            <input type="text" name="username" required class="form-control" placeholder="Usuario"/>
            <span class="glyphicon glyphicon-user form-control-feedback"></span>
          </div>
          <div class="form-group has-feedback">
            <input type="password" name="password" required class="form-control" placeholder="Password"/>
            <span class="glyphicon glyphicon-lock form-control-feedback"></span>
          </div>
          <div class="row">

            <div class="col-xs-12">
              <button type="submit" class="btn btn-primary btn-block btn-flat">Acceder</button><br>
            </div><!-- /.col -->
          </div>
        </form>
      </div><!-- /.login-box-body -->
    </div><!-- /.login-box -->  
      <?php endif;?>
      <?php endif;?>


    </div><!-- ./wrapper -->

    <!-- REQUIRED JS SCRIPTS -->

    <!-- jQuery 2.1.4 -->
    <!-- Bootstrap 3.3.2 JS -->
    <script src="plugins/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
    <!-- AdminLTE App -->
    <script src="plugins/dist/js/app.min.js" type="text/javascript"></script>

    <!-- Optionally, you can add Slimscroll and FastClick plugins.
          Both of these plugins are recommended to enhance the
          user experience. Slimscroll is required when using the
          fixed layout. -->
  </body>
</html>

