
<?php include_once 'config/_globle.php'; ?>
<?php
// Temporary feature visibility switches. Set these to true later if you need these modules again.
$showInventoryFeatures = false;
$showPurchaseFeatures = false;
?>

<style>
    .nav-link-icon {
      color: #1f4e79;
    }

</style>
        <header class="navbar-expand-md sticky-top">
          <div class="collapse navbar-collapse" id="navbar-menu">
            <div class="navbar">
              <div class="container-xl">
                <ul class="navbar-nav">
                  <li class="nav-item">
                    <a class="nav-link" href="<?=$app_url;?>" >
                      <span class="nav-link-icon d-md-none d-lg-inline-block">
                        <svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M5 12l-2 0l9 -9l9 9l-2 0" /><path d="M5 12v7a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-7" /><path d="M9 21v-6a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v6" /></svg>
                      </span>
                      <span class="nav-link-title" style="color: #1f4e79;">
                        Home
                      </span>
                    </a>
                  </li>
                  <?php
                  // Check if any of the permissions under Admin are granted
                  $showAdminMenu = $userrole_permission["create_role"] == "1" ||
                                  $userrole_permission["employee"] == "1" ||
                                  $userrole_permission["create_account"] == "1" ||
                                  $userrole_permission["investor"] == "1";

                  // Only show the Admin menu if at least one permission is granted
                  if ($showAdminMenu): ?>
                    <li class="nav-item dropdown">
                      <a class="nav-link dropdown-toggle" href="#navbar-base" data-bs-toggle="dropdown" data-bs-auto-close="outside" role="button" aria-expanded="false" >
                        <span class="nav-link-icon d-md-none d-lg-inline-block">
                          <svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
                            <path stroke="none" d="M0 0h24v24H0z" fill="none"/>
                            <path d="M12 3l8 4.5l0 9l-8 4.5l-8 -4.5l0 -9l8 -4.5" />
                            <path d="M12 12l8 -4.5" />
                            <path d="M12 12l0 9" />
                            <path d="M12 12l-8 -4.5" />
                            <path d="M16 5.25l-8 4.5" />
                          </svg>
                        </span>
                        <span class="nav-link-title" style="color: #1f4e79;">
                          Admin
                        </span>
                      </a>
                      <div class="dropdown-menu">
                        <div class="dropdown-menu-columns">
                          <div class="dropdown-menu-column">
                            <?php if ($userrole_permission["create_role"] == "1"): ?>
                                <a class="dropdown-item" href="<?=$app_url;?>admin/userrolelist.php">User Role</a>
                            <?php endif; ?>
                            <?php if ($userrole_permission["employee"] == "1"): ?>
                                <a class="dropdown-item" href="<?=$app_url;?>entry/employee.php">Employee</a>
                            <?php endif; ?>
                            <?php if ($userrole_permission["create_account"] == "1"): ?>
                                <a class="dropdown-item" href="<?=$app_url;?>admin/userlist.php">User Account</a>
                            <?php endif; ?>
                            <?php if ($userrole_permission["investor"] == "1"): ?>
                                <a class="dropdown-item" href="<?=$app_url;?>entry/investor.php">Investor</a>
                            <?php endif; ?>
                          </div>
                        </div>
                      </div>
                    </li>
                  <?php endif; ?>

                  <?php
                  // Check if any of the permissions under Entry are granted
                  $showEntryMenu = $userrole_permission["room"] == "1" ||
                                  $userrole_permission["agent"] == "1" ||
                                  $userrole_permission["duty_schedule"] == "1" ||
                                  $userrole_permission["attendance"] == "1" ||
                                  $userrole_permission["attendance_update"] == "1";

                  // Only show the Entry menu if at least one permission is granted
                  if ($showEntryMenu): ?>
                    <li class="nav-item dropdown">
                      <a class="nav-link dropdown-toggle" href="#navbar-base" data-bs-toggle="dropdown" data-bs-auto-close="outside" role="button" aria-expanded="false">
                        <span class="nav-link-icon d-md-none d-lg-inline-block">
                          <svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
                            <path stroke="none" d="M0 0h24v24H0z" fill="none"/>
                            <path d="M12 3l8 4.5l0 9l-8 4.5l-8 -4.5l0 -9l8 -4.5" />
                            <path d="M12 12l8 -4.5" />
                            <path d="M12 12l0 9" />
                            <path d="M12 12l-8 -4.5" />
                            <path d="M16 5.25l-8 4.5" />
                          </svg>
                        </span>
                        <span class="nav-link-title" style="color: #1f4e79;">
                          Entry
                        </span>
                      </a>
                      <div class="dropdown-menu">
                        <div class="dropdown-menu-columns">
                          <div class="dropdown-menu-column">
                            <?php if ($userrole_permission["room"] == "1"): ?>
                                <a class="dropdown-item" href="<?=$app_url;?>entry/vehicle.php">Vehicle</a>
                            <?php endif; ?>
                            <?php if ($userrole_permission["agent"] == "1"): ?>
                                <a class="dropdown-item" href="<?=$app_url;?>entry/driver.php">Driver</a>
                            <?php endif; ?>
                            <?php if ($userrole_permission["duty_schedule"] == "1"): ?>
                                <a class="dropdown-item" href="<?=$app_url;?>entry/duty_schedule.php">Duty Schedule</a>
                            <?php endif; ?>
                            <?php if ($userrole_permission["attendance"] == "1"): ?>
                                <a class="dropdown-item" href="<?=$app_url;?>attendance/attendance.php">Attendance</a>
                            <?php endif; ?>
                            <?php if ($userrole_permission["attendance_update"] == "1"): ?>
                                <a class="dropdown-item" href="<?=$app_url;?>attendance/attendance_update.php">Attendance Update</a>
                            <?php endif; ?>
                          </div>
                        </div>
                      </div>
                    </li>
                  <?php endif; ?>

                  <?php
                  // Check if any of the permissions under Operations are granted
                  $showOperationsMenu = $userrole_permission["reservation"] == "1" ||
                                $userrole_permission["upcoming_arrivals"] == "1" ||
                                $userrole_permission["arrival"] == "1" ||
                                $userrole_permission["occupied_list"] == "1" ||
                                $userrole_permission["deleted_reservation_list"] == "1";

                  // Only show the Operations menu if at least one permission is granted
                  if ($showOperationsMenu): ?>
                    <li class="nav-item dropdown">
                      <a class="nav-link dropdown-toggle" href="#navbar-base" data-bs-toggle="dropdown" data-bs-auto-close="outside" role="button" aria-expanded="false">
                        <span class="nav-link-icon d-md-none d-lg-inline-block">
                          <svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
                            <path stroke="none" d="M0 0h24v24H0z" fill="none"/>
                            <path d="M12 3l8 4.5l0 9l-8 4.5l-8 -4.5l0 -9l8 -4.5" />
                            <path d="M12 12l8 -4.5" />
                            <path d="M12 12l0 9" />
                            <path d="M12 12l-8 -4.5" />
                            <path d="M16 5.25l-8 4.5" />
                          </svg>
                        </span>
                        <span class="nav-link-title" style="color: #1f4e79;">
                          Operations
                        </span>
                      </a>
                      <div class="dropdown-menu">
                        <div class="dropdown-menu-columns">
                          <div class="dropdown-menu-column">
                            <?php if ($userrole_permission["reservation"] == "1"): ?>
                                <a class="dropdown-item" href="<?=$app_url;?>entry/booking.php">Booking</a>
                            <?php endif; ?>
                            <?php if ($userrole_permission["upcoming_arrivals"] == "1"): ?>
                                <a class="dropdown-item" href="<?=$app_url;?>entry/reservation_list.php">Upcoming Pickups</a>
                            <?php endif; ?>
                            <?php if ($userrole_permission["occupied_list"] == "1"): ?>
                                <a class="dropdown-item" href="<?=$app_url;?>entry/pickup_list.php">Active Rentals</a>
                            <?php endif; ?>
                            <?php if ($userrole_permission["occupied_list"] == "1"): ?>
                                <a class="dropdown-item" href="<?=$app_url;?>entry/return_list.php">Completed Returns</a>
                            <?php endif; ?>
                            <?php if ($userrole_permission["deleted_reservation_list"] == "1"): ?>
                                <a class="dropdown-item" href="<?=$app_url;?>entry/deleted_reservation_list.php">Deleted Bookings</a>
                            <?php endif; ?>
                          </div>
                        </div>
                      </div>
                    </li>
                  <?php endif; ?>


                  <?php
                  // Check if any of the permissions under Inventory are granted
                  $showInventoryMenu = $showInventoryFeatures && (
                                      $userrole_permission["item"] == "1" ||
                                      $userrole_permission["stock_in"] == "1" ||
                                      $userrole_permission["stock_out"] == "1" ||
                                      $userrole_permission["stock_in_report"] == "1" ||
                                      $userrole_permission["stock_out_report"] == "1" ||
                                      $userrole_permission["stock_balance_report"] == "1");

                  // Only show the Inventory menu if at least one permission is granted
                  if ($showInventoryMenu): ?>
                    <li class="nav-item dropdown">
                      <a class="nav-link dropdown-toggle" href="#navbar-base" data-bs-toggle="dropdown" data-bs-auto-close="outside" role="button" aria-expanded="false">
                        <span class="nav-link-icon d-md-none d-lg-inline-block">
                          <svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
                            <path stroke="none" d="M0 0h24v24H0z" fill="none"/>
                            <path d="M12 3l8 4.5l0 9l-8 4.5l-8 -4.5l0 -9l8 -4.5" />
                            <path d="M12 12l8 -4.5" />
                            <path d="M12 12l0 9" />
                            <path d="M12 12l-8 -4.5" />
                            <path d="M16 5.25l-8 4.5" />
                          </svg>
                        </span>
                        <span class="nav-link-title" style="color: #1f4e79;">
                          Inventory
                        </span>
                      </a>
                      <div class="dropdown-menu">
                        <div class="dropdown-menu-columns">
                          <div class="dropdown-menu-column">
                            <?php if ($userrole_permission["item"] == "1"): ?>
                                <a class="dropdown-item" href="<?=$app_url;?>entry/item.php">Item</a>
                            <?php endif; ?>
                            <?php if ($userrole_permission["stock_in"] == "1"): ?>
                                <a class="dropdown-item" href="<?=$app_url;?>inventory/stock_in.php">Stock In</a>
                            <?php endif; ?>
                            <?php if ($userrole_permission["stock_out"] == "1"): ?>
                                <a class="dropdown-item" href="<?=$app_url;?>inventory/stock_out.php">Stock Out</a>
                            <?php endif; ?>
                            <?php if ($userrole_permission["stock_in_report"] == "1"): ?>
                                <a class="dropdown-item" href="<?=$app_url;?>reports/stock_in.php">Stock In Report</a>
                            <?php endif; ?>
                            <?php if ($userrole_permission["stock_out_report"] == "1"): ?>
                                <a class="dropdown-item" href="<?=$app_url;?>reports/stock_out.php">Stock Out Report</a>
                            <?php endif; ?>
                            <?php if ($userrole_permission["stock_balance_report"] == "1"): ?>
                                <a class="dropdown-item" href="<?=$app_url;?>reports/stock_balance.php">Stock Balance Report</a>
                            <?php endif; ?>
                          </div>
                        </div>
                      </div>
                    </li>
                  <?php endif; ?>

                  <?php
                  // Check if any of the permissions under Transactions are granted
                  $showTransactionsMenu = ($showPurchaseFeatures && (
                                          $userrole_permission["purchase"] == "1" ||
                                          $userrole_permission["purchase_report"] == "1")) ||
                                          $userrole_permission["monthly_report"] == "1" ||
                                          $userrole_permission["cash_book_report"] == "1";

                  // Only show the Transactions menu if at least one permission is granted
                  if ($showTransactionsMenu): ?>
                    <li class="nav-item dropdown">
                      <a class="nav-link dropdown-toggle" href="#navbar-base" data-bs-toggle="dropdown" data-bs-auto-close="outside" role="button" aria-expanded="false">
                        <span class="nav-link-icon d-md-none d-lg-inline-block">
                          <svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
                            <path stroke="none" d="M0 0h24v24H0z" fill="none"/>
                            <path d="M12 3l8 4.5l0 9l-8 4.5l-8 -4.5l0 -9l8 -4.5" />
                            <path d="M12 12l8 -4.5" />
                            <path d="M12 12l0 9" />
                            <path d="M12 12l-8 -4.5" />
                            <path d="M16 5.25l-8 4.5" />
                          </svg>
                        </span>
                        <span class="nav-link-title" style="color: #1f4e79;">
                          Transactions
                        </span>
                      </a>
                      <div class="dropdown-menu">
                        <div class="dropdown-menu-columns">
                          <div class="dropdown-menu-column">
                            <?php if ($showPurchaseFeatures && $userrole_permission["purchase"] == "1"): ?>
                                <a class="dropdown-item" href="<?=$app_url;?>entry/purchase.php">Purchase</a>
                            <?php endif; ?>
                            <?php if ($showPurchaseFeatures && $userrole_permission["purchase_report"] == "1"): ?>
                                <a class="dropdown-item" href="<?=$app_url;?>reports/purchase.php">Purchase Report</a>
                            <?php endif; ?>
                            <?php if ($userrole_permission["monthly_report"] == "1"): ?>
                                <a class="dropdown-item" href="<?=$app_url;?>reports/monthly.php">Monthly Report</a>
                            <?php endif; ?>
                            <?php if ($userrole_permission["cash_book_report"] == "1"): ?>
                                <a class="dropdown-item" href="<?=$app_url;?>reports/cash_book.php">Cash Book Report</a>
                            <?php endif; ?>
                          </div>
                        </div>
                      </div>
                    </li>
                  <?php endif; ?>

                  <?php
                  // Check if any of the permissions under Accounting are granted
                  $showAccountingMenu = $userrole_permission["coa"] == "1" ||
                                        $userrole_permission["expense"] == "1" ||
                                        $userrole_permission["income"] == "1" ||
                                        $userrole_permission["expense_report"] == "1" ||
                                        $userrole_permission["income_report"] == "1";

                  // Only show the Accounting menu if at least one permission is granted
                  if ($showAccountingMenu): ?>
                    <li class="nav-item dropdown">
                      <a class="nav-link dropdown-toggle" href="#navbar-base" data-bs-toggle="dropdown" data-bs-auto-close="outside" role="button" aria-expanded="false">
                        <span class="nav-link-icon d-md-none d-lg-inline-block">
                          <svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
                            <path stroke="none" d="M0 0h24V0H0z" fill="none"/>
                            <path d="M12 3l8 4.5l0 9l-8 4.5l-8 -4.5l0 -9l8 -4.5" />
                            <path d="M12 12l8 -4.5" />
                            <path d="M12 12l0 9" />
                            <path d="M12 12l-8 -4.5" />
                            <path d="M16 5.25l-8 4.5" />
                          </svg>
                        </span>
                        <span class="nav-link-title" style="color: #1f4e79;">
                          Accounting
                        </span>
                      </a>
                      <div class="dropdown-menu">
                        <div class="dropdown-menu-columns">
                          <div class="dropdown-menu-column">
                            <?php if ($userrole_permission["coa"] == "1"): ?>
                                <a class="dropdown-item" href="<?=$app_url;?>entry/coa.php">COA</a>
                            <?php endif; ?>
                            <?php if ($userrole_permission["expense"] == "1"): ?>
                                <a class="dropdown-item" href="<?=$app_url;?>entry/expense.php">Expense</a>
                            <?php endif; ?>
                            <?php if ($userrole_permission["income"] == "1"): ?>
                                <a class="dropdown-item" href="<?=$app_url;?>entry/income.php">Income</a>
                            <?php endif; ?>
                            <?php if ($userrole_permission["expense_report"] == "1"): ?>
                                <a class="dropdown-item" href="<?=$app_url;?>reports/expense.php">Expense Report</a>
                            <?php endif; ?>
                            <?php if ($userrole_permission["income_report"] == "1"): ?>
                                <a class="dropdown-item" href="<?=$app_url;?>reports/income.php">Income Report</a>
                            <?php endif; ?>
                          </div>
                        </div>
                      </div>
                    </li>
                  <?php endif; ?>

                  <?php
                  // Check if any of the permissions under Reports are granted
                  $showReportsMenu = $userrole_permission["attendance_report"] == "1" ||
                                    $userrole_permission["guest_report"] == "1" ||
                                    $userrole_permission["arrival_report"] == "1" ||
                                    $userrole_permission["departure_report"] == "1";

                  // Only show the Reports menu if at least one permission is granted
                  if ($showReportsMenu): ?>
                    <li class="nav-item dropdown">
                      <a class="nav-link dropdown-toggle" href="#navbar-base" data-bs-toggle="dropdown" data-bs-auto-close="outside" role="button" aria-expanded="false">
                        <span class="nav-link-icon d-md-none d-lg-inline-block">
                          <svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
                            <path stroke="none" d="M0 0h24v24H0z" fill="none"/>
                            <path d="M12 3l8 4.5l0 9l-8 4.5l-8 -4.5l0 -9l8 -4.5" />
                            <path d="M12 12l8 -4.5" />
                            <path d="M12 12l0 9" />
                            <path d="M12 12l-8 -4.5" />
                            <path d="M16 5.25l-8 4.5" />
                          </svg>
                        </span>
                        <span class="nav-link-title" style="color: #1f4e79;">
                          Reports
                        </span>
                      </a>
                      <div class="dropdown-menu">
                        <div class="dropdown-menu-columns">
                          <div class="dropdown-menu-column">
                            <?php if ($userrole_permission["attendance_report"] == "1"): ?>
                                <a class="dropdown-item" href="<?=$app_url;?>reports/attendance.php">Attendance</a>
                            <?php endif; ?>
                            <?php if ($userrole_permission["guest_report"] == "1"): ?>
                                <a class="dropdown-item" href="<?=$app_url;?>reports/guest.php">Customer</a>
                            <?php endif; ?>
                            <?php if ($userrole_permission["arrival_report"] == "1"): ?>
                                <a class="dropdown-item" href="<?=$app_url;?>reports/reservation_stay.php">Booking & Rental Report</a>
                            <?php endif; ?>
                            <?php if ($userrole_permission["arrival_report"] == "1"): ?>
                                <a class="dropdown-item" href="<?=$app_url;?>reports/room_sales.php">Rental Sales</a>
                            <?php endif; ?>
                          </div>
                        </div>
                      </div>
                    </li>
                  <?php endif; ?>

                </ul>
              </div>
            </div>
          </div>
        </header>

        <div class="page-wrapper">

