<script type="text/javascript">
     $(document).on("click", "#managebtn", function()
        {
			
		     var taskid = $(this).data('id');
		  $("#taskid1").val(taskid);  	
          var recommendation = $(this).data('recommendation');
		  $("#recommendation").val(recommendation); 
		  
		    var user = $(this).data('user');
		   $("#user").val(user); 
		   
		     var description = $(this).data('description');
		   $("#description").val(description); 
		   var title = $(this).data('title');
		   $("#title").val(title); 
		  		   
		   
        });
		
	
	
		
    </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"> View Report</span>					                    
						 <a data-toggle='modal' data-target='#addModal' class="btn btn-primary">Add Report </a>

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

				<div class="widget-content nopadding table_holder table-responsive" >				
	<?PHP


				echo $this->session->flashdata('msg'); 
								?>	
										
					<div class="row">
						<div class="col-md-12">
							
							<div class="panel-body">
	
									
				<table class="tablesorter table table-bordered  table-hover" id="sortable_table">			

             <thead>
         <tr>
    
     <th>Date</th>
	 <th>title</th>
	   <th>Type</th>
	      
		   <th>Name</th>
		     
		 
		   <th>Supervisor </th> 
	
 <th>Action</th>
                 </tr>
             </thead>
<?php
 if(!is_array($viewreport)) {
				    echo '<div class="alert alert-danger text-center">There was no report found in the system</div>';

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

 {


   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 ($viewreport as $c): 

		 

             ?>



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


?>

              

  <td><?php echo $c->reportdate ; ?></td>
  	  <td><?php echo $c->title ; ?></td>
    <td><?php echo $c->type ; ?></td>

	   <td><?php echo $c->user ; ?></td>
	   <td><?php echo $c->controller ; ?></td>
	  

			  <td>
			  	 <a class="btn btn-primary managebtn" id="managebtn"	data-title='<?php echo  $c->title;?>'  data-description='<?php echo  $c->description;?>'  data-recommendation='<?php echo  $c->recommendation;?>' data-user='<?php echo  $c->user;?>' data-status='<?php echo  $c->status;?>'  data-id='<?php echo  $c->id;?>' data-toggle='modal' data-target='#moretModal'> Update  </a>	 


			  </td>  
             </tr>

	<?php endforeach;} ?>

              <?php }?>

        </table>
<div class="col-md-12 text-center">    <?php echo $links; ?>
					   		<span style="color:red; font-size:20px"><?php  echo $total_rows. "   Report (s) in the system. " ;?>    </span>

        
        </div>
									
									
									
									
					</div>	

								
<div id="addModal" 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">Add new Report</h4>
      </div>
      <div class="modal-body">
      
	  	

				<?PHP
//$session_data = $this->session->userdata('logged_in');



				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/addReport' , 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;?>
				    <div class="form-group">
    <label for="inputtype" class="col-sm-2 control-label">Report Type?	</label>
    <div class="col-sm-10">
	<select class="form-control" name="type" required>
			<option value=""  >Select Type </option>

	<option value="Sales"  >Sales</option>
	<option value="Progress"  >Progress</option>
		<option value="Follow-up"  >Follow-up</option>
				<option value="Meetings"  >Meetings</option>
				<option value="Training"  >Training</option>
				<option value="Developement"  >Developement</option>
								<option value="Management"  >Management</option>
							<option value="Busuness"  >Busuness</option>
							<option value="Other"  >Other</option>



