
<?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>
						
				
	<?php 
  $id=$_GET['id']; 
  $lokasi=fetch($koneksi,'absensi',['guru'=>$id]);
   $nama=fetch($koneksi,'users',['id_pengawas'=>$id]);
  $latitude= $lokasi['lat'];
$longitude= $lokasi['lon'];
$name=$nama['nama'];
  ?>
 
   <div class='col-md-7'>
             <div class='box box-solid '>
                <div class='box-header with-border '>
                    <h4 class='box-title'> Lokasi</h4>
                    <div class='box-tools pull-right'>
					
                    </div>
                </div>
                <div class='box-body'>
                    
		<div id="peta" style="height:490px; width: 100%"></div>
  	<script type="text/javascript">
  		var mymap = L.map('peta').setView([<?php echo $latitude;?>, <?php echo $longitude;?>], 13);
            L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoiYWRpZ3VuYXdhbnhkIiwiYSI6ImNrcWp2Yjg2cDA0ZjAydnJ1YjN0aDNnbm4ifQ.htvHCgSgN0UuV8hhZBfBfQ', {
              maxZoom: 20,
              attribution:'',
              id: 'mapbox/streets-v11',
              tileSize: 512,
              zoomOffset:-1,
              accessToken: 'pk.eyJ1IjoiYWRpZ3VuYXdhbnhkIiwiYSI6ImNrcWp2Yjg2cDA0ZjAydnJ1YjN0aDNnbm4ifQ.htvHCgSgN0UuV8hhZBfBfQ'
            }).addTo(mymap);
          L.marker([<?php echo $latitude;?>, <?php echo $longitude;?>]).addTo(mymap);
          L.circle([<?php echo $latitude;?>, <?php echo $longitude;?>], 550, {
  		color: 'red',
  		fillColor: '#f03',
  		fillOpacity: 0.5
  		}).addTo(mymap).bindPopup("<?php echo $name;?>").openPopup();
          var popup = L.popup();
          function onMapClick(e) {
  		popup
  			.setLatLng(e.latlng)
  			.setContent(""+ e.latlng.toString())
  			.openOn(mymap);
  		}
  		mymap.on('click', onMapClick);
    </script>

	 </div>
				</div>
			</div>
		
       
   
 <div class="col-md-5">
            <div class='box box-solid '>
                <div class='box-header with-border '>
				<h4 class='box-title'>Detail Waktu</h4>
				</div>
                    <div class="panel-body">
					<?php  $absen=fetch($koneksi,'absensi',['guru'=>$id]); ?>
					<?php  $guru=fetch($koneksi,'users',['id_pengawas'=>$absen['guru']]); ?>
					<h2><?= $guru['nama'] ?></h2>
					<div class='table-responsive'>
                      <table style="font-size: 12px" id='tabeltugas' class='table table-bordered table-striped'>
					<tr>
					<td width="35%"> Tanggal</td>
					<td width="5%"> : </td>
					<td><?= date('d-m-Y', strtotime($absen['tanggal'])) ?></td> 
					</tr>
					<tr>
					<td> Batas Absen Masuk</td>
					<td> : </td>
					<td><?= $setting['batas_masuk'] ?></td> 
					</tr>
					<tr>
					
					<td> Jam Absen Masuk</td>
					<td> : </td>
					<td><?= $absen['jam_masuk'] ?> | <?php if($setting['batas_masuk'] >= $absen['jam_masuk']) { ?> <b>Ket : Tepat Waktu</b> <?php }else{ ?> <b style="color:red">Ket : Terlambat Waktu <b><?php } ?></td> 
					</tr>
					<tr>
					<td> Jam Absen Pulang</td>
					<td> : </td>
					<td><?= $absen['jam_pulang'] ?></td> 
					</tr>
					<tr>
					<td> Latitude</td>
					<td> : </td>
					<td><?= $absen['lat'] ?></td> 
					</tr>
					<tr>
					<td> Longitude</td>
					<td> : </td>
					<td><?= $absen['lon'] ?></td> 
					</tr>
					<tr>
					<td> Jarak Absen</td>
					<td> : </td>
					<td><?= $absen['jarak'] ?> meter</td> 
					</tr>
					<tr>
					<td> Foto Absen </td>
					<td> : </td>
					<td>
					<img src="<?= $homeurl ?>/train/<?= $id ?>.png" width="100%">
					</td>
					</tr>
					</table>
					
					
					
					 </div>
				</div>
			</div>
		 </div>
        </div>  
    </div>
</div>  
	<?php } ?>
  
  