<!-- By : Ghanim Software -->
<!-- Di Larang Memperjual Source Code ini -->
<?php
include "config.php";
	session_start();
	if($_SESSION['status']!="login"){
		header("location:login.php");
	}
$result1 = mysqli_query($conn, "SELECT * FROM login");
while($data = mysqli_fetch_array($result1))
{
    $user = $data['username'];
    $id = $data['id_login'];
    $toko = $data['nama_toko'];
    $alamat = $data['alamat'];
    $telp = $data['telepon'];
}

// Get user role
$user_role = $_SESSION['role'] ?? 'admin';
$user_name = $_SESSION['name'] ?? $user;
?>
<!DOCTYPE html>
<html lang="en">
<head>
  <title>APLIKASI KASIR TOKO KOSMETIK</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="icon" href="baru.ico">
  <link rel="icon" href="icon.ico" type="image/ico">
  <link rel="stylesheet" href="assets/css/bootstrap.min.css">
  <link rel="stylesheet" href="assets/css/style.css">
  <link href="assets/fontawesome/css/all.min.css" rel="stylesheet" type="text/css">
  <link href="assets/vendor/datatables/dataTables.bootstrap4.min.css" rel="stylesheet">
  <link href="assets/vendor/datatables/responsive.bootstrap4.min.css" rel="stylesheet">
</head>
<body>

<nav class="navbar navbar-expand-lg navbar-dark bg-dark sticky-top">
<div class="container">
  <a class="navbar-brand px-3 bg-warning" href="#"><?php echo $toko ?></a>
  <button class="navbar-toggler border-0" type="button" data-toggle="collapse" data-target="#navbarC" aria-controls="navbarC" aria-expanded="false" aria-label="Toggle navigation">
    <i class="fa fa-bars muncul"></i>
    <i class="fa fa-times-circle fa-1x text-white close"></i>
  </button>

  <div class="collapse navbar-collapse" id="navbarC">
    <ul class="navbar-nav ml-auto">
      <li class="nav-item">
        <a class="nav-link" href="index.php">
        <span class="text-center d-block pt-2"><i class="fa fa-desktop fa-2x"></i></span>Transaksi</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="dashboard.php">
        <span class="text-center d-block pt-2"><i class="fa fa-chart-pie fa-2x"></i></span>Dashboard</a>
      </li>
      <?php if($user_role == 'admin'): ?>
      <li class="nav-item">
        <a class="nav-link" href="produk.php">
        <span class="text-center d-block pt-2"><i class="fa fa-shopping-bag fa-2x"></i></span>Data Produk</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="kategori.php">
        <span class="text-center d-block pt-2"><i class="fa fa-box-open fa-2x"></i></span>Kategori</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="laporan.php">
        <span class="text-center d-block pt-2"><i class="fa fa-chart-bar fa-2x"></i></span>Data laporan</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="pelanggan.php">
        <span class="text-center d-block pt-2"><i class="fa fa-users fa-2x"></i></span>Pelanggan</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="users.php">
        <span class="text-center d-block pt-2"><i class="fa fa-users-cog fa-2x"></i></span>Manajemen User</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="device_management.php">
        <span class="text-center d-block pt-2"><i class="fa fa-print fa-2x"></i></span>Perangkat</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="admin_reset.php">
        <span class="text-center d-block pt-2"><i class="fa fa-sync-alt fa-2x"></i></span>Reset Data</a>
      </li>
      <?php endif; ?>
      <li class="nav-item">
        <a class="nav-link" href="returns.php">
        <span class="text-center d-block pt-2"><i class="fa fa-exchange-alt fa-2x"></i></span>Retur Barang</a>
      </li>
      <li class="nav-item dropdown">
        <a class="nav-link dropdown-toggle" href="#" id="userDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
          <span class="text-center d-block pt-2"><i class="fa fa-user fa-2x"></i></span><?php echo htmlspecialchars($user_name); ?>
        </a>
        <div class="dropdown-menu dropdown-menu-right" aria-labelledby="userDropdown">
          <?php if($user_role == 'admin'): ?>
          <a class="dropdown-item" href="pengaturan.php">
            <i class="fas fa-cogs fa-sm fa-fw mr-2 text-gray-400"></i>
            Pengaturan Akun
          </a>
          <div class="dropdown-divider"></div>
          <?php endif; ?>
          <a class="dropdown-item" href="logout.php" onclick="javascript:return confirm('Anda yakin ingin keluar ?');">
            <i class="fas fa-sign-out-alt fa-sm fa-fw mr-2 text-gray-400"></i>
            Keluar
          </a>
        </div>
      </li>
    </ul>
  </div>
  </div>
</nav>

<div class="container">