<?php
defined('APK') or exit('Anda tidak dizinkan mengakses langsung script ini!');

?>
<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'>
                        <?php if ($user['level'] == 'admin') : ?>
                            
                            <a href='?pg=impor5' class='btn btn-sm btn-success'><i class='fa fa-upload'></i> <span class='hidden-xs'> Impor Nilai</span></a>
                           
                        <?php endif ?>
                    </div>
					 <h4 class='box-title'><i class="fas fa-upload fa-fw"></i> Nilai US Kelompok (C3)</h4>
                </div>
				
			  <div class="box-body">
                    <ul class="nav nav-tabs">
                        <li class="active"><a href="#tab_1" data-toggle="tab" aria-expanded="true" >Data Nilai</a></li>
                        
                    </ul>
					
					<div class="tab-content">
                        <div class="tab-pane active" id="tab_1" >
						<br>
						<div class="panel panel-default">	
                <div class='box-body'>
                <div class="table-responsive">
                    <table style="font-size: 12px" class="table table-bordered table-hover" id="example1">
                        <thead>
                            <tr>
                                <th class="text-center" width="3%" rowspan="3">
                                    #
                                </th>
                                <th width="5%" rowspan="3">Kelas</th>
                                <th rowspan="3">Nama Siswa</th>
								
								</tr>
								
							 <tr>
                                 <?php $queryx = mysqli_query($koneksi, "select * from mata_pelajaran WHERE kelompok='C3'");
                                while ($mapel = mysqli_fetch_array($queryx)) { ?>
								
							
                                    <th width="5%" colspan="2" style="text-align:center"><?= $mapel['kode_mapel'] ?></th>
									
                                <?php
                                }
                                ?>
								</tr><tr>
								  <?php $queryx = mysqli_query($koneksi, "select * from mata_pelajaran WHERE kelompok='C3'");
                                while ($mapel = mysqli_fetch_array($queryx)) { ?>
								
								<th>Praktek</th>
								    <th>Teori</th>
									
                                <?php
                                }
                                ?>
                            </tr>
                        </thead>
                        <tbody>
                            <?php
                            $query = mysqli_query($koneksi, "select * from nilai_transkip GROUP BY nis");
                            $no = 0;
                            while ($s = mysqli_fetch_array($query)) {
								$siswa = fetch($koneksi,'siswa',['nis'=>$s['nis']]);
                                $no++;
                            ?>
                                <tr>
                                    <td><?= $no; ?></td>
                                   <td><?= $siswa['id_kelas'] ?></td>
                                    <td><?= $siswa['nama'] ?></td>

                                    <?php
                                    $queryx = mysqli_query($koneksi, "select * from mata_pelajaran WHERE kelompok='C3'");
                                    while ($mapel = mysqli_fetch_array($queryx)) {
                                       $nilaiP = mysqli_fetch_array(mysqli_query($koneksi, "SELECT * FROM nilai_transkip WHERE mapel='$mapel[kode_mapel]' and nis='$s[nis]' AND jenis='PRAKTEK'"));
									    $nilaiT = mysqli_fetch_array(mysqli_query($koneksi, "SELECT * FROM nilai_transkip WHERE mapel='$mapel[kode_mapel]' and nis='$s[nis]' AND jenis='TEORI'"));
                                    ?>

                                        <td><?= $nilaiP['nilai'] ?></td>
										<td><?= $nilaiT['nilai'] ?></td>
                                    <?php
                                    }
                                    ?>
                                </tr>

                            <?php }
                            ?>

                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