</select>
		
						<span class="text-danger"><?php echo form_error('type'); ?>

	</div>
  </div>  	
	<div class="form-group">
    <label for="inputuser" class="col-sm-2 control-label">Report from? </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="user" value="<?php echo set_value('user'); ?>" class="form-control" required placeholder="Enter the person in charge">
		 
				
		<span class="text-danger"> <?php echo form_error('user'); ?>
		
		</span>
	</div>
  </div>  
  
	<div class="form-group">
    <label for="inputcontroller" class="col-sm-2 control-label">Supervisor </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="controller" value="<?php echo set_value('controller'); ?>" class="form-control" required placeholder="Enter controller">
		 
				
		<span class="text-danger"> <?php echo form_error('controller'); ?>
		
		</span>
	</div>
  </div>
 	<div class="form-group">
    <label for="inputreportdate" class="col-sm-2 control-label">	Report Date  </label>
    <div class="col-sm-10">
	
		  		<input type="date" name="reportdate" value="<?php echo set_value('reportdate'); ?>" class="form-control" required placeholder="Enter date ">
		 
				
		<span class="text-danger"> <?php echo form_error('reportdate'); ?>
		
		</span>
	</div>
  </div>
  
  	<div class="form-group">
    <label for="inputtitle" class="col-sm-2 control-label">	Report title </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="title" value="<?php echo set_value('title'); ?>" class="form-control" required placeholder="Enter report title">
		 
				
		<span class="text-danger"> <?php echo form_error('title'); ?>
		
		</span>
	</div>
  </div>
  
   	<div class="form-group">
    <label for="inputrecommendation" class="col-sm-2 control-label">Recommendation </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="recommendation" value="<?php echo set_value('recommendation'); ?>" class="form-control" required placeholder="Enter the recommendation">
		 
				
		<span class="text-danger"> Make a Recommendation<?php echo form_error('recommendation'); ?>
		
		</span>
	</div>
  </div>
  
  
 
	<div class="form-group">
    <label for="inputdescription" class="col-sm-2 control-label">	Description</label>
    <div class="col-sm-10">

				<textarea name="description" value="<?php echo set_value('description'); ?>"  class="form-control"  placeholder="Enter description"></textarea>
			
		<span class="text-danger"> <?php echo form_error('description'); ?>
		
		</span>
	</div>
  </div>
		

	

	
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="Report" name="btn_addReport" class="btn btn-primary"> Add Report   </button>

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

    

				</div>

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


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

  
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title">	View more details</h4>
      </div>
      <div class="modal-body">
      
	  	

				<?PHP
//$session_data = $this->session->userdata('logged_in');



				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/viewreport' , 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="reportid" value=""id="reportid" class="form-control" required placeholder="Enter reportid">
		<input type="hidden" name="page" value="<?php echo $page ?>"id="page" class="form-control" required placeholder="Enter page number">
	<div class="form-group">
    <label for="inputtitle" class="col-sm-2 control-label">	Report title </label>
    <div class="col-sm-10">
	
		  		<input type="text" readonly name="title"id="title"  value="<?php echo set_value('title'); ?>" class="form-control" required placeholder="Enter report title">
		 
				
		<span class="text-danger"> <?php echo form_error('title'); ?>
		
		</span>
	</div>
  </div>
	<div class="form-group">
    <label for="inputtaskowner" class="col-sm-2 control-label">	Report From?</label>
    <div class="col-sm-10">
	
		  		<input type="text" readonly name="user" value="<?php echo set_value('user'); ?>"id="user" class="form-control" required placeholder="Report Owner">
		 
				
		<span class="text-danger"> <?php echo form_error('user'); ?>
		
		</span>
	</div>
  </div>	
  
    
	
	
	
	<div class="form-group">
    <label for="inputcomments" class="col-sm-2 control-label">	 	Description</label>
    <div class="col-sm-10">

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

	<div class="form-group">
    <label for="inputdescription" class="col-sm-2 control-label">	 Description</label>
    <div class="col-sm-10">

<textarea name="description" id="description"  class="form-control"><?php echo set_value('description'); ?></textarea>		
		<span class="text-danger"> Enter description if any<?php echo form_error('description'); ?>
		
		</span>
	</div>
  </div>
		
	
	
	
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="task" name="btn_taskdata" class="btn btn-primary"> Go back   </button>

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

    

				</div>

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


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

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

 
</div>


















