
<?php 
//session_start();
ob_start();
error_reporting(0);
include("../../pidbco/pidbjoin.php");
$sujpath="./";
//if((!isset($_SESSION['user_name'])) && ($_SESSION['user_name'] == '')){
   // header("Location: ../index.php");
//} 

$taskid=$_POST["taskid"];
$sqtask = mysqli_query($con, "SELECT * FROM `p_task`  where tid='$taskid'");
   $rstask = mysqli_fetch_array($sqtask);
?>


      <div class="modal-header" style=" background-color: #E8E8E8;">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="myModalLabel"> #<?php echo $taskid; ?> - Edit Task Register</h4>
        </div>
        <div class="modal-body" id="myModal2" >
      
        <div class="row">   
          <div class="col-md-12">
 <div class="col-md-6"  style=" padding-left: 2px; padding-right: 0px; ">           
 <div class="form-group">
   <select name="taskfrom<?php echo $taskid; ?>" id="taskfrom<?php echo $taskid; ?>" class="form-control" <?php if($rstask['t_from'] != $_SESSION['us_staff']){ ?> disabled <?php } ?>>
    <option value="">From</option>
    <?php
    $sq1 = mysqli_query($con, "SELECT * FROM `employee_registration`  ORDER BY `emp_name` ASC ");
    while($res1 = mysqli_fetch_array($sq1)){
        if($rstask['t_from'] == $res1['id']){
    ?>
    <option value="<?php echo $res1['id']; ?>" selected><?php echo $res1['emp_name']; ?></option>
    <?php } else { ?>
    <option value="<?php echo $res1['id']; ?>"><?php echo $res1['emp_name']; ?></option>
    <?php } } ?>
   </select>        
 </div></div>

          
 <div class="col-md-6"  style=" padding-left: 2px; padding-right: 0px; ">           
 <div class="form-group">
  <select class="form-control" id="taskto<?php echo $rstask['tid']; ?>" name="taskto<?php echo $rstask['tid']; ?>" <?php if($rstask['t_from'] != $_SESSION['us_staff']){ ?> disabled <?php } ?>>
    <option value="">To</option>
    <?php
    $sq1 = mysqli_query($con, "SELECT * FROM `employee_registration`  ORDER BY `emp_name` ASC ");
    while($res1 = mysqli_fetch_array($sq1)){
        if($rstask['t_to'] == $res1['id']){
    ?>
    <option value="<?php echo $res1['id']; ?>" selected><?php echo $res1['emp_name']; ?></option>
    <?php } else { ?>
    <option value="<?php echo $res1['id']; ?>"><?php echo $res1['emp_name']; ?></option>
    <?php } } ?>  
  </select> 
 </div></div>
 
 </div>
 <div class="col-md-12">
      <div class="col-md-12" style=" padding-left: 2px; padding-right: 0px; " >
 <div class="form-group">
      <textarea <?php if($rstask['t_from'] != $_SESSION['us_staff']){ ?> disabled <?php } ?> name="taskaction<?php echo $rstask['tid']; ?>" id="taskaction<?php echo $rstask['tid']; ?>" class="form-control"  placeholder="Task Details"  <?php if($idd2 != ''){ ?> style=" height: 35px;" <?php } else { ?>  style=" height: 80px;" <?php } ?> ><?php echo $rstask['t_action']; ?></textarea>
 </div></div>
 </div>
 
 
    
        
 <?php 
 $task_id = $rstask['tid'];
 $sqw2 = mysqli_query($con, "SELECT * FROM `p_taswise_rep` WHERE `task_id`='$task_id'");
 while($resw2 = mysqli_fetch_array($sqw2)){
    $log_id = $resw2['log_id'];
    $sqemp = mysqli_query($con, "SELECT emp_name FROM `employee_registration` WHERE `id`='$log_id' ");
    $resemp = mysqli_fetch_array($sqemp);
    $reportemp = $resemp['emp_name'];
    ?>
    <div class="col-md-12" style="font-size: 14px; margin-top: 5px;">
    <div class="col-md-12" style=" padding-left: 2px; padding-right: 0px; " >
 
 <div style="float: left; margin-top: 3px; margin-bottom: 3px; ">   
 <small class="label label-warning" > <?php echo $resw2['reprt_date']; ?> </small> &nbsp; <?php echo $reportemp.'&nbsp;'.'Says :'; ?>   
 <?php echo $resw2['tas_report']; ?>
 </div></div></div><div style="clear:both;"></div>
<?php } ?>
 
 
 <div class="col-md-12">
      <div class="col-md-12" style=" padding-left: 2px; padding-right: 0px; " >
  <div class="form-group">
      <textarea name="taskreport<?php echo $rstask['tid']; ?>" id="taskreport<?php echo $rstask['tid']; ?>" class="keyboardInput form-control"  placeholder="Task Report" style=" height: 40px;" ></textarea>
  </div></div>
 </div>
    
         
  
 <div class="col-md-12">
  <div class="col-md-4"  style=" padding-left: 2px; padding-right: 0px; ">
  <div class="form-group">
  <select class="form-control" id="taskstatus<?php echo $rstask['tid']; ?>" name="taskstatus<?php echo $rstask['tid']; ?>" onchange="status_change2(this.value,'<?php echo $rstask['tid']; ?>');" >
     <option value="0" <?php if($rstask['t_status'] == 0){ ?> selected <?php } ?>>Open</option>
     <option value="1" <?php if($rstask['t_status'] == 1){ ?> selected <?php } ?>>Closed</option>
     <option value="2">Transfer</option>
     <option value="3" <?php if($rstask['t_status'] == 3){ ?> selected <?php } ?>>Hold</option>
  </select> 
 </div></div>
 
  
 <div class="col-md-3"  style=" padding-left: 2px; padding-right: 0px; display: none;" id="trans_div_vis<?php echo $rstask['tid']; ?>">         
    <div class="form-group">
    <select name="transferto<?php echo $rstask['tid']; ?>" id="transferto<?php echo $rstask['tid']; ?>" class="form-control">
    <option value="">Tansfer To</option>
    <?php
    $sq1 = mysqli_query($con, "SELECT * FROM `employee_registration` WHERE `status`='1' ORDER BY `emp_name` ASC ");
    while($res1 = mysqli_fetch_array($sq1)){
    ?>
    <option value="<?php echo $res1['id']; ?>"><?php echo $res1['emp_name']; ?></option>
    <?php } ?>
    </select>       
    </div></div>
    
    
  
    
    
    
 <div class="col-md-4" style=" padding-left: 2px; padding-right: 0px; ">                    
 <div class="form-group">
    <input type="checkbox" name="tasksign<?php echo $rstask['tid']; ?>" id="tasksign<?php echo $rstask['tid']; ?>" placeholder="Signature" style=" margin-left: 15px;" <?php if($rstask['t_sign'] == 1){ ?> checked <?php } ?> />Signature
    <input type="hidden" name="hidvall2" id="hidvall2" value="<?php echo $rstask['tid']; ?>" />
    <input type="submit" class="btn btn-primary" name="frasubmit" id="frasubmit" value="Update" onclick="edit_new_task('<?php echo $rstask['tid']; ?>');" style=" float: right;margin-right: 5px; " /> 
 </div>
 </div>
 
    
 </div>      
   
   
         
      
     
        </div>  
       
        
	