<?php 
session_start();
require"inc/auth.php";
include"inc/conn.php";
include"inc/session_siswa.php";
?>
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="utf-8">
  <meta content="width=device-width, initial-scale=1.0" name="viewport">

  <title><?php echo $rsiswa_login['nama_lengkap'];?> | Profil Pengguna</title>
  <meta content="" name="description">
  <meta content="" name="keywords">

  <?php 
  include"inc/style.php";
  ?>
  <script src="assets/js/jquery.min.js"></script>
    <script type="text/javascript">
      
      $('document').ready(function () {
        
        $("#tombolsubmit").hide();

        $("#imgload").change(function () {
            if (this.files && this.files[0]) {
                var reader = new FileReader();
                reader.onload = function (e) {
                    $('#imgshow').attr('src', e.target.result);
                    $("#tombolsubmit").show();
                }
                reader.readAsDataURL(this.files[0]);
            }
        });

    

      });
    </script>
    <style>
    .image-upload>input {
        display: none;
    }
    #imgshow:hover{
      opacity: 0.3;
      cursor:pointer;
    }
    </style>
  
</head>

<body>

  <?php include"inc/menu.php";?>

  
  <main id="main">
    
    <!-- ======= Breadcrumbs ======= -->
    <section class="breadcrumbs">
      <div class="container">

      </div>
    </section><!-- End Breadcrumbs -->
    

    <section id="contact" class="contact">

      <div class="container" data-aos="fade-up">

        <header class="section-header">
          <p>Hasil Penilaian</p>
        </header>

        <div class="row gy-4">

         

          <div class="col-lg-12">
            <form action="forms/contact.php" method="post" class="php-email-form">
              <div class="row gy-4">

                <h3 style="color:#d7528a;"><?php echo $rsiswa_login['nama_lengkap'];?></h3>

                <div class="col-md-12">
                  <div class="table-responsive">
                  <table class="table table-hover" style="color:#d7528a;">
                    <thead>
                      <tr>
                        <th width="3%" scope="col">No</th>
                        <th width="37%" scope="col">Materi</th>
                        <th width="20%" scope="col">Status</th>
                        <th width="15%" scope="col">Skor Pretest</th>
                        <th width="15%" scope="col">Nilai Latihan Soal</th>
                      </tr>
                    </thead>
                    <tbody>
                      <?php
                      $bilangan=1;
                      $qunit=mysqli_query($connect,"select * from tb_unit order by id_unit asc");
                      while($runit=mysqli_fetch_array($qunit)){
                      ?>
                      <tr>
                        <th scope="row"><?php echo $bilangan++;?></th>
                        <td><b style="color:#d7528a;"><?php echo $runit['judul_unit'];?></b></td>
                        <td>

                            <?php
                            $qcek=mysqli_query($connect,"select * from tb_jawaban where id_siswa='".$rsiswa_login['id_siswa']."' AND id_unit='".$runit['id_unit']."'");
                            $jumjawaban=mysqli_num_rows($qcek);
                            if($jumjawaban>0){
                            ?>
                            <span class="badge bg-success">Dikerjakan</span>
                            <?php }else{?>
                            <span class="badge bg-danger">Kosong</span>
                            <?php }?>

                        </td>
                        <td>
                          <?php
                          if($jumjawaban>0){
                            include"inc/skor2_pretest.php";
                          }else{
                            echo"-";
                          }
                          ?>
                        </td>
                        <td>
                          <?php
                          if($jumjawaban>0){
                            include"inc/skor2.php";
                          }else{
                            echo"-";
                          }
                          ?>
                        </td>
                      </tr>
                      <?php }?>
                    </tbody>
                  </table>
                  </div>
                </div>

              </div>
            </form>

          </div>

        </div>

      </div>

    </section>

    
  </main><!-- End #main -->

  <!-- ======= Footer ======= -->
  <footer id="footer" class="footer">

    <?php include"inc/footer.php";?>
    
  </footer><!-- End Footer -->

  <a href="#" class="back-to-top d-flex align-items-center justify-content-center"><i class="bi bi-arrow-up-short"></i></a>

  <?php include"inc/script.php";?>

</body>

</html>