<?= $this->extend('layouts/main') ?>
<?= $this->section('content') ?>

<h4>Edit Pengguna</h4>
<form action="<?= base_url('admin/users/update/' . $user['id']) ?>" method="post">
    <div class="mb-3">
        <label>Username</label>
        <input type="text" name="username" class="form-control" value="<?= esc($user['username']) ?>" required>
    </div>

    <div class="mb-3">
        <label>Password (kosongkan jika tidak diubah)</label>
        <input type="password" name="password" class="form-control" minlength="6">
    </div>
    <div class="mb-3">
        <label>Role</label>
        <select name="role" class="form-select" required>
            <option value="admin" <?= $user['role'] == 'admin' ? 'selected' : '' ?>>Admin</option>
            <option value="kasir" <?= $user['role'] == 'kasir' ? 'selected' : '' ?>>Kasir</option>
        </select>
    </div>
    <button class="btn btn-primary">Update</button>
    <a href="<?= base_url('admin/users') ?>" class="btn btn-secondary">Batal</a>
</form>

<?= $this->endSection() ?>
