<?php
session_start();

if (!isset($_SESSION["login"])) {
    header("location: ../../login.php");
    exit;
}

$nip = $_SESSION['nip'];

error_reporting(E_ALL);
ini_set('display_errors', 1);

require_once __DIR__ . '/../../vendor/autoload.php';
include "../../koneksi.php";

use Sastrawi\Stemmer\StemmerFactory;
use Sastrawi\StopWordRemover\StopWordRemoverFactory;

/* ===========================
   PREPROCESSING
=========================== */

function tokenize($text) {
    $words = preg_split('/\s+/', strtolower($text));
    return array_values(array_filter(array_map(
        fn($w) => preg_replace('/[^a-z0-9]/', '', $w),
        $words
    )));
}

function filtering($tokens) {
    $stopwordRemover = (new StopWordRemoverFactory())->createStopWordRemover();
    return array_values(array_filter(array_map(
        fn($t) => $stopwordRemover->remove($t),
        $tokens
    )));
}

function stemming($tokens) {
    $stemmer = (new StemmerFactory())->createStemmer();
    return array_map(fn($t) => $stemmer->stem($t), $tokens);
}

function preprocessing_detail($text) {
    $token  = tokenize($text);
    $filter = filtering($token);
    $stem   = stemming($filter);

    return [
        'token' => $token,
        'filter' => $filter,
        'stem' => $stem,
        'final' => implode(' ', $stem)
    ];
}

/* ===========================
   LEVENSHTEIN
=========================== */

function levenshtein_similarity($s1, $s2) {
    $d = levenshtein($s1, $s2);
    $max = max(strlen($s1), strlen($s2));
    return ($max == 0) ? 0 : (1 - ($d / $max));
}

function levenshtein_matrix($s, $t) {
    $m = strlen($s);
    $n = strlen($t);
    $d = [];

    for ($i=0;$i<=$m;$i++) $d[$i][0] = $i;
    for ($j=0;$j<=$n;$j++) $d[0][$j] = $j;

    for ($i=1;$i<=$m;$i++) {
        for ($j=1;$j<=$n;$j++) {
            $cost = ($s[$i-1] == $t[$j-1]) ? 0 : 1;
            $d[$i][$j] = min(
                $d[$i-1][$j] + 1,
                $d[$i][$j-1] + 1,
                $d[$i-1][$j-1] + $cost
            );
        }
    }
    return $d;
}

/* ===========================
   PARAMETER
=========================== */

$nis         = $_GET['nis'];
$kode_kelas  = $_GET['kode_kelas'];
$kode_mapel  = $_GET['kode_mapel'];
$jenis_ujian = $_GET['jenis_ujian'];

/* ===========================
   AMBIL DATA
=========================== */

