@extends('layouts.main')

@section('title','Advanced - Search Jobs')

@section('body')

<!--/inner_banner-->
<div class="inner_banner">
</div>
<!--//inner_banner-->

<div class="services-breadcrumb">
	<div class="inner_breadcrumb">
		<ul class="short_w3ls_agile">
			<li><a href="{{ url('/') }}">Home</a><span>|</span></li>
			<li>Search Jobs</li>
		</ul>
	</div>
</div>

<div class="banner_bottom">
	<div class="container">
		<div class="tittle_head">
			<h3 class="tittle">Search Jobs</h3>
		</div>
		<hr>
	</div>
	<div class="container">
		<div class="row">
			<div class="col-md-8 col-md-offset-2">
				<form method="GET" action="{{ url('/jobs/search') }}">
					{{ csrf_field() }}
					<div class="form-group">
						<label>Job Category</label>
						<select name="job_category" class="form-control">
							<option value="0">All</option>
							@foreach($categories as $category)
							<option value="{{ $category->id }}">{{ $category->name }}</option>
							@endforeach
						</select>
					</div>
					<div class="form-group">
						<label>Job Title</label>
						<input type="text" name="job_title" class="form-control" placeholder="Enter Job Title..">
					</div>
					<div style="font-size: 1.6rem" class="text-center">
						<input type="submit" name="submit" value="Search" class="btn btn-success btn-lg btn-block">
					</div>
				</form>
			</div>
		</div>
	</div>
	<div class="container" id="results">
		<hr>
		<div class="inner_sec_info_w3ls_agile">
			@if(count($jobs)>0)
			<h4>We found the following jobs that matched your search criteria.</h4>
			<br>
			@foreach($jobs->chunk(3) as $chunkedJobs)
			<div class="row">
				@foreach($chunkedJobs as $job)
				<div class="col-md-4">
					<div class="panel panel-info">
						<div class="panel-heading"><h4 class="text-center">{{ $job->title }}</h4></div>
						<div class="panel-body text-center">
							<img src="{{ asset('images/'.$job->company->image) }}" class="img-thumbnail" alt="{{ $job->company->name }}">
							<br>
							<p>Company: {{ $job->company->name }}</p>
							<p>Country: {{ $job->company->country->name }}</p>
							<p>Salary: <span style="color:green">{{ $job->company->country->currency }} {{ $job->salary }}</span></p>
							<a href="{{ url('/jobs/'.$job->slug) }}" class="btn btn-info">Read More</a>
						</div>
					</div>
				</div>
				@endforeach
			</div>
			@endforeach
			{{ $jobs->links() }}
			@else
			@if($jobs!=null)
			<p class="text-center">We could not find any jobs that matched your query. Please <a href="{{ url('/contact-us') }}">contact us</a> to find out more.</p>
			@endif
			@endif
		</div>
	</div>
</div>
@endsection