<?php include("parent/callMe.php"); ?>
<?php include("sessioncheck.php"); ?>

<?php

$date= date("Y-m");

$date1= date("Y-m-d");


$sessionID = $_SESSION['current_session'];
$brID=$_SESSION['branch'];

$m->where("status",'1');
$m->where("branch_id", $_SESSION['branch']);
$completed = $m->get("eduportal_customer_support");

//print($completed);

$m->where("status",'0');
$m->where("branch_id", $_SESSION['branch']);
$pending = $m->get("eduportal_customer_support");

$sql="SELECT * FROM eduportal_customer_support";
$totalTickets = $m->query($sql);


$date= date("Y-m");
$sql = "SELECT * from eduportal_customer_support WHERE branch_id='$brID' and query_date LIKE '$date%' ";
$active_tickets = $m->query($sql);


$sql = "SELECT * from eduportal_customer_support WHERE branch_id='$brID' and status='1' And query_date LIKE '$date%' ";
$current_completed = $m->query($sql);


$sql = "SELECT * from eduportal_customer_support WHERE branch_id='$brID' and status='0' And query_date LIKE '$date%' ";
$current_pending = $m->query($sql);



$date1= date("Y-m-d");
$sql1 = "SELECT * from eduportal_customer_support WHERE branch_id='$brID' and query_date LIKE '$date1%' ";
$today_tickets = $m->query($sql1);

//print_r($today_tickets);

$sql2 = "SELECT * from eduportal_customer_support WHERE branch_id='$brID' and status='1' And approval_date LIKE '$date1%' ";
$today_completed = $m->query($sql2);


$sql3 = "SELECT * from eduportal_customer_support WHERE branch_id='$brID' and status='0' And query_date LIKE '$date1%' ";
$today_pending = $m->query($sql3);



$qr="SELECT SUM(data_entry) AS totalEntry  FROM eduportal_data_entry_log WHERE branch_id='$brID' and status='0'";
$total_entry = $m->query($qr);



$totalentry=$total_entry[0]['totalEntry'];

 
?>


<!DOCTYPE html>
<html lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <!-- Meta, title, CSS, favicons, etc. -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title> Complaints Dashboard | EduPortal </title>

    <?php include('RootMe/css_links.php');?>

    <style type="text/css">
      .tile-stats .icon i{
        font-size: 35px;
        color:gray;
      }

      .tile-stats .count{
        font-size: 30px;
      font-weight: 700;
      line-height: 1.65857;
      color:#1F4F80;
      }

      .h3, h3{
        font-size: 15px;
      color:gray; 
      }

      .tile-stats .icon {
      width: 20px;
      height: 20px;
      color: #BAB8B8;
      position: absolute;
      right: 30px;
      top: 22px;
      z-index: 1;
  }

  .tile-stats h3 {
    color: #727171;
}


    </style>
  </head>
  
  <body class="nav-md">
    <div class="container body">
      <div class="main_container">
        <div class="col-md-3 left_col">
     
    <?php include('RootMe/sidebar.php');?>
<?php include('RootMe/header.php');?>

              <!-- page content -->
        <div class="right_col" role="main">

  
  <a href="add_ticket.php" class="btn btn-round btn-info quiklink">Add Complaint </a>
  <a href="view_ticket.php" class="btn btn-round btn-warning quiklink">View Complaints</a>
  
<?php

$branch=$_SESSION['branch'];
$sql = "SELECT * FROM eduportal_customer_support where branch_id='$branch' order by customer_support_id desc";

// echo $sql;

