contract tables and such

This commit is contained in:
2019-07-07 06:24:44 -05:00
parent 22a62ab082
commit 6e9a13b44e
2 changed files with 145 additions and 28 deletions

View File

@@ -40,27 +40,12 @@ class LogisticsController extends Controller
'status' => 'in_progress', 'status' => 'in_progress',
])->get(); ])->get();
$cancelledCount = EveContract::where(['status' => 'cancelled'])->count();
$cancelled = EveContract::where([
'status' => 'cancelled',
])->get();
$failedCount = EveContract::where(['status' => 'failed'])->count();
$failed = EveContract::where([
'status' => 'failed',
])->get();
$deletedCount = EveContract::where(['status' => 'deleted'])->count();
$deleted = EveContract::where([
'status' => 'deleted',
])->get();
$finishedCount = EveContract::where(['status' => 'finished'])->count(); $finishedCount = EveContract::where(['status' => 'finished'])->count();
$finished = EveContract::where([ $finished = EveContract::where([
'status' => 'finished', 'status' => 'finished',
])->get(); ])->get();
$totalCount = $openCount + $inProgressCount + $cancelledCoutn + $failedCount + $deletedCount + $finishedCount; $totalCount = $openCount + $inProgressCount + $finishedCount;
//Fuel Gauge Chart Declarations //Fuel Gauge Chart Declarations
$lava = new Lavacharts; $lava = new Lavacharts;
@@ -88,15 +73,9 @@ class LogisticsController extends Controller
return view('logistics.display.contracts')->with('open', $open) return view('logistics.display.contracts')->with('open', $open)
->with('inProgress', $inProgress) ->with('inProgress', $inProgress)
->with('cancelled', $cancelled)
->with('failed', $failed)
->with('deleted', $deleted)
->with('finished', $finished) ->with('finished', $finished)
->with('openCount', $openCount) ->with('openCount', $openCount)
->with('inProgressCount', $inProgressCount) ->with('inProgressCount', $inProgressCount)
->with('cancelledCount', $cancelledCount)
->with('failedCount', $failedCount)
->with('deletedCount', $deletedCount)
->with('finishedCount', $finishedCount) ->with('finishedCount', $finishedCount)
->with('totalCount', $totalCount) ->with('totalCount', $totalCount)
->with('lava', $lava); ->with('lava', $lava);
@@ -106,9 +85,25 @@ class LogisticsController extends Controller
* Function to calculate details needing to be set for contracts * Function to calculate details needing to be set for contracts
*/ */
public function displayContractForm() { public function displayContractForm() {
//Declare some variables
$route = array();
//Get the distances table for solar system routes for logistics.
$distances = SolarSystemDistance::all(); $distances = SolarSystemDistance::all();
return view('logistics.display.courierform'); foreach($distance as $dist) {
$name = $dist->start_name . ' -> ' . $dist->end_name;
$tempRoute = [
'name' => $name,
'start' => $dist->start_name,
'end' => $dist->end_name,
];
array_push($route, $tempRoute);
}
return view('logistics.display.courierform')->with('route', $route);
} }
/** /**

View File

@@ -68,15 +68,137 @@ class CreateLogisticsTables extends Migration
$table->string('end_id'); $table->string('end_id');
$table->string('end_name'); $table->string('end_name');
$table->decimal('distance', 20, 6); $table->decimal('distance', 20, 6);
$table->integer('isotopes');
}); });
} }
DB::table('solar_system_distances')->insert([ DB::table('solar_system_distances')->insert([
'start_id' 'start_id' => '30001195',
'start_name' 'start_name' => 'J-ODE7',
'end_id' 'end_id' => '30002269',
'end_name' 'end_name' => 'Ebo',
'distance' 'distance' => 16.953,
'isotopes' => 53706,
]);
DB::table('solar_system_distances')->insert([
'start_id' => '30002269',
'start_name' => 'Ebo',
'end_id' => '30001195',
'end_name' => 'J-ODE7',
'distance' => 16.953,
'isotopes' => 53706,
]);
DB::table('solar_system_distances')->insert([
'start_id' => '30001195',
'start_name' => 'J-ODE7',
'end_id' => '30002110',
'end_name' => 'B9E-H6',
'distance' => 5.587,
'isotopes' => 17699,
]);
DB::table('solar_system_distances')->insert([
'start_id' => '30002110',
'start_name' => 'B9E-H6',
'end_id' => '30001195',
'end_name' => 'J-ODE7',
'distance' => 5.587,
'isotopes' => 17699,
]);
DB::table('solar_system_distances')->insert([
'start_id' => 30002269,
'start_name' => 'Ebo',
'end_id' => 30002142,
'end_name' => 'L-5JCJ',
'distance' => 26.009,
'isotopes' => 82393,
]);
DB::table('solar_system_distances')->insert([
'start_id' => 30002142,
'start_name' => 'L-5JCJ',
'end_id' => 30002269,
'end_name' => 'Ebo',
'distance' => 26.009,
'isotopes' => 82393,
]);
DB::table('solar_system_distances')->insert([
'start_id' => 30001195,
'start_name' => 'J-ODE7',
'end_id' => 30002142,
'end_name' => 'L-5JCJ',
'distance'=> 8.779,
'isotopes' => 27811,
]);
DB::table('solar_system_distances')->insert([
'start_id' => 30002142,
'start_name' => 'L-5JCJ',
'end_id' => 30001195,
'end_name' => 'J-ODE7',
'distance' => 8.779,
'isotopes' => 278111,
]);
if(!Schema::hasTable('logistics_routes')) {
Schema::create('logistics_routes', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->decimal('price_per_m3', 20, 2);
$table->decimal('max_size', 20, 2);
});
}
DB::table('logistics_routes')->insert([
'name' => 'J-ODE7 -> Ebo',
'price_per_m3' => 300.00,
'max_size' => 300000.00,
]);
DB::table('logistics_routes')->insert([
'name' => 'Ebo -> J-ODE7',
'price_per_m3' => 300.00,
'max_size' => 300000.00,
]);
DB::table('logistics_routes')->insert([
'name' => 'J-ODE7 -> B9E-H6',
'price_per_m3' => 150.00,
'max_size' => 300000.00,
]);
DB::table('logistics_routes')->insert([
'name' => 'B9E-H6 -> J-ODE7',
'price_per_m3' => 150.00,
'max_size' => 300000.00,
]);
DB::table('logistics_routes')->insert([
'name' => 'Ebo -> L-5JCJ',
'price_per_m3' => 600.00,
'max_size' => 300000.00,
]);
DB::table('logistics_routes')->insert([
'name' => 'L-5JCJ -> Ebo',
'price_per_m3' => 600.00,
'max_size' => 300000.00,
]);
DB::table('logistics_routes')->insert([
'name' => 'J-ODE7 -> L-5JCJ',
'price_per_m3' => 300.00,
'max_size' => 300000.00,
]);
DB::table('logistics_routes')->insert([
'name' => 'L-5JCJ -> J-ODE7',
'price_per_m3' => 300.00,
'max_size' => 300000.00,
]); ]);
} }