{{-- NOTE ABOUT THIS VIEW The fields that are marked "read-only", make sure the read-only status doesn't change! If you make those fields editable, after they're in a read-only state, it can have an impact on your stats and financials, and will require a recalculation of all the flight reports that have been filed. You've been warned! --}} @if($read_only)
@component("components.info") Once a PIREP has been accepted/rejected, certain fields go into read-only mode. @endcomponent
@endif
{{-- Write out the custom fields, and label if they're required --}} @foreach($pirep_fields as $field) @endforeach
Airline @if($read_only)

{{ $pirep->airline->name }}

{{ Form::hidden('airline_id') }} @else
{{ Form::select('airline_id', $airline_list, null, [ 'class' => 'custom-select select2', 'readonly' => $read_only]) }}

{{ $errors->first('airline_id') }}

@endif
Flight Number/Code/Leg @if($read_only)

{{ $pirep->ident }} {{ Form::hidden('flight_number') }} {{ Form::hidden('flight_code') }} {{ Form::hidden('flight_leg') }}

@else
{{ Form::text('flight_number', null, [ 'placeholder' => 'Flight Number', 'class' => 'form-control', 'readonly' => $read_only]) }} {{ Form::text('route_code', null, [ 'placeholder' => 'Code (optional)', 'class' => 'form-control', 'readonly' => $read_only]) }} {{ Form::text('route_leg', null, [ 'placeholder' => 'Leg (optional)', 'class' => 'form-control', 'readonly' => $read_only]) }}

{{ $errors->first('flight_number') }}

{{ $errors->first('route_code') }}

{{ $errors->first('route_leg') }}

@endif
Aircraft @if($read_only)

{{ $pirep->aircraft->name }}

{{ Form::hidden('aircraft_id') }} @else
{{-- You probably don't want to change this ID if you want the fare select to work --}} {{ Form::select('aircraft_id', $aircraft_list, null, [ 'id' => 'aircraft_select', 'class' => 'custom-select select2', 'readonly' => $read_only ]) }}

{{ $errors->first('aircraft_id') }}

@endif
Origin Airport @if($read_only)

{{ $pirep->dpt_airport->id }} - {{ $pirep->dpt_airport->name }}

{{ Form::hidden('dpt_airport_id') }} @else
{{ Form::select('dpt_airport_id', $airport_list, null, [ 'class' => 'custom-select select2', 'readonly' => $read_only ]) }}

{{ $errors->first('dpt_airport_id') }}

@endif
Arrival Airport @if($read_only)

{{ $pirep->arr_airport->id }} - {{ $pirep->arr_airport->name }}

{{ Form::hidden('arr_airport_id') }} @else
{{ Form::select('arr_airport_id', $airport_list, null, [ 'class' => 'custom-select select2', 'readonly' => $read_only ]) }}

{{ $errors->first('arr_airport_id') }}

@endif
Flight Time @if($read_only)

{{ $pirep->hours }} hours, {{ $pirep->minutes }} minutes {{ Form::hidden('hours') }} {{ Form::hidden('minutes') }}

@else
{{ Form::number('hours', null, [ 'class' => 'form-control', 'placeholder' => 'hours', 'min' => '0', 'readonly' => $read_only ]) }} {{ Form::number('minutes', null, [ 'class' => 'form-control', 'placeholder' => 'minutes', 'min' => 0, 'readonly' => $read_only ]) }}

{{ $errors->first('hours') }}

{{ $errors->first('minutes') }}

@endif
{{ $field->name }} @if($field->required === true) * @endif
{{ Form::text($field->slug, null, [ 'class' => 'form-control' ]) }}

{{ $errors->first($field->slug) }}

Route
{{ Form::textarea('route', null, ['class' => 'form-control', 'placeholder' => 'Route']) }}

{{ $errors->first('route') }}

Notes

{{ Form::textarea('notes', null, ['class' => 'form-control', 'placeholder' => 'Notes']) }}

{{ $errors->first('notes') }}

{{-- You don't want to change this ID unless you don't want the fares form to work :) --}}
@include("pireps.fares")
{{ Form::submit('Save PIREP', ['class' => 'btn btn-primary']) }}