<div class="page-header">
	<h3 class="page-title">
		<span class="page-title-icon bg-gradient-info text-white mr-2">
			<i class="fa fa-cubes"></i>
		</span>
		Task History
	</h3>
</div>


<div class="row">
	<div class="col-md-12 grid-margin stretch-card p-0 m-0">

		<div class="card border10">
			<div class="card-body p-3">
				<h4 class="card-title">Pending & Rejected Task</h4>
				<div class="table-responsive">
					<table class="table table-borderless table-striped table-hover " id="datatable">
						<thead>
						<tr>
							<th>#</th>
							<th>Task Url</th>
							<th>Status</th>
							<th>Task Submitted</th>
						</tr>
						</thead>
						<tbody>
						<?php $serial = 1;
						foreach ($pending_tasks as $task) { ?>
							<tr>
								<td><?= $serial++ ?></td>
								<td><a href="<?= $task->url ?>" target="_blank"><?= $task->url ?></a> </td>
									<td>

											<span class="badge <?php if($task->status == 2){echo 'badge-danger';}elseif($task->status == 1){echo 'badge-success';}else{echo 'badge-info';}?>">

											<?php if($task->status==1):?>
												Accepted
											<?php elseif($task->status==2):?>
												Rejected
											<?php else:?>
												Pending
											<?php endif;?>
										</span>

									</td>
								<td><?= nice_date($task->created_at, 'd-m-y') ?></td>
							</tr>
						<?php } ?>

						</tbody>
					</table>
				</div>
			</div>
		</div>
	</div>
</div>
<br><br><br>

<div class="row">
	<div class="col-md-12 grid-margin stretch-card p-0 m-0">

		<div class="card border10">
			<div class="card-body p-3">
				<h4 class="card-title">Approved Task</h4>
				<div class="table-responsive">
					<table class="table table-borderless table-striped table-hover " id="datatable">
						<thead>
						<tr>
							<th>#</th>
							<th>Task Url</th>
							<th>Income</th>
							<th>Status</th>
							<th>Task Submitted</th>
							<th>Task Approved</th>
						</tr>
						</thead>
						<tbody>
						<?php $serial = 1;
						foreach ($approve_tasks as $task) { ?>
							<tr>
								<td><?= $serial++ ?></td>
								<td><?= $task->url ?></td>
								<td>৳ <?= number_format($task->income,2) ?></td>
								<td>

										<span class="badge <?php if($task->status == 2){echo 'badge-danger';}elseif($task->status == 1){echo 'badge-success';}else{echo 'badge-info';}?>">

										<?php if($task->status==1):?>
											Accepted
										<?php elseif($task->status==2):?>
											Rejected
										<?php else:?>
											Pending
										<?php endif;?>
									</span>

								</td>
								<td><?= nice_date($task->created_at, 'd-m-y') ?></td>
								<td><?= nice_date($task->updated_at, 'd-m-y') ?></td>
							</tr>
						<?php } ?>

						</tbody>
					</table>
				</div>
			</div>
		</div>
	</div>
</div>
