{{-- 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') @lang('pireps.fieldsreadonly') @endcomponent
@endif
 @lang('pireps.flightinformations')
{{ Form::label('airline_id', __('common.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', __('pireps.flightident')) }} @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' => __('flights.flightnumber'), 'class' => 'form-control', 'readonly' => (!empty($pirep) && $pirep->read_only), ]) }}   {{ Form::text('route_code', null, [ 'placeholder' => __('pireps.codeoptional'), 'class' => 'form-control', 'readonly' => (!empty($pirep) && $pirep->read_only), ]) }}   {{ Form::text('route_leg', null, [ 'placeholder' => __('pireps.legoptional'), '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', __('flights.flighttype')) }} @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', __('flights.flighttime')) }} @if(!empty($pirep) && $pirep->read_only)

{{ $pirep->hours.' '.trans_choice('common.hour', $pirep->hours) }} , {{ $pirep->minutes.' '.trans_choice('common.minute', $pirep->minutes) }} {{ Form::hidden('hours') }} {{ Form::hidden('minutes') }}

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

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

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

@endif
{{ Form::label('level', __('flights.level')) }} ({{config('phpvms.internal_units.altitude')}}) @if(!empty($pirep) && $pirep->read_only)

{{ $pirep->level }}

@else
{{ Form::number('level', null, [ 'class' => 'form-control', 'min' => '0', 'step' => '0.01', 'readonly' => (!empty($pirep) && $pirep->read_only), ]) }}

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

@endif
 @lang('pireps.deparrinformations')
{{ Form::label('dpt_airport_id', __('airports.departure')) }} @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', __('airports.arrival')) }} @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
 @lang('pireps.aircraftinformations')
{{ Form::label('aircraft_id', __('common.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
{{ Form::label('block_fuel', __('pireps.block_fuel')) }} ({{config('phpvms.internal_units.fuel')}}) @if(!empty($pirep) && $pirep->read_only)

{{ $pirep->block_fuel }}

@else
{{ Form::number('block_fuel', null, [ 'class' => 'form-control', 'min' => '0', 'step' => '0.01', 'readonly' => (!empty($pirep) && $pirep->read_only), ]) }}

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

@endif
{{ Form::label('fuel_used', __('pireps.fuel_used')) }} ({{config('phpvms.internal_units.fuel')}}) @if(!empty($pirep) && $pirep->read_only)

{{ $pirep->fuel_used }}

@else
{{ Form::number('fuel_used', null, [ 'class' => 'form-control', 'min' => '0', 'step' => '0.01', 'readonly' => (!empty($pirep) && $pirep->read_only), ]) }}

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

@endif
@include('pireps.fares')
 @lang('flights.route')
{{ Form::textarea('route', null, [ 'class' => 'form-control', 'placeholder' => __('flights.route'), 'readonly' => (!empty($pirep) && $pirep->read_only), ]) }}

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

 {{ trans_choice('common.remark', 2) }}
{{ Form::textarea('notes', null, ['class' => 'form-control', 'placeholder' => trans_choice('common.note', 2)]) }}

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

{{-- Write out the custom fields, and label if they're required --}}
 {{ trans_choice('common.field', 2) }}
@if(isset($pirep) && $pirep->fields) @each('pireps.custom_fields', $pirep->fields, 'field') @else @each('pireps.custom_fields', $pirep_fields, 'field') @endif
{{ Form::hidden('flight_id') }} @if(isset($pirep) && !$pirep->read_only) {{ Form::button(__('pireps.deletepirep'), [ 'name' => 'submit', 'value' => 'Delete', 'class' => 'btn btn-warning', 'type' => 'submit']) }} @endif {{ Form::button(__('pireps.savepirep'), [ 'name' => 'submit', 'value' => 'Save', 'class' => 'btn btn-info', 'type' => 'submit']) }} @if(!isset($pirep) || (filled($pirep) && !$pirep->read_only)) {{ Form::button(__('pireps.submitpirep'), [ 'name' => 'submit', 'value' => 'Submit', 'class' => 'btn btn-success', 'type' => 'submit']) }} @endif