<?php
defined('APK') or exit('Anda tidak dizinkan mengakses langsung script ini!');
?>
<?php
if($menu['absen_siswa']=='0'){{$absis="Manual";}}elseif($menu['absen_siswa']=='1'){{$absis="RFID";}}
if($menu['absen_guru']=='0'){{$abgur="Manual";}}elseif($menu['absen_guru']=='1'){{$abgur="RFID";}}
if($menu['soal']=='0'){{$soal="CBT";}}elseif($menu['soal']=='1'){{$soal="AKM";}}

?>

<div class='row'>
        <div class='col-md-7'>
         <div class="card">
             <div class="card-header">	
                  <h5 class='card-title'><i class="fas fa-tools"></i> Pengaturan Kurikulum</h5></div>    
			 
						<div class="card-body">
                    <form id='menu'   class="form-horizontal" >
									
					         <div class="row mb-1">
							<label class="col-md-3 col-form-label bold">Tingkat Kelas</label>
							<div class="col-sm-6">
						   <select name='level'  class='form-select' required='true'>
                                      <option value=""></option>
                                        <?php
                                        $lev = mysqli_query($koneksi, "SELECT * FROM level");
                                        while ($level = mysqli_fetch_array($lev)) {
                                            echo "<option value='$level[kode_level]'>$level[kode_level]</option>";
                                        }
                                        ?>
                                    </select>
                                 
							</div>
		                    </div>
							
					      <div class="row mb-1">
							<label class="col-md-3 col-form-label bold">Kurikulum</label>
							<div class="col-sm-9">
						   <select name="kurikulum"  class="form-select" style="width: 100%;" required>
							      <option value=""></option>
								  <option value="K-13">K-13</option>
			                      <option value="Merdeka">Merdeka</option>
                                  </select>
								</div>  
							</div>
						   <button type='submit' name='submit' class='btn btn-outline-primary right'><i class='fa fa-check-circle'></i>Simpan</button>
                        
					  </form>
                        </div>
					 </div>
                   </div>
			    
				<div class='col-md-5'>
						<div class="card">
             <div class="card-header"></div>	
					<div class="card-body">
						<div class='table-responsive'>
                    <table id='table1' class='table table-hover'>
                        <thead>
                            <tr>
                                <th width='5px'>#</th>
                               
                                <th>Tingkat</th>
                                <th>Rombel</th>
                                <th>Kurikulum</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php $lev = mysqli_query($koneksi, "SELECT * FROM kelas ORDER BY level ASC"); ?>
                            <?php while ($k = mysqli_fetch_array($lev)) : ?>
                                <?php $no++; ?>
                                <tr>
                                    <td><?= $no ?></td>
                                    <td><?= $k['level'] ?></td>
                                    <td><?= $k['id_kelas'] ?></td>
                                    <td><?= $k['kurikulum'] ?></td>  
                                    
                                </tr>
                            <?php endwhile ?>
                        </tbody>
                    </table>
                </div>
             </div>
			  </div>
             </div>
						  <script>
				  $('#menu').submit(function(e) {
        e.preventDefault();
        var data = new FormData(this);
      
        $.ajax({
            type: 'POST',
            url: 'sandik_ptm/crud_setting.php?pg=setting_kurikulum',
            enctype: 'multipart/form-data',
            data: data,
            cache: false,
            contentType: false,
            processData: false,
            success: function(data) {
               iziToast.info({
					title: 'Sukses!',
					message: 'Data berhasil disimpan',
					titleColor: '#FFFF00',
					messageColor: '#fff',
					backgroundColor: 'rgba(0, 0, 0, 0.5)',
					progressBarColor: '#FFFF00',
					position: 'topRight'			  
                });
                setTimeout(function() {
                    window.location.reload();
                }, 2000);

            }
        });
        return false;
    });
</script>
