Skip to content

Commit

Permalink
Remove laravelcollective/html from frontend (#1753)
Browse files Browse the repository at this point in the history
* Apply fixes from StyleCI

* Remove laravelcollective/html from frontend

* Fix typo

* Fix airport_list in PirepController@edit

* Fix values in pirep edit form

* Apply fixes from StyleCI

* Fill dpt/arr airports when creating a pirep from a flight

* Fix checkbox in registeration form

* Fix register view

* Fix typo

* Remove discord button from registration page (forgotten while merging)

* Remove readonly from select in pirep fields view

* Fix home airport selected value in edit profile

* Fix checkbox in edit profile form

---------

Co-authored-by: StyleCI Bot <bot@styleci.io>
Co-authored-by: Nabeel S <nabeelio@users.noreply.github.com>
  • Loading branch information
3 people authored May 8, 2024
1 parent 2040c99 commit 7c0eb7d
Show file tree
Hide file tree
Showing 14 changed files with 317 additions and 243 deletions.
8 changes: 4 additions & 4 deletions app/Http/Controllers/Frontend/PirepController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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', [
Expand Down
6 changes: 3 additions & 3 deletions app/Http/Controllers/Frontend/ProfileController.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,16 +106,16 @@ 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!');

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 = ['' => ''];
}
Expand Down
38 changes: 20 additions & 18 deletions resources/views/layouts/default/auth/login.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
@section('content')
<div class="col-md-4 ml-auto mr-auto content-center">
<div class="card card-login card-plain">
{{ Form::open(['url' => url('/login'), 'method' => 'post', 'class' => 'form']) }}
<form method="post" action="{{ url('/login') }}" class="form">
@csrf
<div class="header header-primary text-center">
<div class="logo-container" style="width: 320px;">
<img src="{{ public_asset('/assets/frontend/img/logo.svg') }}" width="320" height="320"
Expand All @@ -18,14 +19,15 @@
<i class="now-ui-icons users_circle-08"></i>
</span>
</div>
{{
Form::text('email', old('email'), [
'id' => 'email',
'placeholder' => __('common.email').' '.__('common.or').' '.__('common.pilot_id'),
'class' => 'form-control',
'required' => true,
])
}}
<input
type="text"
name="email"
id="email"
class="form-control"
value="{{ old('email') }}"
placeholder="@lang('common.email') @lang('common.or') @lang('common.pilot_id')"
required
/>
</div>
@if ($errors->has('email'))
<span class="help-block">
Expand All @@ -39,14 +41,14 @@
<i class="now-ui-icons text_caps-small"></i>
</span>
</div>
{{
Form::password('password', [
'name' => 'password',
'class' => 'form-control',
'placeholder' => __('auth.password'),
'required' => true,
])
}}
<input
type="password"
name="password"
id="password"
class="form-control"
placeholder="@lang('auth.password')"
required
/>
</div>
@if ($errors->has('password'))
<span class="help-block">
Expand All @@ -73,7 +75,7 @@
<a href="{{ url('/password/reset') }}" class="link">@lang('auth.forgotpassword')?</a>
</h6>
</div>
{{ Form::close() }}
</form>
</div>
</div>
@endsection
25 changes: 10 additions & 15 deletions resources/views/layouts/default/auth/passwords/reset.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,9 @@
<div class="panel panel-default">
<div class="panel-heading">{{ __('Reset Password') }}</div>
<div class="panel-body">
{{ Form::open([
'url' => url('/password/reset'),
'method' => 'post',
'role' => 'form',
'class' => 'form-horizontal',
])
}}
<input type="hidden" name="token" value="{{ $token }}">
<form method="post" action="{{ url('/password/reset') }}" class="form-horizontal">
@csrf
<input type="hidden" name="token" value="{{ $token }}">

<div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
<label for="email" class="col-md-4 control-label">{{ __('Email Address') }}</label>
Expand All @@ -26,8 +21,8 @@

@if ($errors->has('email'))
<span class="help-block">
<strong>{{ $errors->first('email') }}</strong>
</span>
<strong>{{ $errors->first('email') }}</strong>
</span>
@endif
</div>
</div>
Expand All @@ -40,8 +35,8 @@

@if ($errors->has('password'))
<span class="help-block">
<strong>{{ $errors->first('password') }}</strong>
</span>
<strong>{{ $errors->first('password') }}</strong>
</span>
@endif
</div>
</div>
Expand All @@ -53,8 +48,8 @@

