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

      
			<div class="col-md-6">
						 <div class="card">
             <div class="card-header">	
                    </div>
                     <div class='card-body'>
                        <div class='form-group-sm'>
                      <div class='row'>
                      <form id='formsiswa' enctype='multipart/form-data'>
                           <div class='col-md-12'>
                            <label>Pilih File</label>
                    <input type='file' name='file' class='form-control' required='true' />
                       </div><p>
                  <div class='kanan'>
                      <a href="?pg=nilaiujian&ac=view" class='btn btn-primary'><i class='material-icons'>search</i>Lihat</a>
                                    
                     <button type='submit' name='submit' id="blockui-3" class='btn btn-success'><i class='material-icons'>upload</i>Impor</button>
                         </div>								
                      </form>
                      </div>
                    	 </div>
						     </div>	
						         </div>
						            </div>	
										 <script>
										$('#formsiswa').submit(function(e){
											e.preventDefault();
											var data = new FormData(this);
											$.ajax(
											{
												type: 'POST',
												 url: 'cbtserver_skl/tujian.php',
												data: data,
												cache: false,
												contentType: false,
												processData: false,
												success: function(data){   		
												setTimeout(function()
													{
													window.location.reload();
															}, 1500);
																		  
															}
														});
													return false;
												});
											</script>	

									  
       <div class='col-md-6'>
           <div class="card">
             <div class="card-header">	
                    <h5 class='card-title'>Nilai Ujian</h5>
					</div>    
			  <div class='card-body'>
            <div class="alert alert-dark alert-style-light" role="alert">  
                  Pastikaan Nomor Urut Mapel dan Kelompok Mapel Sudah di isi. Jika belum diisi maka tidak muncul pada Pilih Mapel</b>          
							</div>	
							<div class="d-grid gap-2">
						<button class="btn btn-dark" type="button" disabled>
							<span class="spinner-grow spinner-grow-sm" role="status" aria-hidden="true"></span>
							Digunakan Untuk Transkip Nilai
						</button>
						</div><p>
						<form id="formpengaturan" action='cbtserver_skl/proses_ujian.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-9">
							   <select id='level' name='level' class='form-select' required='true'>
                                      <option value=''>Pilih Tingkat</option>
                                       <?php $quem = mysqli_query($koneksi, "SELECT * FROM skl"); ?>
                                                <?php while ($m = mysqli_fetch_array($quem)) : ?>
                                                    <option value="<?= $m['tingkat'] ?>"><?= $m['tingkat'] ?></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-9">
							<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">Kelompok</label>
							<div class="col-sm-9">
							   <select id='kelompok' name='kelompok' class='form-select' required='true'>
                                      <option value=''>Pilih Kelompok Mapel</option>	
													<?php if($setting['jenjang']=='SD' OR $setting['jenjang']=='SMP' OR $setting['jenjang']=='PAKET-A' OR $setting['jenjang']=='PAKET-B'): ?>
                                                       
                                                         <option value='A'>A. Umum</option>
														  <option value='B'>B. Muatan Lokal</option>
													  
													   <?php elseif($setting['jenjang']=='SMA' OR $setting['jenjang']=='PAKET-C'): ?>
													    <option value='A'>A. Umum</option>
														  <option value='B'>B. Umum</option>
														   <option value='C'>C. Peminatan</option>
														   <?php elseif($setting['jenjang']=='SMK'): ?>
													    <option value='A'>A. Muatan Nasional</option>
														  <option value='B'>B. Muatan Kewilayahan</option>
														   <option value='C1'>C1. Dasar Bidang Keahlian</option>
														    <option value='C2'>C2. Dasar Program Keahlian</option>
															 <option value='C3'>C3. Kompetensi Keahlian</option>
													<?php endif; ?>
                                                    </select>       
										   </div>
						            </div>
							 <div class="row mb-2">
							<label  class="col-md-3 col-form-label bold">Pilih Mapel</label>
							<div class="col-sm-9">
							<select name='mapel' id="mapel" class='form-select'  required='true'>
                            
                                                </select>
                                            </div>
                                        </div>
							 
							
													 <div class="kanan">
											   <button type='submit'  class='btn btn-primary'><i class='material-icons' >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: "cbtserver_skl/crud_skl.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: "cbtserver_skl/crud_skl.php?pg=ambil", 
						data: "kelompok=" + kelompok, 
						success: function(response) { 
							$("#mapel").html(response);
						}
					});
				});				
			</script>
					 
						
						
						 <script>
				  $("#levelQ").change(function() {
					var levelQ = $(this).val();
					console.log(levelQ);
					$.ajax({
						type: "POST", 
						url: "cbtserver_pk/crud_pk.php?pg=ambil_kelasQ", 
						data: "levelQ=" + levelQ, 
						success: function(response) { 
							$("#kelasQ").html(response);
						}
					});
				});						
			</script>
						
					
		
		 
<?php } elseif ($ac == 'view') { ?>
<div class='row'>

        <div class='col-md-12'>
             <div class="card">
             <div class="card-header">	
                  <h5 class='card-title'><i class="fas fa-eye"></i> View Nilai Semester</h4></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 Nomor Urut Mapel dan Kelompok Mapel Sudah di isi. Jika belum diisi maka tidak muncul pada Pilih Mapel</b>          
							  </span>
                            </div>
                                </div>				
						<div class="card-body">
						<form action='?pg=viewujian'  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 skl"); ?>
                                                <?php while ($m = mysqli_fetch_array($quem)) : ?>
                                                    <option value="<?= $m['tingkat'] ?>"><?= $m['tingkat'] ?></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">Kelompok Mapel</label>
							<div class="col-sm-7">
							   <select id='kelompok' name='kelompok' class='form-select' required='true'>
													<option value=''>Pilih Kelompok Mapel</option>
													<?php if($setting['jenjang']=='SD' OR $setting['jenjang']=='SMP'): ?>
                                                       
                                                         <option value='A'>A. Umum</option>
														  <option value='B'>B. Muatan Lokal</option>
													  
													   <?php elseif($setting['jenjang']=='SMA'): ?>
													    <option value='A'>A. Umum</option>
														  <option value='B'>B. Umum</option>
														   <option value='C'>C. Peminatan</option>
														   <?php elseif($setting['jenjang']=='SMK'): ?>
													    <option value='A'>A. Muatan Nasional</option>
														  <option value='B'>B. Muatan Kewilayahan</option>
														   <option value='C'>C. Muatan Peminatan Kejuruan</option>
														   
													<?php endif; ?>
                                                    </select>       
													   </div>
												</div>
												 <div class="row mb-2">
												<label  class="col-md-3 col-form-label bold">Pilih Mapel</label>
												<div class="col-sm-7">
												<div class="input-group">
												<select name='mapel' id="mapel" class='form-select'  required='true'>
												
                                                </select>
												<span class="input-group-btn">
											   <button type='submit'  class='btn  btn-primary'><i class='fa fa-eye' ></i><span> View Nilai</span></button>
											  </span>
                                            </div>
                                        </div>
							
									  
                                       </div>
						            </div>	
								
									           </form>
								            
											</div>
										</div>
									</div>
								</div> 
               <script>
				  $("#level").change(function() {
					var level = $(this).val();
					console.log(level);
					$.ajax({
						type: "POST", 
						url: "cbtserver_skl/crud_skl.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: "cbtserver_skl/crud_skl.php?pg=ambil", 
						data: "kelompok=" + kelompok, 
						success: function(response) { 
							$("#mapel").html(response);
						}
					});
				});				
			</script>
					 
<?php } ?>	