$tickets = $m->query($sql);
 //print_r($categories);
 
     ?>

  <div class="">
            <div class="row top_tiles">
              <div class="animated flipInY col-lg-4 col-md-6 col-sm-6 col-xs-12">
                <div class="tile-stats">
                  <div class="icon"><i class="fa fa-university"></i></div>
                  <div class="count"><?php echo count($tickets);?></div>
                  <a href="view_ticket.php" target="_blank">
                  <h3>Total Complaints</h3>
                   <p>View Details ...</p>
                 </a> 
                </div>
              </div>
         
           


              <div class="animated flipInY col-lg-4 col-md-6 col-sm-6 col-xs-12">
                <div class="tile-stats">
                  <div class="icon"><i class="fa fa-check"></i></div>
                  <div class="count"><?php echo count($completed);?></div>
                  <a  target="_blank" href="view_ticket.php?<?php echo session_id().session_id().session_id().session_id().session_id(); ?>&completed=completed">
                  <h3> Complaints Completed</h3>
                   <p>View Details ...</p>
                </a>
                </div>
              </div>



           <div class="animated flipInY col-lg-4 col-md-6 col-sm-6 col-xs-12">
                <div class="tile-stats">
                  <div class="icon"><i class="fa fa-check"></i></div>
                  <div class="count"><?php echo count($pending);?></div>
                  <a  target="_blank" href="view_ticket.php?<?php echo session_id().session_id().session_id().session_id().session_id(); ?>&pending=pending">
                  <h3> Complaints Pending</h3>
                   <p>View Details ...</p>
                 </a> 
                </div>
              </div>
       

              <div class="animated flipInY col-lg-4 col-md-6 col-sm-6 col-xs-12">
                <div class="tile-stats">
                  <div class="icon"><i class="fa fa-check"></i></div>
                  <div class="count"><?php echo count($active_tickets);?></div>
                  <a  target="_blank" href="view_ticket.php?<?php echo session_id().session_id().session_id().session_id().session_id(); ?>&active_tickets=active_tickets">
                  <h3> Complaints (<? echo date('F Y'); ?>) </h3>
                   <p>View Details ...</p>
                 </a> 
                </div>
              </div>


          
              <div class="animated flipInY col-lg-4 col-md-6 col-sm-6 col-xs-12">
                <div class="tile-stats">
                  <div class="icon"><i class="fa fa-get-pocket"></i></div>
                  <div class="count"><?php echo count($current_completed);?></div>
                  <a  target="_blank" href="view_ticket.php?<?php echo session_id().session_id().session_id().session_id().session_id(); ?>&current_completed=current_completed">
                  <h3> Completed Complaints (<? echo date('F Y'); ?>)</h3>
                   <p>View Details ...</p>
                </a>
                </div>
              </div>


              <div class="animated flipInY col-lg-4 col-md-6 col-sm-6 col-xs-12">
                <div class="tile-stats">
                  <div class="icon"><i class="fa fa-get-pocket"></i></div>
                  <div class="count"><?php echo count($current_pending);?></div>
                  <a  target="_blank" href="view_ticket.php?<?php echo session_id().session_id().session_id().session_id().session_id(); ?>&current_pending=current_pending">
                  <h3> Pending Complaints (<? echo date('F Y'); ?>)</h3>
                   <p>View Details ...</p>
                </a>
                </div>
              </div>




              <div class="animated flipInY col-lg-4 col-md-6 col-sm-6 col-xs-12">
                <div class="tile-stats">
                  <div class="icon"><i class="fa fa-check"></i></div>
                  <div class="count"><?php echo count($today_tickets);?></div>
                  <a  target="_blank" href="view_ticket.php?<?php echo session_id().session_id().session_id().session_id().session_id(); ?>&today_tickets=today_tickets">
                  <h3> Today Complaints (<? echo date('d-M-Y'); ?>) </h3>
                   <p>View Details ...</p>
                 </a> 
                </div>
              </div>


          
              <div class="animated flipInY col-lg-4 col-md-6 col-sm-6 col-xs-12">
                <div class="tile-stats">
                  <div class="icon"><i class="fa fa-get-pocket"></i></div>
                  <div class="count"><?php echo count($today_completed);?></div>
                  <a  target="_blank" href="view_ticket.php?<?php echo session_id().session_id().session_id().session_id().session_id(); ?>&today_completed=today_completed">
                  <h3> Today Completed (<? echo date('d-M-Y'); ?>)</h3>
                   <p>View Details ...</p>
                </a>
                </div>
              </div>


              <div class="animated flipInY col-lg-4 col-md-6 col-sm-6 col-xs-12">
                <div class="tile-stats">
                  <div class="icon"><i class="fa fa-get-pocket"></i></div>
                  <div class="count"><?php echo count($today_pending);?></div>
                  <a  target="_blank" href="view_ticket.php?<?php echo session_id().session_id().session_id().session_id().session_id(); ?>&today_pending=today_pending">
                  <h3> Today Pending (<? echo date('d-M-Y'); ?>)</h3>
                   <p>View Details ...</p>
                </a>
                </div>
              </div>


          



            </div>

          
          </div>
        </div>
        <!-- /page content -->


      </div>
    </div>

    <!-- jQuery -->
    <script src="../vendors/jquery/dist/jquery.min.js"></script>
    <!-- Bootstrap -->
    <script src="../vendors/bootstrap/dist/js/bootstrap.min.js"></script>
    
    <!-- Custom Theme Scripts -->
    <script src="../build/js/custom.min.js"></script>
  </body>
</html>
