{{-- 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(!empty($pirep) && $pirep->read_only)
@component('components.info') {{ __('Once a PIREP has been accepted/rejected, certain fields go into read-only mode.') }} @endcomponent
@endif
 {{ __('Flight Informations') }}
{{ Form::label('airline_id', __('Airline')) }} @if(!empty($pirep) && $pirep->read_only)

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

{{ Form::hidden('airline_id') }} @else
{{ Form::select('airline_id', $airline_list, null, [ 'class' => 'custom-select select2', 'style' => 'width: 100%', 'readonly' => (!empty($pirep) && $pirep->read_only), ]) }}

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

@endif
{{ Form::label('flight_number', __('Flight Number/Code/Leg')) }} @if(!empty($pirep) && $pirep->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' => (!empty($pirep) && $pirep->read_only), ]) }}   {{ Form::text('route_code', null, [ 'placeholder' => __('Code (optional)'), 'class' => 'form-control', 'readonly' => (!empty($pirep) && $pirep->read_only), ]) }}   {{ Form::text('route_leg', null, [ 'placeholder' => __('Leg (optional)'), 'class' => 'form-control', 'readonly' => (!empty($pirep) && $pirep->read_only), ]) }}

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

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

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

@endif
{{ Form::label('flight_type', __('Flight Type')) }} @if(!empty($pirep) && $pirep->read_only)

{{ \App\Models\Enums\FlightType::label($pirep->flight_type) }}

{{ Form::hidden('flight_type') }} @else
{{ Form::select('flight_type', \App\Models\Enums\FlightType::select(), null, [ 'class' => 'custom-select select2', 'style' => 'width: 100%', 'readonly' => (!empty($pirep) && $pirep->read_only), ]) }}

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

@endif
{{ Form::label('hours', __('Flight Time')) }} @if(!empty($pirep) && $pirep->read_only)

{{ $pirep->hours.' '.__trans_choice('Hour', $pirep->hours) }}, {{ $pirep->minutes.' '.__trans_choice('Minute', $pirep->minutes) }} {{ Form::hidden('hours') }} {{ Form::hidden('minutes') }}

@else
{{ Form::number('hours', null, [ 'class' => 'form-control', 'placeholder' => __trans_choice('Hour', 2), 'min' => '0', 'readonly' => (!empty($pirep) && $pirep->read_only), ]) }} {{ Form::number('minutes', null, [ 'class' => 'form-control', 'placeholder' => __trans_choice('Minute', 2), 'min' => 0, 'readonly' => (!empty($pirep) && $pirep->read_only), ]) }}

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

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

@endif
{{--{{ Form::label('submitted_date', __('Date Flown')) }} {{ Form::text('submmitted_date', null, [ 'placeholder' => __('Departure Date'), 'class' => 'form-control', 'readonly' => $pirep->read_only]) }}--}}
{{--{{ Form::label('departure_time', __('Departure Time')) }} {{ Form::text('departure_time', null, [ 'placeholder' => __('Departure TIme'), 'class' => 'form-control', 'readonly' => $pirep->read_only]) }}--}}
{{--{{ Form::label('arrival_time', __('Arrival Time')) }} {{ Form::text('arrival_time', null, [ 'placeholder' => __('Arrival TIme'), 'class' => 'form-control', 'readonly' => $pirep->read_only]) }}--}}
 {{ __('Departure/Arrival Informations') }}
{{ Form::label('dpt_airport_id', __('Departure Airport')) }} @if(!empty($pirep) && $pirep->read_only) {{ $pirep->dpt_airport->name }} ({{$pirep->dpt_airport->icao}}) {{ Form::hidden('dpt_airport_id') }} @else
{{ Form::select('dpt_airport_id', $airport_list, null, [ 'class' => 'custom-select select2', 'style' => 'width: 100%', 'readonly' => (!empty($pirep) && $pirep->read_only), ]) }}

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

@endif
{{ Form::label('arr_airport_id', __('Arrival Airport')) }} @if(!empty($pirep) && $pirep->read_only) {{ $pirep->arr_airport->name }} ({{$pirep->arr_airport->icao}}) {{ Form::hidden('arr_airport_id') }} @else
{{ Form::select('arr_airport_id', $airport_list, null, [ 'class' => 'custom-select select2', 'style' => 'width: 100%', 'readonly' => (!empty($pirep) && $pirep->read_only), ]) }}

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

@endif
 {{ __('Aircraft Informations') }}
{{ Form::label('aircraft_id', __('Aircraft')) }} @if(!empty($pirep) && $pirep->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' => (!empty($pirep) && $pirep->read_only), ]) }}

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

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

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

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

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

 {{ __trans_choice('Field', 2) }}
{{-- Write out the custom fields, and label if they're required --}} @foreach($pirep_fields as $field) {{ $field->name }} @if($field->required === true) * @endif
{{ Form::text($field->slug, null, [ 'class' => 'form-control' ]) }}

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

@endforeach
@include('pireps.fares')
@if(isset($pirep) && !$pirep->read_only) {{ Form::button(__('Delete PIREP'), [ 'name' => 'submit', 'value' => 'Delete', 'class' => 'btn btn-warning', 'type' => 'submit']) }} @endif @if(!isset($pirep) || (filled($pirep) && !$pirep->read_only)) {{ Form::button(__('Save PIREP'), [ 'name' => 'submit', 'value' => 'Save', 'class' => 'btn btn-info', 'type' => 'submit']) }} {{ Form::button(__('Submit PIREP'), [ 'name' => 'submit', 'value' => 'Submit', 'class' => 'btn btn-success', 'type' => 'submit']) }} @endif