  <?php
  /* This sets the $time variable to the current hour in the 24 hour clock format */
  $time = date("H");
  /* Set the $timezone variable to become the current timezone */
  // $timezone = date("e");
  $greetings = '';
  /* If the time is less than 1200 hours, show good morning */
  if ($time < "12") {
    $greetings = "Good morning,";
  } else {
    /* If the time is grater than or equal to 1200 hours, but less than 1700 hours, so good afternoon */
    if ($time >= "12" && $time < "17") {
      $greetings = "Good afternoon,";
    } else
      /* Should the time be between or equal to 1700 and 1900 hours, show good evening */
      if ($time >= "17" && $time < "19") {
        $greetings = "Hello,";
      } else {
        /* Finally, show good night if the time is greater than or equal to 1900 hours */
        if ($time >= "19") {
          $greetings = "Hello,";
        }
      }
  }
  ?>
 
 <?php
$formattedDate = date('Y-m'); // Initialize the variable

if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $selectedDate = $_POST['date'];

    // Make sure the selected date is in the correct format for the month input
    $formattedDate = date('Y-m', strtotime($selectedDate));
    $currentmonth= $formattedDate;
}
?>
 <nav class="navbar default-layout col-lg-12 col-12 p-0 fixed-top d-flex align-items-top flex-row">
        <div class="text-center navbar-brand-wrapper d-flex align-items-center justify-content-start">
          <div class="me-3">
            <button class="navbar-toggler navbar-toggler align-self-center" type="button" data-bs-toggle="minimize">
              <span class="icon-menu"></span>
            </button>
          </div>
          <div>
            <a class="navbar-brand brand-logo" href="#">
              <h2>Inventory</h2>
            </a>
            <!--<a class="navbar-brand brand-logo-mini" href="index.html">-->
            <!--  <img src="assets/images/logo-mini.svg" alt="logo" />-->
            <!--</a>-->
          </div>
        </div>
        <div class="navbar-menu-wrapper d-flex align-items-top">
          <ul class="navbar-nav">
            <li class="nav-item fw-semibold d-none d-lg-block ms-0">
              <h1 class="welcome-text"><?= $greetings ?> <span class="text-black fw-bold"><?=$_SESSION['firstname']." ". $_SESSION['lastname']?></span></h1>
              <h3 class="welcome-sub-text">Your performance summary for: <?= date('F Y', strtotime($currentmonth))?></h3>
            </li>
          </ul>
          
          <ul class="navbar-nav ms-auto">
            
           <li class="nav-item d-none d-lg-block">
              

<form method="POST">
    <label for="date">Select a date:</label>
    <input type="month" id="date" name="date" value="<?= isset($formattedDate) ? $formattedDate : '' ?>" required>
    <button type="submit">Update</button>
</form>


            </li>
            
            
            
            <li class="nav-item dropdown d-none d-lg-block user-dropdown">
              <a class="nav-link" id="UserDropdown" href="#" data-bs-toggle="dropdown" aria-expanded="false">
                <img class="img-xs rounded-circle" src="../assets/images/faces/morph.jfif" alt="Profile image"> </a>
              <div class="dropdown-menu dropdown-menu-right navbar-dropdown" aria-labelledby="UserDropdown">
                <div class="dropdown-header text-center">
                  <img class="img-md rounded-circle" src="../assets/images/faces/morph.jfif" alt="Profile image">
                  <p class="mb-1 mt-3 fw-semibold"><?=$_SESSION['firstname']." ". $_SESSION['lastname']?></p>
                  <p class="fw-light text-muted mb-0"><?=$_SESSION['email']?></p>
                </div>
                
               
                <a class="dropdown-item" href="../users/logout">
                  <i class="dropdown-item-icon mdi mdi-power text-primary me-2"></i>Sign Out</a>
              </div>
            </li>
          </ul>
          <button class="navbar-toggler navbar-toggler-right d-lg-none align-self-center" type="button" data-bs-toggle="offcanvas">
            <span class="mdi mdi-menu"></span>
          </button>
        </div>
      </nav>