<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="<?= base_url() ?>tambah_ruta" class="nav-link">TAMBAH RUTA</a>
    </li>
   <?php if ($pengguna['role_id'] == 1) : ?>
      <li class="nav-item d-none d-sm-inline-block">
        <a href="#" data-toggle="modal" data-target="#modal-tambahpengguna" class="nav-link">TAMBAH PENGGUNA</a>
      </li>
    <?php endif ?>
    <!-- <li class="nav-item d-none d-sm-inline-block">
        <a href="#" class="nav-link">Contact</a>
      </li> -->

  </ul>
  <ul class="navbar-nav ml-auto">

    <li class="nav-item">
      <a class="nav-link" data-widget="fullscreen" href="#" role="button">
        <i class="fas fa-expand-arrows-alt"></i>
      </a>
    </li>
    <li class="nav-item dropdown">
      <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-expanded="false">
        <?= $pengguna['username'] ?>
      </a>
      <div class="dropdown-menu" aria-labelledby="navbarDropdown">
        <a class="dropdown-item" href="<?= base_url('login/logout') ?>">Logout</a>
      </div>
    </li>

  </ul>

</nav>
<div class="modal fade" id="modal-tambahpengguna">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <h4 class="modal-title">Tambah Pengguna</h4>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">
        <form class="form-horizontal" method="post" action="<?= base_url(''); ?>kelola_pengguna/tambah">
          <div class="card-body">
            <div class="form-group">
              <label for="kabupaten">Email</label>
              <input type="email" class="form-control" name="email" id="email" placeholder="Email">
              <?= form_error('email', '<small class ="text-danger pl-3">', '</small>'); ?>
            </div>
            <div class="form-group">
              <label for="kabupaten">Username</label>
              <input type="text" class="form-control" name="username" id="username" placeholder="username">
              <?= form_error('username', '<small class ="text-danger pl-3">', '</small>'); ?>
            </div>
            <div class="form-group">
              <label for="kabupaten">Kata Sandi</label>
              <input type="Password" class="form-control" name="pass1" id="pass1" placeholder="Kata Sandi">
              <?= form_error('pass1', '<small class ="text-danger pl-3">', '</small>'); ?>
            </div>
            <div class="form-group">
              <label for="kabupaten">Konfirmasi Kata Sandi</label>
              <input type="Password" class="form-control" name="pass2" id="pass2" placeholder="Konfirmasi Kata Sandi">
              <?= form_error('pass2', '<small class ="text-danger pl-3">', '</small>'); ?>
            </div>
            <div class="form-group">
              <label for="role">Role</label>
              <select class="select form-control role" id="role" name="role" tabindex="-1">
                <option disabled selected value="0">Pilih Role</option>
                <option value="1">Admin</option>
                <option value="2">Pengguna</option>
              </select>
              <?= form_error('role', '<small class ="text-danger pl-3">', '</small>'); ?>
            </div>
            <div class="form-group">
              <label for="status">Status</label>
              <select class="select form-control status" id="status" name="status" tabindex="-1">
                <option disabled selected value="0">Pilih Status</option>
                <option value="1">Aktif</option>
                <option value="2">Non-Aktif</option>
              </select>
              <?= form_error('status', '<small class ="text-danger pl-3">', '</small>'); ?>
            </div>

          </div>
          <div class="modal-footer justify-content-between">
            <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
            <button type="submit" class="btn btn-primary">Simpan</button>
          </div>
        </form>
      </div>
    </div>
    <!-- /.modal-content -->
  </div>
  <!-- /.modal-dialog -->
</div>