Adjust columns in migrations and give lens to strings and custom flight fields #48
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -44,3 +44,5 @@ phpvms_next.iml
|
|||||||
.idea/**/gradle.xml
|
.idea/**/gradle.xml
|
||||||
.idea/**/libraries
|
.idea/**/libraries
|
||||||
public/info.php
|
public/info.php
|
||||||
|
|
||||||
|
local.conf.php
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ class Pirep extends Model
|
|||||||
'route_leg',
|
'route_leg',
|
||||||
'dpt_airport_id',
|
'dpt_airport_id',
|
||||||
'arr_airport_id',
|
'arr_airport_id',
|
||||||
|
'fuel_used',
|
||||||
'source',
|
'source',
|
||||||
'level',
|
'level',
|
||||||
'route',
|
'route',
|
||||||
@@ -47,6 +48,7 @@ class Pirep extends Model
|
|||||||
= [
|
= [
|
||||||
'flight_time' => 'integer',
|
'flight_time' => 'integer',
|
||||||
'level' => 'integer',
|
'level' => 'integer',
|
||||||
|
'fuel_used' => 'integer',
|
||||||
'source' => 'integer',
|
'source' => 'integer',
|
||||||
'status' => 'integer',
|
'status' => 'integer',
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -152,4 +152,13 @@ class PIREPService extends BaseService
|
|||||||
|
|
||||||
return $pirep;
|
return $pirep;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calculate all of the finances for a PIREP
|
||||||
|
* @param Pirep $pirep
|
||||||
|
*/
|
||||||
|
public function calculateFinances(Pirep &$pirep)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,9 +11,18 @@
|
|||||||
|
|
||||||
return [
|
return [
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Start date. Set the date of when your VA has started
|
||||||
|
* Used as an anchor point for some financials and things
|
||||||
|
*
|
||||||
|
* YYYY-MM-DD format
|
||||||
|
*/
|
||||||
|
'start_date' => '2017-07-07',
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pick one of:
|
* Pick one of:
|
||||||
* dollar, euro, gbp, yen, jpy, rupee, ruble
|
* dollar, euro, gbp, yen, jpy, rupee, ruble
|
||||||
*/
|
*/
|
||||||
'currency' => 'dollar',
|
'currency' => 'dollar',
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -15,9 +15,9 @@ class CreateAirlinesTable extends Migration
|
|||||||
{
|
{
|
||||||
Schema::create('airlines', function (Blueprint $table) {
|
Schema::create('airlines', function (Blueprint $table) {
|
||||||
$table->increments('id');
|
$table->increments('id');
|
||||||
$table->string('code');
|
$table->string('code', 5);
|
||||||
$table->string('name');
|
$table->string('name', 50);
|
||||||
$table->char('country', 2)->nullable();
|
$table->string('country', 2)->nullable();
|
||||||
$table->boolean('active');
|
$table->boolean('active');
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
|
|
||||||
|
|||||||
@@ -11,10 +11,10 @@ class CreateAircraftsTable extends Migration
|
|||||||
$table->increments('id');
|
$table->increments('id');
|
||||||
$table->integer('subfleet_id')->unsigned();
|
$table->integer('subfleet_id')->unsigned();
|
||||||
$table->integer('airport_id')->unsigned()->nullable();
|
$table->integer('airport_id')->unsigned()->nullable();
|
||||||
$table->string('hex_code')->nullable();
|
$table->string('hex_code', 10)->nullable();
|
||||||
$table->string('name');
|
$table->string('name', 50);
|
||||||
$table->string('registration')->nullable();
|
$table->string('registration', 10)->nullable();
|
||||||
$table->string('tail_number')->nullable();
|
$table->string('tail_number', 10)->nullable();
|
||||||
$table->boolean('active')->default(true);
|
$table->boolean('active')->default(true);
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
|
|
||||||
|
|||||||
@@ -15,14 +15,16 @@ class CreateFaresTable extends Migration
|
|||||||
{
|
{
|
||||||
Schema::create('fares', function (Blueprint $table) {
|
Schema::create('fares', function (Blueprint $table) {
|
||||||
$table->increments('id');
|
$table->increments('id');
|
||||||
$table->string('code');
|
$table->string('code', 50);
|
||||||
$table->string('name');
|
$table->string('name', 50);
|
||||||
$table->decimal('price', 19, 2)->default(0.0);
|
$table->decimal('price', 19, 2)->default(0.0);
|
||||||
$table->decimal('cost', 19, 2)->default(0.0);
|
$table->decimal('cost', 19, 2)->default(0.0);
|
||||||
$table->integer('capacity')->default(0)->unsigned();
|
$table->integer('capacity')->default(0)->unsigned();
|
||||||
$table->string('notes')->nullable();
|
$table->string('notes')->nullable();
|
||||||
$table->boolean('active')->default(true);
|
$table->boolean('active')->default(true);
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
|
|
||||||
|
$table->primary('id');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,9 +16,9 @@ class CreateAirportsTable extends Migration
|
|||||||
Schema::create('airports', function (Blueprint $table) {
|
Schema::create('airports', function (Blueprint $table) {
|
||||||
$table->increments('id');
|
$table->increments('id');
|
||||||
$table->string('icao', 5)->unique();
|
$table->string('icao', 5)->unique();
|
||||||
$table->string('name');
|
$table->string('name', 50);
|
||||||
$table->string('location')->nullable();
|
$table->string('location', 50)->nullable();
|
||||||
$table->string('country')->nullable();
|
$table->string('country', 50)->nullable();
|
||||||
$table->double('fuel_100ll_cost', 19, 2)->default(0);
|
$table->double('fuel_100ll_cost', 19, 2)->default(0);
|
||||||
$table->double('fuel_jeta_cost', 19, 2)->default(0);
|
$table->double('fuel_jeta_cost', 19, 2)->default(0);
|
||||||
$table->double('fuel_mogas_cost', 19, 2)->default(0);
|
$table->double('fuel_mogas_cost', 19, 2)->default(0);
|
||||||
|
|||||||
@@ -16,15 +16,16 @@ class CreateFlightsTable extends Migration
|
|||||||
Schema::create('flights', function (Blueprint $table) {
|
Schema::create('flights', function (Blueprint $table) {
|
||||||
$table->uuid('id');
|
$table->uuid('id');
|
||||||
$table->integer('airline_id')->unsigned();
|
$table->integer('airline_id')->unsigned();
|
||||||
$table->text('flight_number');
|
$table->string('flight_number', 10);
|
||||||
$table->text('route_code')->nullable();
|
$table->string('route_code', 5)->nullable();
|
||||||
$table->text('route_leg')->nullable();
|
$table->string('route_leg', 5)->nullable();
|
||||||
$table->integer('dpt_airport_id')->unsigned();
|
$table->integer('dpt_airport_id')->unsigned();
|
||||||
$table->integer('arr_airport_id')->unsigned();
|
$table->integer('arr_airport_id')->unsigned();
|
||||||
$table->integer('alt_airport_id')->unsigned()->nullable();
|
$table->integer('alt_airport_id')->unsigned()->nullable();
|
||||||
$table->text('route')->nullable();
|
$table->text('route')->nullable();
|
||||||
$table->text('dpt_time')->nullable();
|
$table->text('dpt_time', 10)->nullable();
|
||||||
$table->text('arr_time')->nullable();
|
$table->text('arr_time', 10)->nullable();
|
||||||
|
$table->double('flight_time', 19, 2)->unsigned();
|
||||||
$table->text('notes')->nullable();
|
$table->text('notes')->nullable();
|
||||||
$table->boolean('active')->default(true);
|
$table->boolean('active')->default(true);
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
@@ -37,6 +38,13 @@ class CreateFlightsTable extends Migration
|
|||||||
$table->index('dpt_airport_id');
|
$table->index('dpt_airport_id');
|
||||||
$table->index('arr_airport_id');
|
$table->index('arr_airport_id');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Schema::create('flight_fields', function (Blueprint $table) {
|
||||||
|
$table->increments('id');
|
||||||
|
$table->uuid('flight_id');
|
||||||
|
$table->string('name', 50);
|
||||||
|
$table->text('value');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class CreateRanksTable extends Migration
|
|||||||
{
|
{
|
||||||
Schema::create('ranks', function (Blueprint $table) {
|
Schema::create('ranks', function (Blueprint $table) {
|
||||||
$table->increments('id');
|
$table->increments('id');
|
||||||
$table->string('name');
|
$table->string('name', 50);
|
||||||
$table->integer('hours')->default(0);
|
$table->integer('hours')->default(0);
|
||||||
$table->boolean('auto_approve_acars')->default(false);
|
$table->boolean('auto_approve_acars')->default(false);
|
||||||
$table->boolean('auto_approve_manual')->default(false);
|
$table->boolean('auto_approve_manual')->default(false);
|
||||||
|
|||||||
@@ -16,19 +16,18 @@ class CreateSubfleetsTable extends Migration
|
|||||||
Schema::create('subfleets', function (Blueprint $table) {
|
Schema::create('subfleets', function (Blueprint $table) {
|
||||||
$table->increments('id');
|
$table->increments('id');
|
||||||
$table->integer('airline_id')->unsigned()->nullable();
|
$table->integer('airline_id')->unsigned()->nullable();
|
||||||
$table->string('name');
|
$table->string('name', 50);
|
||||||
$table->text('type');
|
$table->string('type', 7);
|
||||||
$table->tinyInteger('fuel_type')->unsigned()->nullable();
|
$table->tinyInteger('fuel_type')->unsigned()->nullable();
|
||||||
$table->double('cargo_capacity', 19, 2)->nullable();
|
$table->double('cargo_capacity', 19, 2)->nullable();
|
||||||
$table->double('fuel_capacity', 19, 2)->nullable();
|
$table->double('fuel_capacity', 19, 2)->nullable();
|
||||||
$table->double('gross_weight', 19, 2)->nullable();
|
$table->double('gross_weight', 19, 2)->nullable();
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
$table->softDeletes();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Schema::create('subfleet_expenses', function(Blueprint $table) {
|
Schema::create('subfleet_expenses', function(Blueprint $table) {
|
||||||
$table->integer('subfleet_id')->unsigned();
|
$table->integer('subfleet_id')->unsigned();
|
||||||
$table->string('name');
|
$table->string('name', 50);
|
||||||
$table->decimal('cost', 19, 2)->unsigned();
|
$table->decimal('cost', 19, 2)->unsigned();
|
||||||
|
|
||||||
$table->primary(['subfleet_id', 'name']);
|
$table->primary(['subfleet_id', 'name']);
|
||||||
|
|||||||
@@ -16,16 +16,15 @@ class CreatePirepsTable extends Migration
|
|||||||
Schema::create('pireps', function (Blueprint $table) {
|
Schema::create('pireps', function (Blueprint $table) {
|
||||||
$table->uuid('id');
|
$table->uuid('id');
|
||||||
$table->integer('user_id');
|
$table->integer('user_id');
|
||||||
$table->string('flight_id');
|
$table->uuid('flight_id')->nullable();
|
||||||
$table->integer('aircraft_id');
|
$table->integer('aircraft_id');
|
||||||
$table->text('route_code')->nullable();
|
$table->string('route_code', 5)->nullable();
|
||||||
$table->text('route_leg')->nullable();
|
$table->string('route_leg', 5)->nullable();
|
||||||
$table->integer('dpt_airport_id')->unsigned();
|
$table->integer('dpt_airport_id')->unsigned();
|
||||||
$table->integer('arr_airport_id')->unsigned();
|
$table->integer('arr_airport_id')->unsigned();
|
||||||
$table->integer('flight_time')->unsigned();
|
$table->double('flight_time', 19, 2)->unsigned();
|
||||||
$table->double('gross_weight', 19, 2)->nullable();
|
$table->double('gross_weight', 19, 2)->nullable();
|
||||||
$table->double('starting_fuel', 19, 2)->nullable();
|
$table->double('fuel_used', 19, 2)->nullable();
|
||||||
$table->double('landing_fuel', 19, 2)->nullable();
|
|
||||||
$table->integer('level')->unsigned();
|
$table->integer('level')->unsigned();
|
||||||
$table->string('route')->nullable();
|
$table->string('route')->nullable();
|
||||||
$table->string('notes')->nullable();
|
$table->string('notes')->nullable();
|
||||||
@@ -68,7 +67,7 @@ class CreatePirepsTable extends Migration
|
|||||||
*/
|
*/
|
||||||
Schema::create('pirep_fields', function (Blueprint $table) {
|
Schema::create('pirep_fields', function (Blueprint $table) {
|
||||||
$table->increments('id');
|
$table->increments('id');
|
||||||
$table->string('name');
|
$table->string('name', 50);
|
||||||
$table->integer('required');
|
$table->integer('required');
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
@@ -76,8 +75,8 @@ class CreatePirepsTable extends Migration
|
|||||||
Schema::create('pirep_field_values', function (Blueprint $table) {
|
Schema::create('pirep_field_values', function (Blueprint $table) {
|
||||||
$table->increments('id');
|
$table->increments('id');
|
||||||
$table->uuid('pirep_id');
|
$table->uuid('pirep_id');
|
||||||
$table->string('name');
|
$table->string('name', 50);
|
||||||
$table->string('value');
|
$table->text('value');
|
||||||
$table->tinyInteger('source')->default(0);
|
$table->tinyInteger('source')->default(0);
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ class PIREPTest extends TestCase
|
|||||||
'flight_time' => 21600, # 6 hours
|
'flight_time' => 21600, # 6 hours
|
||||||
'level' => 320,
|
'level' => 320,
|
||||||
'source' => 0, # manual
|
'source' => 0, # manual
|
||||||
|
'fuel_used' => 100,
|
||||||
'notes' => 'just a pilot report',
|
'notes' => 'just a pilot report',
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -52,6 +53,9 @@ class PIREPTest extends TestCase
|
|||||||
parent::setUp(); // TODO: Change the autogenerated stub
|
parent::setUp(); // TODO: Change the autogenerated stub
|
||||||
$this->addData('base');
|
$this->addData('base');
|
||||||
$this->pirepSvc = app('App\Services\PIREPService');
|
$this->pirepSvc = app('App\Services\PIREPService');
|
||||||
|
|
||||||
|
$conf = config('phpvms');
|
||||||
|
print_r($conf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -121,4 +125,9 @@ class PIREPTest extends TestCase
|
|||||||
$latest_pirep->status
|
$latest_pirep->status
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testPirepFinances()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -99,11 +99,13 @@ subfleets:
|
|||||||
name: 747-400 Winglets
|
name: 747-400 Winglets
|
||||||
type: 744W
|
type: 744W
|
||||||
fuel_type: 1
|
fuel_type: 1
|
||||||
|
fuel_capacity: 2000
|
||||||
- id: 2
|
- id: 2
|
||||||
airline_id: 1
|
airline_id: 1
|
||||||
name: 777-200 LR
|
name: 777-200 LR
|
||||||
type: 772-LR
|
type: 772-LR
|
||||||
fuel_type: 1
|
fuel_type: 1
|
||||||
|
fuel_capacity: 1000
|
||||||
|
|
||||||
# add a few mods to aircraft and fares
|
# add a few mods to aircraft and fares
|
||||||
subfleet_fare:
|
subfleet_fare:
|
||||||
|
|||||||
Reference in New Issue
Block a user