
<?php
ob_start();
session_start();
date_default_timezone_set('asia/Kuala_Lumpur');
include "../db/connection.php";
include "send-email.php";
ini_set('display_errors',0);
if(isset($_SESSION) && $_SESSION['logged']!=1){
  header("Location:http://ytyportal.ytygroup.my/Dashboard/Authenticate/login.php");
  die;
}
//*********************************SUPPORT EMAIL START BY DEEP RANA*****************/
$querySE= "SELECT YTY_FN_EMPGRV_REPLY AS SUPPORT_EMAIL FROM DUAL"; 
$supportEmailDetails = oci_parse($dbcon,$querySE);
oci_execute($supportEmailDetails);
$rowSupt=oci_fetch_array($supportEmailDetails);
//echo"<pre>";print_r($rowSupt);die;
//*********************************SUPPORT EMAIL END BY DEEP RANA*****************/
if(isset($_POST['employee_id']) && isset($_POST['application_id']))
{
  //echo"<pre>";print_r($_FILES);die;
  $insertFlag=0;
  $emp_id = $_POST['emp_id'];
  $emp_name = $_POST['emp_name'];
  $date_form_submitted = date('d-M-Y',strtotime($_POST['date_form_submitted']));
  $postion = $_POST['postion'];
  $additional_info = $_POST['additional_info'];
  $employee_sign = $_POST['employee_sign'];
  $date = date('d-M-Y',strtotime($_POST['date']));
  $event_location = $_POST['event_location'];
  $event_location_Date = $_POST['event_location_Date'];
  $witness = $_POST['witness'];
  $event_account = $_POST['event_account'];
  $violation = $_POST['violation'];
  $team_handled = $_POST['team_handled'];
  $emp_sign_1 = $_POST['emp_sign_1'];
  $date_1 = date('d-M-Y',strtotime($_POST['date_1']));
  $received_sign = $_POST['received_sign'];
  $date_2 = date('d-M-Y',strtotime($_POST['date_2']));
  $fileName="";
if($_FILES['attachment']['name']!="")
{
  $fileNamses=$_FILES['attachment']['name'];
  $tmpName=$_FILES['attachment']['tmp_name'];
  $ext = pathinfo($fileNamses, PATHINFO_EXTENSION);
  $fileName=$_POST['application_id']."_pic_file.".$ext;
  move_uploaded_file($tmpName,"upload/".$fileName);
}
else
{
  $fileName=$_POST['old_file'];
}
  //***************************************************** */
  $from_language =$_POST['convert_lang'];
  $to_language ='en';
  $assignTh=addslashes($_POST['team_handled']);
  $assignRs=$_POST['received_sign'];
  $assignDs=$_POST['date_2'];
  $returnLangTh=googleTranslatorCoverter($assignTh,$to_language,$from_language);
  $returnLangRs=googleTranslatorCoverter($assignRs,$to_language,$from_language);
  $grievance_status ='0';
  if($_POST['grievance_status']=='on')
    $grievance_status ='1';

  if($_POST['click_on']=='save')
  {
     $update_query = "UPDATE EMPLOYEE_GRIEVANCE SET HANDLED_BY='".$team_handled."',EMP_SIGNATURE_2='".$emp_sign_1."',SIGN_DATE_2='".$date_1."',RECEIVED_BY='".$received_sign."',RECEIVED_DATE='".$date_2."',HANDLED_BY_GRV='".$returnLangTh."',RECEIVED_BY_GRV='".$returnLangRs."',RECEIVED_DATE_GRV='".$date_2."',ADDITIONAL_INFO='".$additional_info."',PIC_FILE_NAME='".$fileName."' WHERE EMP_ID='".$_POST['employee_id']."' AND APPLICATION_ID='".$_POST['application_id']."'";
      $executeQuery1= oci_parse($dbcon,$update_query);
     if(oci_execute($executeQuery1))
        $insertFlag=1;
  }
  else
  {
     $update_query = "UPDATE EMPLOYEE_GRIEVANCE SET HANDLED_BY='".$team_handled."',STATUS_OF_GRIEVANCE='3',EMP_SIGNATURE_2='".$emp_sign_1."',SIGN_DATE_2='".$date_1."',RECEIVED_BY='".$received_sign."',RECEIVED_DATE='".$date_2."',HANDLED_BY_GRV='".$returnLangTh."',RECEIVED_BY_GRV='".$returnLangRs."',RECEIVED_DATE_GRV='".$date_2."',ADDITIONAL_INFO='".$additional_info."',PIC_FILE_NAME='".$fileName."' WHERE EMP_ID='".$_POST['employee_id']."' AND APPLICATION_ID='".$_POST['application_id']."'";
    $executeQuery1= oci_parse($dbcon,$update_query);
    if(oci_execute($executeQuery1))
    {
        $html_hr='<!doctype html>
        <html>
        <head>
          <title></title>
          <style type="text/css">
            table {border-collapse:separate;}
            .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td {line-height: 100%}
            .ExternalClass {width: 100%;}
        
            .wrapper {
              width:100%;
              background-color: #fff;
            }
        
            .container {
              width:800px !important;
            }
        
            .content {
              background-color: #fff;
              border: 1px solid #D6D6D6;
              -webkit-box-shadow: 0px 0px 7px 1px rgba(0,0,0,0.75);
              -moz-box-shadow: 0px 0px 7px 1px rgba(0,0,0,0.75);
              box-shadow: 0px 0px 7px 1px rgba(0,0,0,0.55);
            }
        
            .mbody {
              color: #000;
              font-family: Verdana;
              font-style: normal;
              font-size: 10.5pt;
            }
        
            .note {
              font-size: 7.5pt;
              font-family: Verdana;
              color: #000;
              text-align: justify;
            }
          </style>
        </head>
        <body>
        <table cellpadding="0" cellspacing="0" align="center" border="0" width="100%" style="height:100%!important; margin:0; padding:0; width:100%!important; text-align:center">
        <tr>
          <td style="height:20px; display:block;"></td>
        </tr>
        <tr>
          <td style="width:20px; display:block;"></td>
          <td align="center">
            <table class="content" border="0" cellspacing="0" cellpadding="0" width="800" style="border-collapse: collapse; border:1px solid #7f7f7f;">
            <tr>
              <td>
                <img src="http://dl.ytygroup.com.my/CommonLogo/MailHeader.jpg" width="952" height="106" style="display:block;"/>
              </td>
            </tr>
            <tr>
              <td style="height:10px; display:block;"></td>
            </tr>
            <tr>
              <td>
                <table class="mbody" style="width:100%;">
                <tr>
                  <td style="width:20px; display:block;"></td>
                  <td style="line-height: 1.3em;">
                    <p>Feedback from PIC has been received on the following case:</p>
                    <p><b>Application no.:</b>'.$_POST['application_id'].'</p>
                    <p><b>Employee ID :</b>'.substr($_POST['employee_id'],3).'</p>
                    <p>Kindly put up for committee`s review.</p>
                    <br/><p>Sincerely,<br /><b>YTY Workflow</b></p> 
                    <p style="font-size:11px;">Note: This message is auto-generated so please do not respond to this email.</p></td>
                  <td style="width:20px; display:block;"></td>
                </tr>
                </table>
              </td>
            </tr>
            <tr>
              <td style="height:10px; display:block;"></td>
            </tr>
            <tr>
              <td>
                <img src="http://dl.ytygroup.com.my/CommonLogo/MailFooter.jpg" style="display:block;"/>
              </td>
            </tr>
            </table>
          </td>
          <td style="width:20px; display:block;"></td>
        </tr>
        <tr>
          <td style="height:20px; display:block;"></td>
        </tr>
        </table>
        </body>
        </html>';
        //echo"<pre>";print_r($html_hr);die;
        if($_POST['application_id']){ 
          $mailSubject="GRIEVANCE SYSTEM-PIC RESPONSE RECEIVED/APPLICATION ID:".$_POST['application_id'];
          sendEmail($rowSupt['SUPPORT_EMAIL'],$mailSubject,$html_hr,'');
        }
          $insertFlag=1;
    }  
  }         
    if($insertFlag==1)
    {
      header("location:yty-grievance-form-report.php?msg=Data has been updated successfuly.");  
      die;    
    }
   else
   {
      header("location:yty-grievance-form-report.php?msg=Data Not Inserted.");
      die;      
   }
}
if(isset($_POST['emp_id']) && isset($_POST['app_id']))
{
  $query= "SELECT EG.*,ei.employee_name AS ASSIGN_TO FROM EMPLOYEE_GRIEVANCE EG
              LEFT JOIN YTY_VW_EMP_INFO EI ON EG.ASSIGN_TO_EMPLOYEE_GRV=EI.EMP_MAIN_ID WHERE EG.EMP_ID='".$_POST['emp_id']."' AND EG.APPLICATION_ID='".$_POST['app_id']."'"; 
  $tableDetails = oci_parse($dbcon, $query);
  oci_execute($tableDetails);
  $rowDetailsArr=oci_fetch_array($tableDetails);
  //echo"<pre>";print_r($rowDetailsArr);die;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
  <title>EMPLOYEE GRIEVANCE AND REDRESSAL</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="css/mystyle.css">
  <link rel="shortcut icon" href="favicon.png" />
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.min.js"></script>
  <link rel="stylesheet" href="https://code.jquery.com/ui/1.8.23/themes/base/jquery-ui.css">
  <script src="https://code.jquery.com/jquery-1.8.2.js"></script>
  <script src="https://code.jquery.com/ui/1.8.23/jquery-ui.js"></script>
  <link rel="stylesheet" href="https://jqueryui.com/resources/demos/style.css">

</head>
<body>
<header id="myHeader">
  <div class="container-fluid">
   <div class="col-md-12 col-sm-12 col-xs-12">
   <img src="medi-logo1.png" alt="YTY"><span>EMPLOYEE GRIEVANCE AND REDRESSAL</span>
   </div>
  </div>
</header>
 <div class="containerfluid mydesignform">
 
   <div class="row">
     <div class="divtitle">
       <h1>EMPLOYEE GRIEVANCE FORM<span>(Employees are strongly encouraged to have informal discussions before filling the  grievance form)</span></h1>
     </div>  
     <div class="col-sm-12 col-xs-4">
                    <?php
          if($_REQUEST['msg'])
          {
            ?>
                        <div class="alert alert-success" id="success-alert">
                          <button type="button" class="close" data-dismiss="alert">x</button>
                          <strong><?php echo $_REQUEST['msg'];?></strong></a>
                        </div>  
          <?php
          }
          ?>
          </div>
   </div>
   
   <div class="row">
      <form action="" method="post" id="formSubmit" enctype="multipart/form-data">
      <input type="hidden" name="employee_id" value="<?php echo $_POST['emp_id'];?>" />
      <input type="hidden" name="application_id" value="<?php echo $_POST['app_id'];?>" />
      <input type="hidden" name="convert_lang" value="<?php echo $rowDetailsArr['EMP_GRV_LANGUAGE'];?>" />
      <?php
      if($rowDetailsArr['OPEN_FOR_OTHERS']=='Y')
      { 
        ?>
      <div class="section1bg">
      <!--heading Start-->  
      <div class="col-lg-12 col-12 formheading">EMPLOYEE'S INFORMATION (<?php echo $rowDetailsArr['APPLICATION_ID'];?>)</div>
      <!--heading End-->     
       <!--Form Column Start-->
      <div class="col-lg-6 col-md-6 col-sm-6 col-6 autodropdownlist">
        <div class="form-group">
         <label for="email">EMPLOYEE ID<span>*</span></label>
         <input type="text" class="form-control" disabled name="emp_id" required id="emp_id" value="<?php echo substr($rowDetailsArr['EMP_ID'],3);?>"    onkeyup="return wating(this.value)" onchange="return getEmployeeDetails(document.getElementById('txtUserid').value)">
        </div>
        <span id="empList"></span>
      </div>
      <!--Form Column End-->
   
      <!--Form Column Start-->
      <div class="col-lg-6 col-md-6 col-sm-6 col-6">
        <div class="form-group">
         <label for="email">EMPLOYEE NAME<span>*</span></label>
         <input type="text" class="form-control" name="emp_name" value="<?php echo $rowDetailsArr['EMPLOYEE_NAME'];?>" id="emp_name" readonly placeholder="" required>
        </div>
      </div>      
      <!--Form Column End-->
      <!--Form Column Start-->
      <div class="col-lg-6 col-md-6 col-sm-6 col-6">
        <div class="form-group">
         <label for="email">DATE FORM SUBMITTED<span>*</span></label>
         <input class="form-control" name="date_form_submitted" placeholder="MM/DD/YYY" value="<?php echo date('d-M-Y',strtotime($rowDetailsArr['SUBMISSION_DATE']));?>" readonly required type="text"  autocomplete="off"/>
        </div>
      </div>
      <!--Form Column End--> 
      <!--Form Column Start-->
      <!--<div class="col-lg-6 col-md-6 col-sm-6 col-6">
        <div class="form-group">
         <label for="email">POSITION</label>
         <input type="text" class="form-control" value="<?php echo $rowDetailsArr['POSITION'];?>" readonly name="postion" required>
        </div>
      </div>--> 
      <!--Form Column End--> 
      <!--Form Column Start-->
      <!--<div class="col-lg-6 col-md-6 col-sm-6 col-6">
        <div class="form-group">
         <label for="email">SIGNATURE OF EMPLOYEE</label>
         <input type="text" class="form-control" value="<?php echo $rowDetailsArr['EMP_SIGNATURE_1'];?>" readonly name="employee_sign">
        </div>
      </div>--> 
      <!--Form Column End-->
      <!--Form Column Start-->
      <!--<div class="col-lg-6 col-md-6 col-sm-6 col-6">
        <div class="form-group">
         <label for="email">DATE</label>
          <input class="form-control" name="date" type="text" value="<?php echo date('d-M-Y',strtotime($rowDetailsArr['SIGN_DATE_1']));?>" readonly autocomplete="off"/>
        </div>
      </div>--> 
      <!--Form Column Start-->
      <div class="col-lg-6 col-md-6 col-sm-6 col-6">
        <div class="form-group">
         <label for="email">Email</label>
         <input type="email" class="form-control"  name="email_id" disabled value="<?php echo $rowDetailsArr['EMPLOYEE_EMAIL'];?>" id="email_id" required>
        </div>
      </div>
      <!--Form Column End-->
      <!--Form Column Start-->
      <div class="col-lg-6 col-md-6 col-sm-6 col-6">
        <div class="form-group">
         <label for="email">Mobile</label>
          <input class="form-control" name="mobile" id="mobile" type="number" disabled value="<?php echo $rowDetailsArr['EMPLOYEE_MOB'];?>" required  autocomplete="off"/>
        </div>
      </div>
      <!--Form Column End-->  
      <!--Form Column End-->  
     </div>
     <?php
     }
     ?>
     <div class="section1bg">
      <!--heading Start-->  
      <div class="col-lg-12 col-12 formheading">DETAILS OF EVENT LEADING TO GRIEVANCE</div>
      <!--heading End-->      
      <!--Form Column Start-->
      <div class="col-lg-6 col-md-4 col-sm-4 col-6">
        <div class="form-group">
         <label for="email">DATE, TIME, AND LOCATION OF EVENT</label>
         <textarea type="text" class="form-control" readonly name="event_location" placeholder="Location of event. If you cannot remember the exact date, please enter the approximate date."><?php echo $rowDetailsArr['GRIEVANCE_DETAILS_HR'];?></textarea>
        </div>
      </div>
      <!--Form Column End--> 
      <!--Form Column Start-->
      <div class="col-lg-6 col-md-4 col-sm-4 col-6">
        <div class="form-group">
        <label for="email">WITNESSES if applicable</label>
        <textarea type="text" class="form-control" readonly name="event_location_Date" placeholder="Date & time location of event"><?php echo $rowDetailsArr['WITNESS_NAME_HR'];?></textarea>
        </div>
      </div>
      <!--Form Column End--> 
      <!--Form Column Start-->
      <div class="col-lg-6 col-md-6 col-sm-6 col-6">
        <div class="form-group">
         <label for="email">ACCOUNT OF EVENT</label>
         <textarea type="text" class="form-control" readonly name="event_account" placeholder="Provide a detailed account of the occurrence. 
Include the names of any additional persons involved."><?php echo $rowDetailsArr['ACCOUNT_OF_EVENT_HR'];?></textarea>
        </div>
      </div>
      <!--Form Column End--> 
      <!--Form Column Start-->
      <div class="col-lg-6 col-md-6 col-sm-6 col-6">
        <div class="form-group">
         <label for="email">VIOLATIONS</label>
         <textarea type="text" class="form-control" readonly name="violation" placeholder="Provide a list of any policies, procedures, or guidelines you believe have been violated in the event described."><?php echo $rowDetailsArr['VIOLATIONS_HR'];?></textarea>
        </div>
      </div>
      <!--Form Column End--> 
      <!--Form Column Start-->
      <div class="col-lg-6 col-md-6 col-sm-6 col-6">
        <div class="form-group">
         <label for="email">Attachment</label>
         <?php
         $filePath="https://ytyhub.com/formsyty/upload/".$rowDetailsArr['GRIEVANCE_ATTACHMENT'];
         if($rowDetailsArr['GRIEVANCE_ATTACHMENT']!="")
         {
           ?>
            <a href="<?php echo $filePath;?>" class="indicatorbg" target="_blank">View</a>
           <?php
         }
         else{
            echo "<span style='color:red'>&nbsp;-&nbsp;No file attached.</span>";
         }
         ?>
        </div>
      </div>
      <!--Form Column End-->        
     </div>
     <div class="section1bg">
      <!--heading Start-->  
      <div class="col-lg-12 col-12 formheading">ADMINISTRATIVE SECTION</div>
      <!--heading End-->     
      <!--Form Column Start-->
      <div class="col-lg-12 col-md-4 col-sm-4 col-6">
        <div class="form-group">
         <label for="email">COMMENT</label>
         <textarea type="text" class="form-control"  name="comment" maxlength="3999" disabled placeholder=""><?php echo $rowDetailsArr['ADMIN_COMMENT_GRV'];?></textarea>
        </div>
      </div> 
      <!--heading End-->          
      <!--Form Column Start-->
      <div class="col-lg-6 col-md-12 col-sm-12 col-6 autodropdownlist">
        <div class="form-group">
         <label for="email">ASSIGN TO<span>*</span></label>
         <input type="text" class="form-control"  disabled name="emp_id" value="<?php if($rowDetailsArr['ASSIGN_TO']!="") echo $rowDetailsArr['ASSIGN_TO'];?>" required id="emp_id" autocomplete="off" onkeyup="return wating(this.value)" onchange="return getEmployeeDetails(document.getElementById('txtUserid').value)">
         <input type="hidden" class="form-control"  name="assign_emp_id" required id="assign_emp_id">
        </div>
        <span id="empList"></span>
      </div>
      <!--Form Column End-->
        <!--Form Column Start-->
      <div class="col-lg-6 col-md-12 col-sm-12 col-6">
      <div class="form-group">
         <label for="email">CATEGORY<span>*</span></label>
          <select name="priority" id="priority" disabled class="form-control" <?php if($rowDetailsArr['RECEIVED_BY']!='') echo "disabled";?> required>
          <option value="">--Category--</option>
          <?php
            $queryProrty= "SELECT EMP_GRV_SRNO,EMP_GRV_CATEGORY FROM EMPLOYEE_GRIEVANCE_PRIORITY ORDER BY EMP_GRV_SRNO"; 
            $prirotyDets = oci_parse($dbcon, $queryProrty);
            oci_execute($prirotyDets);
            while($row=oci_fetch_array($prirotyDets))
            { 
           ?>
            <option value="<?php echo $row['EMP_GRV_CATEGORY']?>" <?php if(trim($rowDetailsArr['CATEGORY_GRV'])==trim($row['EMP_GRV_CATEGORY'])) echo "selected";?>><?php echo $row['EMP_GRV_CATEGORY']?></option>
            <?php
            }
            ?>
          </select>
        </div>
      </div> 
      <!--heading End-->
      </div>
     <div class="section1bg">
      <!--heading Start-->  
      <div class="col-lg-12 col-12 formheading">CORRECTIVE ACTION</div>
      <!--heading End-->     
      <!--Form Column Start-->
      <div class="col-lg-6 col-md-4 col-sm-4 col-6">
        <div class="form-group">
         <label for="email">HANDLED BY PIC</label>
         <textarea type="text" class="form-control" <?php if($rowDetailsArr['CLOSE_DATE']!='') echo "disabled";?>  name="team_handled" id="team_handled" maxlength="3999" placeholder="Handled by Grievance Adminstrator Team"><?php echo $rowDetailsArr['HANDLED_BY'];?></textarea>
        </div>
      </div>      
      <!--Form Column End-->
      <!--Form Column Start-->
      <div class="col-lg-6 col-md-4 col-sm-4 col-6">
        <div class="form-group">
         <label for="email">ADDITIONAL INFO</label>
         <textarea type="text" class="form-control" <?php if($rowDetailsArr['CLOSE_DATE']!='') echo "disabled";?>  name="additional_info" id="additional_info" maxlength="3999" placeholder="Additional info"><?php echo $rowDetailsArr['ADDITIONAL_INFO'];?></textarea>
        </div>
      </div>      
      <!--Form Column End-->
      <div class="col-lg-6 col-md-6 col-sm-6 col-6">
        <div class="form-group">
         <label for="email">RECEIVED BY:  [PIC] NAME AND SIGNATURE</label>
         <input type="text" class="form-control" value="<?php if($rowDetailsArr['RECEIVED_BY']!="") echo $rowDetailsArr['RECEIVED_BY']; else echo $rowDetailsArr['ASSIGN_TO']; ?>" <?php if($rowDetailsArr['CLOSE_DATE']!='') echo "disabled";?> name="received_sign" placeholder="">
        </div>
      </div>      
      <!--Form Column End--> 
       <!--Form Column Start-->
      <div class="col-lg-6 col-md-6 col-sm-6 col-6">
        <div class="form-group">
         <label for="email">TARGET COMPLETION DATE <span>*</span></label>
          <input class="form-control" id="datepicker" name="date_2" <?php if($rowDetailsArr['CLOSE_DATE']!='') echo "disabled";?> value="<?php if($rowDetailsArr['RECEIVED_DATE']!="") echo date('d-M-Y',strtotime($rowDetailsArr['RECEIVED_DATE'])); else echo date('d-M-Y')?>" placeholder="DD-MM-YYYY" type="text" autocomplete="off"/>
          <div class="input-group-addon dateicon">
              <span class="glyphicon glyphicon-th"></span>
          </div>
        </div>
      </div>
      <!--Form Column End--> 
        <!--Form Column Start-->
      <div class="col-lg-6 col-md-12 col-sm-12 col-6">
        <div class="form-group">
         <label for="email">
         <strong class="indicatorbg" style="margin-left:0;">Open &nbsp; <strong class="open" style="margin-right:0;"></strong></strong>
         </label>        
        </div>
      </div>   
       <!--Form Column Start-->
      <div class="col-lg-6 col-md-6 col-sm-6 col-6">
        <div class="form-group">
         <label for="email">Attachment (PIC) 
         <?php
        $filePath="https://ytyhub.com/formsyty/upload/".$rowDetailsArr['PIC_FILE_NAME'];
         //$filePath="upload/".$rowDetailsArr['PIC_FILE_NAME'];
         if($rowDetailsArr['PIC_FILE_NAME']!="")
         {
           ?>
            <a href="<?php echo $filePath;?>" class="indicatorbg" target="_blank">View File</a>
           <?php
         }
         ?>
       </label>
          <input class="form-control" type="hidden" name="old_file" value="<?php echo $rowDetailsArr['PIC_FILE_NAME'];?>"  />
          <input class="form-control" type="file" name="attachment" <?php if($rowDetailsArr['CLOSE_DATE']!='') echo "disabled";?>  accept=".xls,.xlsx,.txt,.pptx,.docx,.tif,.doc,.xls,.odt,.ott"  id="attachment"  />
        </div>
      </div>
      <!--Form Column Start-->    
      <!--Form Column End-->      
     <!--<div class="section1bg"> 
      Form Column End     
      <div class="col-lg-12 col-12 formheading">MANAGEMENT REIVIEW SECTION</div>
       Form Column Start
      <div class="col-lg-12 col-md-12 col-sm-12 col-6">
        <div class="form-group">
         <label for="email">STATUS OF GRIEVANCE 
         <strong class="indicatorbg">Open <strong class="open"></strong> Close <strong class="close"></strong></strong>
         </label><br>
         <label class="switch">
         <input type="checkbox" disabled name="grievance_status" <?php if($rowDetailsArr['STATUS_OF_GRIEVANCE']=='1') echo 'checked';?>><div class="status_slider round"></div></label>       
        </div>
      </div>      
      Form Column End-->       
       <!--Form Column Start-->
      <div class="col-lg-12 col-md-12 col-sm-12 col-6">
        <div class="form-group">
        <?php 
          if($rowDetailsArr['CLOSE_DATE']!='')
          {
            ?>
            <span style="color: red;"><strong>This application has been closed.</strong><span>
          <?php
          }
          else{ ?>
            <!--<button type="submit" class="formbutton" onclick="return submitForm('save');" id="btnLogin1">Save</button> -->
            <button type="submit" class="formbutton" onclick="return submitForm('submit');" id="btnLogin">Submit</button> 
         <?php } ?>
         <button type="button" class="formbutton" id="btnLogin"><a href="yty-grievance-form-report.php" style="color: #fff;text-decoration:none">Back</a></button>   <input type="hidden" name="click_on" id="click_on" />    
        </div>
      </div>      
      <!--Form Column End--> 
     </div>
      </form>
     </div>  
  </div>
  <script>
  $(function() {
    $( "#datepicker" ).datepicker({dateFormat: 'dd-M-yy',
                                  changeMonth: true,
                                  changeYear: true,
                                  minDate: "dateToday"
                                }
                        );
  });
</script>
  <script>
    function wating(val)
  {
      document.getElementById("empList").innerHTML='Loading please wait...';
      document.getElementById('btnLogin').disabled=true;
      $.ajax({
        url: "search_employee.php",
        type: 'get',
        data: { term:+val,type:+1}, 
        dataType: 'json',
        success:function(response) {
          if(response!="")
          {
              document.getElementById('empList').innerHTML=response[0];
              document.getElementById('btnLogin').disabled=false;
          }
        }
        }); 
    //else
      //document.getElementById("loading").innerHTML='';
  }
  function fillTextData(data)
  {
    var dataArr=data.split("_");
    $("#emp_id").val(dataArr[0]);
    $("#emp_name").val(dataArr[1]);
    document.getElementById("empList").innerHTML='';
  }
  function getEmployeeDetails(value)
  {
    document.getElementById('validationMsg').innerHTML='Alert !!';
    if(value!=""){
      $.ajax({
        url: "search_employee.php",
        type: 'get',
        data: { term:+val,type:+1}, 
        dataType: 'json',
        success:function(response) {
          if(response[1]==0)
          {
            document.getElementById("messagePara").innerHTML='Invalid Employee ID.';
            $("#txtUserid").val('');
            $("#txtUserid1").val('');
            //document.getElementById("loading").innerHTML='';
            $("#alertModel").modal('show');
          }
        }
        }); 
    }
  }
  function submitForm(click_by)
  {
    //if(document.getElementById("team_handled").value=="")
    //{
      //alert('Handled by PIC is required');
      //return false;
    //}
    if(click_by=='submit')
    { 
        if(confirm('Please confirm ? Are you want to save for final Submittion.'))
        {
          return true;
        }
        else
        {
          return false;
        }
    }

    document.getElementById("click_on").value=click_by;
    //document.getElementById("btnLogin1").style.color='#000 ';
    //document.getElementById('btnLogin1').innerHTML ="Processing please wait...";
    document.getElementById("btnLogin").style.color='#000 ';
    document.getElementById('btnLogin').innerHTML ="Processing please wait...";
    $('#btnLogin').attr('disabled',true);
    document.getElementById('formSubmit').submit();
  }

  </script>
</body>
</html>
