<?php
  /*-------------------------
  Autor: Amner Saucedo Sosa
  Web: www.abisoftgt.net
  E-Mail: waptoing7@gmail.com
  ---------------------------*/
    session_start();
    include "config/config.php";
    if (!isset($_SESSION['admin_id']) AND $_SESSION['admin_id'] != 1) {
        header("location: index.php");
        exit;
        }
?>
<?php
    $id=$_SESSION['admin_id'];
    $query=mysqli_query($con,"SELECT * from user where id=$id");
    while ($row=mysqli_fetch_array($query)) {
        $username=$row['username'];
        $name=$row['name'];
        $lastname=$row['lastname'];
        $email=$row['email'];
        $profile_pic=$row['profile_pic'];
        $is_admin=$row['is_admin'];
        $created_at=$row['created_at'];

    }

    $status = mysqli_query($con, "select * from tickets where id=$id");
    $r=mysqli_fetch_array($status);
    $status_id=$r['status_id'];

    $config = mysqli_query($con, "select * from configuration where name='website' ");
    while($row=mysqli_fetch_array($config)){
        $website=$row['val'];
    }

    $fav = mysqli_query($con, "select * from configuration where name='favicon' ");
    while($row=mysqli_fetch_array($fav)){
        $favicon=$row['val'];
    }

?>

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <link rel="shortcut icon" href="images/<?php echo $favicon ?>" />
    <title><?php echo $website ?> | <?php echo $username?></title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <!-- Bootstrap 3.3.6 -->
    <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
    <!-- Font Awesome -->
    <link rel="stylesheet" href="bootstrap/font-awesome/css/font-awesome.min.css">
    <!-- Ionicons -->
    <!--  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ionicons/2.0.1/css/ionicons.min.css"> -->
    <!-- DataTables -->
    <!-- <link rel="stylesheet" href="plugins/datatables/dataTables.bootstrap.css"> -->
      <link rel="stylesheet" href="plugins/datatables/dataTables.bootstrap.css">

  <link rel="stylesheet" href="https://cdn.datatables.net/fixedheader/3.1.5/css/fixedHeader.bootstrap.min.css">
  <link rel="stylesheet" href="https://cdn.datatables.net/responsive/2.2.3/css/responsive.bootstrap.min.css">
    <!-- jvectormap -->
    <link rel="stylesheet" href="plugins/jvectormap/jquery-jvectormap-1.2.2.css">
    <!-- Theme style -->
    <link rel="stylesheet" href="dist/css/AdminLTE.min.css">

    <link rel="stylesheet" href="dist/css/skins/_all-skins.min.css">
    <link rel="stylesheet" href="dist/css/micss.css">
    <style>
        .table_header{
          background-color: #34495e;
          color: #fff;
        }
    </style>
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">

  <header class="main-header">

    <!-- Logo -->
    <a href="mistickets.php" class="logo">
      <!-- mini logo for sidebar mini 50x50 pixels -->
      <span class="logo-mini"><b>P</b>ro</span>
      <!-- logo for regular state and mobile devices -->
      <span class="logo-lg"><b><?php echo $website ?></b></span>
    </a>

    <!-- Header Navbar: style can be found in header.less -->
    <nav class="navbar navbar-static-top">
      <!-- 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: style can be found in dropdown.less -->
          <li class="dropdown user user-menu">
            <a href="#" class="dropdown-toggle" data-toggle="dropdown">
              <img src="images/profiles/<?php echo $profile_pic ?>" class="user-image" alt="User Image">
              <span class="hidden-xs"><?php echo $name." ".$lastname ?></span>
            </a>
            <ul class="dropdown-menu">
              <!-- User image -->
              <li class="user-header">
                <img src="images/profiles/<?php echo $profile_pic ?>" class="img-circle" alt="User Image">

                <p>
                  <?php
                     echo $name." ".$lastname;
                     if ($is_admin==1) {
                       echo " (Admin)";
                     }else{
                        echo " (Empleado)";
                     }
                  ?>
                  <small>Miembro desde el:  <?php $created_at=date('d/M/Y', strtotime($created_at)); echo $created_at ?></small>
                </p>
              </li>

              <!-- Menu Footer-->
              <li class="user-footer">
                <div class="pull-left">
                  <a href="profile.php" class="btn btn-default btn-flat">Perfil</a>
                </div>
                <div class="pull-right">
                  <a href="action/logout.php" class="btn btn-default btn-flat">Salir</a>
                </div>
              </li>
            </ul>
          </li>

        </ul>
      </div>

    </nav>
  </header>