@if ($errors->has('password_confirmation'))
<span class="help-block">
<strong>{{ $errors->first('password_confirmation') }}</strong>
</span>
<strong>{{ $errors->first('password_confirmation') }}</strong>
</span>
@endif
</div>
</div>
Expand All @@ -66,7 +61,7 @@
</button>
</div>
</div>
{{ Form::close() }}
</form>
</div>
</div>
</div>
Expand Down
65 changes: 41 additions & 24 deletions resources/views/layouts/default/auth/register.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,54 +6,74 @@
<div class="col-sm-3"></div>
<div class="col-sm-6">

{{ Form::open(['url' => '/register', 'class' => 'form-signin']) }}

<form method="post" action="{{ url('/register') }}" class="form-signin">
@csrf
<div class="panel periodic-login">
<div class="panel-body">
<h2>@lang('common.register')</h2>
<label for="name" class="control-label">@lang('auth.fullname')</label>
<div class="input-group form-group-no-border {{ $errors->has('name') ? 'has-danger' : '' }}">
{{ Form::text('name', null, ['class' => 'form-control']) }}
<input type="text" name="name" id="name" class="form-control" value="{{ old('name') }}" />
</div>
@if ($errors->has('name'))
<p class="text-danger">{{ $errors->first('name') }}</p>
@endif

<label for="email" class="control-label">@lang('auth.emailaddress')</label>
<div class="input-group form-group-no-border {{ $errors->has('email') ? 'has-danger' : '' }}">
{{ Form::text('email', null, ['class' => 'form-control']) }}
<input type="email" name="email" id="email" class="form-control" value="{{ old('email') }}" />
</div>
@if ($errors->has('email'))
<p class="text-danger">{{ $errors->first('email') }}</p>
@endif

<label for="airline" class="control-label">@lang('common.airline')</label>
<div class="input-group form-group-no-border {{ $errors->has('airline') ? 'has-danger' : '' }}">
{{ Form::select('airline_id', $airlines, null , ['class' => 'form-control select2']) }}
<select name="airline_id" id="airline_id" class="form-control select2">
@foreach($airlines as $airline_id => $airline_label)
<option value="{{ $airline_id }}" @if($airline_id === old('airline_id')) selected @endif>{{ $airline_label }}</option>
@endforeach
</select>
</div>
@if ($errors->has('airline_id'))
<p class="text-danger">{{ $errors->first('airline_id') }}</p>
@endif

<label for="home_airport" class="control-label">@lang('airports.home')</label>
<div class="input-group form-group-no-border {{ $errors->has('home_airport') ? 'has-danger' : '' }}">
{{ Form::select('home_airport_id', $airports, null , ['class' => 'form-control airport_search '.($hubs_only?'hubs_only':'')]) }}
<select name="home_airport_id" id="home_airport_id" class="form-control airport_search @if($hubs_only) hubs_only @endif">
@foreach($airports as $airport_id => $airport_label)
<option value="{{ $airport_id }}">{{ $airport_label }}</option>
@endforeach
</select>
</div>
@if ($errors->has('home_airport_id'))
<p class="text-danger">{{ $errors->first('home_airport_id') }}</p>
@endif

<label for="country" class="control-label">@lang('common.country')</label>
<div class="input-group form-group-no-border {{ $errors->has('country') ? 'has-danger' : '' }}">
{{ Form::select('country', $countries, null, ['class' => 'form-control select2' ]) }}
<select name="country" id="country" class="form-control select2">
@foreach($countries as $country_id => $country_label)
<option value="{{ $country_id }}" @if($country_id === old('country')) selected @endif>{{ $country_label }}</option>
@endforeach
</select>
</div>
@if ($errors->has('country'))
<p class="text-danger">{{ $errors->first('country') }}</p>
@endif

