<?= $this->extend('layout/default') ?>

<?= $this->section('content') ?>

<div class="card-header" style="margin-bottom: 2rem;">
    <h1 class="page-title" style="margin-bottom: 0;">Edit Data Dosen</h1>
</div>

<div class="card" style="background: white; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); padding: 2rem;">
    <form action="<?= base_url('dosen/update/'.$dosen['id']) ?>" method="post">
        <?= csrf_field() ?>

        <div class="form-group" style="margin-bottom: 1.5rem;">
            <label for="nama_lengkap" style="display: block; margin-bottom: 0.5rem; font-weight: 500;">Nama Lengkap</label>
            <input type="text" id="nama_lengkap" name="nama_lengkap" class="form-control" value="<?= esc($dosen['nama_lengkap']) ?>" required style="width: 100%; padding: 0.75rem; border: 1px solid #cbd5e1; border-radius: 4px;" readonly>
            <small style="color: #64748b;">Nama tidak dapat diubah di sini karena disinkronisasi dari PDDIKTI.</small>
        </div>

        <div class="form-group" style="margin-bottom: 1.5rem;">
            <label for="nidn" style="display: block; margin-bottom: 0.5rem; font-weight: 500;">NIDN / NUPTK</label>
            <input type="text" id="nidn" class="form-control" value="<?= esc($dosen['nidn'] ?: $dosen['nuptk']) ?>" style="width: 100%; padding: 0.75rem; border: 1px solid #cbd5e1; border-radius: 4px;" readonly>
        </div>

        <div class="form-group" style="margin-bottom: 1.5rem;">
            <label for="jenis_dosen" style="display: block; margin-bottom: 0.5rem; font-weight: 500;">Jenis Dosen <span style="color: red;">*</span></label>
            <select id="jenis_dosen" name="jenis_dosen" class="form-control" required style="width: 100%; padding: 0.75rem; border: 1px solid #cbd5e1; border-radius: 4px;">
                <option value="Internal" <?= $dosen['jenis_dosen'] == 'Internal' ? 'selected' : '' ?>>Dosen Internal (Homebase)</option>
                <option value="Eksternal" <?= $dosen['jenis_dosen'] == 'Eksternal' ? 'selected' : '' ?>>Dosen Eksternal (Hanya Mengajar)</option>
            </select>
        </div>

        <div class="form-group" style="margin-bottom: 1.5rem;">
            <label for="no_hp" style="display: block; margin-bottom: 0.5rem; font-weight: 500;">Nomor HP</label>
            <input type="text" id="no_hp" name="no_hp" class="form-control" value="<?= esc($dosen['no_hp']) ?>" placeholder="Opsional" style="width: 100%; padding: 0.75rem; border: 1px solid #cbd5e1; border-radius: 4px;">
        </div>

        <div style="margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid #e2e8f0; display: flex; gap: 1rem;">
            <button type="submit" class="btn btn-primary">Simpan Perubahan</button>
            <a href="<?= base_url('dosen') ?>" class="btn" style="background-color: #f1f5f9; color: #475569;">Batal</a>
        </div>
    </form>
</div>

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