<?php include_once __DIR__ . '/../layouts/head.php'; ?>

<div class="container py-4" style="max-width: 1350px; width: 100%;">
  <div class="row">
    <div class="col-lg-12">
      <div class="shadow-sm bg-white rounded overflow-hidden border">
        <div class="p-0">
          <div class="row px-0 m-0">

            <?php include_once __DIR__ . '/../layouts/menu_body.php'; ?>

            <div class="col-12 col-md-9 px-0">
              <div class="tab-content" id="v-pills-tabContent">
			  
		<div class="tab-pane fade show active" id="v-pills-home" role="tabpanel" aria-labelledby="v-pills-home-tab">
            <div class="p-4">
                <div class="mb-4">
                    <center><h5 class="mb-0 fw-bold">Form Pendaftaran Wisuda</h5></center>
                </div>

				<div class="d-flex justify-content-between align-items-center">
					<p style="font-size:x-small; margin: 0;">
				 
					</p>
					<a href="/dashboard/mahasiswa-cetakfwisuda" 
					   class="text-warning text-decoration-none" 
					   target="_blank">
						<i class="bi bi-printer"></i> Cetak
					</a>
				</div>
				</br>
				</br>
<?php if (isset($_SESSION['info']) && isset($_SESSION['info_type'])): ?>
    <div class="alert alert-<?= $_SESSION['info_type']; ?>" id="alert-info">
        <?= $_SESSION['info']; ?>
    </div>
    <?php unset($_SESSION['info'], $_SESSION['info_type']); ?>
<?php endif; ?>

<script>
    setTimeout(function() {
        const alertInfo = document.getElementById('alert-info');
        if (alertInfo) {
            alertInfo.style.transition = 'opacity 0.5s ease';
            alertInfo.style.opacity = '0';
            setTimeout(() => alertInfo.remove(), 500);
        }
    }, 3000); // Auto-hide after 3 seconds
</script>
				
<form method="post" action="/dashboard/mahasiswa-daftarwisuda/daftar">
    <div class="row">
        <div class="col-md-6">
            <div class="form-floating mb-3">
                <input type="text" class="form-control" id="editNIM" name="nim" value="<?= $r['nim'] ?>" readonly>
                <label for="editNIM">NIM</label>
            </div>
            <div class="form-floating mb-3">
                <input type="text" class="form-control" id="editNama" name="nama" value="<?= $r['nama'] ?>" readonly>
                <label for="editNama">Nama Lengkap</label>
            </div>
            <div class="form-floating mb-3">
                <input type="text" class="form-control" id="editNIK" name="nik" value="<?= $r['nik'] ?? '' ?>">
                <label for="editNIK">NIK</label>
            </div>
            <div class="form-floating mb-3">
                <input type="text" class="form-control" id="editNISN" name="nisn" value="<?= $r['nisn'] ?? '' ?>">
                <label for="editNISN">NISN</label>
            </div>
            <div class="form-floating mb-3">
                <input type="text" class="form-control" id="editTLahir" name="tempat_lahir" value="<?= $r['tempat_lahir'] ?? '' ?>">
                <label for="editTLahir">Tempat Lahir</label>
            </div>
            <div class="form-floating mb-3">
                <input type="date" class="form-control" id="editTGLahir" name="tanggal_lahir" value="<?= date('Y-m-d', strtotime($r['tanggal_lahir'])); ?>">
                <label for="editTGLahir">Tanggal Lahir</label>
            </div>
            <div class="form-floating mb-3">
                <select name="gender" class="form-control" id="editGender">
                    <option value="">Pilih</option>
                    <option value="Laki-laki" <?= isset($r['gender']) && $r['gender'] == 'Laki-laki' ? 'selected' : '' ?>>Laki-laki</option>
                    <option value="Perempuan" <?= isset($r['gender']) && $r['gender'] == 'Perempuan' ? 'selected' : '' ?>>Perempuan</option>
                </select>
                <label class="editGender">Jenis Kelamin</label>
            </div>
            <div class="form-floating mb-3">
                <textarea class="form-control" id="editAlamat" name="alamat_leng" style="height: 150px;"><?= $r['alamat_leng'] ?></textarea>
                <label for="editAlamat">Alamat Orang Tua</label>
            </div>
        </div>

        <div class="col-md-6">
            <div class="form-floating mb-3">
                <textarea class="form-control" id="editJudul" name="judul_skripsi" style="height: 220px;"><?= $r['judul_skripsi'] ?></textarea>
                <label for="editJudul">Judul Skripsi</label>
            </div>
			
		<div class="form-floating mb-3">
		  <input type="text" class="form-control" id="ipeka" name="ipk" value="<?= $r['ipk'] ?? '' ?>">
		  <label for="editPemII">IPK</label>
		</div>
					
		<div class="form-floating mb-3">
		  <input type="text" class="form-control" id="ayah" name="nama_ayah" value="<?= $r['nama_ayah'] ?? '' ?>">
		  <label for="editPemI">Nama Ayah</label>
		</div>

		<div class="form-floating mb-3">
		  <input type="text" class="form-control" id="ibu" name="nama_ibu" value="<?= $r['nama_ibu'] ?? '' ?>">
		  <label for="editPemII">Nama Ibu</label>
		</div>

            <div class="form-floating mb-3">
                <input type="text" class="form-control" id="editLink" name="email" value="<?= $r['email'] ?? '' ?>">
                <label for="editLink">Alamat Email</label>
            </div>
            <div class="form-floating mb-3">
                <input type="date" class="form-control" id="editTGLS" name="tgl_lulus" value="<?= date('Y-m-d', strtotime($r['tgl_lulus'])); ?>">
                <label for="editTGLS">Tanggal Lulus Lulus</label>
            </div>
            <div class="form-floating mb-3">
                <input type="text" class="form-control" id="editWA" name="no_wa" value="<?= $r['no_wa'] ?? '' ?>">
                <label for="editWA">No WA Aktif</label>
            </div>
        </div>
    </div>

    <div class="mt-3">
        <button class="btn btn-primary" type="submit">Simpan</button>
    </div>
</form>
						
</div>
</div>

					  
              </div> <!-- end tab-content -->
            </div> <!-- end col-9 -->

          </div> <!-- end row -->
        </div> <!-- end p-0 -->
      </div> <!-- end shadow-sm -->
    </div> <!-- end col -->
  </div> <!-- end row -->
</div> <!-- end container -->

<?php include_once __DIR__ . '/../layouts/footer.php'; ?>