@extends('layouts.main')

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

@section('body')

<div class="services-breadcrumb">
	<div class="inner_breadcrumb">
		<ul class="short_w3ls_agile">
			<li><a href="{{ url('/') }}">Home</a><span>|</span></li>
			<li><a href="{{ url('/jobs') }}">Jobs</a><span>|</span></li>
			<li>{{ $job->title }} in {{ $job->company->country->name }}</li>
		</ul>
	</div>
</div>

@include('flash::message')

<div class="banner_bottom">
	<div class="container">
		<div class="tittle_head">
			<h3 class="tittle">Apply for Job</h3>
		</div>
		<div class="row">
			<div class="col-md-8">
				<div class="inner_sec_info_w3ls_agile">
					<div class="panel panel-default">
						<div class="panel-body">
							<h3>{{ $job->title }}</h3>
							<p><span class="text-primary"><i class="fa fa-map-marker"></i> {{ $job->company->country->name }}</span> &nbsp; <span class="text-success"><i class="fa fa-calendar"></i> Posted {{ $job->created_at->diffForHumans() }}</span> &nbsp; <span class="text-danger"><i class="fa fa-clock-o"></i> Last date {{ $job->expires_at->toFormattedDateString() }} @if($job->hasExpired()) (Expired) @endif </span></p>
							<hr>
							<div class="panel panel-default">
								<div class="panel-body">
									<div class="row">
										<div class="col-md-5">
											<img src="{{ asset('images/'.$job->company->image) }}" class="img img-responsive">
										</div>
										<div class="col-md-7">
											<h4>{{ $job->company->name }}</h4>
											<br>
											<h5>Job Title: {{ $job->title }}</h5>
											<p style="color:green">Salary: {{ $job->company->country->currency }} {{ $job->salary }}</p>
											<p>{!! $job->description !!}</p>
										</div>
									</div>
								</div>
							</div>
						</div>
					</div>
					@if(!$job->hasExpired())
					<h3 class="text-center"><button class="btn btn-success" data-toggle="collapse" data-target="#applyForm">Apply for this job</button></h3>
					<br>
					<div id="applyForm" class="collapse panel panel-default">
						<div class="panel-body">
							@include('errors.form')
							<form enctype="multipart/form-data" action="{{ url('/jobs/apply') }}" method="POST">
								{{ csrf_field() }}
								<input type="hidden" name="_method" value="PUT">
								<input type="hidden" name="job" value="{{ $job->id }}">
								<div class="form-group">
									<label>Your Name</label>
									<input type="text" name="name" placeholder="Enter your full name here.." class="form-control input-lg" required>
								</div>
								<div class="row">
									<div class="col-md-6">
										<div class="form-group">
											<label>Contact Number</label>
											<input type="text" name="phone" placeholder="Enter your mobile or phone number.." class="form-control input-lg" required>
										</div>
									</div>
									<div class="col-md-6">
										<div class="form-group">
											<label>Email</label>
											<input type="email" name="email" placeholder="Enter your email here.." class="form-control input-lg">
										</div>
									</div>
								</div>
								<div class="form-group">
									<label>Your CV</label>
									<input type="file" accept=".jpg,.png,.pdf,.doc,.docx,.jpeg" name="image" class="btn btn-info" required>
									<span class="help-block">CV is required in order to apply online. (Allowed file types: doc, docx, pdf, jpg)</span>
								</div>
								<div class="form-group">
									{!! NoCaptcha::display() !!}
								</div>
								<input type="submit" name="submit" value="Apply" class="btn btn-success btn-block" style="font-size: 1.6rem">
							</form>
						</div>
					</div>
					@endif
				</div>
			</div>
			<div class="inner_sec_info_w3ls_agile">
				<div class="col-md-4">
					<div class="panel panel-info">
						<div class="panel-heading"><h5 class="text-center">Other Jobs</h5></div>
						<div class="panel-body">
							@foreach($jobs as $job)
							<h5>{{ $job->title }}</h5>
							<h5>{{ $job->company->name }} , {{ $job->company->country->name }}</h5>
							<p style="color:green">{{ $job->company->country->currency }} {{ $job->salary }}</p>
							<p><a href="{{ url('/jobs/'.$job->slug) }}" class="btn btn-info">More Info</a></p>
							<hr>
							@endforeach
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
@endsection

@section('footer')

{!! NoCaptcha::renderJs() !!}

@endsection