Split rank pay rate into separate rates for acars and manual flights
This commit is contained in:
@@ -18,7 +18,8 @@ class CreateRanksTable extends Migration
|
||||
$table->string('name', 50);
|
||||
$table->string('image_link')->nullable();
|
||||
$table->unsignedInteger('hours')->default(0);
|
||||
$table->unsignedDecimal('base_pay_rate')->nullable()->default(0);
|
||||
$table->unsignedDecimal('acars_base_pay_rate')->nullable()->default(0);
|
||||
$table->unsignedDecimal('manual_base_pay_rate')->nullable()->default(0);
|
||||
$table->boolean('auto_approve_acars')->nullable()->default(false);
|
||||
$table->boolean('auto_approve_manual')->nullable()->default(false);
|
||||
$table->boolean('auto_promote')->nullable()->default(true);
|
||||
|
||||
@@ -75,17 +75,20 @@ ranks:
|
||||
- id: 2
|
||||
name: Junior First Officer
|
||||
hours: 10
|
||||
base_pay_rate: 100
|
||||
acars_base_pay_rate: 100
|
||||
manual_base_pay_rate: 90
|
||||
- id: 3
|
||||
name: First Officer
|
||||
hours: 15
|
||||
base_pay_rate: 250
|
||||
acars_base_pay_rate: 250
|
||||
manual_base_pay_rate: 200
|
||||
auto_approve_acars: 1
|
||||
auto_approve_manual: 1
|
||||
- id: 4
|
||||
name: Senior Captain
|
||||
hours: 20
|
||||
base_pay_rate: 500
|
||||
acars_base_pay_rate: 500
|
||||
manual_base_pay_rate: 400
|
||||
auto_approve_acars: 1
|
||||
auto_approve_manual: 1
|
||||
auto_promote: 0
|
||||
|
||||
@@ -14,7 +14,8 @@ class Rank extends BaseModel
|
||||
'name',
|
||||
'hours',
|
||||
'image_link',
|
||||
'base_pay_rate',
|
||||
'acars_base_pay_rate',
|
||||
'manual_base_pay_rate',
|
||||
'auto_approve_acars',
|
||||
'auto_approve_manual',
|
||||
'auto_promote',
|
||||
@@ -31,7 +32,8 @@ class Rank extends BaseModel
|
||||
public static $rules = [
|
||||
'name' => 'required',
|
||||
'hours' => 'required|integer',
|
||||
'base_pay_rate' => 'nullable|numeric',
|
||||
'acars_base_pay_rate' => 'nullable|numeric',
|
||||
'manual_base_pay_rate' => 'nullable|numeric',
|
||||
];
|
||||
|
||||
public function subfleets() {
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Models\Enums\PirepSource;
|
||||
use App\Models\Pirep;
|
||||
|
||||
class FinanceService extends BaseService
|
||||
{
|
||||
private $fareSvc,
|
||||
@@ -22,4 +25,19 @@ class FinanceService extends BaseService
|
||||
$this->fareSvc = $fareSvc;
|
||||
$this->flightSvc = $flightSvc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the pilot's hourly pay for the given PIREP
|
||||
* @param Pirep $pirep
|
||||
*/
|
||||
public function getPayForPirep(Pirep $pirep)
|
||||
{
|
||||
# Get the base rate for the rank
|
||||
$rank = $pirep->user->rank;
|
||||
if($pirep->source === PirepSource::ACARS) {
|
||||
$base_rate = $rank->acars_base_pay_rate;
|
||||
} else {
|
||||
$base_rate = $rank->manual_base_pay_rate;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,22 +13,33 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="form-group col-md-6">
|
||||
{!! Form::label('base_pay_rate', 'Base Pay Rate:') !!}
|
||||
{!! Form::number('base_pay_rate', null, ['min' => 0, 'class' => 'form-control']) !!}
|
||||
<p class="text-danger">{{ $errors->first('base_pay_rate') }}</p>
|
||||
@component('admin.components.info')
|
||||
This is the base rate of pay, per-flight hour, for this rank.
|
||||
This can be adjusted via a multiplier on the subfleet.
|
||||
@endcomponent
|
||||
</div>
|
||||
|
||||
<!-- Hours Field -->
|
||||
<div class="form-group col-sm-6">
|
||||
<div class="form-group col-sm-4">
|
||||
{!! Form::label('hours', 'Hours:') !!}
|
||||
{!! Form::number('hours', null, ['class' => 'form-control']) !!}
|
||||
<p class="text-danger">{{ $errors->first('hours') }}</p>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
{!! Form::label('acars_base_pay_rate', 'ACARS Base Pay Rate:') !!}
|
||||
{!! Form::number('acars_base_pay_rate', null, ['min' => 0, 'class' => 'form-control']) !!}
|
||||
<p class="text-danger">{{ $errors->first('acars_base_pay_rate') }}</p>
|
||||
@component('admin.components.info')
|
||||
Base rate, per-flight hour, for ACARS PIREPs.
|
||||
Can be adjusted via a multiplier on the subfleet.
|
||||
@endcomponent
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
{!! Form::label('manual_base_pay_rate', 'Manual Base Pay Rate:') !!}
|
||||
{!! Form::number('manual_base_pay_rate', null, ['min' => 0, 'class' => 'form-control']) !!}
|
||||
<p class="text-danger">{{ $errors->first('manual_base_pay_rate') }}</p>
|
||||
@component('admin.components.info')
|
||||
Base rate, per-flight hour, for manually-filed PIREPs.
|
||||
Can be adjusted via a multiplier on the subfleet.
|
||||
@endcomponent
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="row">
|
||||
<!-- Auto Approve Acars Field -->
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<table class="table table-hover table-responsive">
|
||||
<thead>
|
||||
<th>Name</th>
|
||||
<th>Hours</th>
|
||||
<th class="text-center">Hours</th>
|
||||
<th class="text-center">Auto Approve Acars</th>
|
||||
<th class="text-center">Auto Approve Manual</th>
|
||||
<th class="text-center">Auto Promote</th>
|
||||
@@ -12,7 +12,7 @@
|
||||
@foreach($ranks as $rank)
|
||||
<tr>
|
||||
<td><a href="{!! route('admin.ranks.edit', [$rank->id]) !!}">{!! $rank->name !!}</a></td>
|
||||
<td>{!! $rank->hours !!}</td>
|
||||
<td class="text-center">{!! $rank->hours !!}</td>
|
||||
<td class="text-center">
|
||||
@if($rank->auto_approve_acars == 1)
|
||||
<span class="label label-success">Yes</span>
|
||||
|
||||
Reference in New Issue
Block a user