<?php
defined('APK') or exit('Anda tidak dizinkan mengakses langsung script ini!');
?>
<?php if ($ac == '') { ?>
<div class='row'>

        <div class='col-md-7'>
           <div class="card">
             <div class="card-header">	
                    <h5 class='card-title'><i class="fas fa-download"></i> Rekap Nilai Ujian</h5>
					</div>    
			  <div class='card-body'>
             <div class="alert alert-custom" role="alert">
               <div class="custom-alert-icon icon-dark"><i class="fa fa-check fa-2x"></i></div>
                 <div class="alert-content">
                  <span class="alert-text" style="text-align:justify">
                  Pastikaan Ujian Sudah dilaksanakan. Jika belum dilaksanakan maka tidak muncul pada Pilih Rekap Nilai</b>          
							  </span>
                            </div>
                                </div>				
						<div class="card-body">
						<form id="formpengaturan" action='sandik_nilai/rekap_excel.php'  method='post' class="form-horizontal" enctype='multipart/form-data'>
                          <div class="row mb-2">
							<label  class="col-md-3 col-form-label bold">Tingkat</label>
							<div class="col-sm-7">
							   <select id='level' name='level' class='form-select' required='true'>
                                      <option value=''>Pilih Tingkat</option>
                                       <?php $quem = mysqli_query($koneksi, "SELECT * FROM siswa GROUP BY level"); ?>
                                                <?php while ($m = mysqli_fetch_array($quem)) : ?>
                                                    <option value="<?= $m['level'] ?>"><?= $m['level'] ?></option>
                                                <?php endwhile ?>
                                                    </select>            
										   </div>
						            </div>
							 <div class="row mb-2">
							<label  class="col-md-3 col-form-label bold">Kelas</label>
							<div class="col-sm-7">
							<select name='kelas' id="kelas" class='form-select'  required='true'>
                            
                                                </select>
                                            </div>
                                        </div>
							
							 <div class="row mb-2">
							<label  class="col-md-3 col-form-label bold">Pilih Ujian</label>
							<div class="col-sm-9">
							  <select name='jenis' class='form-select' required='true'>
                                     <?php $quem = mysqli_query($koneksi, "SELECT * FROM jenis WHERE status='aktif'"); ?>
                                                <?php while ($m = mysqli_fetch_array($quem)) : ?>
                                                    <option value="<?= $m['id_jenis'] ?>"><?= $m['nama'] ?></option>
                                                <?php endwhile ?>
                                                    </select> 
							                        </div>
                                                </div>
							
													 <div class="right">
											   <button type='submit'  class='btn btn-sm  btn-outline-success'><i class='fa fa-download' ></i>Download</button>
											  
                                       </div>
						           
								
									           </form>
								            
											</div>
										</div>
									</div>
								</div> 
                          		 <script>
				  $("#level").change(function() {
					var level = $(this).val();
					console.log(level);
					$.ajax({
						type: "POST", 
						url: "sandik_pk/crud_pk.php?pg=ambil_kelas", 
						data: "level=" + level, 
						success: function(response) { 
							$("#kelas").html(response);
						}
					});
				});			
        			   $("#kelompok").change(function() {
					var kelompok = $(this).val();
					console.log(kelompok);
					$.ajax({
						type: "POST", 
						url: "sandik_skl/crud_skl.php?pg=ambil", 
						data: "kelompok=" + kelompok, 
						success: function(response) { 
							$("#mapel").html(response);
						}
					});
				});				
			</script>
					 
			<div class="col-md-5">
						 <div class="card">
             <div class="card-header">	
                    </div>
                     <div class='card-body'>
                         <div class='table-responsive'>
                        <table style="font-size: 12px" id='daatable' class='table'>
                            <thead>
                                <tr>
                                    <th width='3px'>No</th>
									<th>Kode Ujian</th>
									<th>Kode Mapel</th>
                                </tr>
                            </thead>
							
							<tbody>
							
                                <?php
								$no = 0;
								
								 $query = mysqli_query($koneksi, "select * from ujian");							  
                            while ($ujian = mysqli_fetch_array($query)) {							
                                $no++;
                            ?>
							 <tr>
                                    <td><?= $no; ?></td>
									 <td><?= $ujian['kode_nama'] ?></td>
									 <td><?= $ujian['nama'] ?></td>
							       
                                     
							       </tr>
                            <?php } ?>
                        </tbody>
                        </table>
                            </div>
                        </div>
						
						
                    	 </div>
						     </div>	
						         </div>
						            </div>	
									  
                                    
						
						
						 <script>
				  $("#levelQ").change(function() {
					var levelQ = $(this).val();
					console.log(levelQ);
					$.ajax({
						type: "POST", 
						url: "sandik_pk/crud_pk.php?pg=ambil_kelasQ", 
						data: "levelQ=" + levelQ, 
						success: function(response) { 
							$("#kelasQ").html(response);
						}
					});
				});						
			</script>
						
						<script>
    $('#formsiswa').on('submit', function(e) {
        e.preventDefault();
        $.ajax({
            type: 'post',
            url: 'sandik_skl/crud_ujian.php',
            data: new FormData(this),
            processData: false,
            contentType: false,
            cache: false,
            beforeSend: function() {
                $('#progressbox').html('<div><img src="<?= $homeurl ?>/dist/img/animasi1.gif" style="margin-left:100px"></div>');
                $('.progress-bar').animate({
                    width: "30%"
                }, 100);
            },
            success: function(response) {
                setTimeout(function() {
                    $('.progress-bar').css({
                        width: "100%"
                    });
                    setTimeout(function() {
                        $('#hasilimport').html(response);
						});
						setTimeout(function() {
                    window.location.reload();
                    }, 2000);
                }, 2000);
            }
        });
    });
</script>

		
		 

<?php } ?>	