<?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-print"></i> Cetak Nilai</h5></div>    
     					
						<div class="card-body">
						<form id="formpengaturan" action='?pg=cetaknilai&ac=siswa'  method='post' class="form-horizontal" enctype='multipart/form-data'>
                            <div class="row mb-2">
							<label  class="col-md-3 col-form-label bold">Pilih Tingkat</label>
							<div class="col-sm-5">
							   <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-9">
							<select name='kelas' id="kelas" class='form-select'  required='true'>
                            
                                                </select>
                                            </div>
                                        </div>
							
							<div class="right">
							
											   <button type='submit'  class='btn btn-sm  btn-default'><i class='fa fa-print' ></i><span> Print Nilai</span></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);
						}
					});
				});		
						
			</script>
<?php } elseif ($ac == 'siswa') { ?>
    <?php
	$kelas = $_POST['kelas']; 
	$kelasQ = fetch($koneksi,'kelas',['id_kelas'=>$kelas]);
	?>
	 <div class='row'>
	<div class='col-md-12'>
            <div class="card">
             <div class="card-header">	
                    <h5 class='card-title'><i class="fas fa-graduation-cap"></i> Cetak Nilai</h5>
                </div>
				
			
            <div class='card-body'>
                   <div class='table-responsive'>
                        <table style="font-size: 11px" id='example1' class='table'>
                            <thead>
                            <tr>
                             <th width="5%" class="text-center">
                                    #
                                </th>
                                <th>Kelas</th>
                                <th>N I S</th>
							     <th>N I S N</th>
								  <th>Nama Siswa</th>
							<th width="5%" style="text-align:center">Nilai</th>
							
                            </tr>
                        </thead>
                        <tbody>
                            <?php
                            $query = mysqli_query($koneksi, "select * FROM siswa WHERE id_kelas='$_POST[kelas]'");
                            $no = 0;
                            while ($siswa = mysqli_fetch_array($query)) {
							
                                $no++;
                            ?>
                                <tr>
                                    <td><?= $no; ?></td>
									<td><?= $siswa['id_kelas'] ?></td>
									<td><?= $siswa['nis'] ?></td>
									<td><?= $siswa['nisn'] ?></td>
									<td><?= $siswa['nama'] ?></td>
									<td>
									<?php if($kelasQ['kurikulum']=='K-13' AND $kelasQ['model_rapor']=='1'):?>
									<a href="sandik_binduk/print_rapor_k13.php?nis=<?= $siswa['nis'] ?>" target="_blank" class="btn btn-sm btn-outline-success"><i class="fas fa-print"></i></a>
									<?php elseif($kelasQ['kurikulum']=='K-13' AND $kelasQ['model_rapor']=='2') : ?>
										<a href="sandik_binduk/print_rapor_k13baru.php?nis=<?= $siswa['nis'] ?>" target="_blank" class="btn btn-sm btn-outline-success"><i class="fas fa-print"></i></a>
									<?php elseif($kelasQ['kurikulum']=='Merdeka' AND $kelasQ['model_rapor']=='3') : ?>
									<a href="sandik_binduk/print_raporikm.php?ids=<?= $siswa['id_siswa'] ?>" target="_blank" class="btn btn-sm btn-outline-success"><i class="fas fa-print"></i></a>
									<?php endif; ?>
									</td>
									</tr>
								
                            <?php }
                            ?>

                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
<?php } elseif ($ac == 'detail') { ?>

<div class='row'>
	 <div class='col-md-12'>
             <div class='panel panel-default'>
               <div class="panel-heading" style="height:45px">
                     <div class='box-tools pull-right'>
					 
                </div>
					<h4 class='box-title'><i class="fas fa-graduation-cap"></i> E-Rapor</h4>
                </div>
				<div class='box-header with-border '>
			   <div class='box-tools pull-right '>
			   <table>
			   <tr>
			   <td>
			   <div class="form-group-sm">
			  <select name='jenjang' class='form-control' >
              <option value=""><?= $setting['sekolah'] ?></option>
               </select>
			   </div>
				</td>
			   <td>
			   <div class="form-group-sm">
			  <select name='jenjang' class='form-control' >
              <option value=""><?= $setting['jenjang'] ?></option>
               </select>
			   </div>
				</td>
				<td>
				<div class="form-group-sm">
			  <select name='jenjang' class='form-control'>
               <option value=""><?= $setting['kota'] ?></option>
               </select>
			   </div>
				</td>
				<td>
				<div class="form-group-sm">
			  <select name='jenjang' class='form-control' >
               <option value=""><?= $setting['kecamatan'] ?></option>
               </select>
			   </div>
				</td>
				</tr>					
			</table>
			</div>
			 <h4 class='box-title'></h4>
			  </div>
			  <div class="box-body">
                    <ul class="nav nav-tabs">
                        <li class="active"><a href="#tab_1" data-toggle="tab" aria-expanded="true" >Menu PTM</a></li>
                    </ul>
					<div class="tab-content">
                    <div class="tab-pane active" id="tab_1" >
				<div class="panel panel-default">
				 <div class='box-body'>
       		  <div class='row'>
        <div class='col-md-12'>
           <div class="panel panel-default">
                <div class='box-header'>
                    <h4 class='box-title'>Detail Nilai Formatif</h4>
                   
				</div>
					
                <div class='box-body'>
                    <div class='table-responsive'>
                        <table style="font-size: 11px" id='example1' class='table table-hover'>
                            <thead >
                                <tr>
                                    <th width='5px'>No</th>
									 <th width='5%'>Tingkat</th>	
									  <th width='5%'>Kelas</th>
									 <th width='5%'>Fase</th>	
									<th width='5%'>No Urut</th>
                                    <th>Kode</th>  
									<th>Nama Mapel</th> 
																	
									
									<th width='5%'>Action</th>
									
										</tr>
									</thead>							
							<tbody>							
                                <?php
								$no=0;
								$query = mysqli_query($koneksi, "select * FROM jadwal_proto
								JOIN mapel_proto ON mapel_proto.kode_mapel=jadwal_proto.kode WHERE jadwal_proto.kelas='$_GET[kelas]' ");
								 while ($mapel = mysqli_fetch_array($query)) {
									 $no++;
                                ?>
							 <tr>
                                    <td><?= $no; ?></td>
									<td><?= $mapel['tingkat'] ?></td>
									<td><?= $mapel['kelas'] ?></td>
									<td><?= $mapel['fase'] ?></td>
							        <td><?= $mapel['nourut'] ?></td>
									<td ><?= $mapel['kode_mapel'] ?></td>
									<td ><?= $mapel['nama_mapel'] ?></td>
									
									<td>
									 <button class='btn btn-xs btn-flat btn-danger' onclick="frames['frameresult<?= $no ?>'].print()"><i class='fa fa-print'></i> </button>                                        
										 <iframe id='loadframe' name="frameresult<?= $no ?>" src="m_rapor/detailformatif.php?kelas=<?= $mapel['kelas'] ?>&mapel=<?= $mapel['kode_mapel'] ?>" style='display:none'></iframe>
 
									</td>
   			
							       </tr>
                           <?php } ?>
                        </tbody>
                        </table>
                      </div>
                     </div>
					</div>
                  </div>
				</div>
				<?php } elseif ($ac == 'detailsum') { ?>

<div class='row'>
	 <div class='col-md-12'>
             <div class='panel panel-default'>
               <div class="panel-heading" style="height:45px">
                     <div class='box-tools pull-right'>
					 
                </div>
					<h4 class='box-title'><i class="fas fa-graduation-cap"></i> E-Rapor</h4>
                </div>
				<div class='box-header with-border '>
			   <div class='box-tools pull-right '>
			   <table>
			   <tr>
			   <td>
			   <div class="form-group-sm">
			  <select name='jenjang' class='form-control' >
              <option value=""><?= $setting['sekolah'] ?></option>
               </select>
			   </div>
				</td>
			   <td>
			   <div class="form-group-sm">
			  <select name='jenjang' class='form-control' >
              <option value=""><?= $setting['jenjang'] ?></option>
               </select>
			   </div>
				</td>
				<td>
				<div class="form-group-sm">
			  <select name='jenjang' class='form-control'>
               <option value=""><?= $setting['kota'] ?></option>
               </select>
			   </div>
				</td>
				<td>
				<div class="form-group-sm">
			  <select name='jenjang' class='form-control' >
               <option value=""><?= $setting['kecamatan'] ?></option>
               </select>
			   </div>
				</td>
				</tr>					
			</table>
			</div>
			 <h4 class='box-title'></h4>
			  </div>
			  <div class="box-body">
                    <ul class="nav nav-tabs">
                        <li class="active"><a href="#tab_1" data-toggle="tab" aria-expanded="true" >Menu PTM</a></li>
                    </ul>
					<div class="tab-content">
                    <div class="tab-pane active" id="tab_1" >
				<div class="panel panel-default">
				 <div class='box-body'>
       		  <div class='row'>
        <div class='col-md-12'>
           <div class="panel panel-default">
                <div class='box-header'>
                    <h4 class='box-title'>Detail Nilai Sumatif</h4>
                   
				</div>
					
                <div class='box-body'>
                    <div class='table-responsive'>
                        <table style="font-size: 11px" id='example1' class='table table-hover'>
                            <thead >
                                <tr>
                                    <th width='5px'>No</th>
									 <th width='5%'>Tingkat</th>	
									  <th width='5%'>Kelas</th>
									 <th width='5%'>Fase</th>	
									<th width='5%'>No Urut</th>
                                    <th>Kode</th>  
									<th>Nama Mapel</th> 
																	
									
									<th width='5%'>Action</th>
									
										</tr>
									</thead>							
							<tbody>							
                                <?php
								$no=0;
								$query = mysqli_query($koneksi, "select * FROM jadwal_proto
								JOIN mapel_proto ON mapel_proto.kode_mapel=jadwal_proto.kode WHERE jadwal_proto.kelas='$_GET[kelas]' ");
								 while ($mapel = mysqli_fetch_array($query)) {
									 $no++;
                                ?>
							 <tr>
                                    <td><?= $no; ?></td>
									<td><?= $mapel['tingkat'] ?></td>
									<td><?= $mapel['kelas'] ?></td>
									<td><?= $mapel['fase'] ?></td>
							        <td><?= $mapel['nourut'] ?></td>
									<td ><?= $mapel['kode_mapel'] ?></td>
									<td ><?= $mapel['nama_mapel'] ?></td>
									
									<td>
									<button class='btn btn-xs btn-flat btn-danger' onclick="frames['frameresult<?= $no ?>'].print()"><i class='fa fa-print'></i> </button>                                        
										 <iframe id='loadframe' name="frameresult<?= $no ?>" src="m_rapor/detailsumatif.php?kelas=<?= $mapel['kelas'] ?>&mapel=<?= $mapel['kode_mapel'] ?>" style='display:none'></iframe>
 
									</td>
   			
							       </tr>
                           <?php } ?>
                        </tbody>
                        </table>
                      </div>
                     </div>
					</div>
                  </div>
				</div>
				<?php } elseif ($ac == 'siswapts') { ?>
    <?php $kelas = $_GET['kelas']; ?>
	 <div class='row'>
	<div class='col-md-12'>
             <div class='panel panel-default'>
               <div class="panel-heading" style="height:45px">
                    <div class='box-tools pull-right '>
					 
                    </div>
					<h4 class='box-title'><i class="fas fa-graduation-cap"></i> Cetak Rapor</h4>
                </div>
				<div class='box-header with-border '>
			   <div class='box-tools pull-right '>
			   <table>
			   <tr>
			   <td>
			   <div class="form-group-sm">
			  <select name='jenjang' class='form-control' >
              <option value=""><?= $setting['sekolah'] ?></option>
               </select>
			   </div>
				</td>
			   <td>
			   <div class="form-group-sm">
			  <select name='jenjang' class='form-control' >
              <option value=""><?= $setting['jenjang'] ?></option>
               </select>
			   </div>
				</td>
				<td>
				<div class="form-group-sm">
			  <select name='jenjang' class='form-control'>
               <option value=""><?= $setting['kota'] ?></option>
               </select>
			   </div>
				</td>
				<td>
				<div class="form-group-sm">
			  <select name='jenjang' class='form-control' >
               <option value=""><?= $setting['kecamatan'] ?></option>
               </select>
			   </div>
				</td>
				</tr>					
			</table>
			</div>
			 <h4 class='box-title'></h4>
			  </div>
			  <div class="box-body">
                    <ul class="nav nav-tabs">
                        <li class="active"><a href="#tab_1" data-toggle="tab" aria-expanded="true" >E-Rapor</a></li>
                    </ul>
					<div class="tab-content">
                    <div class="tab-pane active" id="tab_1" >
				<div class="panel panel-default">
				 
				 <div class='row'>
        <div class='col-md-12'>
          
            <div class='box-body'>
                   <div class='table-responsive'>
                        <table style="font-size: 11px" id='tabelekstra' class='table'>
                            <thead>
                            <tr>
                             <th width="5%" class="text-center">
                                    #
                                </th>
                                <th width="5%">Kelas</th>
                                <th>Nama Siswa</th>
							<th width="5%" style="text-align:center">Cover</th>
							<th width="5%" style="text-align:center">Biodata</th>
							<th width="5%" style="text-align:center">Rapor PTS</th>
							
                            </tr>
                        </thead>
                        <tbody>
                            <?php
                            $query = mysqli_query($koneksi, "select * FROM siswa_ptm WHERE id_kelas='$_GET[kelas]'");
                            $no = 0;
                            while ($siswa = mysqli_fetch_array($query)) {
							
                                $no++;
                            ?>
                                <tr>
                                    <td><?= $no; ?></td>
									<td><?= $siswa['id_kelas'] ?></td>
									<td><?= $siswa['nama'] ?></td>
									<td>
									<a href="m_rapor/print_cover.php?ids=<?= $siswa['id_siswa'] ?>" target="_blank" class="btn btn-sm btn-primary"><i class="fas fa-graduation-cap"></i></a>
									</td>
									<td>
									<a href="m_rapor/print_biodata.php?ids=<?= $siswa['id_siswa'] ?>" target="_blank" class="btn btn-sm btn-warning"><i class="fas fa-user-cog"></i></a>
									</td>
									<td>
									<a href="m_rapor/rapor_pts.php?nis=<?= $siswa['nis'] ?>" target="_blank" class="btn btn-sm btn-success"><i class="fas fa-print"></i></a>
									</td>
									</tr>
								
                            <?php }
                            ?>

                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
	<?php } ?>