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

<?php   

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

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

$branch=$_SESSION['branch'];


if(isset($_GET['completed']))
{

$sql = " select * from  eduportal_customer_support where branch_id='$branch' and status='1' ";

}  elseif(isset($_GET['pending']))
{
$sql = " select * from  eduportal_customer_support where branch_id='$branch' and status='0' ";

} elseif(isset($_GET['active_tickets']))
{
$sql = " select * from  eduportal_customer_support WHERE branch_id='$branch' and query_date LIKE '$date%' ";

} elseif(isset($_GET['current_completed']))
{

$sql = " select * from  eduportal_customer_support WHERE branch_id='$branch' and status='1' And query_date LIKE '$date%' ";

} elseif(isset($_GET['current_pending']))

{
$sql = " select * from  eduportal_customer_support WHERE branch_id='$branch' and status='0' And query_date LIKE '$date%' ";

} elseif(isset($_GET['today_tickets']))

{
$sql = " select * from  eduportal_customer_support WHERE branch_id='$branch' and query_date LIKE '$date1%' ";

} elseif(isset($_GET['today_completed']))

{
$sql = " select * from  eduportal_customer_support WHERE branch_id='$branch' and status='1' And query_date LIKE '$date1%' ";

} elseif(isset($_GET['today_pending']))

{
$sql = " select * from  eduportal_customer_support WHERE branch_id='$branch' and status='0' And query_date LIKE '$date1%' ";

}  else {

$sql = "select *  from  eduportal_customer_support ";

if (isset($_REQUEST['branch'])) {


if($_REQUEST['branch']=="All"){

$sql;

} else {

$sql .= " where branch_id = '$branch' ";

}


if($_REQUEST['modules_id']=="All"){
$sql;

} else {

if($_REQUEST['branch']=="All"){

$sql .= " where module_id = '" .$_REQUEST['modules_id']. "' ";

} else {

$sql .= " AND module_id = '" .$_REQUEST['modules_id']. "' ";

}
}

}

}

$sql .= " order by customer_support_id desc";

//print_r($sql);

$tickets = $m->query($sql);


?>

<!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>View tickets | EduPortal</title>

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

</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">

<br>

<a href="complaints_dashboard.php">Complaints Dashboard </a> &nbsp; <i style="" class="fa fa-angle-double-right"></i>  &nbsp; 

View Tickets Log

<div class="">

<div class="page-title">

<div class="title_left">

<?php

$branch_id=$_SESSION['branch'];

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

 //echo $sql;

$tickets = $m->query($sql);

?>

<h3>Manage Tickets List<small> (<?php echo count($tickets);?> records)</small></h3>

</div>


<?php  if(isset($_SESSION['addsuccessexp'])){?>

<div id="snackbar"><script> toastFunction();</script> Your Recored is Sucessfully Added</div>

<?php  unset($_SESSION['addsuccessexp']); } ?>



<?php  if(isset($_SESSION['upsuccessexp'])){?>


<div class="alert alert-success" id="msg">
<a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
<strong>Success!</strong> Record is updated successfully...
</div>


<?php  unset($_SESSION['upsuccessexp']); }
?>

<?php  if(isset($_SESSION['deleteexp'])){?>


<div class="alert alert-danger" id="msg">
<a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
<strong>Danger!</strong> Record is deleted successfully...
</div>


<?php  unset($_SESSION['deleteexp']); } ?>

</div>

<div class="clearfix"></div>


</div>

<div class="row">
<div class="col-md-12 col-sm-12 col-xs-12">

<div class="x_content">




<table id="datatable" class="table table-striped table-bordered">
<thead>
<tr>
<th width="2%">S.No</th>
<th width="6%">Title</th>
<th width="5%">Module</th>
<th width="5%">Priority</th>
<th width="3%">Review </th>
<th width="5%">Images</th>
<th width="5%">Status</th>
<th width="8%">Action</th>

</tr>
</thead>
<tbody>


<?php  $count=1;


