
<section class="container" style="padding-bottom: 2rem;">
	<div class="card bg-light-transparent">
		<div class="card-body">
			<div class="card no-shadow" style="padding-top: 3rem; padding-bottom: 3rem;">
				<div class="card-body">
					<div class="row">
						<div class="col-md-4 text-center align-self-center">
							<img class="image-responsive" src="<?php echo base_url('assets/uploads/admin/company/logo/logo-red-salihin.png'); ?>" style="max-height: 15rem; max-width: 15rem;">
						</div>
						<div class="col-md-8">
							<!-- <h1 class="display-4" id="cardName"><?php echo $company['name']; ?></h1> -->
							<img class="image-responsive" src="<?php echo base_url($company['file_location'].'salihin-logo.png'); ?>" style="max-height: 15rem; max-width: 15rem;">
							<p class="lead" id="cardProfile"><?php echo $company['profile']; ?></p>
							<hr class="my-4">
							<p id="cardPhone"><?php echo $company['phone']; ?></p>
							<p><a id="cardWebsite" target="_blank" href="<?php echo 'http://'.$company['website']; ?>"><?php echo $company['website']; ?></a></p>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</section>

<section class="container" style="padding-bottom:2rem;">
    <div class="row">
        <div class="col">
            <a class="btn btn-dark btn-block" href="<?php echo base_url('/hr/claim/report/print'); ?>" target="_blank" style="color:#fff;">
                <h3>print</h3>
                <small>print report</small>
            </a>
        </div>
    </div>
</section>

<section class="container" style="padding-bottom:2rem;">
   <div class="card">
        <div class="card-body">

			<form action="<?php echo base_url('/hr/claim/report/'); ?>" method="post">
				<div class="row">
					<div class="col">
						<label>Business Entity</label>
						<select class="form-control form-control-sm" name="business_entity">
							<option value="All">All</option>
							<?php foreach($business_entities as $key => $value): ?>
								<option value="<?php echo $value['id']; ?>" <?php echo ($business_entity == $value['id'])?'selected':''; ?>><?php echo $value['name']; ?></option>
							<?php endforeach; ?>
						</select>
					</div>
					<div class="col">
						<label>Department</label>
						<select class="form-control form-control-sm" name="department">
							<option value="All">All</option>
							<?php foreach($departments as $key => $value): ?>
								<option value="<?php echo $value['id']; ?>" <?php echo ($department == $value['id'])?'selected':''; ?>><?php echo $value['name'].' ['.$value['branch_name'].']' ; ?></option>
							<?php endforeach; ?>
						</select>
					</div>
					<div class="col">
						<label>Staff Name</label>
						<select class="form-control form-control-sm" name="staff_name">
							<option value="All">All</option>
							<?php foreach($users as $key => $value): ?>
								<option value="<?php echo $value['id']; ?>" <?php echo ($staff_name == $value['id'])?'selected':''; ?>><?php echo $value['name']; ?></option>
							<?php endforeach; ?>
						</select>
					</div>
					<div class="col">
						<label>Status</label>
						<select class="form-control form-control-sm" name="status">
							<option value="All">All</option>
							<option value="1" <?php echo ($status == '1')?'selected':''; ?>>Approved</option>
							<option value="0" <?php echo ($status == '0')?'selected':''; ?>>Pending</option>
							<option value="2" <?php echo ($status == '2')?'selected':''; ?>>Rejected</option>
						</select>
					</div>
					<div class="col">
						<label>Status</label>
						<select class="form-control form-control-sm" name="complete_status">
							<option value="All">All</option>
							<option value="0" <?php echo ($complete_status == '0')?'selected':''; ?>>Complete</option>
							<option value="1" <?php echo ($complete_status == '1')?'selected':''; ?>>Incomplete</option>
						</select>
					</div>
				</div>
				<div class="row">
					<div class="col">
						<label>Year</label>
						<select class="form-control form-control-sm" name="year">
							<option value="All">All</option>
							<?php foreach($years as $key => $value): ?>
								<option value="<?php echo $value->year; ?>" <?php echo ($year == $value->year)?'selected':''; ?>><?php echo $value->year; ?></option>
							<?php endforeach; ?>
						</select>
					</div>
					<div class="col">
						<label>Month</label>
						<select class="form-control form-control-sm" name="month">
							<option value="All">All</option>
							<?php for($i = 1; $i <= 12; $i++):?>
								<option value='<?php echo $i; ?>' <?php echo ($month == $i)?'selected':''; ?>><?php echo date('F',strtotime(date('Y').'-'.$i.'-01')); ?></option>
							<?php endfor; ?>
						</select>
					</div>
					<div class="col align-self-end">
						<button type="submit" class="btn btn-primary btn-block btn-sm">
							<i class="fas fa-search"></i> search
						</button>
					</div>
				</div>
			</form>
			<hr>

			<div class="row">
				<div class="col table-responsive">
					<table class="table table-bordered">
						<thead>
							<tr>
								<!-- <th>#</th> -->
								<th>Business Entity</th>
								<th>Department</th>
								<th>Staff Name</th>
								<th>Year</th>
								<th>Month</th>
								<th>Claim Type</th>
								<th>Total</th>
								<th>HOD Status</th>
								<th>Claim Status</th>
							</tr>
						</thead>
						<tbody>
							<?php if($claims) foreach($claims as $key => $value): ?>
								<?php if(!empty($value['amount'])):?>
									<tr>
										<!-- <td><?php echo $key+1; ?></td> -->
										<td><?php echo $value['business_entity']; ?></td>
										<td><?php echo $value['department']; ?></td>
										<td><?php echo $value['name']; ?></td>
										<td><?php echo $value['year']; ?></td>
										<td><?php echo date('F',strtotime('01-'.$value['month'].'-'.$value['year'])); ?></td>
										<td><?php echo $value['type']; ?></td>
										<td><?php echo $value['amount']; ?></td>
										<td>
											<small>Admin Status</small>
											<?php if($value['admin_status'] == 0): ?>
												<span class="badge badge-primary w-100">Pending</span>
											<?php endif; ?>
											
											<?php if($value['admin_status'] == 1): ?>
												<span class="badge badge-success w-100">Approved</span>
											<?php endif; ?>
											
											<?php if($value['admin_status'] == 2): ?>
												<span class="badge badge-danger w-100">Rejected</span>
											<?php endif; ?>

											<hr>
											<small>HOD Status</small>
											<?php if($value['hod_status'] == 0): ?>
												<span class="badge badge-primary w-100">Pending</span>
											<?php endif; ?>
											
											<?php if($value['hod_status'] == 1): ?>
												<span class="badge badge-success w-100">Approved</span>
											<?php endif; ?>
											
											<?php if($value['hod_status'] == 2): ?>
												<span class="badge badge-danger w-100">Rejected</span>
											<?php endif; ?>
										</td>
										<td>
											<?php if($value['claim_status'] == 0): ?>
												<span class="badge badge-primary w-100">Pending</span>										
											<?php endif; ?>

											<?php if($value['claim_status'] == 1): ?>
												<span class="badge badge-success w-100">Complete</span>										
											<?php endif; ?>
										</td>
									</tr>
								<?php endif; ?>
							<?php endforeach; ?>
						</tbody>	
						<tfoot>
							<tr>
								<!-- <th>#</th> -->
								<th>Business Entity</th>
								<th>Department</th>
								<th>Staff Name</th>
								<th>Year</th>
								<th>Month</th>
								<th>Claim Type</th>
								<th>Total</th>
								<th>HOD Status</th>
								<th>Claim Status</th>
							</tr>
						</tfoot>
					</table>
				</div>
			</div>


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