diff --git a/app/Http/Controllers/Frontend/PirepController.php b/app/Http/Controllers/Frontend/PirepController.php index 804e1c827..d154e7338 100644 --- a/app/Http/Controllers/Frontend/PirepController.php +++ b/app/Http/Controllers/Frontend/PirepController.php @@ -532,13 +532,13 @@ public function edit(string $id): RedirectResponse|View } $airports = [ - ['' => ''], - [$pirep->arr_airport->id => $pirep->arr_airport->full_name], - [$pirep->dpt_airport->id => $pirep->dpt_airport->full_name], + '' => '', + $pirep->arr_airport->id => $pirep->arr_airport->full_name, + $pirep->dpt_airport->id => $pirep->dpt_airport->full_name, ]; if ($pirep->alt_airport) { - $airports[] = [$pirep->alt_airport->id => $pirep->alt_airport->full_name]; + $airports[$pirep->alt_airport->id] = $pirep->alt_airport->full_name; } return view('pireps.edit', [ diff --git a/app/Http/Controllers/Frontend/ProfileController.php b/app/Http/Controllers/Frontend/ProfileController.php index eb19cc7a5..9b940fa36 100644 --- a/app/Http/Controllers/Frontend/ProfileController.php +++ b/app/Http/Controllers/Frontend/ProfileController.php @@ -106,7 +106,7 @@ public function show(int $id): RedirectResponse|View public function edit(Request $request): RedirectResponse|View { /** @var \App\Models\User $user */ - $user = User::with('fields.field', 'location')->where('id', Auth::id())->first(); + $user = User::with('fields.field', 'home_airport')->where('id', Auth::id())->first(); if (empty($user)) { Flash::error('User not found!'); @@ -114,8 +114,8 @@ public function edit(Request $request): RedirectResponse|View return redirect(route('frontend.dashboard.index')); } - if ($user->location) { - $airports = [$user->location->id => $user->location->description]; + if ($user->home_airport) { + $airports = [$user->home_airport->id => $user->home_airport->description]; } else { $airports = ['' => '']; } diff --git a/resources/views/layouts/default/auth/login.blade.php b/resources/views/layouts/default/auth/login.blade.php index 7918c9398..8e6f883ca 100644 --- a/resources/views/layouts/default/auth/login.blade.php +++ b/resources/views/layouts/default/auth/login.blade.php @@ -4,7 +4,8 @@ @section('content')
- {{ Form::open(['url' => url('/login'), 'method' => 'post', 'class' => 'form']) }} +
+ @csrf
- {{ - Form::text('email', old('email'), [ - 'id' => 'email', - 'placeholder' => __('common.email').' '.__('common.or').' '.__('common.pilot_id'), - 'class' => 'form-control', - 'required' => true, - ]) - }} +
@if ($errors->has('email')) @@ -39,14 +41,14 @@
- {{ - Form::password('password', [ - 'name' => 'password', - 'class' => 'form-control', - 'placeholder' => __('auth.password'), - 'required' => true, - ]) - }} +
@if ($errors->has('password')) @@ -73,7 +75,7 @@ @lang('auth.forgotpassword')? - {{ Form::close() }} + @endsection diff --git a/resources/views/layouts/default/auth/passwords/reset.blade.php b/resources/views/layouts/default/auth/passwords/reset.blade.php index 8c4c9b408..4c839f6b2 100644 --- a/resources/views/layouts/default/auth/passwords/reset.blade.php +++ b/resources/views/layouts/default/auth/passwords/reset.blade.php @@ -8,14 +8,9 @@
{{ __('Reset Password') }}
- {{ Form::open([ - 'url' => url('/password/reset'), - 'method' => 'post', - 'role' => 'form', - 'class' => 'form-horizontal', - ]) - }} - +
+ @csrf +
@@ -26,8 +21,8 @@ @if ($errors->has('email')) - {{ $errors->first('email') }} - + {{ $errors->first('email') }} + @endif
@@ -40,8 +35,8 @@ @if ($errors->has('password')) - {{ $errors->first('password') }} - + {{ $errors->first('password') }} + @endif
@@ -53,8 +48,8 @@ @if ($errors->has('password_confirmation')) - {{ $errors->first('password_confirmation') }} - + {{ $errors->first('password_confirmation') }} +
@endif @@ -66,7 +61,7 @@ - {{ Form::close() }} + diff --git a/resources/views/layouts/default/auth/register.blade.php b/resources/views/layouts/default/auth/register.blade.php index 6e6fdf0be..752919e7c 100644 --- a/resources/views/layouts/default/auth/register.blade.php +++ b/resources/views/layouts/default/auth/register.blade.php @@ -6,14 +6,14 @@
- {{ Form::open(['url' => '/register', 'class' => 'form-signin']) }} - +
+ @csrf
diff --git a/resources/views/layouts/default/flights/search.blade.php b/resources/views/layouts/default/flights/search.blade.php index 62d8100ef..df354642d 100644 --- a/resources/views/layouts/default/flights/search.blade.php +++ b/resources/views/layouts/default/flights/search.blade.php @@ -2,53 +2,64 @@
- {{ Form::open([ - 'route' => 'frontend.flights.search', - 'method' => 'GET', - ]) }} - +
+ @csrf
@lang('common.airline')
- {{ Form::select('airline_id', $airlines, null , ['class' => 'form-control select2']) }} +
@lang('flights.flighttype')
- {{ Form::select('flight_type', $flight_types, null , ['class' => 'form-control select2']) }} +
@lang('flights.flightnumber')
- {{ Form::text('flight_number', null, ['class' => 'form-control']) }} +
@lang('flights.code')
- {{ Form::text('route_code', null, ['class' => 'form-control']) }} +
@lang('airports.departure')
- {{ Form::select('dep_icao', [], null , ['class' => 'form-control airport_search']) }} +
@lang('airports.arrival')
- {{ Form::select('arr_icao', [], null , ['class' => 'form-control airport_search']) }} +
@lang('common.subfleet')
- {{ Form::select('subfleet_id', $subfleets, null , ['class' => 'form-control select2']) }} +
- {{ Form::submit(__('common.find'), ['class' => 'btn btn-outline-primary']) }}  + @lang('common.reset')
- {{ Form::close() }} +
diff --git a/resources/views/layouts/default/pireps/create.blade.php b/resources/views/layouts/default/pireps/create.blade.php index 1dcef11ba..4433eea16 100644 --- a/resources/views/layouts/default/pireps/create.blade.php +++ b/resources/views/layouts/default/pireps/create.blade.php @@ -6,15 +6,11 @@

@lang('pireps.newflightreport')

@include('flash::message') - @if(!empty($pirep)) - {{ Form::model($pirep, ['route' => 'frontend.pireps.store']) }} - @else - {{ Form::open(['route' => 'frontend.pireps.store']) }} - @endif - @include('pireps.fields') - - {{ Form::close() }} +
+ @csrf + @include('pireps.fields') +
@endsection diff --git a/resources/views/layouts/default/pireps/custom_fields.blade.php b/resources/views/layouts/default/pireps/custom_fields.blade.php index 37363599b..83de3d23a 100644 --- a/resources/views/layouts/default/pireps/custom_fields.blade.php +++ b/resources/views/layouts/default/pireps/custom_fields.blade.php @@ -11,10 +11,7 @@
@if(!$field->read_only) - {{ Form::text($field->slug, $field->value, [ - 'class' => 'form-control', - 'readonly' => (!empty($pirep) && $pirep->read_only), - ]) }} + read_only) readonly @endif/> @else {{ $field->value }} @endif diff --git a/resources/views/layouts/default/pireps/edit.blade.php b/resources/views/layouts/default/pireps/edit.blade.php index 77369b825..db01c2383 100644 --- a/resources/views/layouts/default/pireps/edit.blade.php +++ b/resources/views/layouts/default/pireps/edit.blade.php @@ -5,14 +5,12 @@

@lang('pireps.editflightreport')

@include('flash::message') - {{ Form::model($pirep, [ - 'route' => ['frontend.pireps.update', $pirep->id], - 'class' => 'form-group', - 'method' => 'patch']) }} +
+ @method('PATCH') + @csrf - @include('pireps.fields') - - {{ Form::close() }} + @include('pireps.fields') +
@endsection diff --git a/resources/views/layouts/default/pireps/fares.blade.php b/resources/views/layouts/default/pireps/fares.blade.php index d2e959db5..50031ab7d 100644 --- a/resources/views/layouts/default/pireps/fares.blade.php +++ b/resources/views/layouts/default/pireps/fares.blade.php @@ -7,9 +7,9 @@ @foreach($aircraft->subfleet->fares as $fare)
- {{Form::label('fare_'.$fare->id, $fare->name.' ('. \App\Models\Enums\FareType::label($fare->type).', code '.$fare->code.')')}} +
- {{ Form::number('fare_'.$fare->id, $fare->count, ['class' => 'form-control', 'min' => 0]) }} +
diff --git a/resources/views/layouts/default/pireps/fields.blade.php b/resources/views/layouts/default/pireps/fields.blade.php index df29dfb82..0301a1a21 100644 --- a/resources/views/layouts/default/pireps/fields.blade.php +++ b/resources/views/layouts/default/pireps/fields.blade.php @@ -26,48 +26,60 @@
- {{ 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), - ]) }} + read_only) readonly @endif + value="{{ !empty($pirep) ? $pirep->flight_number : old('flight_number') }}" + placeholder="@lang('flights.flightnumber')" + /> + + read_only) readonly @endif + value="{{ !empty($pirep) ? $pirep->route_code : old('route_code') }}" + placeholder="@lang('pireps.codeoptional')" + /> + + route_leg) readonly @endif + value="{{ !empty($pirep) ? $pirep->route_leg : old('route_leg') }}" + placeholder="@lang('pireps.legoptional')" + />

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

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

