Your IP : 3.135.220.239


Current Path : /home/lentoinv/churchmr.com/dclm/
Upload File :
Current File : //home/lentoinv/churchmr.com/dclm/program.php

<?php
session_start(); ob_start();
if(!isset($_SESSION['userdata'])){header('location: ../login.php');   exit;}
  
  $data = json_decode($_SESSION['userdata']);
  $page = 2;
    
  //New pages
//programreport,complaince
//programreportgr,compliancegr,addmember


?>





<!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-lg-3 col-xs-6">
              <!-- small box -->
              <div class="small-box bg-orange">
                <div class="inner">
               
                  <h3 id="members"></h3>
                  <p>Members</p>
                </div>
                <div class="icon">
                  <i class="fa fa-line-chart"></i>
                </div>
                <a href="#" onclick="myList(1)" class="small-box-footer">
                  Members <i class="fa fa-arrow-circle-right"></i>
                </a>
              </div>
            </div><!-- ./col -->
            
            
            
            
         <div class="col-lg-3 col-xs-6">
              <!-- small box -->
              <div class="small-box bg-purple">
                <div class="inner" onclick="myList(4)">
              
                  <h3 id="converts"></h3>
                  <p>Converts</p>
                </div>
                <div class="icon">
                  <i class="fa fa-line-chart"></i>
                </div>
                <a href="#" onclick="myList(5)" class="small-box-footer">
                  <span id="invitees"></span> Visitors <i class="fa fa-arrow-circle-right"></i>
                </a>
              </div>
            </div><!-- ./col -->
            
            
            
   <div class="col-lg-3 col-xs-6">
              <!-- small box -->
              <div class="small-box bg-maroon">
                <div class="inner">
            
                  <h3 id="workers"></h3>
                  <p>Church Workers</p>
                </div>
                <div class="icon">
                  <i class="fa fa-line-chart"></i>
                </div>
                <a href="#" onclick="myList(2)" class="small-box-footer">
                 Workers <i class="fa fa-arrow-circle-right"></i>
                </a>
              </div>
            </div><!-- ./col -->
            
            
            
            
            
            
            
               <div class="col-lg-3 col-xs-6">
              <!-- small box -->
              <div class="small-box bg-navy">
                <div class="inner">
              
                  <h3 id="leaders"></h3>
                  <p>Leaders</p>
                </div>
                <div class="icon">
                  <i class="fa fa-line-chart"></i>
                </div>
                <a href="#" onclick="myList(3)" class="small-box-footer">
                  Leaders <i class="fa fa-arrow-circle-right"></i>
                </a>
              </div>
            </div><!-- ./col -->
            
            
                      </div><!-- /.row -->
   <!-- /.dashboard -->
        


          <div class="row">
   <div class="col-md-12">
              <div class="box box-primary box-solid">
                <div class="box-header with-border">
                  <h3 class="box-title">SUBMIT WEEKLY REPORTS</h3>
                  <div class="box-tools pull-right">
                  
                  </div><!-- /.box-tools -->
                </div><!-- /.box-header -->
                <div class="box-body" style="padding:10px 0" id="weeklyrep">
                 <center><h4>Loading...</h4></center>
                </div><!-- /.box-body -->
              </div><!-- /.box -->
            </div>

   <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">
                   
                  </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">PENDING REPORTS</h3>
                  <div class="box-tools pull-right">
                  
                  </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>




          </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>
 
</script>
    <script type="text/javascript">

 // alert('123'); 

function districtData() {

  <?php if(isset($_SESSION['didata'])){ ?>
     var d = '<?= $_SESSION['didata'] ?>';

        const obj = JSON.parse(d);
              $('#members').text(obj.members);
              $('#workers').text(obj.workers);
              $('#leaders').text(obj.leaders);
              $('#converts').text(obj.converts);
              $('#invitees').text(obj.invitees);
            <?php } else{ ?>

 $.ajax({
                type: 'get',
                url : 'ajax.php?type=districtdata'
            }).done(function(data){
                  const obj = JSON.parse(data);
              $('#members').text(obj.members);
              $('#workers').text(obj.workers);
              $('#leaders').text(obj.leaders);
              $('#converts').text(obj.converts);
              $('#invitees').text(obj.invitees);

              sessionStorage.setItem('diddav',data);
            })
       <?php  }  ?>        

  } 


$(document).ready(function(){
districtData();
reload();
})

function reload() {
  $('#weeklyrep').load('ajax.php?type=weeklyrep');
  if(sessionStorage.p1){ recentrep(); } else{ $('#recentrep').load('ajax.php?type=recentrep'); }
  <?php if(isset($_COOKIE['penda'])) { ?> pendingRepCook(); <?php }else{ ?> pendingRep(); <?php } ?>
}

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" 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('<div class="row" style="padding:0 15px">'+gg+'</div><div class="row"><center><a href="pending.php" class="btn btn-default">Show all Pending Reports</a></center></div>');
               })
}


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" 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('<div class="row" style="padding:0 15px">'+gg+'</div><div class="row"><center><a href="pending.php" class="btn btn-default">Show all Pending Reports</a></center></div>');
            
}


function setCookie(cname, cvalue, exdays) {
  const d = new Date();
  d.setTime(d.getTime() + (exdays*24*60*60*1000));
  let expires = "expires="+ d.toUTCString();
  document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
}


function reloadAll() {
  $('#weeklyrep').load('ajax.php?type=weeklyrep');
 $('#recentrep').load('ajax.php?type=recentrep'); 
  pendingRep();//$('#pendingrep').load('ajax.php?type=pendingrep');
}

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(){
$('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();
               })
}


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 myList(a) {
 $('#myListModal').modal('show'); 
     if(a==1){$('#ltitle').html('Registered Members'); }
else if(a==2){$('#ltitle').html('Workers'); }
else if(a==3){$('#ltitle').html('Leaders'); }
else if(a==4){$('#ltitle').html('Converts'); }
else if(a==5){$('#ltitle').html('Visitors'); }
  
  $('#mlist').load('ajax.php?type=memberlist&mode='+a);
}


function showHistory(a){
 if(a==''){ $('#monthhistory').html(''); }else{
  $('#monthhistory').html('<center><h4>Loading...</h4></center>');
   $.ajax({
                type: 'get',
                url : 'ajax.php?type=showhistory&time='+a
            }).done(function(data){
$('#monthhistory').html(data);
               })
   $.ajax({
                type: 'get',
                url : 'ajax.php?type=showmonth&time='+a
            }).done(function(data){
  $('#hismonth').html(data);
               })
     }       
}

function showGrowthReport(){
  var x = document.getElementsByClassName('cga');
  var a = x[0].value;
  var b = x[1].value;
  var c = x[2].value;

 if(a=='' || b=='' || c==''){ $('#monthhistory2').html(''); }else{
$('#monthhistory2').html('<center><h4>Loading...</h4></center>');
   $.ajax({
                type: 'get',
                url : 'ajax.php?type=showgrowthhistory&from='+a+'&to='+b+'&prog='+c
            }).done(function(data){
$('#monthhistory2').html(data);
               })
     }       
}
</script>


  </body>
</html>

?>