
  <script type="text/javascript">
  
		
		 $(document).on("click", "#managebtndelete", function()
        {
          var itemid = $(this).data('id');
		  $("#itemid1").val(itemid); 
		  
		   

		  
		  	   
        });
		  $(document).on("click", "#editbtn", function()
        {
          var taskid = $(this).data('id');
		  $("#taskid").val(taskid); 
		   
 
		    var date = $(this).data('date');
		   $("#date").val(date); 
		   
		     var description = $(this).data('description');
		   $("#description").val(description); 
		 
		    var challanges = $(this).data('challanges');
		   $("#challanges").val(challanges); 
		   
		     var recommendation = $(this).data('recommendation');
		   $("#recommendation").val(recommendation); 
		 
		    var status =  $(this).data('status');
		   $("#status").val(status); 
		   
		     var comments = $(this).data('comments');
		   $("#comments").val(comments); 
		   var subject = $(this).data('subject');
		   $("#subject").val(subject); 
		  
		      var achieved = $(this).data('achieved');
		   $("#achieved").val(achieved); 
		   
        });
		
		
		
		
    </script>   
 
 <div class="row">
  
   	

   	<div class="col-md-12">
	
  
		<div class="panel panel-default" data-collapsed="0">
        	<div class="panel-heading">
            	<div class="panel-title" id="redcolor" >
            		<i class="entypo-plus-circled"></i>
						 <span class="pull-right"> Task history</span>	
                        <a  id="more" target="blank" class="btn btn-primary" href="<?php echo base_url();?>user/viewtasks">back  </a>
						 

				
            	</div>
            </div>
			<div class="panel-body">

				<div class="widget-content nopadding table_holder table-responsive" >				
	<?PHP
 $session_data = $this->session->userdata('logged_in');

   
 	$data['id'] = $session_data['id'];
        
		 $userid = $data['id'];

 $data['companyid'] = $session_data['companyid'];
	 $companyid = $data['companyid'];
		 $data['usertype'] = $session_data['usertype'];
	 $usertype = $data['usertype'];

				echo $this->session->flashdata('msg'); 
								?>	
										
					<table class="tablesorter table table-bordered  table-hover" id="sortable_table">			
 <tr>
   			<b style="color:red">Task No : <?php  if (isset($itemid)){ echo $itemid;}    ?></b> </br>

	Subject : <?php  if (isset($subject)){ echo $subject;}    ?> :
	 </th>
	        <th>
			Task Given:</br>
				 <?php  if (isset($comments)){ echo $comments;}  ?>

			</th>
			</tr>
             </table>
			 
			 
			 
									
									
				<table class="tablesorter table table-bordered  table-hover" id="sortable_table">			

             <thead>
         <tr>
    
     <th>Subject/title</th>
	        <th>Date</th>
	        <th>Exact Date</th>

	     <th>Feedback</th>
		 	     <th>Achieved</th>

		 	     <th>Challanges / recommendation.</th>
		 	     <th>Todo List</th>


	 <th>Added by:</th>
	 	 <th>Status</th>

		 	 <th>Supervisor Comments</th>

	 	 <th>More:</th>


                 </tr>
             </thead>
