<div class="collapse" id="collapseBasicPay">
	<div class="card card-body">
		<h4 class="card-title">Basic Pay</h4>
		<hr>
		<div class="container">
			 <div class="row">
				<div class="btn-group ml-auto">
					<a class="btn btn-info btn-sm" style="margin-bottom:15px; width: 200px;" href="<?php echo base_url('hr/StaffProfile/actionReport/'.$staff_id.'/10'); ?>" target="_blank">
						<i class="fa fa-print"></i> Print
					</a>
				</div>
			</div>
		</div>
		<div class="table-responsive">
			<table id="table_basic_pay" 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($basic_payment) foreach ($basic_payment as $key => $bp): ?>
						<tr class="link-row" data-id="" >
							<td scope="row">
								<?php
									echo $bp->action_type.'<br/><b>( '.date('d-F-Y',strtotime($bp->action_efective_date)).' )</b>';
								?>
							</td>
							<td>
								<b>Pay Scale Group (Grade) : </b> <?php echo $bp->scale_group; ?> <br>
								<b>Basic Pay Amount (RM) : </b> <?php echo number_format($bp->amount,2); ?> <br>
								<b>Start Date : </b> <?php echo date('d-F-Y',strtotime($bp->start_date)); ?> <br>
								<b>End Date : </b> <?php echo mysql_to_date_format((!empty($bp->end_date))?$bp->end_date:null); ?><br>
								<b>Reason : </b> <?php echo $bp->reason; ?> <br/>
								<b>Status : </b> <?php echo (empty($bp->status))?'INACTIVE':'ACTIVE'; ?>
							</td>
							<td><?php echo $bp->created_at; ?></td>
							<?php if($role == 'admin'): ?>
							<td class="text-center">
								<div class="btn-group">
									<button class="btn btn-success btn-sm" onclick="btnEditBasicPay(this)" data-content="<?php echo base64_encode(json_encode($bp));?>" data-toggle="modal" data-target="#basicPayModal">
										<i class="fas fa-edit"></i>
									</button>
									<button class="btn btn-danger btn-sm" onclick="btnDeleteBasicPay(this)" data-content="<?php echo base64_encode(json_encode($bp));?>"><i class="fas fa-trash"></i></button>
								</div>
							</td>
							<?php endif ?>
						</tr>
					<?php endforeach ?>
				</tbody>
			</table>
		</div>
	</div><br> 		
</div>

<div class="modal fade" id="basicPayModal">
	<div class="modal-dialog modal-lg">
		<div class="modal-content">
			<div class="modal-header">
				<h5 class="modal-title" id="racks-modal-title">Edit Basic Pay</h5>
				<button type="button" class="close" data-dismiss="modal" aria-label="Close">
					<span aria-hidden="true">&times;</span>
				</button>
			</div>
			<div class="modal-body">
				<div class="form-group">
					<label>Pay Scale Group (Grade)</label>
					<select class="form-control" id="modal_basic_pay_scale" placeholder="Enter Grade">
						<?php foreach ($jobPositions as $key => $post): ?>
							<option value="<?php echo $post->grade; ?>"><?php echo $post->grade; ?></option>
						<?php endforeach ?>
					</select>
				</div>
				<input type="hidden" class="form-control" id="modal_basic_pay_id">
				<div class="form-group">
					<label>Basic Pay Amount</label>
					<input type="number" class=" form-control" id="modal_basic_pay_amount" placeholder="Enter Basic Pay Amount">
				</div>
				<div class="form-group">
					<label>Start Date</label>
					<input type="text" class="datepicker form-control" id="modal_basic_pay_start_date" placeholder="Enter Start Date">
				</div>
				<div class="form-group">
					<label>End Date</label>
					<input type="text" class="datepicker form-control" id="modal_basic_pay_end_date" placeholder="Enter End Date">
				</div>
				<div class="form-group">
					<label>Status</label>
					<select id="mdl_basic_pay_status" class="form-control">
							<option value="1">Active</option>
							<option value="0">Inactive</option>
					</select>
				</div>
				<div class="form-group">
					<label>Reason</label>
					 <textarea class="form-control" rows="3" id="modal_basic_pay_reason" placeholder="Enter Reason"></textarea>
				</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 class="btn btn-success btn-sm" style="margin-bottom:15px; width: 200px;" onclick="EditBasicPay()"><i class="fa fa-save"></i> Submit</button>
			</div>
		</div>
	</div>
</div>