Skip to content

Commit

Permalink
Merge branch 'nabeelio:dev' into filament
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurpar06 authored May 9, 2024
2 parents f9cce59 + 7c0eb7d commit e6d479f
Show file tree
Hide file tree
Showing 17 changed files with 345 additions and 321 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
74 changes: 0 additions & 74 deletions app/Services/LegacyImporter/LedgerImporter.php

This file was deleted.

30 changes: 28 additions & 2 deletions app/Services/LegacyImporter/PirepImporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public function run($start = 0)
'fuelprice',
'expenses',
'gross',
'pilotpay',
];

// See if there's a flightlevel column, export that if there is
Expand Down Expand Up @@ -131,6 +132,14 @@ public function run($start = 0)
// TODO: Add extra fields in as PIREP fields
$this->idMapper->addMapping('pireps', $row->pirepid, $pirep->id);

if ($pirep->wasRecentlyCreated) {
$count++;
}

if (!$pirep->airline || !$pirep->airline->journal) {
continue;
}

// Some financial imports
if ($row->fuelprice && $row->fuelprice != 0) {
$fuel_price = Money::createFromAmount($row->fuelprice);
Expand Down Expand Up @@ -168,8 +177,25 @@ public function run($start = 0)
);
}

if ($pirep->wasRecentlyCreated) {
$count++;
if ($row->pilotpay && $row->pilotpay != 0) {
$pilot_pay = Money::createFromAmount($row->pilotpay * $duration / 60);
$financeSvc->debitFromJournal(
$pirep->airline->journal,
$pilot_pay,
$pirep,
'Pilot payment',
'Pilot Pay',
'pilot_pay'
);

$financeSvc->creditToJournal(
$pirep->user->journal,
$pilot_pay,
$pirep,
'Pilot payment',
'Pilot Pay',
'pilot_pay'
);
}
}

Expand Down
2 changes: 0 additions & 2 deletions app/Services/LegacyImporterService.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
use App\Services\LegacyImporter\FinalizeImporter;
use App\Services\LegacyImporter\FlightImporter;
use App\Services\LegacyImporter\GroupImporter;
use App\Services\LegacyImporter\LedgerImporter;
use App\Services\LegacyImporter\PirepImporter;
use App\Services\LegacyImporter\RankImport;
use App\Services\LegacyImporter\SettingsImporter;
Expand Down Expand Up @@ -45,7 +44,6 @@ class LegacyImporterService extends Service
UserImport::class,
PirepImporter::class,
ExpenseImporter::class,
LedgerImporter::class,
SettingsImporter::class,
FinalizeImporter::class,
];
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="fa fa-user"></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="fa fa-lock"></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
Loading

0 comments on commit e6d479f

Please sign in to comment.