<?php
include('includes/session.php');
include('includes/config.php');
  if(isset($_POST['update']))
  {
$complaintnumber=$_GET['cid'];
$status=$_POST['status'];
//$person=$_POST['person'];
$remark=$_POST['remark'];
if($status=="closed"){
$query=mysqli_query($conn,"insert into complaintremark(complaintNumber,status,remark) values('$complaintnumber','$status','$remark')");
$sql=mysqli_query($conn,"update tblcomplaints set status='$status' where complaintNumber='$complaintnumber'");	  
$query4=mysqli_query($conn,"update workerlog set status='$status' where complaintNumber='$complaintnumber'");
echo "<script>alert('Complaint details updated successfully');</script>";
	  }
	  if($status=="reopen")
	  {
		$sql=mysqli_query($conn,"update tblcomplaints set status=null where complaintNumber='$complaintnumber'");  
		  echo "<script>alert('Complaint Reopened successfully');</script>";
  }
  }

 ?>
<script language="javascript" type="text/javascript">
function f2()
{
window.close();
}
function f3()
{
window.print(); 
}
</script>
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="Dashboard">
    <meta name="keyword" content="Dashboard, Bootstrap, Admin, Template, Theme, Responsive, Fluid, Retina">

    <title>AVIT | Complaint Details</title>

    <!-- Bootstrap core CSS -->
    <link href="assets/css/bootstrap.css" rel="stylesheet">
    <link href="assets/font-awesome/css/font-awesome.css" rel="stylesheet" />
    <link href="assets/css/style.css" rel="stylesheet">
    <link href="assets/css/style-responsive.css" rel="stylesheet">
<body>
  <section id="container" >
<?php include('includes/header.php');?>
<?php include('includes/sidebar.php');?>
      <section id="main-content">
          <section class="wrapper site-min-height">
          	<h3> Complaint Details</h3>
            <hr />
            <div class="col-sm-6">
            <div class="row">
 <form name="updateticket" id="updatecomplaint" class="horizontal-form" method="post"> 
 <div class="form-group col-sm-12">
	<label class="control-label" style="color: crimson; font-size: 20px; font-weight: bold;">Complaint Number : <?php echo htmlentities($_GET['cid']); ?></label>
   </div><br/>
    <div class="form-group col-sm-12">
	   <label><b>Status</b></label>
      <select name="status" class="form-control" required>
      <option value="">Select Status</option>
    	<option value="closed">Closed</option>
       <option value="reopen">Reopen</option>
        
      </select>
	 </div><br/>
  <div class="form-group col-sm-12">
	 <label><b>Remark</b></label>
      <textarea name="remark" class="form-control" cols="50" rows="5" required></textarea>
	 </div><br/>
    
    <div class="form-group col-sm-6">
      <input type="submit" name="update" class="btn btn-success" value="Submit">
	 </div>
 </form>
				</div>
			  </div>
		</section><! --/wrapper -->
      </section><!-- /MAIN CONTENT -->
<?php include('includes/footer.php');?>
  </section>

    <!-- js placed at the end of the document so the pages load faster -->
    <script src="assets/js/jquery.js"></script>
    <script src="assets/js/bootstrap.min.js"></script>
    <script src="assets/js/jquery-ui-1.9.2.custom.min.js"></script>
    <script src="assets/js/jquery.ui.touch-punch.min.js"></script>
    <script class="include" type="text/javascript" src="assets/js/jquery.dcjqaccordion.2.7.js"></script>
    <script src="assets/js/jquery.scrollTo.min.js"></script>
    <script src="assets/js/jquery.nicescroll.js" type="text/javascript"></script>


    <!--common script for all pages-->
    <script src="assets/js/common-scripts.js"></script>

    <!--script for this page-->
    
  <script>
      //custom select box

      $(function(){
          $('select.styled').customSelect();
      });

  </script>
</body>

</html>