
<div class="container">
	<br>
	<br>
	<br>
	<div class="row">
		<div class="col-lg-12">
			<div class="card">
				<div class="card-header">
					<h3 class="card-title">All Job posted by : <?= $user->name ?> </h3>
				</div>
			</div>
			<br>
			<br>
			<br>
		</div>



		<div class="col-lg-12">
			<div class="table-responsive">
				<table class="table table-hover">
					<thead>
						<tr>
							<th>SL</th>
							<th>Title</th>
							<th>Category</th>
							<th>Skills</th>
							<th>Budget</th>
							<th>Deadline</th>
							<th>Status</th>
							<th>Manage</th>
						</tr>
					</thead>

					<tbody>

							<?php
								$rows =null;

									if ($jobs)
									{
										$encodedJobs = json_decode($jobs);
										foreach ($encodedJobs as $key=>$job)
											{

												$rows.='
												<tr>
													<td>'.($key+1).'</td>
													<td>'.$job->job->title.'</td>
													<td>'.$job->job->category->name.'</td>
													<td>
													';
												/* Skill start */

												foreach ($job->skills as $j=>$skill)
												{
													$rows.=' <p class="bg-warning" style="padding: 5px 10px;margin: 3px; border-radius: 5px;"> '.$skill->name.' </p> ';
												}
												/* Skill End */


												$today = Date('Y-m-d');

												$status = $today>$job->job->deadline
														?
														' <label class="badge-success" style="padding: 5px 10px; border-radius: 5px;"> Expired </label> '
														: ( $job->job->isClosed == 1
																?
																' <label class="badge-success" style="padding: 5px 10px; border-radius: 5px;">Hired </label>'
																:
																'<label class="badge-success" style="padding: 5px 10px; border-radius: 5px;"> Available </label>');

												$rows.='
													</td>
													<td>'.$job->job->budget.' Tk</td>
													<td>'.$job->job->deadline.'</td>
													<td>'.$status.' </td>
													<td>
													<a href="#" class="bg-success " style=" margin:3px;padding: 5px 10px;font-size: 1.5rem;border-radius: 5px;color: #fff;"> <i class="fa fa-edit"></i> </a>
													
													<a href="'.base_url().'/FreelanceController/viewJobPost/'.$job->job->id.'" class="bg-success " style=" margin:3px;padding: 5px 10px;font-size: 1.5rem;border-radius: 5px;color: #fff;"> <i class="fa fa-eye"></i> </a>
		</td>
												 </tr>
											';
											}
									}else{
										$rows.= ' 
										 		<tr>
													<td colspan="5"> No Data found</td>										 		
												</tr>
										 ';
									}


								echo $rows;
							?>

					</tbody>

				</table>
			</div>

		</div>

	</div>
</div>

<script>

</script>
