@extends(Auth::check() && Auth::user()->role->layout == 1 ? 'layouts.admin' : 'layouts.employee')

@section('content')
<div class="content-wrapper">
	<section class="content-header">
		<h1>
		{{trans('general.reservations')}} 
		</h1>
	</section>


	<section class="content">
		<div class="row">
			<div class="col-md-12">
			@include('alert.success')
			@include('alert.errorlist')

			   <div class="box box-success">
				<div class="box-body">

				@if(count($inspections)>0)


				    <h2>Contestaciones</h2>
				    <ul>
					    @foreach($questions as $q)
					    @if(in_array($q->answerId, $inspections))
						<li>{{ $q->question }} - {{ $q->answer }}</li>
					    @endif
					    @endforeach
				    </ul>


				@else

					{!! Form::open(['url' => '/reservations/'.$reservation.'/savecheckin', 'method' => 'post']) !!}

					@php
					$questionId = 0;
					@endphp
					<div class="form-group">
					@foreach ($questions as $item)

						@if($item->questionId != $questionId)
							</div>
							<div class="form-group">
								<p>{{ $item->question }}</p>
						@endif
								{{ Form::radio( $item->questionId, $item->answerId) }}
								{{ Form::label( $item->questionId, $item->answer) }}&nbsp;&nbsp;

						@php
						$questionId = $item->questionId;
						@endphp

					@endforeach
					</div>
					{{ Form::hidden('reservation', $reservation) }}

					{{ Form::submit('Guardar') }}

					{!! Form::close() !!}


				@endif

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

@endsection
