<?php
include(__DIR__ . '/auth.php');
require_login();

// Don't send ANY HTML or echo above this line
?>
<style>
  .logo {
    display: inline-block;
    margin: auto;
    vertical-align: middle;
  }
  .welcome-text {
    padding: 15px;
    color: #FFF;
    display: inline-block;
  }
  .navbar-right {
    display: flex;
    align-items: center;
  }
  /* Mobile-specific styles */
  @media (max-width: 767px) {
    .mobile-welcome {
      padding: 15px;
      color: #FFF;
      line-height: 20px;
      margin-left: 15px;
    }
    .desktop-welcome {
      display: none;
    }
  }
  /* Desktop styles */
  @media (min-width: 768px) {
    .mobile-welcome {
      display: none;
    }
    .desktop-welcome {
      display: inline-block;
    }
  }
</style>
<!-- nav start -->
<nav class="navbar navbar-default">
  <div class="container-fluid">
    <div class="navbar-header">
      <a href="/Admin/"><img class="img-responsive logo" style="height:50px" src="/asset/images/logo.webp" alt=""></a>
      
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <span class="mobile-welcome">Welcome! <?php echo htmlspecialchars($_SESSION['name'] ?? ''); ?></span>
    </div>

    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
      <ul class="nav navbar-nav">
        <li><a href="/Admin/Create_AC_Recurring">New Recurring</a></li>
        <li><a href="/Admin/Create_AC_FD">New FD</a></li>
        <li><a href="/Admin/Create_AC_Loan">New Loan</a></li>
        <li><a href="/Admin/Add_group">Add New Group</a></li>
        <li><a href="/Admin/View_AC?Type=Recurring">View A/C</a></li>
        <li><a href="/Admin/Trans_New">Transaction</a></li>
        <li><a href="/Admin/Due">Deemand Sheet</a></li>
        <li><a href="/Admin/Report">Report</a></li>
        <!-- <li><a href="/Admin/Revert">Revert</a></li> -->
        <?php
          if($_SESSION['type'] === 'admin'){ ?>
            <li><a href="/Admin/agent_View_report">Commission</a></li>
            <li><a href="/Admin/Settings_Agent">Agent Settings</a></li>
          <?php } ?>
      </ul>

      <ul class="nav navbar-nav navbar-right">
        <li class="desktop-welcome"><span class="welcome-text">Welcome! <?php echo htmlspecialchars($_SESSION['name'] ?? ''); ?></span></li>
        <li><a href="/Admin/Signout">Signout</a></li>
      </ul>
    </div>
  </div>
</nav>