foreach($tickets as $ticket){

$m->where("Month_Id", $ticket['month_id']);
$months=$m->get("eduportal_month_config");


?>
<tr>


<td style="text-align:center;"><?php echo $count; $count++;?></td>


<td><?php echo $ticket['customer_support_title'];?></td>

<td>
<a class="btn btn-success" style="padding: 0px 5px; font-size:14px;color:white;" data-toggle="modal" data-target="#ticketDetails<?php echo $ticket['customer_support_id'];?>" > View Ticket </a>
</td>

<!-- Student Lecture popup start -->


<div id="ticketDetails<?php echo $ticket['customer_support_id'];?>" class="modal fade" role="dialog">
<div class="modal-dialog" style="width: 80%;">

<!-- Modal content-->
<div class="modal-content">
<div class="modal-header" style="border-bottom:none;">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title" style="text-align:center"> Ticket Details </h4>
</div>

<div class="modal-body">



<div class="col-md-12 col-sm-12 col-xs-12" style="padding:8px;"  id="">

<?php echo $ticket['description'];?>
</div>



<div class="modal-footer">




</div>





</div>

</div>

</div>
</div>

<!-- Student Lecture popup ending -->

<td><?php echo $ticket['priority'];?></td>

<td>

<?php if($ticket['status']==1 || $ticket['status']=="1"){    

echo  $ticket['approval_date']; ?>

<a  href="commentPopUp.php?TicketId=<?php echo $ticket['customer_support_id'];?>" class="btn btn-warning iframePupop">Comment</a>

<?php } ?>


</td>

<td><?php
$extention=substr($ticket['images'],-4);        
if($extention==".jpg" || $extention==".JPEG") { ?>

<img style="height:100px;width:100%;" src="<?php echo DOMAIN.AgentDirectory; ?>/Ticketimages/<?php echo $ticket['images'];?>"  />

<?php }  else if($extention==".png" || $extention==".PNG") {?>

<img style="height:100px;width:100%;" src="https://www.emiratesnights.com/Project/EduPortal/Production/Ticketimages/<?php echo $ticket['images'];?>"  />

<?php  } else if($extention==".pdf" || $extention==".PDF") { ?> 


<a class="btn btn-success" target="_blank" href="https://www.emiratesnights.com/Project/EduPortal/Production/Ticketimages/<?php echo $ticket['images'];?>">Download file</a>
<?php } else {echo "No Attachment..."; }?>
</td>


<!-- <td>

<?php echo $userName[0]['fname'];?>

</td> -->

<td> 

<?php if($ticket['status']==0 || $ticket['status']=="0"){ ?>    

<a  class="btn btn-danger">Under Review</a> 

<?php } else { ?>    

<a  class="btn btn-success">completed </a> 

<?php } ?>   

</td>

<td>


<a style="padding: 0px 5px;font-size:11px;" href="approve_ticket.php?branchId=<?php echo $ticket['branch_id'];?>&customer_support_id=<?php echo $ticket['customer_support_id'];?>&title=<?php echo $ticket['suggest_title'];?>" class="iframePupop btn btn-primary" >
<i class="fa fa-calendar" aria-hidden="true"></i>
</a>   

<a style="padding: 0px 5px;font-size:11px;" href="view_ticket_popup.php?customer_support_id=<?php echo $ticket['customer_support_id'];?>" class="btn btn-success iframePupop" >
<i class="fa fa-search" aria-hidden="true"></i>
</a>

<!-- </?php if ($access[0]['edit_access']!=NULL) { ?>-->
<a style="padding: 0px 5px; font-size:14px;"  href="add_ticket.php?<?php echo session_id().session_id().session_id().session_id().session_id();?>&tikup=<?php echo $ticket['customer_support_id'];?>" style="cursor:pointer;"  class="btn btn-success"> <i class="fa fa-pencil" aria-hidden="true"></i></a> 



<a href="<?php echo DOMAIN.AgentDirectory;?>parent/InsertMe.php?id=<?php echo $ticket['customer_support_id'];?>&action=DeleteTicket" style="padding: 0px 5px; font-size:14px;" onClick="return confirm('Are you sure you want to delete this record');"  class="btn btn-danger"><i class="fa fa-remove"></i> </a>

</td>

</tr>

<?php } ?>


</tbody>
</table>
</div>
</div>
</div>



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

<?php include('includes/footer.php');?>


</div>
</div>

<!-- jQuery -->
<script src="../vendors/jquery/dist/jquery.min.js"></script>
<!-- Bootstrap -->
<script src="../vendors/bootstrap/dist/js/bootstrap.min.js"></script>
<!-- FastClick -->
<script src="../vendors/fastclick/lib/fastclick.js"></script>
<!-- NProgress -->
<script src="../vendors/nprogress/nprogress.js"></script>
<!-- iCheck -->
<script src="../vendors/iCheck/icheck.min.js"></script>
<!-- Datatables -->
<script src="../vendors/datatables.net/js/jquery.dataTables.min.js"></script>
<script src="../vendors/datatables.net-bs/js/dataTables.bootstrap.min.js"></script>
<script src="../vendors/datatables.net-buttons/js/dataTables.buttons.min.js"></script>
<script src="../vendors/datatables.net-buttons-bs/js/buttons.bootstrap.min.js"></script>
<script src="../vendors/datatables.net-buttons/js/buttons.flash.min.js"></script>
<script src="../vendors/datatables.net-buttons/js/buttons.html5.min.js"></script>
<script src="../vendors/datatables.net-buttons/js/buttons.print.min.js"></script>
<script src="../vendors/datatables.net-fixedheader/js/dataTables.fixedHeader.min.js"></script>
<script src="../vendors/datatables.net-keytable/js/dataTables.keyTable.min.js"></script>
<script src="../vendors/datatables.net-responsive/js/dataTables.responsive.min.js"></script>
<script src="../vendors/datatables.net-responsive-bs/js/responsive.bootstrap.js"></script>
<script src="../vendors/datatables.net-scroller/js/dataTables.scroller.min.js"></script>
<script src="../vendors/jszip/dist/jszip.min.js"></script>
<script src="../vendors/pdfmake/build/pdfmake.min.js"></script>
<script src="../vendors/pdfmake/build/vfs_fonts.js"></script>

<!-- Custom Theme Scripts -->
<script src="../build/js/custom.min.js"></script>

<link rel="stylesheet" href="colorbox.css" />

<script src="jquery.colorbox.js"></script>

<script>

$(document).ready(function(){

$(".iframePupop").colorbox({iframe:true, width:"50%", height:"85%"});

});

</script>


<link href="autosearch_select/select2.css" rel="stylesheet">
<link href="autosearch_select/select2-default.css" rel="stylesheet">
<script src="autosearch_select/select2.min.js"></script>

<script>
$(function() {
$('.chosen-select').select2( { width:'100%', maximumSelectionSize: 1 } );
$(document).ready(function() {
$(".chosen-multi-select").select2( { width:'100%', } ); }); }); function slideout(){ setTimeout(function(){
$(".alert-success").fadeOut("slow", function () { });
$(".alert-danger").fadeOut("slow", function () { }); }, 4000);}
</script>

</body>
</html>