<?php if (auth()->user()->role == 'customer'): ?>
    <?= $this->extend('layouts/topbar') ?>
<?php else: ?>
    <?= $this->extend('layouts/sidebar') ?>
<?php endif; ?>

<?= $this->section('content') ?>
<section class="content">
    <div class="container-fluid">
        <!-- Small boxes (Stat box) -->
        <div class="card mb-3">
            <div class="card-body">
                <form method="POST" action="<?= base_url('employee/edit/' . $data->id_pegawai) ?>" enctype="multipart/form-data">
                    <?= csrf_field() ?>
                    <div class="form-group">
                        <label class="form-label" for="exampleInputNama">Nama Lengkap</label>
                        <input type="text" class="form-control" id="exampleInputNama" name="nama" placeholder="Input Nama" required value="<?= $data->nama ?>">
                    </div>
                    <div class="form-group">
                        <label class="form-label" for="exampleInputUsername">Username</label>
                        <input type="text" class="form-control" id="exampleInputUsername" name="username" placeholder="Input Username" required value="<?= $data->username ?>">
                    </div>
                    <div class="form-group">
                        <label class="form-label" for="role">Role</label>
                        <select class="custom-select rounded-0" id="role" name="role" required>
                            <option value="">--- Pilih Role ---</option>
                            <option value="admin" <?= ($data->role == 'admin') ? 'selected' : '' ?>>Admin</option>
                            <option value="kasir" <?= ($data->role == 'kasir') ? 'selected' : '' ?>>Kasir</option>
                            <option value="pemilik_toko" <?= ($data->role == 'pemilik_toko') ? 'selected' : '' ?>>Kepala Toko</option>
                        </select>
                    </div>

                    <button type="submit" class="btn btn-primary">Simpan</button>
                </form>
            </div>
        </div>
    </div><!-- /.container-fluid -->
</section>
<?= $this->endSection() ?>