<header class="page-header">
	<h2>Manage Students</h2> 
</header>
<div class="col-sm-12" >
	<div class="row">
		<div class="col-sm-12">
		<?php if($this->session->flashdata('message_name')){
			echo $this->session->flashdata('message_name'); }?>
			
		</div>
	</div>	
	<div class="row">
		<div style="margin-bottom:20px;">
			<a href= "<?= BASE_URL .'students/uploads'?>" class="btn btn-info"><i style="padding:10px;" class="fa fa-upload"></i> Upload Student Records</a>
		
		</div>
	</div>

	<div class="row">
		<div class="panel panel-default">
			<div class="panel-heading">
				<b style="color:#cd2026;">Students List</b> 			  
			</div>		
			<div class="panel-body">	
				<table class="table table-bordered table-striped mb-none" id="datatable-default">
					<thead>							
						<tr>						 
							<th style="width:2%">S.No.</th>
							<th style="width:5%">Code</th>
							<th style="width:5%">Name</th>
							<th style="width:5%">Father/Mother Name</th>
							<th style="width:5%">EmailId</th>
							<th style="width:5%">Date of Birth</th>
							<th style="width:5%">Education</th>
							<th style="width:5%">Last Examination Marks</th>
							<th style="width:5%">District Code</th>
							<th style="width:5%">Training Center Code</th>
							<th style="width:5%">State</th>							
							<th style="width:5%">Action</th>								
							
						</tr>
					</thead>
					
					<tbody>
						<?php $fresult=''; $i=1;
							if(count($students)>0){
								foreach($students as $row){
									$btn='<a data-sid="'.$row['id'].'" data-testid="'.$row['ParticipateTestId'].'" class="btn btn-primary StudentReport">Report</a>';
									
									$fresult.="<tr id='row_".$row['id']."'> <td>".$i."</td> <td>".$row['StudentCode']."</td> <td>".$row['Name']."</td><td>".$row['ParentsName']."</td> <td>".$row['EmailId']."</td><td>".$row['DoB']."</td> <td>".$row['Education']."</td> <td>" .                   $row['LastExaminationMarks']."</td> <td>".$row['DistrictCode']."</td><td>".$row['TrainingCenterCode']."</td><td>".$row['State']."</td><td>$btn</td></tr>";		
								$i++;
								}
							}else{							 
								$fresult='<tr><td colspan="12">No Record Found</td></tr>';
							}
							echo $fresult;
						  ?>									 
					</tbody>
				</table>     
				 
			</div>
		</div>
	</div>
</div>

<script>
	 
	$(document).ready(function() {		
		setTimeout(function(){
			$('#RsMesg').remove();
		},6000);
	 
	}); 
	$(document).on('click','.StudentReport',function(){
		var me = $(this);
		var SId=me.data('sid');
		var TId=me.data('testid');
		//alert(SId);
		window.location.href=HTTP_PATH +'students/report/'+TId+'/'+SId;
	});
	
	 
	 
</script>
 
 
 