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


?>


                        <div class="row">
                           <div class="col-xl-8">
                                <div class="card widget widget-payment-request">
                                    <div class="card-header">
                                        <h5 class="card-title">
										<?php
									if (isset($_POST['dari'])) { ?>
										
                                      <h5>Absen Tanggal <span class="badge badge-primary">
									<?= date('d M Y',strtotime($_POST['dari'])) ?> 
									</span></h5> <p>
									<?php } ?>
										<button class="btn btn-secondary kanan" type="button" disabled>
                                      <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span> 
									<?= buat_tanggal('D, d M Y') ?> </button>
										</h5>
                                    </div>
									
                                    <div class="card-body">
									
									
                                         <div class="card-box table-responsive">
                                        <table id="datatable1" class="table table-bordered table-hover" style="width:100%">
                                            <thead>
                                                <tr>
                                                    <th>No</th>
                                                    <th>NAMA LENGKAP</th>
                                                    <th>JABATAN</th>
                                                    <th>KETERANGAN</th>
                                                    
                                                </tr>
                                            </thead>
                                            <tbody>
											<?php
											
											$no=0; 
											if (isset($_POST['dari'])) {
											$dari = $_POST['dari'];
											$query = mysqli_query($koneksi, "SELECT * FROM absensi WHERE tanggal='$dari' AND level='pegawai'"); 
											}else{
												$query = mysqli_query($koneksi, "SELECT * FROM absensi WHERE tanggal='$tanggal' AND level='pegawai'"); 
											}
											 while ($data = mysqli_fetch_array($query)) :
				                              $peg = fetch($koneksi,'users',['id_user'=>$data['idpeg']]);
											$no++;
											   ?>
                                                <tr>
                                                    <td><?= $no; ?></td>
                                                    <td><?= $peg['nama'] ?></td>
                                                     <td><?= strtoupper($peg['level']); ?></td>
                                                    <td><?= $data['keterangan'] ?></td>
                                                    
                                                </tr>
												<?php endwhile; ?>
                                                </table>
												 </div>
                                            
                                           
                                        </div>
                                    </div>
                                </div>
                         
                             <div class="col-xl-4">
                                <div class="card widget widget-payment-request">
                                    <div class="card-header">
                                        <h5 class="card-title">DATA PRESENSI PEGAWAI</h5>
                                    </div>
                                    <div class="card-body">
									 <form id="formabsen" method="POST" action="" enctype="multipart/form-data">
                                        <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"><?= $setting['sekolah'] ?></span>
                                                    <span class="widget-payment-request-author-about"><?= date('d M Y') ?></span>
                                                </div>
                                            </div>
                                            
                                            <div class="widget-payment-request-info m-t-md">
                                                <div class="widget-payment-request-info-item">
                                                    <span class="widget-payment-request-info-title d-block">
													<label>TANGGAL</label>
                                                  <input type='text' name='dari'  class='datepicker form-control'  required="true" autocomplete="off" />
                                                 
												
													</span>                                                  
                                                </div>                                               
                                            </div>
											<p>
                                           <div class="d-grid gap-2">
                                             
                                                <button type="submit"  class="btn btn-primary flex-grow-1 m-l-xxs">CARI</button>
                                            </div>
                                        </div>
										</form>
										<p>
                                    </div>
                                </div>
                            </div>
                        </div>
                             	
					</div>
                     	