<?php
 session_start();
 include "header.php";
 include "sidebar.php";
 include "config.php"; 
?>

  
  <main id="main" class="main">

    <div class="pagetitle">
      <nav>
        <ol class="breadcrumb">
          <li class="breadcrumb-item"><a href="index.php">Home</a></li>
          <li class="breadcrumb-item active">Laporan RPP</li>
        </ol>
      </nav>
    </div><!-- End Page Title -->
	<section class="section">
      <div class="row">
        <div class="col-lg-6">

	<div class="card">
            <div class="card-body">
			 <form name="edit" method="post" action="laporan.php">
               <h5 class="card-title">Lihat Data Beban Kerja Guru</h5>
			  <div class="btn-group" role="group" aria-label="Basic example">
			  <label for="inputEmail1" class="col-sm-3 col-form-label">Tapel / Smt</label> 
			    <select name="itapel" id="itapel" class="form-select" required >
						  <option value="">Tapel ...</option>
						  <?php  
							  $aa= mysqli_query($mysqli,"SELECT * FROM tapel ");
							  while($a1= mysqli_fetch_array($aa)){
							  $nilai="";
							  $nilai2=" | ";
							  $nilai=$a1['nama'].$nilai2.$a1['semester'];
						  ?>
							  <option value="<?php echo $a1['Idtapel'] ?>"><?php echo  $nilai ?></option>
							  <?php }?>
							</select>
			
			 <button type="submit" name="simpan" class="btn btn-primary">Lihat Data</button>
          
            </div>
          </div>
	</div>
	</div>
	</form>
	
	
	<?php
	if(isset($_POST['simpan'])){
	$pilihtapel = $_POST["itapel"];
	$aa= mysqli_query($mysqli,"SELECT * FROM tapel where Idtapel='$pilihtapel' ");
	$a1= mysqli_fetch_array($aa);
	$namatapel=$a1['nama'];
	$smt=$a1['semester'];
   ?>
    <section class="section">
      <div class="row">
        <div class="col-lg-12">

          <div class="card">
            <div class="card-body">
               <h5 class="card-title">Laporan Rencana Pembelajaran Guru  <?php echo " Semester $smt Tahun Pelajaran $namatapel ";?> </h5> 
			   <?php echo" <a href=\"laptoxls1.php?id=$pilihtapel\"><button type=\"button\" class=\"btn btn-primary\" target=\"_blank\"><i class=\"bi bi-file-spreadsheet\"></i> Ekspor ke Excel</button></a>";?>
              <!-- Table with stripped rows -->
			  <div class="table-container">
              <table>
                <thead>
                  <tr bgcolor=#6da66a>
                    <th scope="col">No</th>
					<th scope="col">ID RPP</th>
                    <th scope="col">Nama Guru</th>
                    <th scope="col">Mata Pelajaran</th>
                    <th scope="col">Kelas</th>
                    <th scope="col">Tanggal Kirim</th>
					<th scope="col">Tanggal Verifikasi</th>
					<th scope="col">Catatan</th>
					<th scope="col">Pengawas</th>
					<th scope="col">Status</th>
					<th scope="col">Kalender Akademik</th>
					<th scope="col">Rincian Pekan Efektif</th>
					<th scope="col">Analisis Alokasi Waktu</th>
					<th scope="col">CP / Layanan </th>
					<th scope="col">TP dan ATP </th>
					<th scope="col">Prota </th>
					<th scope="col">Promes </th>
					<th scope="col">KKTP </th>
					<th scope="col">Modul Ajar / RPP </th>
					<th scope="col">Pemetaan CP (KBC & DPL) </th>
					
                  </tr>
                </thead>
                <tbody>
				<?php
				
				$result = mysqli_query($mysqli, "SELECT drpp.Idrpp kodeid,tapel.nama nmtapel,tapel.semester, user.madrasah, user.nama nmguru,mapel.nama nmmapel, kelas.nama nmkelas,drpp.kaldik,drpp.rpe,drpp.alokasiwaktu,drpp.cp,drpp.atp,drpp.prota,drpp.promes, drpp.kktp,drpp.modulrpp,drpp.tglkirim, drpp.tglvalidasi, drpp.catatan,drpp.peta_cp,drpp.catat_pengawas,drpp.validasi FROM drpp,tapel,user,mapel,kelas WHERE drpp.Iduser=user.Iduser AND drpp.Idtapel=tapel.Idtapel AND drpp.Idmapel=mapel.Idmapel AND drpp.Idkelas=kelas.Idkelas AND drpp.Idtapel='$pilihtapel' ORDER BY drpp.Idrpp ASC");
				$counter=0;
				// Fetch the next row of a result set as an associative array
				while ($res = mysqli_fetch_assoc($result)) {
					$counter=$counter+1;
					if ($counter % 2) {
						echo "<tr>";
					} else {
						  echo "<tr bgcolor='#d9d9d9'>";
					 }
					?>
				   <td scope="row">
					<?php
					echo " $counter </td>";
					echo "<td>".$res['kodeid']."</td>";
					echo "<td>".$res['nmguru']."</td>";
					echo "<td>".$res['nmmapel']."</td>";
					echo "<td>".$res['nmkelas']."</td>";
					echo "<td>".$res['tglkirim']."</td>";
					echo "<td>".$res['tglvalidasi']."</td>";
					echo "<td>".$res['catatan']."</td>";
					echo "<td>".$res['catat_pengawas']."</td>";
					echo "<td>".$res['validasi']."</td>";
					echo "<td>".$res['kaldik']."</td>";
					echo "<td>".$res['rpe']."</td>";
					echo "<td>".$res['alokasiwaktu']."</td>";
					echo "<td>".$res['cp']."</td>";
					echo "<td>".$res['atp']."</td>";
					echo "<td>".$res['prota']."</td>";
					echo "<td>".$res['promes']."</td>";
					echo "<td>".$res['kktp']."</td>";
					echo "<td>".$res['modulrpp']."</td>";
					echo "<td>".$res['peta_cp']."</td>";
					echo "</tr>";
					
					
				 
				}
						?>
                                 
                </tbody>
              </table>
			  </div>
			  <!-- End Table with stripped rows -->

            </div>
          </div>

        </div>
      </div>
    </section>
	<?php
	}
	?>

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

  <!-- ======= Footer ======= -->
  <?php
 include "footer.php";
?>
 