<label for="timezone" class="control-label">@lang('common.timezone')</label>
<div class="input-group form-group-no-border {{ $errors->has('timezone') ? 'has-danger' : '' }}">
{{ Form::select('timezone', $timezones, null, ['id'=>'timezone', 'class' => 'form-control select2' ]) }}
<select name="timezone" id="timezone" class="form-control select2">
@foreach($timezones as $group_name => $group_timezones)
<optgroup label="{{ $group_name }}">
@foreach($group_timezones as $timezone_id => $timezone_label)
<option value="{{ $timezone_id }}" @if($timezone_id === old('timezone')) selected @endif>{{ $timezone_label }}</option>
@endforeach
</optgroup>
@endforeach
</select>
</div>
@if ($errors->has('timezone'))
<p class="text-danger">{{ $errors->first('timezone') }}</p>
Expand All @@ -62,7 +82,7 @@
@if (setting('pilots.allow_transfer_hours') === true)
<label for="transfer_time" class="control-label">@lang('auth.transferhours')</label>
<div class="input-group form-group-no-border {{ $errors->has('transfer_time') ? 'has-danger' : '' }}">
{{ Form::number('transfer_time', 0, ['class' => 'form-control']) }}
<input type="number" name="transfer_time" id="transfer_time" class="form-control" value="{{ old('transfer_time') }}" />
</div>
@if ($errors->has('transfer_time'))
<p class="text-danger">{{ $errors->first('transfer_time') }}</p>
Expand All @@ -71,15 +91,15 @@

<label for="password" class="control-label">@lang('auth.password')</label>
<div class="input-group form-group-no-border {{ $errors->has('password') ? 'has-danger' : '' }}">
{{ Form::password('password', ['class' => 'form-control']) }}
<input type="password" name="password" id="password" class="form-control" />
</div>
@if ($errors->has('password'))
<p class="text-danger">{{ $errors->first('password') }}</p>
@endif

<label for="password_confirmation" class="control-label">@lang('passwords.confirm')</label>
<div class="input-group form-group-no-border {{ $errors->has('password_confirmation') ? 'has-danger' : '' }}">
{{ Form::password('password_confirmation', ['class' => 'form-control']) }}
<input type="password" name="password_confirmation" id="password_confirmation" class="form-control" />
</div>
@if ($errors->has('password_confirmation'))
<p class="text-danger">{{ $errors->first('password_confirmation') }}</p>
Expand All @@ -89,7 +109,7 @@
@foreach($userFields as $field)
<label for="field_{{ $field->slug }}" class="control-label">{{ $field->name }}</label>
<div class="input-group form-group-no-border {{ $errors->has('field_'.$field->slug) ? 'has-danger' : '' }}">
{{ Form::text('field_'.$field->slug, null, ['class' => 'form-control']) }}
<input type="text" name="field_{{ $field->slug }}" id="field_{{ $field->slug }}" class="form-control" value="{{ old('field_' .$field->slug) }}" />
</div>
@if ($errors->has('field_'.$field->slug))
<p class="text-danger">{{ $errors->first('field_'.$field->slug) }}</p>
Expand All @@ -106,8 +126,8 @@
@endif

@if($invite)
{{ Form::hidden('invite', $invite->id) }}
{{ Form::hidden('invite_token', base64_encode($invite->token)) }}
<input type="hidden" name="invite" value="{{ $invite->id }}" />
<input type="hidden" name="invite_token" value="{{ base64_encode($invite->token) }}" />
@endif

<div>
Expand All @@ -119,8 +139,7 @@
<tr>
<td style="vertical-align: top; padding: 5px 10px 0 0">
<div class="input-group form-group-no-border">
{{ Form::hidden('toc_accepted', 0, false) }}
{{ Form::checkbox('toc_accepted', 1, null, ['id' => 'toc_accepted']) }}
<input type="checkbox" name="toc_accepted" id="toc_accepted" />
</div>
</td>
<td style="vertical-align: top;">
Expand All @@ -133,8 +152,8 @@
<tr>
<td>
<div class="input-group form-group-no-border">
{{ Form::hidden('opt_in', 0, false) }}
{{ Form::checkbox('opt_in', 1, null) }}
<input type="hidden" name="opt_in" value="0"/>
<input type="checkbox" name="opt_in" id="opt_in" value="1"/>
</div>
</td>
<td>
Expand All @@ -144,16 +163,14 @@
</table>

<div style="width: 100%; text-align: right; padding-top: 20px;">
{{ Form::submit(__('auth.register'), [
'id' => 'register_button',
'class' => 'btn btn-primary',
'disabled' => true,
]) }}
<button type="submit" class="btn btn-primary" id="register_button" disabled>
@lang('auth.register')
</button>
</div>

</div>
</div>
{{ Form::close() }}
</form>
</div>
<div class="col-sm-4"></div>
</div>
Expand Down
Loading

0 comments on commit 7c0eb7d

Please sign in to comment.