<div class="collapse" id="collapseAcademic">
	<div class="card card-body">
	    <h4 class="card-title">Academic Education</h4>
			<hr>
			<div class="container">
				<div class="row">
					<div class="btn-group ml-auto">
						<?php if ($role == 'admin'): ?>
							<a class="btn btn-info btn-sm" style="margin-bottom:15px; width: 200px;" href="<?php echo base_url('/hr/StaffProfile/actionReport/'.$staff_id.'/3'); ?>" target="_blank">
								<i class="fa fa-print"></i> Print
							</a>
						<?php endif ?>
					</div>
				</div>
			</div>
			<div class="table-responsive">
				<table id="table_academic" class="table table-hover table-bordered">
					<thead>
						<tr>
							<th>Action type (Effective date)</th>
							<th>Details</th>
							<th>Created At</th>
							<!-- <?php if($role == 'admin'): ?>
							<th>Action</th>
							<?php endif ?> -->
							
						</tr>
					</thead>
					<tbody>	

						<?php if($academics) foreach ($academics as $key => $academic): ?>
							<tr class="link-row" data-id="<" >
								<td scope="row">
									<?php
										echo $academic->action_type.'<br><b>( '.date('d-F-Y',strtotime($academic->action_efective_date)).' )</b>';
									?>
								</td>
								<td>
									<?php
										echo '<b>Level : </b>'.$academic->academic_level
											.'<br><b>Program : </b>'.$academic->program
											.'<br/><b>University / Institution : </b>'.$academic->institution
											.'<br/><b>Year graduated: </b>'.$academic->year
											.'<br/><b>Final Results / CGPA : </b>'.$academic->cgpa
											.'<br/><b>Attachment : </b>';
									?>
									<?php
										$attachment_name = explode('->',$academic->attachment_name);
										$attachment_mask = explode('->',$academic->mask_id);
										if($attachment_name) foreach($attachment_name as $attach_key => $attach_name)
										{
											echo '<li>';
											echo '<a href="'.base_url('hr/staffProfile/openAttachment/'.$attachment_mask[$attach_key].'/1').'" target="_blank">'.$attach_name.'</a>';
											echo '</li>';
										}
									?>
									<!-- <a href="<?php //echo base_url('hr/staffProfile/openAttachment/'.$academic->mask_id.'/1')?>" target="_blank"><?php //echo $academic->attachment_name; ?></a> -->
								</td>
								<td>
									<?php echo $academic->created_at; ?>
								</td>
								<?php if($role == 'admin'): ?>
								<!-- <td class="text-center">
									<div class="btn-group" role="group">
										<button class="btn btn-success btn-sm" data-content="<?php //echo base64_encode(json_encode($academic)); ?>" data-toggle="modal" data-target="#academicModal" onclick="editAcademicQualification(this)"><i class="fas fa-edit"></i></button>
										<button class="btn btn-danger btn-sm" onclick="removeAcademicQualification(<?php //echo $academic->id; ?>)"><i class="fas fa-trash"></i></button>
									</div>
								</td> -->
								<?php endif ?>
								
							</tr>						
						<?php endforeach ?>						
											
					</tbody>
				</table>
			</div><br>
	</div><br>
</div>

<div class="modal fade" id="academicModal">
	<div class="modal-dialog modal-lg">
		<div class="modal-content">
			<div class="modal-header">
				<h5 class="modal-title" id="racks-modal-title">Edit Academic Education</h5>
				<button type="button" class="close" data-dismiss="modal" aria-label="Close">
					<span aria-hidden="true">&times;</span>
				</button>
			</div>
			<form action="<?php echo base_url('/hr/StaffProfile/createQualification/'.$staff_id); ?>" method="POST" class="form-horizontal" enctype="multipart/form-data" id="mdl-academic-form">
				<div class="modal-body">
					
					<!-- hidden input for edit -->
					<input type="hidden" calss="form-control" id="mdl-qualification-attachment-id" name="attachmentID">
					<input type="hidden" class="form-control" id="mdl-qualification-id" name="id">
					<!-- hidden input for edit -->

					<div class="form-group">
						<label>Level</label>
						<select type="text" class="form-control" name="level_id" id="mdl-qualification-level-id">
							<?php if($qualifications) foreach ($qualifications as $key => $qualify): ?>
								<option value="<?php echo $qualify->id; ?>"><?php echo $qualify->level; ?></option>
							<?php endforeach ?>
						</select>
					</div>	
					<div class="form-group">
						<label>Program</label>
						<input type="text" class="form-control" placeholder="Enter Program" name="program" id="mdl-qualification-program">
					</div>
					<div class="form-group">
						<label>University/Institution</label>
						<input type="text" class="form-control" placeholder="Enter University/Institution" name="institution" id="mdl-qualification-institution">
					</div>
					<div class="form-group">
						<label>Year Graduated</label>
						<input type="text" class="form-control" placeholder="Enter Year Graduated" name="year" id="mdl-qualification-year">
					</div>
					<div class="form-group">
						<label>Final Result / CGPA</label>
						<input type="text" class="form-control" placeholder="Final result or CGPA value" name="cgpa" id="mdl-qualification-cgpa">
					</div>
					<hr style="border: 1px solid;">
					<div class="form-group">
						<div class="float-left"><label><strong>Attachment</strong></label><br><br></div>
						<!-- <input type="file" class="form-control" name="attachment"> -->
						<div class="float-right" id="newQualificationAttachmentBtn"></div>
						<div class="table-responsive">
							<table id="table_academic_attachment" class="table table-hover table-bordered">
								<thead>
									<tr>
										<th>#</th>
										<th>Attachment Name</th>
										<?php if($role == 'admin'): ?>
										<th>Action</th>
										<?php endif ?>
									</tr>
								</thead>
								<tbody>
									
								</tbody>
							</table>
						</div>
					</div>		
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-danger btn-sm" style="margin-bottom:15px; width: 200px;" data-dismiss="modal"><i class="fa fa-ban"></i> Cancel</button>
					<button type="submit" class="btn btn-success btn-sm" style="margin-bottom:15px; width: 200px;"><i class="fa fa-save"></i> Submit</button>
				</div>
			</form>
		</div>
	</div>
</div>

<div class="modal fade" id="academicAttachmentModal">
	<div class="modal-dialog modal-lg">
		<div class="modal-content">
			<div class="modal-header">
				<h5 class="modal-title" id="racks-modal-title">Add Academic Education Attachment</h5>
				<button type="button" class="close" data-dismiss="modal" aria-label="Close">
					<span aria-hidden="true">&times;</span>
				</button>
			</div>
			<form id="mdl-academic-attachment-form" enctype="multipart/form-data">
				<div class="modal-body">
					
					<!-- hidden input for edit -->
					<input type="hidden" class="form-control" id="mdl-qualification-attachmentid" name="id">
					<input type="hidden" class="form-control" id="mdl-qualification-attachmentstaffid" name="staff_id">
					<!-- hidden input for edit -->

					<div class="form-group">
						<label>Attachment</label>
						<input type="file" class="form-control" name="attachment" id="attachment">
					</div>		
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-danger btn-sm" style="margin-bottom:15px; width: 200px;" data-dismiss="modal"><i class="fa fa-ban"></i> Cancel</button>
					<button type="button" class="btn btn-success btn-sm" style="margin-bottom:15px; width: 200px;" onclick="newQualificationAttachment(0,0,'new')"><i class="fa fa-save"></i> Submit</button>
				</div>
			</form>
		</div>
	</div>
</div>