<?php
defined('APK') or exit('Anda tidak dizinkan mengakses langsung script ini!');
$skl = mysqli_fetch_array(mysqli_query($koneksi, "SELECT * FROM skl  WHERE id_skl='1'"));
?>           
	<?php if ($ac == '') : ?>
                   <div class="row">
                          <div class="col-md-8">
                                <div class="card">
                                    <div class="card-header">
                                        <h5 class="card-title">SETTING BIDANG KEAHLIAN</h5>
												
                                    </div>
                                    <div class="card-body">
									
									<div class="card-box table-responsive">
                                        <table id="datatable1" class="table table-bordered table-hover" style="width:100%;font-size:12px">
                                            <thead>
                                                <tr>
                                                    <th width="5%">NO</th> 
													<th>TK</th>													                                                  
                                                    <th>ROMBEL</th>
													 <th>BIDANG KEAHLIAN</th>
													  <th>PROGRAM KEAHLIAN</th>
													 <th>PAKET KEAHLIAN</th>
                                                </tr>
                                            </thead>
                                            <tbody>
											<?php
											$no=0;							
											$query = mysqli_query($koneksi, "SELECT * FROM kelas WHERE level='$skl[tingkat]'"); 											
											  while ($data = mysqli_fetch_array($query)) :										
											$no++;
											   ?>
                                                <tr>
                                                    <td><?= $no; ?></td>
                                                     <td><?= $data['level'] ?></td>
                                                       <td><?= $data['kelas'] ?></td>
													   <td><?= $data['bidang'] ?></td>
													  <td><?= $data['program'] ?></td>
													   <td><?= $data['paket'] ?></td>
                                                </tr>
												<?php endwhile; ?>
												</tbody>
                                                </table>
												 </div>
											</div>
										</div>
										
									</div>
									
					       <div class="col-md-4">
                     
                                <div class="card widget widget-payment-request">
                                    <div class="card-header">
                                  
                                    </div>
                                    <div class="card-body">
                                        <div class="widget-payment-request-container">
                                            <div class="widget-payment-request-author">
                                                <div class="avatar m-r-sm">
                                                    <img src="../images/user.png" alt="">
                                                </div>
                                                <div class="widget-payment-request-author-info">
                                                    <span class="widget-payment-request-author-name"><?= strtoupper($user['nama']) ?></span>
                                                    <span class="widget-payment-request-author-about"><?= $setting['sekolah'] ?></span>
                                               
											   </div>
                                            </div>
											
									<div class="widget-payment-request-info m-t-md">
									 <div class="d-grid gap-2">
									<button class="btn btn-primary" type="button" disabled>
										<span class="spinner-grow spinner-grow-sm" role="status" aria-hidden="true"></span>
										 SETTING BIDANG KEAHLIAN
									</button>
											</div>
											
									  <form id='menu'   class="form-horizontal" >                        
                               <div class="col-md-12">
								<label class="form-label bold">Tingkat</label>
								<select name='level' id='level' class='form-select' required='true' style="width: 100%">
								    <option value="<?= $skl['tingkat'] ?>"><?= $skl['tingkat'] ?></option>									
									 </select>
							     </div>	
							     <div class="col-md-12">
								<label class="form-label bold">Rombel</label>
								<select name="kelas" class='form-select' required='true' style="width: 100%">
										<?php													
										$kls = mysqli_query($koneksi, "SELECT * FROM kelas where  level='$skl[tingkat]'");
										while ($kelas = mysqli_fetch_array($kls)) {										
										echo "<option value='$kelas[kelas]'>$kelas[kelas]</option>";
													}
													?>				
									 </select>
							     </div>	            
								
							<div class="col-md-12">
								<label class="form-label bold">Bidang Keahlian</label>
								<input type="text" name="bk" class="form-control" required="true">
							</div>
							 
								 <div class="col-md-12">
								<label class="form-label bold">Program Keahlian</label>
								<input type="text" name="pk" class="form-control" required="true">
							          </div>
								<div class="col-md-12">
								<label class="form-label bold">Paket Keahlian</label>
								<input type="text" name="paket" class="form-control" required="true">
							          </div>	  
									  
									  <p>
									  
								           <div class="d-grid gap-2">
                                       <button id="blockui-3" class="btn btn-primary">SIMPAN</button>
                           
                                            </div>
									    </form>
										</div>
									 </div>
					            </div>
								</div>
							</div>
						</div>
					</div>
				
				<script>
				  $('#menu').submit(function(e) {
        e.preventDefault();
        var data = new FormData(this);
      
        $.ajax({
            type: 'POST',
            url: 'cbtserver_skl/crud_skl.php?pg=prodi',
            enctype: 'multipart/form-data',
            data: data,
            cache: false,
            contentType: false,
            processData: false,
            success: function(data) {
          
                setTimeout(function() {
                    window.location.reload();
                }, 2000);

            }
        });
        return false;
    });
</script>
<?php endif ?>
					  
					  
					  
					  	  
					  
					  
					