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

<?php   

//print_r($db);

$branch=$_SESSION['branch'];
$date= date("Y-m");
$date1= date("Y-m-d");
$tickets;

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

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

 } elseif(isset($_GET['ActiveTickets']))
 {
 $sql = " select * from  eduportal_suggestions_center WHERE branch_id='$branch' and posted_date LIKE '$date%' ";
 
 } elseif(isset($_GET['CurrentCompleted']))
 {

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

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

 {
 $sql = " select * from  eduportal_suggestions_center WHERE branch_id='$branch' and status='0' And posted_date LIKE '$date%' ";
 
 } elseif(isset($_GET['TodayTickets']))

 {
 $sql = " select * from  eduportal_suggestions_center WHERE branch_id='$branch' and posted_date LIKE '$date1%' ";
 
 } elseif(isset($_GET['today_completed']))

 {
 $sql = " select * from  eduportal_suggestions_center WHERE branch_id='$branch' and status='1' And posted_date LIKE '$date1%' ";
 
 } elseif(isset($_GET['today_pending']))

 {
 $sql = " select * from  eduportal_suggestions_center WHERE branch_id='$branch' and status='0' And posted_date LIKE '$date1%' ";
 
 }  else {

   $sql = "select *  from  eduportal_suggestions_center ";

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

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

      $sql;

    } else {

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

    }


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

    } else {

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

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

    } else {

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

  }
    }

    }

    }

  $sql .= " order by suggest_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 Suggestions | 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="suggestions_dashboard.php">Suggestion Dashboard </a> &nbsp; <i style="" class="fa fa-angle-double-right"></i>  &nbsp; 
            View Suggestions Log
          <div class="">
            <div class="page-title">
              <div class="title_left">
                <h3>Manage Suggestions List<small> (<?php echo count($tickets);?> records)</small></h3>
              </div>

              
            </div>

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

<br>
              <form class="form-style-7">
                     
      <!--         <div class="col-md-3 col-sm-6">
                <label  class="control-label">Clients</label>
                <div class="form-group ">
                
                    <select name="bid" class="chosen-multi-select form-control"  >
                        <option value="All">All</option>

                    

                    </select>
                </div>
              </div> -->


                  <div class="col-md-3 col-sm-6">

                  <label  class="control-label">Module</label>
                  <select name="modules_id" class="chosen-multi-select form-control"  >
                  <option value="All">All</option>

                  <?php
                  $query="select * From eduportal_modules_detail";

                  $modules = $m->query($query);

                  foreach($modules as $module) { ?>

                  <option <?php if($ticketdata[0]['module_id']==$module['modules_id']){echo "selected";} ?>   value="<?php echo $module['modules_id']; ?>"><?php echo $module['modules_name']; ?></option>

                  <?php } ?>


                  </select>
                  </div>

               


              <div class="col-md-2 col-sm-6" >
    
          
                <div class="form-group ">
                   
                <button id="send" type="submit" class="btn btn-primary" style="background-color:#2a3f54;margin-left: 10px;margin-top: 23px;"> 
                Search</button>
                <a href="add_ticket.php" class="btn btn-danger" style="margin-top: -49px; margin-left: 93px;"> Add Suggestion </a>
                </div>

              </div>


           
            </div>


              
</form>

<br>

            <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="12%">Customer Name</th>
                          <th width="12%">Title</th>
                          <th width="5%">Posted Date</th>
                          <th width="3%">Priority </th>
                          <th width="5%">User</th>
                          <th width="5%">Status</th>
                          <th width="8%">Action</th>
                        
                        </tr>
                      </thead>
                      <tbody>

                        
<?php  $count=1;
$date= date("Y-m-d");

foreach($tickets as $ticket){

$m->where("branch_id", $ticket['branch_id']);
$branchName = $m->get("edu_branch_config");

$m->where("id", $ticket['user_id']);
$userName = $m->get("admin_login");
 
?>
        <tr>
          <td style="text-align:center;"><?php echo $count; $count++;?></td>
          <td style=""> <?php echo $branchName[0]['Branch_Name'];?></td>
          <td><?php echo $ticket['suggest_title'];?></td>

          <td><?php echo date("d-M-Y",strtotime($ticket['posted_date']));?></td>
                                   
          <td><?php echo $ticket['priority'];?></td>
          <td>

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

            </td>
        

          <td>

          

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

          <a style="padding: 0px 5px;"  class="btn btn-danger">Pending</a> 
        
         <?php } else { ?>    

          <a style="padding: 0px 5px;" class="btn btn-success">Done </a>  <br>

         <?php echo date("d-M-Y",strtotime($ticket['approval_date'])); } ?>  
                 


          </td>
                         
      <td>
   
         
          <a style="padding: 0px 5px;font-size:11px;" href="approve_suggest.php?branchId=<?php echo $ticket['branch_id'];?>&suggest_id=<?php echo $ticket['suggest_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_suggest_popup.php?suggest_id=<?php echo $ticket['suggest_id'];?>" class="btn btn-success iframePupop" >
          <i class="fa fa-search" aria-hidden="true"></i>
        </a>

        <a style="padding: 0px 5px; font-size:11px;"  href="add_suggest.php?<?php echo session_id().session_id().session_id().session_id().session_id();?>&tikup=<?php echo $ticket['suggest_id'];?>" style="cursor:pointer;"  class="btn btn-warning"> <i class="fa fa-pencil" aria-hidden="true"></i></a>

        <a href="<?php echo DOMAIN.AgentDirectory;?>parent/InsertMe.php?suggest_id=<?php echo $ticket['suggest_id'];?>&action=DeleteSuggest" style="padding: 0px 5px; font-size:11px;" 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>