@@ -75,19 +87,22 @@ @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 @@ -96,46 +111,55 @@
- {{ 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), - ]) }} + read_only) readonly @endif + placeholder="{{ trans_choice('common.hour', 2) }}" + min="0" + value="{{ !empty($pirep) ? $pirep->hours : old('hours') }}" + /> - {{ Form::number('minutes', null, [ - 'class' => 'form-control', - 'placeholder' => trans_choice('common.minute', 2), - 'min' => 0, - 'readonly' => (!empty($pirep) && $pirep->read_only), - ]) }} + read_only) readonly @endif + placeholder="{{ trans_choice('common.minute', 2) }}" + min="0" + value="{{ !empty($pirep) ? $pirep->minutes : old('minutes') }}" + />

{{ $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), - ]) }} + read_only) readonly @endif + min="0" + step="0.01" + value="{{ !empty($pirep) ? $pirep->level : old('level') }}" + />

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

@endif @@ -152,40 +176,50 @@
- {{ Form::label('dpt_airport_id', __('airports.departure')) }} - @if(!empty($pirep) && $pirep->read_only) + + @if(!empty($pirep) && ($pirep->read_only || request()->has('flight_id'))) {{ $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 airport_search', - '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) + + @if(!empty($pirep) && ($pirep->read_only || request()->has('flight_id'))) {{ $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 airport_search', - 'style' => 'width: 100%', - 'readonly' => (!empty($pirep) && $pirep->read_only), - ]) }} +

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

@endif @@ -201,50 +235,68 @@
- {{ 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')) }} ({{setting('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), - ]) }} + read_only) readonly @endif + value="{{ !empty($pirep) ? $pirep->block_fuel : old('block_fuel') }}" + />

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