<?php
 if(!is_array($mytask)) {
				    echo '<div class="alert alert-danger text-center">There was no task history found in the system</div>';

			 }else{
 if(!is_array($mytask)) 

 {


   echo "<tr  style='margin-bottom:0px;margin-top:0px;' '>";
      echo "<td colspan='1'>";
    
       echo '<div class="alert alert-warning text-center">There no records found..</div>';
    echo "</td>";
   echo "</tr>";
    }else {
?>
    
             <?php 
  
  	foreach ($mytask as $c): 

		 

             ?>



             <tr>
                
            <?php 
$id=$c->id;


?>

                 <td><?php 
				 	$mysubject="";
					$manager="";
					$myview="";

					
				  if (isset($itemid)){
					$myview="user/viewmoretasks?randomitemidentifier=".$itemid;

				
	$taskid=$c->taskid;
	
	$mycategory = $this->usermodel->populateall('tasks','id', $itemid);



if(is_array($mycategory)) {

   foreach($mycategory as $mycategoryrow){
		echo $mycategoryrow->subject;
	$mysubject=$mycategoryrow->subject;
	$manager=$mycategoryrow->controller;


}} else {
		$mysubject="";
		$manager="";

    echo 'No Category .';
}
	 }else{
		
		
					
			$taskid=$c->taskid;
	
	$mycategory = $this->usermodel->populateall('tasks','id', $taskid);
	
	if($page>0){
							$myview="user/viewotherfeedback/".$page;

	}else{
							$myview="user/viewotherfeedback";

	}
	
					


if(is_array($mycategory)) {

   foreach($mycategory as $mycategoryrow){
		echo $mycategoryrow->subject;
		$mysubject=$mycategoryrow->subject;
	$manager=$mycategoryrow->controller;


}} else {
			$mysubject="";
					$manager="";

    echo 'No Category .';
}
			
					
					
					
					
					
					
					
					
					
 
				 }
?>
</td>
    <td><?php echo $c->date ; ?></td>

     <td><?php echo $c->exactdate ; ?></td>

    <td><?php echo $c->description ; ?></td>
	    <td><?php echo $c->achieved ; ?></td>
	    <td><?php echo $c->challanges ; ?></td>

		    <td><?php echo $c->recommendation ; ?></td>

	
		 <td><?php 
	$owner=$c->userid;
			$myowner = $this->usermodel->populateall('people', 'id',$owner);


	


if(is_array($myowner)) {

   foreach($myowner as $myowneryrow){
		echo $myowneryrow->firstname;


}} else {
    echo 'No User .';
}
	
?>
</td>

		    <td><?php echo $c->status ; ?></td>

		    <td><?php echo $c->comments ; 
			
			
if($c->updatedby !=0){
	$updatedby=$c->updatedby;
			$user = $this->usermodel->populateallarray('people', 'id',$updatedby);
				
			
			if($c->comments !=""){
				echo "<br>:By ".$user[0]["firstname"]; 
			}
			
	}
			
			
			
			?></td>






	 <td> 

 
 
			
					
									<?php
									


									
										if($usertype=="admin"){
											
											?>
                                        
                                       
									   

	 <a class="btn btn-primary editbtn" id="editbtn"  data-subject='<?php echo  htmlspecialchars($mysubject);?>' data-achieved='<?php echo  $c->achieved;?>'   data-status='<?php echo  $c->status;?>'  data-comments='<?php echo  htmlspecialchars($c->comments);?>'data-recommendation='<?php echo  htmlspecialchars($c->recommendation);?>'     data-challanges='<?php echo  htmlspecialchars($c->challanges);?>'data-date='<?php echo  $c->date;?>' data-description='<?php echo  htmlspecialchars($c->description);?>'  data-id='<?php echo  $c->id;?>' data-toggle='modal' data-target='#editProductModel'> 	 

                                                <i class="glyphicon glyphicon-pencil"></i>
																Update
                                                </a>
                                     
											<?php
										}else  if($userid==$manager){
											?>
											
	 <a class="btn btn-primary editbtn" id="editbtn"  data-subject='<?php echo  htmlspecialchars($mysubject);?>' data-achieved='<?php echo  $c->achieved;?>'   data-status='<?php echo  $c->status;?>'  data-comments='<?php echo  htmlspecialchars($c->comments);?>'data-recommendation='<?php echo  htmlspecialchars($c->recommendation);?>'     data-challanges='<?php echo  htmlspecialchars($c->challanges);?>'data-date='<?php echo  $c->date;?>' data-description='<?php echo  htmlspecialchars($c->description);?>'  data-id='<?php echo  $c->id;?>' data-toggle='modal' data-target='#editProductModel'> 	 

                                                <i class="glyphicon glyphicon-pencil"></i>
																Update
                                                </a>	
											
											
											
											
											
											
											
										<?php	
											
										}
										?>
										
                              
</td>
		 
		
             </tr>

	<?php endforeach;} ?>
	


              <?php }?>

        </table>

						















					
									
				<table class="tablesorter table table-bordered  table-hover" id="sortable_table">			

             <thead>
         <tr>
    
   
	     <th>View Document attached</th>

	

                 </tr>
             </thead>
<?php

 if(!is_array($mydocuments)) 

 {


   echo "<tr  style='margin-bottom:0px;margin-top:0px;' '>";
      echo "<td colspan='1'>";
    
       echo '<div class="alert alert-warning text-center">There no document attached to the this task..</div>';
    echo "</td>";
   echo "</tr>";
    }else {
?>
    
             <?php 
  
  	foreach ($mydocuments as $c): 

		 

             ?>



             <tr>
                
            <?php 
$id=$c->id;


?>

 

 
   
	 <td>
	  <a href="<?php echo base_url();?>docs/<?php echo  $c->name;?>" class="btn btn-success"> Click here to view document </a>	 

		 </td>
             </tr>

	<?php endforeach;} ?>

           

        </table>








						
									
									
					</div>	

			
			</div>
		</div>
		
		
		


