<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><?= $this->renderSection('title') ?></title>

    <!-- Google Font: Source Sans Pro -->
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback">
    <!-- Font Awesome -->
    <link rel="stylesheet" href="<?= base_url() ?>adminlte/plugins/fontawesome-free/css/all.min.css">
    <?= $this->renderSection('css') ?>
    <!-- Theme style -->
    <link rel="stylesheet" href="<?= base_url() ?>adminlte/dist/css/adminlte.min.css">
</head>
<body class="hold-transition <?= $this->renderSection('bodyclass') ?>">

<div class="wrapper">

    <!-- Navbar -->
    <nav class="main-header navbar navbar-expand navbar-white navbar-light">
        <!-- Left navbar links -->
        <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>
            <li class="nav-item d-none d-sm-inline-block">
                <a href="/hi" class="nav-link">Home</a>
            </li>
            <li class="nav-item d-none d-sm-inline-block">
                <a href="#" class="nav-link">Contact</a>
            </li>
        </ul>

        <!-- Right navbar links -->
        <ul class="navbar-nav ml-auto">
            <!-- Navbar Search -->
            <li class="nav-item">
                <a class="nav-link" data-widget="navbar-search" href="#" role="button">
                <i class="fas fa-search"></i>
                </a>
                <div class="navbar-search-block">
                <form class="form-inline">
                    <div class="input-group input-group-sm">
                    <input class="form-control form-control-navbar" type="search" placeholder="Search" aria-label="Search">
                    <div class="input-group-append">
                        <button class="btn btn-navbar" type="submit">
                        <i class="fas fa-search"></i>
                        </button>
                        <button class="btn btn-navbar" type="button" data-widget="navbar-search">
                        <i class="fas fa-times"></i>
                        </button>
                    </div>
                    </div>
                </form>
                </div>
            </li>

            <!-- Notifications Dropdown Menu -->
            <li class="nav-item dropdown">
                <a class="nav-link" data-toggle="dropdown" href="#">
                <i class="far fa-bell"></i>
                <span class="badge badge-warning navbar-badge">15</span>
                </a>
                <div class="dropdown-menu dropdown-menu-lg dropdown-menu-right">
                <span class="dropdown-item dropdown-header">15 Notifications</span>
                <div class="dropdown-divider"></div>
                <a href="#" class="dropdown-item">
                    <i class="fas fa-envelope mr-2"></i> 4 new messages
                    <span class="float-right text-muted text-sm">3 mins</span>
                </a>
                <div class="dropdown-divider"></div>
                <a href="#" class="dropdown-item">
                    <i class="fas fa-users mr-2"></i> 8 friend requests
                    <span class="float-right text-muted text-sm">12 hours</span>
                </a>
                <div class="dropdown-divider"></div>
                <a href="#" class="dropdown-item">
                    <i class="fas fa-file mr-2"></i> 3 new reports
                    <span class="float-right text-muted text-sm">2 days</span>
                </a>
                <div class="dropdown-divider"></div>
                <a href="#" class="dropdown-item dropdown-footer">See All Notifications</a>
                </div>
            </li>
            <!-- .Notifications Dropdown Menu -->

            <!-- User Account: style can be found in dropdown.less -->
            <li class="nav-item dropdown">
                <a id="navbarDropdown" class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" v-pre>
                    <?= auth()->user()->username ?>
                </a>
                <div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown">
                    <a class="dropdown-item" href="#"><i class="fas fa-user mr-2"></i>Profile</a>
                    <a class="dropdown-item" href="/logout"><i class="fas fa-power-off mr-2"></i>Logout</a>
                </div>
            </li>

            <li class="nav-item">
                <a class="nav-link" data-widget="fullscreen" href="#" role="button">
                <i class="fas fa-expand-arrows-alt"></i>
                </a>
            </li>
        </ul>
    </nav>
    <!-- /.navbar -->

    <!-- Main Sidebar Container -->
     <!-- Main Sidebar Container -->
  <aside class="main-sidebar sidebar-dark-primary elevation-4">
    <!-- Brand Logo -->
    <a href="/hi" class="brand-link">
      <img src="/assets/images/karatworldlogo.png" alt="Karat World logo" class="brand-image img-circle elevation-3" style="opacity: .8">
      <span class="brand-text font-weight-light">Karat World</span>
    </a>

    <!-- Sidebar -->
    <div class="sidebar">
      <!-- Sidebar user (optional) -->
      <div class="user-panel mt-3 pb-3 mb-3 d-flex">
        <div class="info">
            <?php if(auth()->user() !== null): ?>
                <a href="#" class="d-block"><?= auth()->user()->display_name ?></a>
            <?php else: ?>
                <a href="#" class="d-block">Guest</a>
            <?php endif; ?>
        </div>
      </div>

      <!-- SidebarSearch Form -->
      <div class="form-inline">
        <div class="input-group" data-widget="sidebar-search">
          <input class="form-control form-control-sidebar" type="search" placeholder="Search" aria-label="Search">
          <div class="input-group-append">
            <button class="btn btn-sidebar">
              <i class="fas fa-search fa-fw"></i>
            </button>
          </div>
        </div>
      </div>

      <!-- Sidebar Menu -->
      <nav class="mt-2">
        <ul class="nav nav-pills nav-sidebar flex-column" data-widget="treeview" role="menu" data-accordion="false">
          <!-- Add icons to the links using the .nav-icon class
               with font-awesome or any other icon font library -->
          <li class="nav-item">
            <a href="/hi" class="nav-link">
              <i class="nav-icon fas fa-tachometer-alt"></i>
              <p>
                Dashboard
                <i class="right"></i>
              </p>
            </a>
          </li>

          <?php if(auth()->user()->inGroup('admin', 'superadmin', 'user')): ?>
          <li class="nav-header">REGULAR EMP</li>
          <li class="nav-item">
            <a href="#" class="nav-link">
              <i class="nav-icon fas fa-calendar-alt"></i>
              <p>
                Attendance
                <i class="right fas fa-angle-left"></i>
              </p>
            </a>
            <ul class="nav nav-treeview">
              <li class="nav-item">
                <a href="#" class="nav-link">
                  <i class="far fa-circle nav-icon"></i>
                  <p>
                    Attendance Log
                  </p>
                </a>
              </li>
              <li class="nav-item">
                <a href="#" class="nav-link">
                  <i class="far fa-circle nav-icon"></i>
                  <p>
                    Time Dispute
                  </p>
                </a>
              </li>
            </ul>
          </li>
          <li class="nav-item">
            <a href="/remp/payview" class="nav-link">
              <i class="nav-icon fas fa-calendar-alt"></i>
              <p>
                View Payslip
              </p>
            </a>
          </li>
          <?php endif; ?>

          <?php if(auth()->user()->inGroup('admin', 'superadmin', 'hr')): ?>
          <li class="nav-header">HUMAN RESOURCES</li>
          <li class="nav-item">
            <a href="/hr/branch" class="nav-link">
              <i class="nav-icon fas fa-calendar-alt"></i>
              <p>
                Company Branches
              </p>
            </a>
          </li>
          <li class="nav-item">
            <a href="/hr/dept" class="nav-link">
              <i class="nav-icon fas fa-calendar-alt"></i>
              <p>
                Company Departments
              </p>
            </a>
          </li>
          <li class="nav-item">
            <a href="/hr/jobtitle" class="nav-link">
              <i class="nav-icon fas fa-calendar-alt"></i>
              <p>
                Job Title
              </p>
            </a>
          </li>
          <li class="nav-item">
            <a href="/hr/empstatus" class="nav-link">
              <i class="nav-icon fas fa-calendar-alt"></i>
              <p>
                Employment Status
              </p>
            </a>
          </li>
          <li class="nav-item">
            <a href="/hr/emp" class="nav-link">
              <i class="nav-icon fas fa-calendar-alt"></i>
              <p>
                Employee Maintenance
              </p>
            </a>
          </li>
          
          <?php endif; ?>

          <?php if(auth()->user()->inGroup('admin', 'superadmin', 'hr', 'tk')): ?>
          <li class="nav-header">TIMEKEEPING</li>
          <li class="nav-item">
            <a href="#" class="nav-link">
              <i class="nav-icon fas fa-calendar-alt"></i>
              <p>
                Raw Logs
                <i class="right fas fa-angle-left"></i>
              </p>
            </a>
            <ul class="nav nav-treeview">
              <?php if(auth()->user()->can('tk.data-upload')): ?>
              <li class="nav-item">
                <a href="/tk/rawattlogupload" class="nav-link">
                  <i class="far fa-circle nav-icon"></i>
                  <p>
                    Attendance Uploading
                  </p>
                </a>
              </li>
              <?php endif; ?>
              <li class="nav-item">
                <a href="/tk/attsummary" class="nav-link">
                  <i class="far fa-circle nav-icon"></i>
                  <p>
                    Attendance Summary
                  </p>
                </a>
              </li>
            </ul>
          </li>
          <?php endif; ?>
          
          <?php if(auth()->user()->inGroup('admin', 'superadmin', 'payroll')): ?>
          <li class="nav-header">PAYROLL</li>
          <li class="nav-item">
            <a href="#" class="nav-link">
              <i class="nav-icon fas fa-calendar-alt"></i>
              <p>
                References &amp; Settings
                <i class="right fas fa-angle-left"></i>
              </p>
            </a>
            <ul class="nav nav-treeview">
              <li class="nav-item">
                <a href="/payroll/paygroup" class="nav-link">
                  <i class="far fa-circle nav-icon"></i>
                  <p>
                    Payroll Group
                  </p>
                </a>
              </li>
              <li class="nav-item">
                <a href="/payroll/inded" class="nav-link">
                  <i class="far fa-circle nav-icon"></i>
                  <p>
                    Income &amp; Deductions
                  </p>
                </a>
              </li>
              <li class="nav-item">
                <a href="/payroll/paytype" class="nav-link">
                  <i class="far fa-circle nav-icon"></i>
                  <p>
                    Payroll Type
                  </p>
                </a>
              </li>
              <li class="nav-item">
                <a href="/payroll/paysettings" class="nav-link">
                  <i class="far fa-circle nav-icon"></i>
                  <p>
                    Payroll Settings
                  </p>
                </a>
              </li>
            </ul>
          </li>
          <li class="nav-item">
            <a href="#" class="nav-link">
              <i class="nav-icon fas fa-calendar-alt"></i>
              <p>
                Employee Payroll
                <i class="right fas fa-angle-left"></i>
              </p>
            </a>
            <ul class="nav nav-treeview">
              <li class="nav-item">
                <a href="/payroll/emppayinfo" class="nav-link">
                  <i class="far fa-circle nav-icon"></i>
                  <p>
                    Employee Pay Info
                  </p>
                </a>
              </li>
              <li class="nav-item">
                <a href="/payroll/compben" class="nav-link">
                  <i class="far fa-circle nav-icon"></i>
                  <p>
                    Compensation &amp; Benefits
                  </p>
                </a>
              </li>
            </ul>
          </li>
          <li class="nav-item">
            <a href="#" class="nav-link">
              <i class="nav-icon far fa-image"></i>
              <p>
                Payroll Processing
                <i class="right fas fa-angle-left"></i>
              </p>
            </a>
            <ul class="nav nav-treeview">
              <li class="nav-item">
                <a href="/payroll/paytrans" class="nav-link">
                <i class="far fa-circle nav-icon"></i>
                  <p>
                    Payroll Transactios
                  </p>
                </a>
              </li>
              <li class="nav-item">
                <a href="#" class="nav-link">
                <i class="far fa-circle nav-icon"></i>
                  <p>
                    Income &amp; Deduction
                  </p>
                </a>
              </li>
            </ul>
          </li>
          <?php endif; ?>

          <?php if(auth()->user()->inGroup('admin', 'superadmin')): ?>
          <li class="nav-header">ADMINISTRATION</li>
          <li class="nav-item">
            <a href="/adminuser" class="nav-link">
              <i class="nav-icon fas fa-user"></i>
              <p>
                User Maintenance
              </p>
            </a>
          </li>
          <li class="nav-item">
            <a href="#" class="nav-link">
              <i class="nav-icon fas fa-building"></i>
              <p>
                Company Settings
              </p>
            </a>
          </li>
          <?php endif; ?>
          
        </ul>
      </nav>
      <!-- /.sidebar-menu -->
    </div>
    <!-- /.sidebar -->
  </aside>

  <!-- /.Main Sidebar Container -->

    <div class="content-wrapper">

      <!-- Content Header (Page header) -->
      <div class="content-header">
        <div class="container-fluid">
          <div class="row mb-2">
            <div class="col-sm-6">
              <h1 class="m-0"><?= $this->renderSection('containertitle') ?></h1>
            </div>
            <div class="col-sm-6">
              <ol class="breadcrumb float-sm-right">
                <li class="breadcrumb-item"><a href="/hi">Home</a></li>
                <?= $this->renderSection('breadcrumbs') ?>
              </ol>
            </div>
          </div>
        </div>
      </div>
      <!-- /.content-header -->
      <div class="content">
        <div class="container-fluid">
            <?php include('errormessage.php'); ?>
            <?= $this->renderSection('main') ?>
        </div>
      </div>
    </div>    
</div>

<!-- jQuery -->
<script src="<?= base_url() ?>adminlte/plugins/jquery/jquery.min.js"></script>
<!-- jQuery UI 1.11.4 -->
<script src="<?= base_url() ?>adminlte/plugins/jquery-ui/jquery-ui.min.js"></script>
<!-- Bootstrap 4 -->
<script src="<?= base_url() ?>adminlte/plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- Resolve conflict in jQuery UI tooltip with Bootstrap tooltip -->
<script>
  $.widget.bridge('uibutton', $.ui.button)
</script>
<?= $this->renderSection('externaljs') ?>
<!-- AdminLTE App -->
<script src="<?= base_url() ?>adminlte/dist/js/adminlte.min.js"></script>

<?= $this->renderSection('js') ?>
    
</body>
</html>