<?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">
                      <h5 class="mb-0 fw-bold">Nilai Kompre</h5>
                    </div>
                    <center>
                      <p><strong>Nama:</strong> <?= $_SESSION['user']['nama'] ?></p>
                      <p><strong>Jumlah Soal:</strong> <?= $data['hasil']['total'] ?></p>
                      <p><strong>Jawaban Benar:</strong> <?= $data['hasil']['benar'] ?></p>
                      <p><strong>Skor:</strong> <?= round(($data['hasil']['benar'] / $data['hasil']['total']) * 100, 2) ?>%</p>

						<?php 
						$total = $data['hasil']['total'];
						$benar = $data['hasil']['benar'];
						$skor = round(($benar / $total) * 100, 2);
						if ($skor >= 80): ?>
							<div class="alert alert-success mt-3 fw-bold">
								🎉 Selamat, Anda telah lulus ujian dengan hasil yang sangat baik! 🎉
							</div>
						<?php elseif ($skor >= 60): ?>
							<div class="alert alert-info mt-3 fw-bold">
								👍 Selamat! Hasil ujian Anda menunjukkan pemahaman yang baik. Pertahankan dan tingkatkan! 👍
							</div>
						<?php else: ?>
							<div class="alert alert-danger mt-3 fw-bold">
								❌ Evaluasi kembali materi yang telah dipelajari. Terus tingkatkan pemahaman Anda! ❌
							</div>
						<?php endif; ?>

                      <a href="/dashboard/mahasiswa-pdf_kompre" class="btn btn-info text-decoration-none" target="_BLANK">
                        <i class="bi bi-file-earmark-pdf"></i> Cetak Hasil
                      </a>
                    </center>

                  </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'; ?>
