<?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-profile" role="tabpanel" aria-labelledby="v-pills-profile-tab">

                  <?php if (!$dosen): ?>
                    <div class="alert alert-danger">Data Dosen tidak ditemukan.</div>
                  <?php else: ?>
                  <div class="p-4">
                    <div class="mb-4">
                      <h5 class="mb-0 fw-bold">Profile Anda</h5>
                    </div>
                    <div class="row row-cols-1 row-cols-md-1 g-4">
                      <div class="col-md-3 d-none d-md-block"></div>
                      <div class="col-md-6 d-md-block">
                        <div class="offer-box position-relative bg-light rounded-3 shadow-sm p-4">
                          <small class="offer-box-title fw-bold text-white">
                            <img src="/assets/img/team1.jpg" alt="" class="img-fluid rounded-circle bg-light h-40">
                          </small>

                          <div class="d-flex align-items-center gap-3 mb-3">
                            <i class="bi bi-fingerprint m-0 rounded-pill rounded-icon"></i>
                            <div>
                              <div class="text-uppercase text-success fw-bold">Nama</div>
                              <p class="text-muted small mb-0"><?= htmlspecialchars($dosen['nama']) ?></p>
                            </div>
                          </div>
                          <div class="d-flex align-items-center gap-3 mb-3">
                            <i class="bi bi-card-heading m-0 rounded-pill rounded-icon"></i>
                            <div>
                              <div class="text-uppercase text-success fw-bold">NIY</div>
                              <p class="text-muted small mb-0"><?= htmlspecialchars($dosen['niy']) ?></p>
                            </div>
                          </div>
 
                        </div>
                      </div>
                      <div class="col">
                        <div class="border rounded d-flex gap-3 p-4">
						<form method="POST" action="/dashboard/updt-prf-dsn" class="mt-3 w-100">
							<div class="mb-3">
								<label for="nama" class="form-label">Nama</label>
								<input type="text" class="form-control" value="<?= htmlspecialchars($dosen['nama']) ?>" disabled>
								<input type="hidden" class="form-control" id="nama" name="nama" value="<?= htmlspecialchars($dosen['nama']) ?>" required>
							</div>
							<div class="mb-3">
								<label for="alamat" class="form-label">Alamat</label>
								<textarea class="form-control" id="alamat" name="alamat" required><?= htmlspecialchars($dosen['alamat']) ?></textarea>
							</div>
							<div class="mb-3">
								<label for="telpon" class="form-label">NIY</label>
								<input type="text" class="form-control" id="telpon" value="<?= htmlspecialchars($dosen['niy']) ?>" disabled>
								<input type="hidden" class="form-control" id="niy" name="niy" value="<?= htmlspecialchars($dosen['niy']) ?>" required>
							</div>
							<div class="mb-3">
								<label for="jenis_kelamin" class="form-label">Jenis Kelamin</label>
								<select class="form-select" id="jenis_kelamin" name="jenis_kelamin" required>
									<option value="Laki-laki" <?= $dosen['jenis_kelamin'] == 'Laki-laki' ? 'selected' : '' ?>>Laki-laki</option>
									<option value="Perempuan" <?= $dosen['jenis_kelamin'] == 'Perempuan' ? 'selected' : '' ?>>Perempuan</option>
								</select>
							</div>
							<div class="mb-3">
								<label for="gelar" class="form-label">Gelar</label>
								<input type="text" class="form-control" id="gelar" name="gelar" value="<?= htmlspecialchars($dosen['gelar']) ?>" required>
							</div>
							<button type="submit" class="btn btn-primary">Update</button>
						</form>
                        </div>
                      </div>
                    </div>
                  </div>
                  <?php endif; ?>

                </div>

              </div>
            </div>

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