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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user