<div class="card shadow">

    <div class="card-header bg-primary text-white">
        <b>Tambah Pengguna</b>
    </div>

    <div class="card-body">

        <form method="post" action="<?= site_url('admin/users/store') ?>">

            <?= csrf_field() ?>

            <div class="mb-3">
                <label>Nama Lengkap</label>
                <input name="name" class="form-control" placeholder="Masukkan nama" required>
            </div>

            <div class="mb-3">
                <label>Email</label>
                <input type="email" name="email" class="form-control" placeholder="Masukkan email" required>
            </div>

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

            <div class="mb-3">
                <label>Role</label>
                <select name="role_id" class="form-control" required>
                    <option value="">-- Pilih Role --</option>
                    <?php foreach($roles as $r): ?>
                        <option value="<?= $r->id ?>"><?= $r->role_name ?></option>
                    <?php endforeach ?>
                </select>
            </div>

            <div class="mb-3">
                <label>Status</label>
                <select name="status" class="form-control">
                    <option value="1">Aktif</option>
                    <option value="0">Nonaktif</option>
                </select>
            </div>

            <div class="text-end">
                <button class="btn btn-success">💾 Simpan</button>
                <a href="<?= site_url('admin/users') ?>" class="btn btn-secondary">Kembali</a>
            </div>

        </form>

    </div>

</div>