<div id="editProductModel" class="modal fade" role="dialog">
  <div class="modal-dialog">

    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title">Update task feedback</h4>
      </div>
      <div class="modal-body">
      
	  	

				<?PHP


				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/updatefeedback' , array('class' => 'form-horizontal form-groups-bordered validate', 'enctype' => 'multipart/form-data'));
				 if(validation_errors()):?>
<div class='alert alert-danger text-center'><?php echo validation_errors(); ?></div>
<?php endif;?>
		<input type="hidden" name="taskid" value=""id="taskid" class="form-control" required placeholder="Enter taskid">
		
				<input type="hidden" name="myview" value="<?php echo $myview ?>"id="myview" class="form-control" required placeholder="Enter myview">

		<input type="hidden" name="page" value="<?php echo $page ?>"id="page" class="form-control" required placeholder="Enter bookid">

		
    <div class="form-group">
    <label for="inputdate" class="col-sm-2 control-label"> Date Posted </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="date" id="date" readonly value="" class="form-control" required placeholder="Enter start date">
		 
				
		<span class="text-danger"> <?php echo form_error('date'); ?>
		
		</span>
	</div>
  </div>
  
	
		<div class="form-group">
    <label for="inputsubject" class="col-sm-2 control-label">	Subject</label>
    <div class="col-sm-10">
	
		  		<input type="text" name="subject" value="" id="subject" class="form-control" readonly required placeholder="Enter  Product name">
		 
				
		<span class="text-danger"> <?php echo form_error('subject'); ?>
		
		</span>
	</div>
  </div>
	
	
	
	
	<div class="form-group">
    <label for="inputdescription" class="col-sm-2 control-label">	 	Feedback</label>
    <div class="col-sm-10">

<textarea name="description"  id="description"class="form-control"><?php echo set_value('comments'); ?></textarea>		
		<span class="text-danger"> <?php echo form_error('description'); ?>
		
		</span>
	</div>
  </div>
  
  
  
  	<div class="form-group">
    <label for="inputachieved" class="col-sm-2 control-label">	Achived</label>
    <div class="col-sm-10">
	
		  		<input type="text" name="achieved" value="" id="achieved" class="form-control"  required placeholder="Enter  target achieved">
		 
				
		<span class="text-danger"> <?php echo form_error('achieved'); ?>
		
		</span>
	</div>
  </div>
	
  
  
  
  
  
  <div class="form-group">
    <label for="inputcomments" class="col-sm-2 control-label">Challanges</label>
    <div class="col-sm-10">

<textarea name="challanges"  id="challanges"class="form-control"><?php echo set_value('challanges'); ?></textarea>		
		<span class="text-danger"> Challanges and Recommendations<?php echo form_error('challanges'); ?>
		
		</span>
	</div>
  </div>
		
		
	
	<div class="form-group">
    <label for="inputrecommendation" class="col-sm-2 control-label">To dolist</label>
    <div class="col-sm-10">

<textarea name="recommendation"  id="recommendation"class="form-control"><?php echo set_value('recommendation'); ?></textarea>		
		<span class="text-danger"> Work plans<?php echo form_error('recommendation'); ?>
		
		</span>
	</div>
  </div>
		

	

	<div class="form-group">
    <label for="inputcomments" class="col-sm-2 control-label">	 Supervisor Comments</label>
    <div class="col-sm-10">

<textarea name="comments"  id="comments"  class="form-control" placeholder="Enter your comments"><?php echo set_value('comments'); ?></textarea>		
		<span class="text-danger"> Supervisor Comments regarding the task submitted<?php echo form_error('comments'); ?>
		
		</span>
	</div>
  </div>
		<div class="form-group">
    <label for="inputstatus" class="col-sm-2 control-label">	Status	 </label>
    <div class="col-sm-10">
	
	
	<select class="form-control" name="status" id="status" required>
		<option value="" selected="selected"></option>

	<option value=""  >---Select status--</option>
	<option value="Approved"  >Approved</option>
		<option value="Rejected"  >Rejected</option>
		<option value="Pending"  >Pending</option>
				<option value="Ongoing"  >Ongoing</option>
				<option value="Submitted"  >Submitted</option>

</select>
	
	
	
	
	
	
	

				
		<span class="text-danger"> <?php echo form_error('status'); ?>
		
		</span>
	</div>
  </div>
	
	
	
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="task" name="btn_updatefeedback" class="btn btn-default"> Update 	Feedback   </button>

    </div>
  </div>
  			
  					<?php echo form_close();?>
			</div>							   
				
									
							
								
			<div class="modal-footer">

    

				</div>

		</div>
	    </div>
    </div>



		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
  
  </div>
			
			
			
		
		
  

 
</div>


















