 <?php
defined('APK') or exit('Anda tidak dizinkan mengakses langsung script ini!');
?>
<?php if ($ac == '') { ?>
   
	<div class='row'>
        <div class='col-md-12'>
            <div class='panel panel-default'>
               <div class="panel-heading" style="height:45px">
                  <h4 class='box-title'><i class="fas fa-calendar"></i> Absensi Pegawai</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" >Absensi</a></li>
                        
                    </ul>
					
					<div class="tab-content">
                        <div class="tab-pane active" id="tab_1" >
						<br>
						<div class='row'>
				
	<div class='col-md-4'>
           <div class="panel panel-default">
                <div class='box-header with-border '>
                    <h3 class='box-title'><i class="fas fa-globe fa-fw"></i> Input Absen Tidak Hadir</h3>
                    <div class='box-tools pull-right'>
					
										</div>
									</div>
									<form id="formabsen" action='' method='post'>
									<div class='box-body'>
									  <div class='form-group-sm'>									
									                                        
                                        <label>Tanggal</label>
									   <input type="text"  name="tanggal" class="form-control" value="<?= date('Y-m-d') ?>" readonly >
                                                   
                                                </div>
												 <div class='form-group-sm'>
                                                   <label>Nama Pegawai</label>
												   <select class="form-control" name="faceid" required>
													 <option value="" selected="">Pilih Pegawai</option>
												<?php $q = mysqli_query($koneksi, "select * from logface 
												JOIN users ON users.face_id=logface.faceid WHERE logface.level='pegawai' ");
												while ($lok = mysqli_fetch_array($q)) { ?>
													<option value="<?= $lok['faceid'] ?>"><?= $lok['nama'] ?></option>
												<?php } ?>
												</select>    
                                                </div>
												<div class='form-group-sm'>
                                                   <label>Ketidak hadiran</label>
												   <select class="form-control" name="ket" required>
													 <option value="" selected="">Pilih Alasan Tidak Hadir</option>
												      <option value="S">Sakit</option>
													   <option value="I">Izin</option>
													      <option value="A">Tanpa Keterangan</option>
												</select>    
                                                </div>
												</div>
                                                <div class='modal-footer'>
                                            <div class='box-tools pull-right btn-group'>
                                                <button type='submit' name='submit' class='btn btn-sm btn-primary'><i class='fa fa-check'></i> Simpan</button>
                                               
                                            </div>
                                        </div>
                                    </form>
                               
                        </div>
                    </div>
	        <script>
  $('#formabsen').submit(function(e) {
        e.preventDefault();
        $.ajax({
            type: 'POST',
            url: 'ptm/m_absen/crud_absen.php?pg=tambah',
            data: $(this).serialize(),
            beforeSend: function() {
                $('form button').on("click", function(e) {
                    e.preventDefault();
                });
            },
            success: function(data) {
                console.log(data);
                if (data == 'OK') {
                   Swal.fire({	
				title: '<a href="#" class="sandik" style="color:blue">Data berhasil disimpan</a>',				
				showConfirmButton: false,
				 animation: false,
				  customClass: 'animated tada',				  
				  imageUrl: '../dist/img/sandik_kecil.gif',
                 footer: '<a href="#"><b style="color:red">Sistem Administrasi Pendidik (SANDIK)</b></a>'
                    });
                    setTimeout(function() {
                        window.location.replace('?pg=');
                    }, 2000);
                } else {
                    Swal.fire({	
				title: '<a href="#" class="sandik" style="color:red">Gagal.. Absen sudah tercatat</a>',				
				showConfirmButton: false,
				 animation: false,
				  customClass: 'animated tada',				  
				  imageUrl: '../dist/img/sandik_kecil.gif',
                 footer: '<a href="#"><b style="color:red">Sistem Administrasi Pendidik (SANDIK)</b></a>'
                    });
					setTimeout(function() {
                        window.location.reload();
                    }, 2000);
                }

            }
        });
        return false;
    });
   
</script>	
					
        <div class='col-md-8'>
            <div class="panel panel-default">
                <div class='box-header with-border '>
                    <h3 class='box-title'><i class="fas fa-globe fa-fw   "></i>Absen Wajah</h3>
                    <div class='box-tools pull-right'>
					
                    </div>
                </div><!-- /.box-header -->
                <div class='box-body'>
                    <div class='table-responsive'>
                        <table style="font-size: 11px" id='example1' class='table'>
                            <thead>
                                <tr>
                                    <th width='3px' style="text-align: center">No</th>
									 <th style="text-align: center" width="20%">Tanggal</th>
                                    <th style="text-align: center">Nama</th>  
                                     <th style="text-align: center" width="5%">Masuk</th> 
										<th style="text-align: center" width="5%">Pulang</th> 
										<th style="text-align: center" width="10%">Ket</th>
											<th style="text-align: center" width="5%">Level</th> 
									
                                </tr>
                            </thead>
							
							<tbody>
							
                                <?php
								$no = 0;
								$tanggal=date('Y-m-d');
							$query = mysqli_query($koneksi,"select * from users
			JOIN logface ON logface.idguru=users.id_pengawas
			LEFT JOIN absensi ON absensi.faceid=logface.faceid  WHERE absensi.tanggal='$tanggal'");
							 
              while ($absen = mysqli_fetch_array($query)) {	
                                $no++;
                            ?>
							 <tr>
                                    <td style="text-align: center"><?= $no; ?></td>
									 <td style="text-align: center"> <?= $absen['tanggal'] ?></td>
							        <td><?= $absen['nama'] ?></td>
									  <td style="text-align: center"><?= $absen['jam_masuk'] ?></td>
									   <td style="text-align: center"><?= $absen['jam_pulang'] ?></td>
									    <td style="text-align: center">
										<?php if($absen['ket']=="H"){ ?>
										<b>Hadir</b>
										<?php } ?>
										<?php if($absen['ket']=="S"){ ?>
										<b>Sakit</b>
										<?php } ?>
										<?php if($absen['ket']=="I"){ ?>
										<b>Izin</b>
										<?php } ?>
										<?php if($absen['ket']=="A"){ ?>
										<b style="color : red;">Alpha</b>
										<?php } ?>
										</td>
										 <td style="text-align: center">
										 PEGAWAI
										 </td>
                                  
                              		
							       </tr>
                            <?php } ?>
                        </tbody>
                        </table>
                    </div>
                    </div>
					</div>
					
                      
                </div>
            </div>
        </div>
    </div>
 
	
	<?php } elseif ($ac == 'rfid') { ?>
	<div class='row'>
        <div class='col-md-12'>
            <div class='panel panel-default'>
               <div class="panel-heading" style="height:45px">
                  <h4 class='box-title'><i class="fas fa-calendar"></i> Absensi Pegawai</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" >Absensi</a></li>
                        
                    </ul>
					
					<div class="tab-content">
                        <div class="tab-pane active" id="tab_1" >
						<br>
						<div class='row'>
				
	<div class='col-md-4'>
           <div class="panel panel-default">
                <div class='box-header with-border '>
                    <h3 class='box-title'><i class="fas fa-globe fa-fw"></i> Input Absen Tidak Hadir</h3>
                    <div class='box-tools pull-right'>
					
										</div>
									</div>
									<form id="formabsen" action='' method='post'>
									<div class='box-body'>
									  <div class='form-group-sm'>									
									                                        
                                        <label>Tanggal</label>
									   <input type="text"  name="tanggal" class="form-control" value="<?= date('Y-m-d') ?>" readonly >
                                                   
                                                </div>
												 <div class='form-group-sm'>
                                                   <label>Nama Pegawai</label>
												   <select class="form-control" name="nokartu" required>
													 <option value="" selected="">Pilih Pegawai</option>
												<?php $q = mysqli_query($koneksi, "select * from datarfid WHERE level='pegawai' ");
												while ($lok = mysqli_fetch_array($q)) { ?>
													<option value="<?= $lok['nokartu'] ?>"><?= $lok['nama'] ?></option>
												<?php } ?>
												</select>    
                                                </div>
												<div class='form-group-sm'>
                                                   <label>Ketidak hadiran</label>
												   <select class="form-control" name="ket" required>
													 <option value="" selected="">Pilih Alasan Tidak Hadir</option>
												      <option value="S">Sakit</option>
													   <option value="I">Izin</option>
													      <option value="A">Tanpa Keterangan</option>
												</select>    
                                                </div>
												</div>
                                                <div class='modal-footer'>
                                            <div class='box-tools pull-right btn-group'>
                                                <button type='submit' name='submit' class='btn btn-sm btn-primary'><i class='fa fa-check'></i> Simpan</button>
                                               
                                            </div>
                                        </div>
                                    </form>
                               
                        </div>
                    </div>
	        <script>
  $('#formabsen').submit(function(e) {
        e.preventDefault();
        $.ajax({
            type: 'POST',
            url: 'ptm/m_absen/crud_absen.php?pg=tambah_rfid',
            data: $(this).serialize(),
            beforeSend: function() {
                $('form button').on("click", function(e) {
                    e.preventDefault();
                });
            },
            success: function(data) {
                console.log(data);
                if (data == 'OK') {
                   Swal.fire({	
				title: '<a href="#" class="sandik" style="color:blue">Data berhasil disimpan</a>',				
				showConfirmButton: false,
				 animation: false,
				  customClass: 'animated tada',				  
				  imageUrl: '../dist/img/sandik_kecil.gif',
                 footer: '<a href="#"><b style="color:red">Sistem Administrasi Pendidik (SANDIK)</b></a>'
                    });
                    setTimeout(function() {
                        window.location.replace('?pg=');
                    }, 2000);
                } else {
                    Swal.fire({	
				title: '<a href="#" class="sandik" style="color:red">Gagal.. Absen sudah tercatat</a>',				
				showConfirmButton: false,
				 animation: false,
				  customClass: 'animated tada',				  
				  imageUrl: '../dist/img/sandik_kecil.gif',
                 footer: '<a href="#"><b style="color:red">Sistem Administrasi Pendidik (SANDIK)</b></a>'
                    });
					setTimeout(function() {
                        window.location.reload();
                    }, 2000);
                }

            }
        });
        return false;
    });
   
</script>	
					
        <div class='col-md-8'>
            <div class="panel panel-default">
                <div class='box-header with-border '>
                    <h3 class='box-title'><i class="fas fa-globe fa-fw   "></i>Absen RFID</h3>
                    <div class='box-tools pull-right'>
					
                    </div>
                </div><!-- /.box-header -->
                <div class='box-body'>
                    <div class='table-responsive'>
                        <table style="font-size: 11px" id='example1' class='table'>
                            <thead>
                                <tr>
                                    <th width='3px' style="text-align: center">No</th>
									 <th style="text-align: center" width="20%">Tanggal</th>
                                    <th style="text-align: center">Nama</th>  
                                     <th style="text-align: center" width="5%">Masuk</th> 
										<th style="text-align: center" width="5%">Pulang</th> 
										<th style="text-align: center" width="10%">Ket</th>
											<th style="text-align: center" width="5%">Level</th> 
									
                                </tr>
                            </thead>
							
							<tbody>
							
                                <?php
								$no = 0;
								$tanggal=date('Y-m-d');
							$query = mysqli_query($koneksi,"select * from users
			JOIN datarfid ON datarfid.idpeg=users.id_pengawas
			LEFT JOIN absensi ON absensi.nokartu=datarfid.nokartu WHERE absensi.tanggal='$tanggal'");
			 while ($absen = mysqli_fetch_array($query)) {	
                                $no++;
                            ?>
							 <tr>
                                    <td style="text-align: center"><?= $no; ?></td>
									 <td style="text-align: center"> <?= $absen['tanggal'] ?></td>
							        <td><?= $absen['nama'] ?></td>
									  <td style="text-align: center"><?= $absen['jam_masuk'] ?></td>
									   <td style="text-align: center"><?= $absen['jam_pulang'] ?></td>
									    <td style="text-align: center">
										<?php if($absen['ket']=="H"){ ?>
										<b>Hadir</b>
										<?php } ?>
										<?php if($absen['ket']=="S"){ ?>
										<b>Sakit</b>
										<?php } ?>
										<?php if($absen['ket']=="I"){ ?>
										<b>Izin</b>
										<?php } ?>
										<?php if($absen['ket']=="A"){ ?>
										<b style="color : red;">Alpha</b>
										<?php } ?>
										</td>
										 <td style="text-align: center">
										 PEGAWAI
										 </td>
                                  
                              		
							       </tr>
                            <?php } ?>
                        </tbody>
                        </table>
                    </div>
                    </div>
					</div>
					
                      
                </div>
            </div>
        </div>
    </div>
	
	
	
	<?php } elseif ($ac == 'manual') { ?>
	<div class='row'>
        <div class='col-md-12'>
            <div class='panel panel-default'>
               <div class="panel-heading" style="height:45px">
                  <h4 class='box-title'><i class="fas fa-calendar"></i> Absensi Pegawai</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" >Absensi</a></li>
                        
                    </ul>
					
					<div class="tab-content">
                        <div class="tab-pane active" id="tab_1" >
						<br>
						<div class='row'>
				
	<div class='col-md-4'>
           <div class="panel panel-default">
                <div class='box-header with-border '>
                    <h3 class='box-title'><i class="fas fa-globe fa-fw"></i> Input Absensi Pegawai</h3>
                    <div class='box-tools pull-right'>
					
										</div>
									</div>
									<form id="formabsen" action='' method='post'>
									<div class='box-body'>
									  <div class='form-group-sm'>									
									                                        
                                        <label>Tanggal</label>
									   <input type="text"  name="tanggal" class="form-control" value="<?= date('Y-m-d') ?>" readonly >
                                                   
                                                </div>
												 <div class='form-group-sm'>
                                                   <label>Nama Pegawai</label>
												   <select class="form-control" name="idpeg" required>
													 <option value="" selected="">Pilih Pegawai</option>
												<?php $q = mysqli_query($koneksi, "select * from users WHERE level<>'admin' ");
												while ($lok = mysqli_fetch_array($q)) { ?>
													<option value="<?= $lok['id_pengawas'] ?>"><?= $lok['nama'] ?></option>
												<?php } ?>
												</select>    
                                                </div>
												<div class='form-group-sm'>
                                                   <label>Absensi</label>
												   <select class="form-control" name="ket" required>
													 <option value="" selected="">Pilih Absen</option>
													  <option value="H">Hadir</option>
												      <option value="S">Sakit</option>
													   <option value="I">Izin</option>
													      <option value="A">Tanpa Keterangan</option>
												</select>    
                                                </div>
												</div>
                                                <div class='modal-footer'>
                                            <div class='box-tools pull-right btn-group'>
                                                <button type='submit' name='submit' class='btn btn-sm btn-primary'><i class='fa fa-check'></i> Simpan</button>
                                               
                                            </div>
                                        </div>
                                    </form>
                               
                        </div>
                    </div>
	        <script>
  $('#formabsen').submit(function(e) {
        e.preventDefault();
        $.ajax({
            type: 'POST',
            url: 'ptm/m_absen/crud_absen.php?pg=tambah_manual',
            data: $(this).serialize(),
            beforeSend: function() {
                $('form button').on("click", function(e) {
                    e.preventDefault();
                });
            },
            success: function(data) {
                console.log(data);
                if (data == 'OK') {
                                       Swal.fire({	
				title: '<a href="#" class="sandik" style="color:blue">Data berhasil disimpan</a>',				
				showConfirmButton: false,
				 animation: false,
				  customClass: 'animated tada',				  
				  imageUrl: '../dist/img/sandik_kecil.gif',
                 footer: '<a href="#"><b style="color:red">Sistem Administrasi Pendidik (SANDIK)</b></a>'
                    });
                    setTimeout(function() {
                        window.location.replace('?pg=');
                    }, 2000);
                } else {
                    Swal.fire({	
				title: '<a href="#" class="sandik" style="color:red">Gagal.. Absen sudah tercatat</a>',				
				showConfirmButton: false,
				 animation: false,
				  customClass: 'animated tada',				  
				  imageUrl: '../dist/img/sandik_kecil.gif',
                 footer: '<a href="#"><b style="color:red">Sistem Administrasi Pendidik (SANDIK)</b></a>'
                    });
					setTimeout(function() {
                        window.location.reload();
                    }, 2000);
                }

            }
        });
        return false;
    });
   
</script>	
					
        <div class='col-md-8'>
            <div class="panel panel-default">
                <div class='box-header with-border '>
                    <h3 class='box-title'><i class="fas fa-globe fa-fw   "></i>Absen Manual & GPS</h3>
                    <div class='box-tools pull-right'>
					
                    </div>
                </div><!-- /.box-header -->
                <div class='box-body'>
                    <div class='table-responsive'>
                        <table style="font-size: 11px" id='example1' class='table'>
                            <thead>
                                <tr>
                                    <th width='3px' style="text-align: center">No</th>
									 <th style="text-align: center" width="20%">Tanggal</th>
                                    <th style="text-align: center">Nama</th>  
                                    
										<th style="text-align: center" width="10%">Ket</th>
											<th style="text-align: center" width="5%">Level</th> 
									
                                </tr>
                            </thead>
							
							<tbody>
							
                                <?php
								$no = 0;
								$tanggal=date('Y-m-d');
							$query = mysqli_query($koneksi,"select * from users
			
		JOIN absensi ON absensi.guru=users.id_pengawas  WHERE absensi.tanggal='$tanggal' ");
			 while ($absen = mysqli_fetch_array($query)) {	
                                $no++;
                            ?>
							 <tr>
                                    <td style="text-align: center"><?= $no; ?></td>
									 <td style="text-align: center"> <?= $absen['tanggal'] ?></td>
							        <td><?= $absen['nama'] ?></td>
									  
									    <td style="text-align: center">
										<?php if($absen['ket']=="H"){ ?>
										<b>Hadir</b>
										<?php } ?>
										<?php if($absen['ket']=="S"){ ?>
										<b>Sakit</b>
										<?php } ?>
										<?php if($absen['ket']=="I"){ ?>
										<b>Izin</b>
										<?php } ?>
										<?php if($absen['ket']=="A"){ ?>
										<b style="color : red;">Alpha</b>
										<?php } ?>
										</td>
										 <td style="text-align: center">
										 PEGAWAI
										 </td>
                                  
                              		
							       </tr>
                            <?php } ?>
                        </tbody>
                        </table>
                    </div>
                    </div>
					</div>
					
                      
                </div>
            </div>
        </div>
    </div>
	<?php  }elseif ($ac == 'qr'){  ?>
	<div class='row'>
        <div class='col-md-12'>
            <div class='panel panel-default'>
               <div class="panel-heading" style="height:45px">
                  <h4 class='box-title'><i class="fas fa-calendar"></i> Absensi Pegawai</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" >Absensi</a></li>
                        
                    </ul>
					
					<div class="tab-content">
                        <div class="tab-pane active" id="tab_1" >
						<br>
						<div class='row'>
				
	<div class='col-md-4'>
           <div class="panel panel-default">
                <div class='box-header with-border '>
                    <h3 class='box-title'><i class="fas fa-globe fa-fw"></i> Input Absen Tidak Hadir</h3>
                    <div class='box-tools pull-right'>
					
										</div>
									</div>
									<form id="formabsen" action='' method='post'>
									<div class='box-body'>
									  <div class='form-group-sm'>									
									                                        
                                        <label>Tanggal</label>
									   <input type="text"  name="tanggal" class="form-control" value="<?= date('Y-m-d') ?>" readonly >
                                                   
                                                </div>
												 <div class='form-group-sm'>
                                                   <label>Nama Pegawai</label>
												   <select class="form-control" name="idpeg" required>
													 <option value="" selected="">Pilih Pegawai</option>
												<?php $q = mysqli_query($koneksi, "select * from users WHERE level<>'admin' ");
												while ($u = mysqli_fetch_array($q)) { ?>
													<option value="<?= $u['id_pengawas'] ?>"><?= $u['nama'] ?></option>
												<?php } ?>
												</select>    
                                                </div>
												<div class='form-group-sm'>
                                                   <label>Ketidak hadiran</label>
												   <select class="form-control" name="ket" required>
													 <option value="" selected="">Pilih Alasan Tidak Hadir</option>
												      <option value="S">Sakit</option>
													   <option value="I">Izin</option>
													      <option value="A">Tanpa Keterangan</option>
												</select>    
                                                </div>
												</div>
                                                <div class='modal-footer'>
                                            <div class='box-tools pull-right btn-group'>
                                                <button type='submit' name='submit' class='btn btn-sm btn-primary'><i class='fa fa-check'></i> Simpan</button>
                                               
                                            </div>
                                        </div>
                                    </form>
                               
                        </div>
                    </div>
	        <script>
  $('#formabsen').submit(function(e) {
        e.preventDefault();
        $.ajax({
            type: 'POST',
            url: 'ptm/m_absen/crud_absen.php?pg=tambah_manual',
            data: $(this).serialize(),
            beforeSend: function() {
                $('form button').on("click", function(e) {
                    e.preventDefault();
                });
            },
            success: function(data) {
                console.log(data);
                if (data == 'OK') {
                    iziToast.info(
            {
                title: 'Sukses!',
                message: 'Absen berhasil disimpan',
				titleColor: '#FFFF00',
				messageColor: '#fff',
				backgroundColor: 'rgba(0, 0, 0, 0.5)',
				 progressBarColor: '#FFFF00',
                  position: 'topRight'
                    });
                    setTimeout(function() {
                        window.location.replace('?pg=');
                    }, 2000);
                } else {
                    Swal.fire({	
				title: '<a href="#" class="sandik" style="color:red">Gagal.. Absen sudah tercatat</a>',				
				showConfirmButton: false,
				 animation: false,
				  customClass: 'animated tada',				  
				  imageUrl: '../dist/img/sandik_kecil.gif',
                 footer: '<a href="#"><b style="color:red">Sistem Administrasi Pendidik (SANDIK)</b></a>'
                    });
					setTimeout(function() {
                        window.location.reload();
                    }, 2000);
                }

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