@endif
- {{ Form::label('fuel_used', __('pireps.fuel_used')) }} ({{setting('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), - ]) }} + read_only) readonly @endif + value="{{ !empty($pirep) ? $pirep->fuel_used : old('fuel_used') }}" + />

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

@endif @@ -265,11 +317,7 @@
- {{ Form::textarea('route', null, [ - 'class' => 'form-control', - 'placeholder' => __('flights.route'), - 'readonly' => (!empty($pirep) && $pirep->read_only), - ]) }} +

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

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

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

@@ -319,33 +367,23 @@
- {{ Form::hidden('flight_id') }} - {{ Form::hidden('sb_id', $simbrief_id) }} + + @if(isset($pirep) && !$pirep->read_only) - {{ Form::button(__('pireps.deletepirep'), [ - 'name' => 'submit', - 'value' => 'Delete', - 'class' => 'btn btn-warning', - 'type' => 'submit', - 'onclick' => "return confirm('Are you sure you want to delete this PIREP?')"]) - }} + @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
diff --git a/resources/views/layouts/default/profile/custom_fields.blade.php b/resources/views/layouts/default/profile/custom_fields.blade.php index 1427ec68e..14761e83b 100644 --- a/resources/views/layouts/default/profile/custom_fields.blade.php +++ b/resources/views/layouts/default/profile/custom_fields.blade.php @@ -7,9 +7,7 @@
- {{ Form::text($field->field->slug, $field->value, [ - 'class' => 'form-control', - ]) }} +

{{ $errors->first('field_'.$field->slug) }}

diff --git a/resources/views/layouts/default/profile/edit.blade.php b/resources/views/layouts/default/profile/edit.blade.php index 699eab717..dba9ed2ce 100644 --- a/resources/views/layouts/default/profile/edit.blade.php +++ b/resources/views/layouts/default/profile/edit.blade.php @@ -6,9 +6,11 @@

@lang('profile.edityourprofile')

@include('flash::message') - {{ Form::model($user, ['route' => ['frontend.profile.update', $user->id], 'files' => true, 'method' => 'patch']) }} - @include("profile.fields") - {{ Form::close() }} +
+ @csrf + @method('PATCH') + @include("profile.fields") +
@endsection diff --git a/resources/views/layouts/default/profile/fields.blade.php b/resources/views/layouts/default/profile/fields.blade.php index 154a9f4b5..fbf9b7041 100644 --- a/resources/views/layouts/default/profile/fields.blade.php +++ b/resources/views/layouts/default/profile/fields.blade.php @@ -5,7 +5,7 @@ {{ __('common.name') }}
- {{ Form::text('name', null, ['class' => 'form-control']) }} +
@if ($errors->has('name'))

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

@@ -17,7 +17,7 @@ {{ __('common.email') }}
- {{ Form::text('email', null, ['class' => 'form-control']) }} +
@if ($errors->has('email'))

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

@@ -29,7 +29,11 @@ {{ __('common.airline') }}
- {{ Form::select('airline_id', $airlines, null , ['class' => 'form-control select2']) }} +
@if ($errors->has('airline_id'))

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

@@ -41,7 +45,11 @@ {{ __('airports.home') }}
- {{ Form::select('home_airport_id', $airports, null , ['class' => 'form-control airport_search '.($hubs_only?'hubs_only':'')]) }} +
@if ($errors->has('home_airport_id'))

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

@@ -53,7 +61,11 @@ {{ __('common.country') }}
- {{ Form::select('country', $countries, null, ['class' => 'form-control select2' ]) }} +
@if ($errors->has('country'))

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

@@ -65,7 +77,15 @@ {{ __('common.timezone') }}
- {{ Form::select('timezone', $timezones, null, ['class' => 'form-control select2' ]) }} +
@if ($errors->has('timezone'))

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

@@ -78,7 +98,7 @@

{{ __('profile.newpassword') }}:

- {{ Form::password('password', ['class' => 'form-control']) }} +
@if ($errors->has('password'))

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

@@ -86,7 +106,7 @@

{{ __('passwords.confirm') }}:

- {{ Form::password('password_confirmation', ['class' => 'form-control']) }} +
@if ($errors->has('password_confirmation'))

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

@@ -97,7 +117,7 @@ {{ __('profile.avatar') }}
- {{ Form::file('avatar', null) }} +

{{ __('profile.avatarresize', [ 'width' => config('phpvms.avatar.width'), @@ -120,9 +140,7 @@

- {{ Form::text('field_'.$field->slug, $field->value, [ - 'class' => 'form-control', - ]) }} +

{{ $errors->first('field_'.$field->slug) }}

@@ -133,8 +151,8 @@ {{ __('profile.opt-in') }}
- {{ Form::hidden('opt_in', 0, false) }} - {{ Form::checkbox('opt_in', 1, null) }} + +

{{ __('profile.opt-in-descrip') }}

@@ -144,7 +162,9 @@
- {{ Form::submit(__('profile.updateprofile'), ['class' => 'btn btn-primary']) }} +