<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);

if (session_status() === PHP_SESSION_NONE) {
    session_start();
}

if (!isset($_SESSION['admin_logged_in'])) {
    header("Location: login.php");
    exit;
}
?>

<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title><?= $title ?></title>
    <link rel="stylesheet" href="assets/css/bootstrap.css">
    <link rel="stylesheet" href="assets/css/custom.css">
    <link rel="stylesheet" href="assets/css/font.css">
    <link rel="stylesheet" href="assets/css/blade-animate.css">
    <script src="assets/js/jquery.min.js"></script>
    <script src="assets/css/font-awesome.css"></script>
    <script src="assets/editor/summernote.css"></script>
    <script src="assets/css/bootstrap.min.css"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">

    <Style>
    .img-fluid {
        width: 100%
    }
    </Style>

<body>
    <style>
    .hig {
        background: red !important;
    }
    </style>
    <div id="wrapper">
        <nav class="navbar navbar-default navbar-cls-top " role="navigation" style="margin-bottom: 0">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".sidebar-collapse">
                    <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span
                        class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>

            </div>
            <div class="hidden-xs" style="color: white; padding: 15px 50px 5px 50px; float: right; font-size: 16px;">

                Username: <font color="red"><b>
                        <?php
                            if (isset($_SESSION['admin_logged_in']) && $_SESSION['admin_logged_in'] === true) {
                                echo $_SESSION['admin_username']; 
                            } else {
                                echo "Guest";
                            }
                        ?>
                    </b></font>
                <i>(Administrator)</i>
                <a href="logout.php" class="btn btn-info btn-xs" title="Back Main Software Admin"><i
                        class="fas fa-sign-out-alt"></i> Logout</a> &nbsp; &nbsp; &nbsp;
            </div>
        </nav>
        <!-- /. NAV TOP  -->
        <nav class="navbar-default navbar-side" role="navigation">
            <div class="sidebar-collapse">
                <ul class="nav" id="main-menu">
                    <!-- <li class="text-center" style=" color: #000; background: #101010;">
                        <img src="logo.png" class="img-responsive bladeAnimated  pulse"
                            style="max-height: 152px ; text-align: center; margin: auto;" />
                    </li> -->

                    <li><a href="index.php"><i class="fas fa-tachometer-alt"></i> Dashboard</a></li>
                    <li><a href="products.php"><i class="fa fa-cubes"></i>Product</a></li>
                    <li><a href="invoice_data.php"><i class="fas fa-tags"></i>invoice</a></li>

                    <!-- <li><a href="#"><i class="glyphicon glyphicon-plus"></i>Invoice<span
                                class="fa fa-angle-down"></span></a>
                        <ul class="nav nav-second-level">
                            <li><a href="invoice_form.php"><i class="fas fa-tags"></i>Add invoice</a></li>
                            <li><a href="invoice_data.php"><i class="fa fa-cubes"></i>View invoice</a></li>
                        </ul>
                    </li> -->
                    <li><a href="client.php"><i class="fas fa-tags"></i>All Client</a></li>
                    <li><a href="stock.php"><i class="fas fa-tags"></i>Purchased</a></li>

                    <li><a href="change_password.php"><i class="fas fa-key"></i> Change Password</i>


                    <li><a href="logout.php"><i class="fas fa-sign-out-alt"></i>

                            Logout</a></li>
                </ul>

            </div>
        </nav>