<?php 
session_start();
require"inc/auth.php";
?>

<?php 
  include"inc/conn.php";
  include"inc/session_siswa.php";
  include"inc/style.php";

  $id = $_GET["id"];
  $qunit=mysqli_query($connect,"select * from tb_unit where id_unit='".$id."' and aktif='1'");
  $runit=mysqli_fetch_array($qunit);

  $qcek=mysqli_query($connect,"select * from tb_jawaban_umpanbalik where id_siswa='".$rsiswa_login['id_siswa']."'");
  $jumjawaban=mysqli_num_rows($qcek);
?>

<!DOCTYPE html>
<html lang="en">

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

  <title>Umpan Balik | <?php echo $runit['judul_unit'];?></title>
  <meta content="" name="description">
  <meta content="" name="keywords">

  
  
</head>

<body>

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

  
  <main id="main">
    
    <!-- ======= Breadcrumbs ======= -->
    <section class="breadcrumbs">
      <div class="container" style="color:grey;">
        
      </div>
    </section><!-- End Breadcrumbs -->
    

    <!-- ======= Blog Single Section ======= -->
    <section id="blog" class="blog" style="margin-top:30px;">
      <div class="container">

        <div class="row">
        
          <div class="col-lg-12 entries">
            
            
            <header class="section-header">
				<p>Umpan Balik</p>
			</header>
            <article class="entry entry-single" style="border-top:17px solid #c2326f;border-bottom:17px solid #c2326f;border-radius:5px;">

              

              <?php
              if($jumjawaban<1){
              ?>






              <form action="simpanjawabanumpanbalik" method="POST">
              <div class="entry-content">

                          <div class="tab-content py-3 px-3 px-sm-0" id="nav-tabContent">
                           
                           
                            
                           

                            <?php
                            $bilangan=1;
                            $urutan=0;
                            $qessai=mysqli_query($connect,"select * from tb_umpanbalik");
                            $jum2=mysqli_num_rows($qessai);
                            while($ressai=mysqli_fetch_array($qessai)){
                            
                            $urutan++;
                            ?>

                            <input type="hidden" name="id_siswa" value="<?php echo $rsiswa_login['id_siswa'];?>">
                            <input type="hidden" name="id_unit" value="<?php echo $runit['id_unit'];?>">
                            <input type="hidden" name="id_umpanbalik[]" value="<?php echo $ressai['id_umpanbalik'];?>">


                            <table border=0 width="100%" cellpadding="5">
                              <tr>
                                <td rowspan=2 width="3%" align="center" valign="top" rowspan=2>
                                  <?php echo $bilangan++;?>.
                                </td>
                                <td width="97%" style="padding-bottom:5px;">
                                  <?php echo $ressai['soal'];?>
                                </td>
                              </tr>
                              <tr>
                                <td width="98%">
                                    <textarea name="jawaban[]" class="form-control" required="required"></textarea>
                                </td>
                              </tr>
                              
                              
                            </table>
                            <br>
                            <?php }?>

                            <?php if($jum2<1){?>
                                  <div class="alert alert-danger text-center" role="alert">
                                    <i class="fa fa-exclamation fa-2x"></i><br><i>Tidak ditemukan data soal</i>
                                  </div>
                              <?php }?>

                                
                          </div>
              </div>




              <?php if($jum2>0){?>
             
              <button class="btn btn-success scrollto d-inline-flex align-items-center justify-content-center align-self-center" style="width:100%;background:#d7528a;color:white;border;0px;">
                  <span>Simpan Umpan Balik</span>
              </button>
              <?php }?>

              
            </article>
            </form>





            














































            <?php }else{?>


              <div class="entry-content">

                          <div class="tab-content py-3 px-3 px-sm-0" id="nav-tabContent">
                           
                           
                            <div class="alert alert-success text-center" role="alert" style="background:#fbf1f6;border:0px;color:#d7528a;">
                              Terimakasih telah memberikan umpan balik untuk e-modul ini
                            </div>

                                
                          </div>
              </div>


            </article>

            <?php }?>























































       

              

          </div><!-- End blog entries list -->

          

        </div>

      </div>
    </section><!-- End Blog Single 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>