<div class="main-content">
  <div class="container-fluid" style="margin-top: 50px;">

<h2><i class="bi bi-person-plus"></i> Tambah Admin</h2>

<?= form_open('admin_group/save', ['class' => 'card p-4']) ?>
  <div class="mb-3">
    <label>Username</label>
    <input type="text" name="username" class="form-control" required>
  </div>

  <div class="mb-3">
    <label>Password</label>
    <input type="password" name="password" class="form-control" required>
  </div>

  <div class="mb-3">
    <label>Nama Lengkap</label>
    <input type="text" name="nama_lengkap" class="form-control" required>
  </div>

  <div class="mb-3">
    <label>Role</label>
    <select name="role" class="form-control" required>
      <option value="">-- Pilih Role --</option>
      <option value="superadmin">Superadmin</option>
      <option value="admin_opd">Admin OPD</option>
    </select>
  </div>

  <div class="mb-3">
    <label>OPD / UNOR</label>
    <select name="unor_id" class="form-control select2-unor" required>
      <option value="">-- Pilih OPD/UNOR --</option>
      <?php foreach ($unor_list as $u): ?>
        <option value="<?= htmlspecialchars($u->unor_id) ?>">
          <?= htmlspecialchars($u->unor_nama) ?>
        </option>
      <?php endforeach; ?>
    </select>
  </div>

  <div class="d-flex gap-2">
    <button type="submit" class="btn btn-primary">Simpan</button>
    <a href="<?= base_url('admin_group') ?>" class="btn btn-secondary">Batal</a>
  </div>
<?= form_close() ?>

<script>
$(document).ready(function() {
    $('.select2-unor').select2({
        placeholder: "Ketik nama OPD/UNOR...",
        allowClear: true,
        width: '100%'
    });
});
</script>

  </div>
</div>