<div class="collapse" id="collapseThirdParty">
	<div class="card card-body">
		<h4 class="card-title">Third Party Payment</h4>
		<hr>
		
		<div class="container">
			<?php if ($role == 'admin'): ?>
				<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.'/15'); ?>" target="_blank">
							<i class="fa fa-print"></i> Print
						</a>
					</div>
				</div>
			<?php endif ?>
		</div>
		
		<div class="table-responsive">
			<table id="table_third_party" class="table table-hover table-bordered">
				<thead>
					<tr>
						<th>Action type</th>
						<th>Details</th>
						<th>Created At</th>
						<!-- <?php if ($role == 'admin'): ?>
						<th>Action</th>
						<?php endif ?> -->
						
					</tr>
				</thead>
				<tbody>

					<?php if($thirdPartyPayments) foreach ($thirdPartyPayments as $key => $payment): ?>
						<tr class="link-row" data-id="" >
							<td scope="row">
								<?php echo $payment->action_type.'<br><b>( '.date('d-F-Y',strtotime($payment->action_efective_date)).' )</b>'?>
							</td>
							<td>
								<!-- <b>Date From : </b><?php echo date('d-F-Y',strtotime($payment->date_start)); ?><br>
								<b>Date End : </b><?php echo date('d-F-Y',strtotime($payment->date_end)); ?><br> -->
								<b>Date From : </b><?php echo mysql_to_date_format((!empty($payment->date_start))?$payment->date_start:null); ?><br>
								<b>Date End : </b><?php echo mysql_to_date_format((!empty($payment->date_end))?$payment->date_end:null); ?><br>
								<b>Third Party Institution / Organisation : </b><?php echo $payment->type; ?><br>
								<b>Status : </b><?php echo ($payment->status == '0')?'Ongoing':'End';?><br>
								<b>Amount : </b>RM<?php echo number_format($payment->amount,2); ?>
							</td>
							<td><?php echo $payment->created_at; ?></td>
							<?php if ($role == 'admin'): ?>
							<!-- <td class="text-center">
								<div class="btn-group">
									<button onclick="btnEditThirdParty(this)" class="btn btn-success btn-sm" data-content="<?php //echo base64_encode(json_encode($payment)); ?>" data-toggle="modal" data-target="#thirdPartyModal" ><i class="fas fa-edit"></i></button>
									<button onclick="btnRemoveThirdParty(<?php //echo $payment->id; ?>)" class="btn btn-danger btn-sm"><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="thirdPartyModal">
	<div class="modal-dialog modal-lg">
		<div class="modal-content">
			<div class="modal-header">
				<h5 class="modal-title" id="racks-modal-title">Edit Third Party Payment</h5>
				<button type="button" class="close" data-dismiss="modal" aria-label="Close">
					<span aria-hidden="true">&times;</span>
				</button>
			</div>
			<form id="mdl-thirdparty-form" action="<?php echo base_url('/hr/StaffProfile/createThirdParty/'.$staff_id); ?>" method="POST" class="form-horizontal" enctype="multipart/form-data">
				<div class="modal-body">
					<input type="hidden" class="form-control" name="id" id="mdl-thirdparty-id">
					
					<div class="row form-group">
						<div class="col">
							<label>Date From</label>
							<input type="text" class="datepicker form-control" placeholder="dd-m-YYYY" autocomplete="off" name="date_start" id="mdl-thirdparty-date_start">
						</div>
						<div class="col">
							<label>Date To</label>
							<input type="text" class="datepicker form-control" placeholder="dd-mm-YYYY" autocomplete="off" name="date_end" id="mdl-thirdparty-date_end">
						</div>
					</div>

					<div class="form-group">
						<label>Third Party Institution / Organisation</label>
						<!-- <input type="text" class=" form-control" placeholder="Enter Third Party Payment" name="type" id="mdl-thirdparty-type"> -->
						<select class="form-control" name="type" id="mdl-thirdparty-type">
							<option value="PTPTN">PTPTN</option>
							<option value="YaPEIM">YaPEIM</option>
							<option value="Tabung Haji">Tabung Haji</option>
							<option value="Perbadanan Wakaf Selangor">Perbadanan Wakaf Selangor</option>
							<option value="Zakat">Zakat</option>
						</select>
					</div>	

					<div class="form-group">
						<label>Amount</label>
						<div class="input-group mb-3">
						  <div class="input-group-prepend">
						    <span class="input-group-text">Rm</span>
						  </div>
							<input type="number" class=" form-control" placeholder="Enter Amount" name="amount" id="mdl-thirdparty-amount">
						</div>
					</div>

					<div class="form-group">
						<label>Status</label>
						<select class="form-control" name="status" id="mdl-thirparty-status">
							<option value="0">Ongoing</option>
							<option value="1">End</option>
						</select>
					</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>