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

<?= $this->section('title') ?>
Edit Pegawai: <?= $pegawai['nama'] ?>
<?= $this->endSection() ?>

<?= $this->section('page_title') ?>
Update Biodata Pegawai
<?= $this->endSection() ?>

<?= $this->section('content') ?>
<div class="row">
    <div class="col-lg-11 mx-auto">
        <form action="<?= base_url('admin/pegawai/processEdit/' . $pegawai['id']) ?>" method="POST">

            <div class="glass-card mb-4">
                <h5 class="mb-4 text-primary"><i class="bi bi-person-badge me-2"></i> Identitas Utama & Akun</h5>
                <div class="row">
                    <div class="col-md-4 mb-3">
                        <label class="form-label small fw-bold">NIP BARU</label>
                        <input type="text" class="form-control rounded-pill px-4 bg-light" name="nip_baru"
                            value="<?= $pegawai['nip_baru'] ?>" readonly>
                    </div>
                    <div class="col-md-4 mb-3">
                        <label class="form-label small fw-bold">NIP LAMA</label>
                        <input type="text" class="form-control px-4" name="nip_lama"
                            value="<?= $pegawai['nip_lama'] ?>">
                    </div>
                    <div class="col-md-4 mb-3">
                        <label class="form-label small fw-bold">NIK</label>
                        <input type="text" class="form-control px-4" name="nik"
                            value="<?= $pegawai['nik'] ?>">
                    </div>
                    <div class="col-md-4 mb-3">
                        <label class="form-label small fw-bold">NAMA LENGKAP</label>
                        <input type="text" class="form-control px-4" name="nama"
                            value="<?= $pegawai['nama'] ?>" required>
                    </div>
                    <div class="col-md-4 mb-3">
                        <label class="form-label small fw-bold">GELAR DEPAN</label>
                        <input type="text" class="form-control px-4" name="gelar_depan"
                            value="<?= $pegawai['gelar_depan'] ?>">
                    </div>
                    <div class="col-md-4 mb-3">
                        <label class="form-label small fw-bold">GELAR BELAKANG</label>
                        <input type="text" class="form-control px-4" name="gelar_belakang"
                            value="<?= $pegawai['gelar_belakang'] ?>">
                    </div>
                </div>
            </div>

            <div class="glass-card mb-4">
                <h5 class="mb-4 text-primary"><i class="bi bi-person-vcard me-2"></i> Data Pribadi & Kontak</h5>
                <div class="row">
                    <div class="col-md-4 mb-3">
                        <label class="form-label small fw-bold">TEMPAT LAHIR</label>
                        <input type="text" class="form-control px-4" name="tempat_lahir"
                            value="<?= $pegawai['tempat_lahir'] ?>">
                    </div>
                    <div class="col-md-4 mb-3">
                        <label class="form-label small fw-bold">TANGGAL LAHIR</label>
                        <input type="date" class="form-control px-4" name="tanggal_lahir"
                            value="<?= $pegawai['tanggal_lahir'] ?>">
                    </div>
                    <div class="col-md-4 mb-3">
                        <label class="form-label small fw-bold">JENIS KELAMIN</label>
                        <select class="form-select px-4" name="jenis_kelamin">
                            <option value="LAKI-LAKI" <?= $pegawai['jenis_kelamin'] == 'LAKI-LAKI' ? 'selected' : '' ?>>
                                LAKI-LAKI</option>
                            <option value="PEREMPUAN" <?= $pegawai['jenis_kelamin'] == 'PEREMPUAN' ? 'selected' : '' ?>>
                                PEREMPUAN</option>
                        </select>
                    </div>
                    <div class="col-md-4 mb-3">
                        <label class="form-label small fw-bold">AGAMA</label>
                        <input type="text" class="form-control px-4" name="agama"
                            value="<?= $pegawai['agama'] ?>">
                    </div>
                    <div class="col-md-4 mb-3">
                        <label class="form-label small fw-bold">STATUS KAWIN</label>
                        <input type="text" class="form-control px-4" name="status_kawin"
                            value="<?= $pegawai['status_kawin'] ?>">
                    </div>
                    <div class="col-md-4 mb-3">
                        <label class="form-label small fw-bold">NO HP/WA</label>
                        <input type="text" class="form-control px-4" name="no_hp"
                            value="<?= $pegawai['no_hp'] ?>">
                    </div>
                    <div class="col-md-4 mb-3">
                        <label class="form-label small fw-bold">EMAIL</label>
                        <input type="email" class="form-control px-4" name="email"
                            value="<?= $pegawai['email'] ?>">
                    </div>
                </div>
            </div>

            <div class="glass-card mb-4">
                <h5 class="mb-4 text-primary"><i class="bi bi-briefcase me-2"></i> Status Kepegawaian</h5>
                <div class="row">
                    <div class="col-md-3 mb-3">
                        <label class="form-label small fw-bold">STATUS CPNS/PNS</label>
                        <input type="text" class="form-control px-4" name="status_cpns_pns"
                            value="<?= $pegawai['status_cpns_pns'] ?>">
                    </div>
                    <div class="col-md-3 mb-3">
                        <label class="form-label small fw-bold">SK CPNS</label>
                        <input type="text" class="form-control px-4" name="nomor_sk_cpns"
                            value="<?= $pegawai['nomor_sk_cpns'] ?>">
                    </div>
                    <div class="col-md-3 mb-3">
                        <label class="form-label small fw-bold">TMT CPNS</label>
                        <input type="date" class="form-control px-4" name="tmt_cpns"
                            value="<?= $pegawai['tmt_cpns'] ?>">
                    </div>
                    <div class="col-md-3 mb-3">
                        <label class="form-label small fw-bold">SK PNS</label>
                        <input type="text" class="form-control px-4" name="nomor_sk_pns"
                            value="<?= $pegawai['nomor_sk_pns'] ?>">
                    </div>
                    <div class="col-md-3 mb-3">
                        <label class="form-label small fw-bold">TMT PNS</label>
                        <input type="date" class="form-control px-4" name="tmt_pns"
                            value="<?= $pegawai['tmt_pns'] ?>">
                    </div>
                    <div class="col-md-3 mb-3">
                        <label class="form-label small fw-bold">GOL AWAL</label>
                        <input type="text" class="form-control px-4" name="gol_awal"
                            value="<?= $pegawai['gol_awal'] ?>">
                    </div>
                    <div class="col-md-3 mb-3">
                        <label class="form-label small fw-bold">GOL AKHIR</label>
                        <input type="text" class="form-control px-4" name="gol_akhir"
                            value="<?= $pegawai['gol_akhir'] ?>">
                    </div>
                    <div class="col-md-3 mb-3">
                        <label class="form-label small fw-bold">TMT GOLONGAN</label>
                        <input type="date" class="form-control px-4" name="tmt_golongan"
                            value="<?= $pegawai['tmt_golongan'] ?>">
                    </div>
                </div>
            </div>

            <div class="glass-card mb-4">
                <h5 class="mb-4 text-primary"><i class="bi bi-mortarboard me-2"></i> Pendidikan & Jabatan</h5>
                <div class="row">
                    <!-- Top Row -->
                    <div class="col-md-4 mb-3">
                        <label class="form-label small fw-bold">JENIS JABATAN</label>
                        <select class="form-select px-4" name="jenis_jabatan">
                            <option value="">Pilih...</option>
                            <option value="Jabatan Struktural" <?= $pegawai['jenis_jabatan'] == 'Jabatan Struktural' ? 'selected' : '' ?>>Jabatan Struktural</option>
                            <option value="Jabatan Fungsional" <?= $pegawai['jenis_jabatan'] == 'Jabatan Fungsional' ? 'selected' : '' ?>>Jabatan Fungsional</option>
                            <option value="Jabatan Fungsional Umum/Pelaksana" <?= $pegawai['jenis_jabatan'] == 'Jabatan Fungsional Umum/Pelaksana' ? 'selected' : '' ?>>Jabatan Fungsional Umum/Pelaksana
                            </option>
                        </select>
                    </div>
                    <div class="col-md-4 mb-3">
                        <label class="form-label small fw-bold">JABATAN SEKARANG</label>
                        <input type="text" class="form-control px-4" name="jabatan"
                            value="<?= $pegawai['jabatan'] ?>">
                    </div>
                    <div class="col-md-4 mb-3">
                        <label class="form-label small fw-bold">PENDIDIKAN</label>
                        <input type="text" class="form-control px-4" name="pendidikan"
                            value="<?= $pegawai['pendidikan'] ?>">
                    </div>

                    <!-- Row 2: Info Jabatan & Pendidikan -->
                    <div class="col-md-4 mb-3">
                        <label class="form-label small fw-bold">TMT JABATAN</label>
                        <input type="date" class="form-control px-4" name="tmt_jabatan"
                            value="<?= $pegawai['tmt_jabatan'] ?>">
                    </div>
                    <div class="col-md-4 mb-3">
                        <label class="form-label small fw-bold">TINGKAT PENDIDIKAN</label>
                        <input type="text" class="form-control px-4" name="tingkat_pendidikan"
                            value="<?= $pegawai['tingkat_pendidikan'] ?>">
                    </div>
                    <div class="col-md-4 mb-3">
                        <label class="form-label small fw-bold">TAHUN LULUS</label>
                        <input type="number" class="form-control px-4" name="tahun_lulus"
                            value="<?= $pegawai['tahun_lulus'] ?>">
                    </div>

                    <!-- Row 3: Instansi & Unit Kerja (Bottom) -->
                    <div class="col-md-6 mb-3">
                        <label class="form-label small fw-bold">INSTANSI / UNOR</label>
                        <input type="text" class="form-control px-4" name="unor"
                            value="<?= $pegawai['unor'] ?>">
                    </div>
                    <div class="col-md-6 mb-3">
                        <label class="form-label small fw-bold">UNIT KERJA INDUK</label>
                        <input type="text" class="form-control px-4" name="unit_kerja_induk"
                            value="<?= $pegawai['unit_kerja_induk'] ?>">
                    </div>
                </div>
            </div>

            <div class="text-end mb-5">
                <button type="submit" class="btn btn-primary px-5 shadow py-3 fw-bold">SIMPAN PERUBAHAN
                    DATA</button>
                <a href="<?= base_url('admin/pegawai') ?>" class="btn btn-link link-secondary">Batalkan</a>
            </div>
        </form>
    </div>
</div>
<?= $this->endSection() ?>