<nav class="main-header navbar navbar-expand navbar-white navbar-light">
  <ul class="navbar-nav">
    <li class="nav-item">
      <a class="nav-link" data-widget="pushmenu" href="#" role="button"><i class="fas fa-bars"></i></a>
    </li>
  </ul>

  <ul class="navbar-nav ml-auto">
    <li class="nav-item dropdown user-menu">
      <a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown">
        <img src="<?php echo userProfile(logged('id')) ?>" class="user-image img-circle elevation-2" alt="User Image">
        <span class="d-none d-md-inline"><?php echo logged('name') ?></span>
      </a>
      <ul class="dropdown-menu dropdown-menu-lg dropdown-menu-right">
        <li class="user-header bg-dark">
          <img src="<?php echo userProfile(logged('id')) ?>" class="img-circle elevation-2" alt="User Image">
          <p>
            <?php echo logged('name') ?>
            <small><?php echo esc(logged_role_title()) ?></small>
          </p>
        </li>
        <li class="user-footer">
          <a href="<?php echo url('profile') ?>" class="btn btn-default">Profile</a>
          <a href="<?php echo url('/auth/logout') . '?redirect=' . urlencode(url('/')) ?>" class="btn btn-default float-right">Sign out</a>
        </li>
      </ul>
    </li>
  </ul>
</nav>

<aside class="main-sidebar sidebar-dark-danger elevation-4">
  <a href="<?php echo url('/') ?>" class="brand-link bg-danger">
    <img src="<?php echo assets_url('admin') ?>/img/AdminLTELogo.png" alt="Logo" class="brand-image img-circle elevation-3" style="opacity: .8">
    <span class="brand-text font-weight-light"><?php echo setting('company_name') ?></span>
  </a>

  <div class="sidebar">
    <div class="user-panel mt-3 pb-3 mb-3 d-flex">
      <div class="image">
        <img src="<?php echo userProfile(logged('id')) ?>" class="img-circle elevation-2" alt="User Image">
      </div>
      <div class="info">
        <a href="#" class="d-block"><?php echo logged('name') ?></a>
      </div>
    </div>

    <nav class="mt-2">
      <ul class="nav nav-pills nav-sidebar flex-column" data-widget="treeview" role="menu" data-accordion="false">
        <?php if (is_role('Shopkeeper')): ?>
          <li class="nav-item">
            <a href="<?php echo url('shopkeeper') ?>" class="nav-link <?php echo (@$_page->submenu=='dashboard')?'active':'' ?>">
              <i class="nav-icon fas fa-tachometer-alt"></i><p>Dashboard</p>
            </a>
          </li>
          <li class="nav-item">
            <a href="<?php echo url('shopkeeper/products') ?>" class="nav-link <?php echo (@$_page->submenu=='products')?'active':'' ?>">
              <i class="nav-icon fas fa-box"></i><p>Products</p>
            </a>
          </li>
          <li class="nav-item">
            <a href="<?php echo url('shopkeeper/services') ?>" class="nav-link <?php echo (@$_page->submenu=='services')?'active':'' ?>">
              <i class="nav-icon fas fa-concierge-bell"></i><p>Services</p>
            </a>
          </li>
          <li class="nav-item">
            <a href="<?php echo url('shopkeeper/discounts') ?>" class="nav-link <?php echo (@$_page->submenu=='discounts')?'active':'' ?>">
              <i class="nav-icon fas fa-percent"></i><p>Discounts</p>
            </a>
          </li>
          <li class="nav-item">
            <a href="<?php echo url('shopkeeper/rewards') ?>" class="nav-link <?php echo (@$_page->submenu=='rewards')?'active':'' ?>">
              <i class="nav-icon fas fa-star"></i><p>Reward Rules</p>
            </a>
          </li>
          <li class="nav-item">
            <a href="<?php echo url('shopkeeper/orders') ?>" class="nav-link <?php echo (@$_page->submenu=='orders')?'active':'' ?>">
              <i class="nav-icon fas fa-receipt"></i><p>Orders</p>
            </a>
          </li>
        <?php else: ?>
          <li class="nav-item">
            <a href="<?php echo url('user') ?>" class="nav-link <?php echo (@$_page->submenu=='dashboard')?'active':'' ?>">
              <i class="nav-icon fas fa-tachometer-alt"></i><p>Dashboard</p>
            </a>
          </li>
          <li class="nav-item">
            <a href="<?php echo url('user/discounts') ?>" class="nav-link <?php echo (@$_page->submenu=='discounts')?'active':'' ?>">
              <i class="nav-icon fas fa-percent"></i><p>Discounts</p>
            </a>
          </li>
          <li class="nav-item">
            <a href="<?php echo url('user/wallet') ?>" class="nav-link <?php echo (@$_page->submenu=='wallet')?'active':'' ?>">
              <i class="nav-icon fas fa-wallet"></i><p>Wallet</p>
            </a>
          </li>
          <li class="nav-item">
            <a href="<?php echo url('user/orders') ?>" class="nav-link <?php echo (@$_page->submenu=='orders')?'active':'' ?>">
              <i class="nav-icon fas fa-receipt"></i><p>Orders</p>
            </a>
          </li>
        <?php endif ?>
      </ul>
    </nav>
  </div>
</aside>

