Your IP : 52.15.109.209
<?php
session_start(); ob_start();
if(!isset($_SESSION['userdata'])){header('location: ../login.php'); exit;}
$data = json_decode($_SESSION['userdata']);
$page = 2;
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Attendance Report</title>
<!-- Tell the browser to be responsive to screen width -->
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<!-- Bootstrap 3.3.5 -->
<link rel="stylesheet" href="../bootstrap/css/bootstrap.min.css">
<!-- Font Awesome -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
<!-- Ionicons -->
<link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
<!-- daterange picker -->
<link rel="stylesheet" href="../plugins/daterangepicker/daterangepicker-bs3.css">
<!-- iCheck for checkboxes and radio inputs -->
<link rel="stylesheet" href="../plugins/iCheck/all.css">
<!-- Bootstrap Color Picker -->
<link rel="stylesheet" href="../plugins/colorpicker/bootstrap-colorpicker.min.css">
<!-- Bootstrap time Picker -->
<link rel="stylesheet" href="../plugins/timepicker/bootstrap-timepicker.min.css">
<!-- Select2 -->
<link rel="stylesheet" href="../plugins/select2/select2.min.css">
<!-- Theme style -->
<link rel="stylesheet" href="../dist/css/AdminLTE.min.css">
<!-- AdminLTE Skins. Choose a skin from the css/skins
folder instead of downloading all of them to reduce the load. -->
<link rel="stylesheet" href="../dist/css/skins/_all-skins.min.css">
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
<?php require('header.php'); ?>
<!-- Left side column. contains the logo and sidebar -->
<?php require('sidebarx.php'); ?>
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
Dashboard
<small>WEEK <?php echo date('W'); ?></small>
</h1>
<ol class="breadcrumb">
<li><i class="fa fa-dashboard"></i> <?php echo strtoupper(date('D, d-M-Y')); ?></li>
<li><?php echo strtoupper($data->zone); ?></li>
<li class=""><?php echo strtoupper($data->district); ?></li>
</ol>
</section>
<!-- Main content -->
<section class="content">
<!-- Dashboards -->
<div class="row">
<div class="col-md-12">
<div class="box box-success box-solid">
<div class="box-header with-border">
<h3 class="box-title">RECENT SUBMISSION</h3>
<div class="box-tools pull-right">
<!-- <button class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button> -->
</div><!-- /.box-tools -->
</div><!-- /.box-header -->
<div class="box-body" style="padding:10px 0" id="recentrep">
<center><h4>Loading...</h4></center>
</div><!-- /.box-body -->
</div><!-- /.box -->
</div>
<div class="col-md-12">
<div class="box box-danger box-solid">
<div class="box-header with-border">
<h3 class="box-title">RECENT PENDING REPORTS</h3>
<div class="box-tools pull-right">
<!-- <button class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button> -->
</div><!-- /.box-tools -->
</div><!-- /.box-header -->
<div class="box-body" style="padding:10px 0" id="pendingrep">
<center><h4>Loading...</h4></center>
</div><!-- /.box-body -->
</div><!-- /.box -->
</div>
<div class="col-md-12">
<div class="box box-danger box-solid">
<div class="box-header with-border">
<h3 class="box-title">ALL PENDING REPORTS</h3>
<div class="box-tools pull-right">
</div><!-- /.box-tools -->
</div><!-- /.box-header -->
<div class="box-body" style="padding:0">
<div style="padding: 10px;">
<select class="form-control select2" onchange="showPending()" id="allp"><option value="">Select Month...</option>
<?php $i = 0; while($i<=60){ $e=$i++; $x = time()-86400*30.5*$e; echo '<option value="'.(int)$x.'">'.date('F Y',$x).'</option>'; } ?>
</select></div>
<div class="table-responsive" id="allpending">
</div>
</div><!-- /.box-body -->
</div><!-- /.box -->
</div>
</div><!-- /.row -->
</section> <!-- /.content -->
</div><!-- /.content-wrapper -->
<?php require('modals.php'); ?>
<?php require('footer.php'); ?>
<!-- Control Sidebar -->
<?php // require('settingbar.php'); ?>
<!-- Add the sidebar's background. This div must be placed
immediately after the control sidebar -->
<div class="control-sidebar-bg"></div>
</div><!-- ./wrapper -->
<!-- jQuery 2.1.4 -->
<script src="../plugins/jQuery/jQuery-2.1.4.min.js"></script>
<!-- Bootstrap 3.3.5 -->
<script src="../bootstrap/js/bootstrap.min.js"></script>
<!-- Select2 -->
<script src="../plugins/select2/select2.full.min.js"></script>
<!-- InputMask -->
<script src="../plugins/input-mask/jquery.inputmask.js"></script>
<script src="../plugins/input-mask/jquery.inputmask.date.extensions.js"></script>
<script src="../plugins/input-mask/jquery.inputmask.extensions.js"></script>
<!-- date-range-picker -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.2/moment.min.js"></script>
<script src="../plugins/daterangepicker/daterangepicker.js"></script>
<!-- bootstrap color picker -->
<script src="../plugins/colorpicker/bootstrap-colorpicker.min.js"></script>
<!-- bootstrap time picker -->
<script src="../plugins/timepicker/bootstrap-timepicker.min.js"></script>
<!-- SlimScroll 1.3.0 -->
<script src="../plugins/slimScroll/jquery.slimscroll.min.js"></script>
<!-- iCheck 1.0.1 -->
<script src="../plugins/iCheck/icheck.min.js"></script>
<!-- FastClick -->
<script src="../plugins/fastclick/fastclick.min.js"></script>
<!-- AdminLTE App -->
<script src="../dist/js/app.min.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="../dist/js/demo.js"></script>
<!-- FLOT CHARTS -->
<script src="../plugins/flot2/jquery.flot.js"></script>
<!-- FLOT RESIZE PLUGIN - allows the chart to redraw when the window is resized -->
<script src="../plugins/flot2/plugins/jquery.flot.resize.js"></script>
<script type="text/javascript">
// $(window).load(function(){
// $('#myModal').modal('show');
// });
$(document).ready(function(){
reload();
})
function reload() {
if(sessionStorage.p1){ recentrep(); } else{ $('#recentrep').load('ajax.php?type=recentrep'); }
<?php if(isset($_COOKIE['penda'])) { ?> pendingRepCook(); <?php }else{ ?> pendingRep(); <?php } ?>
}
function reloadAll() {
$('#recentrep').load('ajax.php?type=recentrep');
pendingRep();//$('#pendingrep').load('ajax.php?type=pendingrep');
}
function pendingRep() {
$.ajax({
type: 'get',
url : 'ajax.php?type=pendingrep'
}).done(function(data){
const obj = JSON.parse(data);
var n = obj.length;
var i = 0;
var gg='';
while(i<n){
var prog = obj[i].prog;
var date = obj[i].date;
var pid = obj[i].pid;
gg += '<div class="col-md-4 col-sm-6 col-xs-12" style="padding:0 10px"><div id="popModal'+i+'" class="info-box" style="border: thin solid #CCC;" data-prog="'+prog+'" data-date="'+date+'" data-pid="'+pid+'"><span class="info-box-icon bg-maroon-active"><i class="fa fa-calendar-times-o"></i></span><div class="info-box-content"><span class="info-box-text"><center><strong>'+prog+'<br>'+date+'</strong></center> </span><button type="button" class="btn btn-danger btn-sm btn-block">SUBMIT REPORT</button></div></div></div>';
i++;
}
$('#pendingrep').html(gg);
})
}
function recentrep() {
$('#recentrep').html('');
var i = 1;
while(i<4){
var p = sessionStorage.getItem('p'+i);
var data = sessionStorage.getItem(p);
const obj = JSON.parse(data);
var a=Number(obj.a1)+Number(obj.a2);
var b=Number(obj.y1)+Number(obj.y2);
var c=Number(obj.c1)+Number(obj.c2);
var d = Number(a)+Number(b)+Number(c);
$('#recentrep').append('<div class="col-md-4 col-sm-6 col-xs-12" style="padding:0 10px"><div class="info-box" style="border: thin solid #CCC;" onclick="popModalEdit('+p+',1)"><span class="info-box-icon bg-green-active"><i class="fa fa-calendar-check-o"></i></span><div class="info-box-content"><span class="info-box-text"><center><strong>'+obj.prog+'<br>'+obj.day+'</strong></center> </span><div><table class="table table-sm" style="margin: 0; padding:0"><tr><td><b>AD</b><br>'+a+'</td><td><b>YO</b><br>'+b+'</td><td><b>CH</b><br>'+c+'</td><td><b>T</b><br>'+d+'</td><td><b>OFF</b><br>N'+obj.off+'</td></tr></table></div></div></div></div>');
i++;
}
//$('#recentrep').append(p);
}
function pendingRepCook() {
var dat = '<?= $_COOKIE['penda'] ?>';
const obj = JSON.parse(dat);
var n = obj.length;
var i = 0;
var gg='';
while(i<n){
var prog = obj[i].prog;
var date = obj[i].date;
var pid = obj[i].pid;
gg += '<div class="col-md-4 col-sm-6 col-xs-12" style="padding:0 10px"><div id="popModal'+i+'" class="info-box" style="border: thin solid #CCC;" data-prog="'+prog+'" data-date="'+date+'" data-pid="'+pid+'"><span class="info-box-icon bg-maroon-active"><i class="fa fa-calendar-times-o"></i></span><div class="info-box-content"><span class="info-box-text"><center><strong>'+prog+'<br>'+date+'</strong></center> </span><button type="button" class="btn btn-danger btn-sm btn-block">SUBMIT REPORT</button></div></div></div>';
i++;
}
$('#pendingrep').html(gg);
}
$(function(){
$('body').on('click', '#popModal', function () {
var a = $(this).data('prog').toUpperCase();
var b = $(this).data('date').toUpperCase();
var c = $(this).data('pid');
$('#myModal').modal('show');
$('#mtitle').html(a+': '+b);
swapId('add2','add1');
document.getElementById('add2').reset();
document.getElementById('prog').value=a;
document.getElementById('pdate').value=b;
document.getElementById('pid').value=c;
})
})
function popModalEdit(a,b){
$('#myModalEdit').modal('show');
swapId('edit2','edit1');
var data = sessionStorage.getItem(a);
// $.ajax({
// type: 'get',
// url : 'ajax.php?type=reportdata&pid='+a+'&did='+b
// }).done(function(data){
const obj = JSON.parse(data);
let title = obj.prog+': '+obj.day;
$('#mtitle2').text(title.toUpperCase());
document.getElementById('a1').value=obj.a1;
document.getElementById('a2').value=obj.a2;
document.getElementById('y1').value=obj.y1;
document.getElementById('y2').value=obj.y2;
document.getElementById('c1').value=obj.c1;
document.getElementById('c2').value=obj.c2;
document.getElementById('vis').value=obj.vis;
document.getElementById('conv').value=obj.conv;
document.getElementById('off').value=obj.off;
document.getElementById('soff').value=obj.soff;
document.getElementById('rem').value=obj.rem;
document.getElementById('sn').value=obj.sn;
// })
//$('.report').attr('value',0);
}
function addReport(){
var a = document.getElementsByClassName('report');
swapId('add1','add2');
$.ajax({
type: 'get',
url : 'ajax.php?type=addreport&a1='+a[0].value+'&a2='+a[1].value+'&a3='+a[2].value+'&a4='+a[3].value+'&a5='+a[4].value+'&a6='+a[5].value+'&a7='+a[6].value+'&a8='+a[7].value+'&a9='+a[8].value+'&a10='+a[9].value+'&a11='+a[10].value+'&pid='+a[11].value+'&prog='+a[12].value+'&pdate='+a[13].value
}).done(function(data){
reloadAll();
showPending();
})
}
function editReport(){
var a = document.getElementsByClassName('reportt');
swapId('edit1','edit2');
$.ajax({
type: 'get',
url : 'ajax.php?type=editreport&a1='+a[0].value+'&a2='+a[1].value+'&a3='+a[2].value+'&a4='+a[3].value+'&a5='+a[4].value+'&a6='+a[5].value+'&a7='+a[6].value+'&a8='+a[7].value+'&a9='+a[8].value+'&a10='+a[9].value+'&a11='+a[10].value+'&sn='+a[11].value
}).done(function(data){
reloadAll();
})
}
function swapId(a,b) {
document.getElementById(a).style.display = 'block';
document.getElementById(b).style.display = 'none';
}
function showPending(){
var a = document.getElementById('allp').value;
if(a==''){ $('#allpending').html(''); }else{
$('#allpending').html('<center><h4>Loading...</h4></center>');
$.ajax({
type: 'get',
url : 'ajax.php?type=allpending&time='+a
}).done(function(data){
$('#allpending').html(data);
})
}
}
</script>
</body>
</html>