$q = mysqli_query($koneksi, "
    SELECT j.id, j.jawaban, s.knc_jawaban, s.bobot, s.soal, j.skor
    FROM jawaban_essay j
    JOIN soal_essay s ON j.id_soal = s.id_soal
    WHERE j.nis='$nis'
      AND j.kode_kelas='$kode_kelas'
      AND j.kode_mapel='$kode_mapel'
      AND j.jenis_ujian='$jenis_ujian'
    ORDER BY s.id_soal
");

$total_nilai_ld = 0;
$hasil = [];

/* ===========================
   PROSES PER SOAL (FORMULA BARU)
=========================== */

while ($row = mysqli_fetch_assoc($q)) {

    $prep_kunci   = preprocessing_detail($row['knc_jawaban']);
    $prep_jawaban = preprocessing_detail($row['jawaban']);

    // Hitung distance dan similarity
    $dist = levenshtein(
        $prep_kunci['final'],
        $prep_jawaban['final']
    );

    $sim_murni = levenshtein_similarity(
        $prep_kunci['final'],
        $prep_jawaban['final']
    );

    // ===== FORMULA BARU (SAMA DENGAN COSINE TAPI BOBOT 0.2) =====
    
    // LANGKAH 1: Similarity murni (0-1), misal: 0.85
    $similarity_murni = round($sim_murni, 2);
    
    // LANGKAH 2: Konversi ke skala 0-100 dan bulatkan → 0.85 × 100 = 85
    $similarity_persen = round($similarity_murni * 100);
    
    // LANGKAH 3: Berikan bobot 20% → 85 × 0.2 = 17.0
    $nilai_levenshtein = round($similarity_persen * 0.2, 1);

    // =============================
// GABUNGKAN DENGAN SKOR COSINE
// =============================

$id_jawaban = $row['id'];

// skor cosine sudah ada di kolom skor
$skor_cosine = $row['skor'] ?? 0;

// skor akhir per soal = cosine + levenshtein
$skor_final_per_soal = $skor_cosine + $nilai_levenshtein;

// update skor di tabel jawaban_essay
mysqli_query($koneksi, "
    UPDATE jawaban_essay
    SET skor = '$skor_final_per_soal'
    WHERE id = '$id_jawaban'
");

    // TOTAL NILAI LEVENSHTEIN (DIJUMLAHKAN)
    $total_nilai_ld += $nilai_levenshtein;

    $hasil[] = [
        'soal' => $row['soal'],
        'kunci_asli' => $row['knc_jawaban'],
        'jawaban_asli' => $row['jawaban'],
        'prep_kunci' => $prep_kunci,
        'prep_jawaban' => $prep_jawaban,
        'distance' => $dist,
        'similarity_murni' => $similarity_murni,
        'similarity_persen' => $similarity_persen,
        'nilai_levenshtein' => $nilai_levenshtein,
        'bobot' => $row['bobot'],
        'matrix' => levenshtein_matrix($prep_kunci['final'], $prep_jawaban['final'])
    ];
}

/* ===========================
   SIMPAN NILAI (ANTI DUPLIKAT)
=========================== */

// Nilai Levenshtein = Total dari semua nilai (sudah berbobot 0.2)
$nilai_levenshtein_total = round($total_nilai_ld, 1);

// Cek apakah data sudah ada
$cek = mysqli_query($koneksi, "
    SELECT id 
    FROM nilai_essay 
    WHERE nis='$nis' 
      AND kode_kelas='$kode_kelas' 
      AND kode_mapel='$kode_mapel' 
      AND jenis_ujian='$jenis_ujian'
");

if (mysqli_num_rows($cek) > 0) {
    // Jika sudah ada → UPDATE
    $update = mysqli_query($koneksi, "
        UPDATE nilai_essay 
        SET nilai_levenshtein = '$nilai_levenshtein_total'
        WHERE nis='$nis' 
          AND kode_kelas='$kode_kelas' 
          AND kode_mapel='$kode_mapel' 
          AND jenis_ujian='$jenis_ujian'
    ");
    
    if (!$update) {
        die("Gagal update nilai levenshtein: " . mysqli_error($koneksi));
    }
} else {
    // Jika belum ada → INSERT
    $insert = mysqli_query($koneksi, "
        INSERT INTO nilai_essay 
        (nis, kode_kelas, kode_mapel, jenis_ujian, nilai_levenshtein)
        VALUES 
        ('$nis', '$kode_kelas', '$kode_mapel', '$jenis_ujian', '$nilai_levenshtein_total')
    ");
    
    if (!$insert) {
        die("Gagal insert nilai levenshtein: " . mysqli_error($koneksi));
    }
}

// Get data siswa untuk header
$siswa_query = mysqli_query($koneksi, "SELECT * FROM siswa WHERE nis='$nis'");
$siswa = mysqli_fetch_array($siswa_query);

$kelas_query = mysqli_query($koneksi, "SELECT * FROM kelas WHERE kode_kelas='$kode_kelas'");
$kelas = mysqli_fetch_array($kelas_query);

$mapel_query = mysqli_query($koneksi, "SELECT * FROM mapel WHERE kode_mapel='$kode_mapel'");
$mapel = mysqli_fetch_array($mapel_query);

?>

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <title>Penilaian Esai - Levenshtein Distance</title>
  <link rel="icon" href="../../assets/img/brand/favicon.png" type="image/png">
  <link rel="stylesheet" href="../../https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700">
  <link rel="stylesheet" href="../../assets/vendor/nucleo/css/nucleo.css" type="text/css">
  <link rel="stylesheet" href="../../assets/vendor/@fortawesome/fontawesome-free/css/all.min.css" type="text/css">
  <link rel="stylesheet" href="../../assets/css/argon.css?v=1.2.0" type="text/css">
  <link href="../../assets/datatables/dataTables.bootstrap4.min.css" rel="stylesheet">
  <style>
    body {
      background: #f5f7fa;
      font-family: 'Open Sans', sans-serif;
    }
    
    .main-card {
      background: white;
      border-radius: 8px;
      box-shadow: 0 2px 4px rgba(0,0,0,0.1);
      margin-bottom: 20px;
    }
    
    .section-header {
      background: #f8f9fa;
      border-bottom: 2px solid #e9ecef;
      padding: 15px 20px;
      font-weight: 600;
      color: #2c3e50;
    }
    
    .content-box {
      padding: 20px;
    }
    
    .info-row {
      padding: 10px 0;
      border-bottom: 1px solid #e9ecef;
    }
    
    .info-row:last-child {
      border-bottom: none;
    }
    
    .info-label {
      font-weight: 600;
      color: #495057;
      min-width: 150px;
      display: inline-block;
    }
    
    .soal-card {
      background: white;
      border: 1px solid #dee2e6;
      border-radius: 6px;
      margin-bottom: 25px;
      overflow: hidden;
    }
    
    .soal-header {
      background: #e9ecef;
      padding: 12px 20px;
      border-bottom: 1px solid #dee2e6;
      display: flex;
      justify-content: space-between;
      align-items: center;
    }
    
    .soal-title {
      font-weight: 600;
      color: #2c3e50;
      margin: 0;
    }
    
    .text-box {
      background: #f8f9fa;
      border: 1px solid #dee2e6;
      padding: 12px;
      border-radius: 4px;
      margin-bottom: 15px;
    }
    
    .text-box-label {
      font-weight: 600;
      color: #495057;
      margin-bottom: 8px;
      display: block;
    }
    
    .preprocessing-table {
      width: 100%;
      margin-bottom: 20px;
    }
    
    .preprocessing-table td {
      padding: 10px;
      border: 1px solid #dee2e6;
      word-wrap: break-word;
      vertical-align: top;
    }
    
    .preprocessing-table td:first-child {
      background: #f8f9fa;
      font-weight: 600;
      width: 150px;
    }
    
    .hasil-row {
      background: #e9ecef;
      font-weight: 600;
    }
    
    .calculation-box {
      background: #f8f9fa;
      border: 1px solid #dee2e6;
      padding: 15px;
      border-radius: 4px;
      margin: 10px 0;
    }
    
    .calc-label {
      font-weight: 600;
      color: #495057;
    }
    
    .calc-value {
      color: #2c3e50;
      font-weight: 600;
    }
    
    .formula-box {
      background: white;
      border-left: 3px solid #6c757d;
      padding: 12px;
      margin: 15px 0;
    }
    
    .step-item {
      background: #f8f9fa;
      padding: 12px;
      margin: 8px 0;
      border-radius: 4px;
      border-left: 3px solid #6c757d;
    }
    
    .step-number {
      display: inline-block;
      background: #6c757d;
      color: white;
      width: 25px;
      height: 25px;
      text-align: center;
      line-height: 25px;
      border-radius: 50%;
      font-weight: 600;
      margin-right: 10px;
    }
    
    .result-box {
      background: #2c3e50;
      color: white;
      padding: 30px;
      text-align: center;
      border-radius: 8px;
      margin: 30px 0;
    }
    
    .result-value {
      font-size: 3rem;
      font-weight: 700;
      margin: 15px 0;
    }
    
    .summary-table {
      width: 100%;
      border-collapse: collapse;
    }
    
    .summary-table th,
    .summary-table td {
      padding: 12px;
      border: 1px solid #dee2e6;
      text-align: left;
    }
    
    .summary-table th {
      background: #f8f9fa;
      font-weight: 600;
    }
    
    .summary-table tfoot td {
      background: #2c3e50;
      color: white;
      font-weight: 700;
      font-size: 1.1rem;
    }
    
    .matrix-wrapper {
      background: #f8f9fa;
      padding: 15px;
      border-radius: 6px;
      overflow-x: auto;
      margin-top: 20px;
    }
    
    .matrix-table {
      font-size: 11px;
      background: white;
      border-collapse: collapse;
    }
    
    .matrix-table td {
      padding: 6px 10px;
      text-align: center;
      border: 1px solid #dee2e6;
    }
    
    .btn-back {
      background: #6c757d;
      color: white;
      padding: 12px 30px;
      border-radius: 4px;
      text-decoration: none;
      display: inline-block;
      margin-top: 20px;
    }
    
    .btn-back:hover {
      background: #5a6268;
      color: white;
      text-decoration: none;
    }
  </style>
</head>

<body>
  <nav class="sidenav navbar navbar-vertical fixed-left navbar-expand-xs navbar-light bg-white" id="sidenav-main">
    <div class="scrollbar-inner">
      <div class="sidenav-header align-items-center">
        <a class="navbar-brand" href="javascript:void(0)">
          <img src="../../assets/img/logo3.jpg" class="navbar-brand-img" alt="...">
        </a>
      </div>
      <div class="navbar-inner">
        <div class="collapse navbar-collapse" id="sidenav-collapse-main">
          <ul class="navbar-nav">
            <li class="nav-item">
              <a class="nav-link" href="beranda.php">
                <i class="ni ni-tv-2 text-warning"></i>
                <span class="nav-link-text">Dashboard</span>
              </a>
            </li>
            <li class="nav-item">
              <a class="nav-link" href="daftar_siswa.php">
                <i class="ni ni-archive-2 text-warning"></i>
                <span class="nav-link-text">Daftar Siswa</span>
              </a>
            </li>
            <li class="nav-item">
              <a class="nav-link active" href="kelas.php">
                <i class="ni ni-paper-diploma text-info"></i>
                <span class="nav-link-text">Room Kelas</span>
              </a>
            </li>
            <li class="nav-item">
              <a class="nav-link" href="../../logout.php">
                <i class="ni ni-button-power text-dark"></i>
                <span class="nav-link-text">Log Out</span>
              </a>
            </li>
          </ul>
        </div>
      </div>
    </div>
  </nav>

  <div class="main-content" id="panel">
    <nav class="navbar navbar-top navbar-expand navbar-dark bg-warning border-bottom">
      <div class="container-fluid">
        <div class="collapse navbar-collapse" id="navbarSupportedContent">
          <ul class="navbar-nav align-items-center  ml-md-auto ">
            <li class="nav-item d-xl-none">
              <div class="pr-3 sidenav-toggler sidenav-toggler-dark" data-action="sidenav-pin" data-target="#sidenav-main">
                <div class="sidenav-toggler-inner">
                  <i class="sidenav-toggler-line"></i>
                  <i class="sidenav-toggler-line"></i>
                  <i class="sidenav-toggler-line"></i>
                </div>
              </div>
            </li>
          </ul>
          <ul class="navbar-nav align-items-center ml-auto ml-md-0">
            <li class="nav-item dropdown">
              <a class="nav-link pr-0" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                <div class="media align-items-center">
                  <span class="avatar avatar-sm rounded-circle">
                    <?php 
                    $profil = mysqli_query($koneksi, "SELECT * FROM guru WHERE nip='$nip'");
                    $tampil_profil = mysqli_fetch_array($profil);
                    ?>
                    <img alt="Image placeholder" src="../../assets/img/profil_guru/<?= $tampil_profil['foto']; ?>">
                  </span>
                  <div class="media-body ml-2 d-none d-lg-block">
                    <span class="mb-0 text-sm font-weight-bold">NIP : <?= $_SESSION['nip']; ?></span>
                  </div>
                </div>
              </a>
              <div class="dropdown-menu dropdown-menu-right">
                <a href="../../logout.php" class="dropdown-item">
                  <i class="ni ni-user-run"></i>
                  <span>Logout</span>
                </a>
              </div>
            </li>
          </ul>
        </div>
      </div>
    </nav>

    <div class="header bg-warning pb-6">
      <div class="container-fluid">
        <div class="header-body">
          <div class="row">
            <div class="col-xl-12">
              
              <div class="main-card">
                <div class="section-header">
                  <h3 class="mb-0">Penilaian Esai Otomatis - Levenshtein Distance</h3>
                </div>
                <div class="content-box">

                  <!-- INFO UJIAN -->
                  <div class="main-card">
                    <div class="section-header">
                      Informasi Ujian
                    </div>
                    <div class="content-box">
                      <div class="row">
                        <div class="col-md-6">
                          <div class="info-row">
                            <span class="info-label">NIS:</span> <?= $nis; ?>
                          </div>
                          <div class="info-row">
                            <span class="info-label">Nama Siswa:</span> <?= $siswa['nama_siswa']; ?>
                          </div>
                          <div class="info-row">
                            <span class="info-label">Kelas:</span> <?= $kelas['nama_kelas']; ?>
                          </div>
                        </div>
                        <div class="col-md-6">
                          <div class="info-row">
                            <span class="info-label">Mata Pelajaran:</span> <?= $mapel['nama_mapel']; ?>
                          </div>
                          <div class="info-row">
                            <span class="info-label">Jenis Ujian:</span> <?= $jenis_ujian; ?>
                          </div>
                          <div class="info-row">
                            <span class="info-label">Jumlah Soal:</span> <?= count($hasil); ?> soal
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>

                  <!-- DETAIL PER SOAL -->
                  <?php foreach ($hasil as $i => $h) : ?>
                  <div class="soal-card">
                    <div class="soal-header">
                      <h5 class="soal-title">Soal <?= ($i+1); ?></h5>
                      <span style="font-weight: 600;">Bobot: <?= $h['bobot']; ?></span>
                    </div>
                    <div class="content-box">
                      
                      <!-- PERTANYAAN -->
                      <div class="text-box">
                        <span class="text-box-label">Pertanyaan:</span>
                        <?= $h['soal']; ?>
                      </div>

                      <!-- KUNCI & JAWABAN -->
                      <div class="row">
                        <div class="col-md-6">
                          <div class="text-box">
                            <span class="text-box-label">Kunci Jawaban:</span>
                            <?= $h['kunci_asli']; ?>
                          </div>
                        </div>
                        <div class="col-md-6">
                          <div class="text-box">
                            <span class="text-box-label">Jawaban Siswa:</span>
                            <?= $h['jawaban_asli']; ?>
                          </div>
                        </div>
                      </div>

                      <!-- PREPROCESSING KUNCI -->
                      <h6 style="margin-top: 25px; margin-bottom: 12px; font-weight: 600;">Preprocessing Kunci Jawaban</h6>
                      <table class="preprocessing-table">
                        <tr>
                          <td>Tokenizing</td>
                          <td><?= implode(', ', $h['prep_kunci']['token']); ?></td>
                        </tr>
                        <tr>
                          <td>Filtering</td>
                          <td><?= implode(', ', $h['prep_kunci']['filter']); ?></td>
                        </tr>
                        <tr>
                          <td>Stemming</td>
                          <td><?= implode(', ', $h['prep_kunci']['stem']); ?></td>
                        </tr>
                        <tr class="hasil-row">
                          <td>Hasil Akhir</td>
                          <td><?= $h['prep_kunci']['final']; ?></td>
                        </tr>
                      </table>

                      <!-- PREPROCESSING JAWABAN -->
                      <h6 style="margin-top: 25px; margin-bottom: 12px; font-weight: 600;">Preprocessing Jawaban Siswa</h6>
                      <table class="preprocessing-table">
                        <tr>
                          <td>Tokenizing</td>
                          <td><?= implode(', ', $h['prep_jawaban']['token']); ?></td>
                        </tr>
                        <tr>
                          <td>Filtering</td>
                          <td><?= implode(', ', $h['prep_jawaban']['filter']); ?></td>
                        </tr>
                        <tr>
                          <td>Stemming</td>
                          <td><?= implode(', ', $h['prep_jawaban']['stem']); ?></td>
                        </tr>
                        <tr class="hasil-row">
                          <td>Hasil Akhir</td>
                          <td><?= $h['prep_jawaban']['final']; ?></td>
                        </tr>
                      </table>

                      <!-- PERHITUNGAN LEVENSHTEIN -->
                      <h6 style="margin-top: 25px; margin-bottom: 12px; font-weight: 600;">Detail Perhitungan Levenshtein Distance</h6>
                      
                      <div class="row">
                        <div class="col-md-6">
                          <div class="calculation-box">
                            <span class="calc-label">Edit Distance:</span>
                            <span class="calc-value float-right"><?= $h['distance']; ?></span>
                          </div>
                          <div class="calculation-box">
                            <span class="calc-label">Max Length:</span>
                            <span class="calc-value float-right"><?= max(strlen($h['prep_kunci']['final']), strlen($h['prep_jawaban']['final'])); ?></span>
                          </div>
                        </div>
                        <div class="col-md-6">
                          <div class="calculation-box">
                            <span class="calc-label">Similarity Murni:</span>
                            <span class="calc-value float-right"><?= number_format($h['similarity_murni'], 4); ?></span>
                          </div>
                          <div class="formula-box">
                            <strong>Formula:</strong> <code>1 - (Distance / Max_Length)</code>
                          </div>
                        </div>
                      </div>

                      <!-- LANGKAH PERHITUNGAN -->
                      <p style="font-weight: 600; margin-top: 20px; margin-bottom: 10px;">Langkah Perhitungan:</p>
                      
                      <div class="step-item">
                        <span class="step-number">1</span>
                        <strong>Similarity Murni (0-1):</strong><br>
                        <code><?= number_format($h['similarity_murni'], 2); ?></code>
                      </div>
                      
                      <div class="step-item">
                        <span class="step-number">2</span>
                        <strong>Konversi ke Skala 0-100:</strong><br>
                        <code><?= number_format($h['similarity_murni'], 2); ?> × 100 = <?= $h['similarity_persen']; ?></code>
                      </div>
                      
                      <div class="step-item">
                        <span class="step-number">3</span>
                        <strong>Berikan Bobot 20%:</strong><br>
                        <code><?= $h['similarity_persen']; ?> × 0.2 = <?= $h['nilai_levenshtein']; ?></code>
                      </div>

                      <!-- MATRIKS LEVENSHTEIN -->
                      <div class="matrix-wrapper">
                        <h6 style="margin-bottom: 12px; font-weight: 600;">Matriks Levenshtein Distance</h6>
                        <table class="matrix-table">
                          <?php foreach ($h['matrix'] as $row_matrix) : ?>
                            <tr>
                              <?php foreach ($row_matrix as $cell) : ?>
                                <td><?= $cell; ?></td>
                              <?php endforeach; ?>
                            </tr>
                          <?php endforeach; ?>
                        </table>
                      </div>

                    </div>
                  </div>
                  <?php endforeach; ?>

                  <!-- RINGKASAN -->
                  <div class="main-card">
                    <div class="section-header">
                      Ringkasan Nilai Levenshtein Distance
                    </div>
                    <div class="content-box" style="padding: 0;">
                      <table class="summary-table">
                        <thead>
                          <tr>
                            <th>Soal</th>
                            <th>Similarity Murni (0-1)</th>
                            <th>Similarity (%)</th>
                            <th>Nilai Levenshtein (× 0.2)</th>
                          </tr>
                        </thead>
                        <tbody>
                          <?php foreach ($hasil as $i => $h) : ?>
                            <tr>
                              <td>Soal <?= ($i+1); ?></td>
                              <td><?= number_format($h['similarity_murni'], 2); ?></td>
                              <td><?= $h['similarity_persen']; ?></td>
                              <td><strong><?= $h['nilai_levenshtein']; ?></strong></td>
                            </tr>
                          <?php endforeach; ?>
                        </tbody>
                        <tfoot>
                          <tr>
                            <td colspan="3">TOTAL NILAI LEVENSHTEIN DISTANCE</td>
                            <td><?= $nilai_levenshtein_total; ?></td>
                          </tr>
                        </tfoot>
                      </table>
                    </div>
                  </div>

                  <!-- HASIL AKHIR -->
                  <div class="result-box">
                    <h4 style="margin-bottom: 10px; opacity: 0.9;">NILAI LEVENSHTEIN DISTANCE</h4>
                    <div class="result-value"><?= $nilai_levenshtein_total; ?></div>
                    <p style="margin: 0; opacity: 0.9;">Total dari <?= count($hasil); ?> soal (sudah termasuk pembobotan 20%)</p>
                  </div>

                  <!-- TOMBOL KEMBALI -->
                  <div class="text-center">
                    <a href="hasil_ujian.php?kode_mapel=<?= $kode_mapel; ?>&jenis_ujian=<?= $jenis_ujian; ?>" class="btn-back">
                      <i class="fas fa-arrow-left"></i> Kembali ke Hasil Ujian
                    </a>
                  </div>

                </div>
              </div>

            </div>
          </div>
        </div>
      </div>
    </div>
  </div>

  <script src="../../assets/vendor/jquery/dist/jquery.min.js"></script>
  <script src="../../assets/vendor/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
  <script src="../../assets/vendor/js-cookie/js.cookie.js"></script>
  <script src="../../assets/vendor/jquery.scrollbar/jquery.scrollbar.min.js"></script>
  <script src="../../assets/vendor/jquery-scroll-lock/dist/jquery-scrollLock.min.js"></script>
  <script src="../../assets/js/argon.js?v=1.2.0"></script>
</body>
</html>