diff --git a/resources/views/admin/pireps/fields.blade.php b/resources/views/admin/pireps/fields.blade.php index 73b2c60d..4998ec33 100644 --- a/resources/views/admin/pireps/fields.blade.php +++ b/resources/views/admin/pireps/fields.blade.php @@ -1,4 +1,4 @@ -@if($pirep->read_only) +@if(!empty($pirep) && $pirep->read_only)
@component('admin.components.info') diff --git a/resources/views/layouts/default/pireps/fields.blade.php b/resources/views/layouts/default/pireps/fields.blade.php index c4e41a3a..95becde4 100644 --- a/resources/views/layouts/default/pireps/fields.blade.php +++ b/resources/views/layouts/default/pireps/fields.blade.php @@ -8,7 +8,7 @@ an impact on your stats and financials, and will require a recalculation of all flight reports that have been filed. You've been warned! --}} -@if($pirep->read_only) +@if(!empty($pirep) && $pirep->read_only)
@component('components.info') @@ -27,7 +27,7 @@ flight reports that have been filed. You've been warned!
{{ Form::label('airline_id', 'Airline') }} - @if($pirep->read_only) + @if(!empty($pirep) && $pirep->read_only)

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

{{ Form::hidden('airline_id') }} @else @@ -35,14 +35,15 @@ flight reports that have been filed. You've been warned! {{ Form::select('airline_id', $airline_list, null, [ 'class' => 'custom-select select2', 'style' => 'width: 100%', - 'readonly' => $pirep->read_only]) }} + 'readonly' => (!empty($pirep) && $pirep->read_only), + ]) }}

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

@endif
{{ Form::label('flight_number', 'Flight Number/Code/Leg') }} - @if($pirep->read_only) + @if(!empty($pirep) && $pirep->read_only)

{{ $pirep->ident }} {{ Form::hidden('flight_number') }} {{ Form::hidden('flight_code') }} @@ -51,19 +52,22 @@ flight reports that have been filed. You've been warned! @else

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

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

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

@@ -72,7 +76,7 @@ flight reports that have been filed. You've been warned!
{{ Form::label('flight_type', 'Flight Type') }} - @if($pirep->read_only) + @if(!empty($pirep) && $pirep->read_only)

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

{{ Form::hidden('flight_type') }} @else @@ -81,7 +85,7 @@ flight reports that have been filed. You've been warned! \App\Models\Enums\FlightType::select(), null, [ 'class' => 'custom-select select2', 'style' => 'width: 100%', - 'readonly' => $pirep->read_only + 'readonly' => (!empty($pirep) && $pirep->read_only), ]) }}
@@ -93,7 +97,7 @@ flight reports that have been filed. You've been warned!
{{ Form::label('hours', 'Flight Time') }} - @if($pirep->read_only) + @if(!empty($pirep) && $pirep->read_only)

{{ $pirep->hours }} hours, {{ $pirep->minutes }} minutes {{ Form::hidden('hours') }} @@ -105,14 +109,14 @@ flight reports that have been filed. You've been warned! 'class' => 'form-control', 'placeholder' => 'hours', 'min' => '0', - 'readonly' => $pirep->read_only - ]) }} + 'readonly' => (!empty($pirep) && $pirep->read_only), + ]) }} {{ Form::number('minutes', null, [ 'class' => 'form-control', 'placeholder' => 'minutes', 'min' => 0, - 'readonly' => $pirep->read_only + 'readonly' => (!empty($pirep) && $pirep->read_only), ]) }}

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

@@ -160,7 +164,7 @@ flight reports that have been filed. You've been warned!
{{ Form::label('dpt_airport_id', 'Departure Airport') }} - @if($pirep->read_only) + @if(!empty($pirep) && $pirep->read_only) {{ $pirep->dpt_airport->name }} ({{ $errors->first('dpt_airport_id') }}

@endif @@ -180,7 +184,7 @@ flight reports that have been filed. You've been warned!
+
+
+  Route +
+
+
+
+
+ {{ Form::textarea('route', null, ['class' => 'form-control', 'placeholder' => 'Route']) }} +

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

+
+
+
+
+
+
 Remarks @@ -235,20 +255,10 @@ flight reports that have been filed. You've been warned!
- {{ Form::label('route', 'Route') }} -
- {{ Form::textarea('route', null, ['class' => 'form-control', 'placeholder' => 'Route']) }} -

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

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

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

-