structure fuel
This commit is contained in:
@@ -23,58 +23,59 @@ class FuelController extends Controller
|
||||
//$this->middleware('permission:logistics.structures');
|
||||
}
|
||||
|
||||
public function displayStructureFuel() {
|
||||
$aHelper = new AssetHelper(null, null, null);
|
||||
public function displayStructures() {
|
||||
//Declare variables
|
||||
$jumpGates = array();
|
||||
|
||||
//Declare the class helpers
|
||||
$sHelper = new StructureHelper(null, null, null);
|
||||
$lava = new Lavacharts;
|
||||
$gates = array();
|
||||
$i = 1;
|
||||
|
||||
$jumpGates = $sHelper->GetStructuresByType('Ansiblex Jump Gate');
|
||||
|
||||
foreach($jumpGates as $jump) {
|
||||
//Liquid Ozone's item id is 16273
|
||||
$lo = $aHelper->GetAssetByType(16273, $jump->structure_id);
|
||||
|
||||
$temp = [
|
||||
'id' => $i,
|
||||
'structure_id' => $jump->structure_id,
|
||||
'structure_name' => $jump->structure_name,
|
||||
'solar_system_name' => $jump->solar_system_name,
|
||||
'fuel_expires' => $jump->fuel_expires,
|
||||
'liquid_ozone' => $lo,
|
||||
'row' => 'Liquid Ozone ' . $i,
|
||||
'div' => 'Liquid-Ozone-' . $i . '-div',
|
||||
];
|
||||
|
||||
array_push($gates, $temp);
|
||||
$i++;
|
||||
}
|
||||
$aHelper = new AssetHelper(null, null, null);
|
||||
//Get all of the jump gates
|
||||
$gates = $sHelper->GetStructuresByType('Ansiblex Jump Gate');
|
||||
|
||||
foreach($gates as $gate) {
|
||||
$gateChart = $lava->DataTable();
|
||||
$gateChart->addStringColumn($gate['structure_name'])
|
||||
->addNumberColumn('Liquid Ozone')
|
||||
->addRow([$gate['row'], $gate['liquid_ozone']]);
|
||||
|
||||
$lava->GaugeChart($gate['row'], $gateChart, [
|
||||
'width' => 300,
|
||||
'redFrom' => 0,
|
||||
'redTo' => 50000,
|
||||
'yellowFrom' => 50000,
|
||||
'yellowTo' => 150000,
|
||||
'greenFrom' => 150000,
|
||||
'greenTo' => 1000000,
|
||||
'majorTicks' => [
|
||||
'Critical',
|
||||
'Ok',
|
||||
],
|
||||
]);
|
||||
$liquidOzone = $aHelper->GetAssetByType(16273, $gate->structure_id);
|
||||
$temp = [
|
||||
'name' => $gate->structure_name,
|
||||
'system' => $gate->solar_system_name,
|
||||
'fuel_expires' => $gate->fuel_expires,
|
||||
'liquid_ozone' => $liquidOzone,
|
||||
'link' => '/logistics/fuel/display/' . $gate->structure_id . '/',
|
||||
];
|
||||
}
|
||||
|
||||
dd($lava);
|
||||
return view('logistics.display.fuel')->with('gates', $gates);
|
||||
}
|
||||
|
||||
return view('logistics.display.fuel')->with('lava', $lava)
|
||||
->with('gates', $gates);
|
||||
/**
|
||||
* Get the structure id passed to it and display fuel gauage for structure
|
||||
*/
|
||||
public function displayStructureFuel($id) {
|
||||
//Declare class variables
|
||||
$lava = new Lavacharts;
|
||||
$aHelper = new AssetHelper(null, null, null);
|
||||
//Get the quantity of liquid ozone in the structure
|
||||
$liquidOzone = $aHelper->GetAssetByType(16273, $id);
|
||||
|
||||
$gauge = $lava->DataTable();
|
||||
$gauge->addStringColumn('Fuel')
|
||||
->addNumberColumn('Liquid Ozone')
|
||||
->addRow(['Liquid Ozone', $liquidOzone]);
|
||||
$lava->GaugeChart('Liquid Ozone', $gauge, [
|
||||
'width' => 400,
|
||||
'redFrom' => 0,
|
||||
'redTo' => 75000,
|
||||
'yellowFrom' => 75000,
|
||||
'yellowTo' => 150000,
|
||||
'greenFrom' => 150000,
|
||||
'greenTo' => 1000000,
|
||||
'majorTicks' => [
|
||||
'Empty',
|
||||
'Ok',
|
||||
],
|
||||
]);
|
||||
|
||||
//Return the view
|
||||
return view('logistics.display.fuelgauage')->with('lava', $lava);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,13 +110,24 @@ class AssetHelper {
|
||||
* Get the liquid ozone asset
|
||||
*/
|
||||
public function GetAssetByType($type, $structureId) {
|
||||
//See if the row is in the database table
|
||||
$count = Asset::where([
|
||||
'location_id' => $structureId,
|
||||
'type_id' => $type,
|
||||
'location_flag' => 'StructureFuel',
|
||||
])->count();
|
||||
//Get the row if it is in the table
|
||||
$asset = Asset::where([
|
||||
'location_id' => $structureId,
|
||||
'type_id' => $type,
|
||||
'location_flag' => 'StructureFuel',
|
||||
])->first();
|
||||
|
||||
return $asset['quantity'];
|
||||
if($count == 0) {
|
||||
return 0;
|
||||
} else {
|
||||
return $asset['quantity'];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,8 +1,32 @@
|
||||
@extends('layouts.b4')
|
||||
@section('content')
|
||||
@foreach($gates as $gate)
|
||||
<div id="{{ $gate['div'] }}"></div>
|
||||
{!! $lava->render('Gauge Chart', $gate['row'], $gate['div']) !!}
|
||||
<br>
|
||||
@endforeach
|
||||
<div class="container">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h2>Jump Gate Fuel Status</h2>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<th>Structure Name</th>
|
||||
<th>System</th>
|
||||
<th>Fuel Expires</th>
|
||||
<th>Liquid Ozone Quantity</th>
|
||||
<th>Fuel Gauge</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($jumpGates as $jumpGate)
|
||||
<tr>
|
||||
<td>{{ $jumpGate['name'] }}</td>
|
||||
<td>{{ $jumpGate['system'] }}</td>
|
||||
<td>{{ $jumpGate{'fuel_expires'} }}</td>
|
||||
<td>{{ $jumpGate['liquid_ozone'] }}</td>
|
||||
<td><a href="{{ $jumpGate['link'] }}">Link</a></td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
4
resources/views/logistics/display/fuelgauge.blade.php
Normal file
4
resources/views/logistics/display/fuelgauge.blade.php
Normal file
@@ -0,0 +1,4 @@
|
||||
@extends('layouts.b4')
|
||||
@section('content')
|
||||
|
||||
@endsection
|
||||
@@ -117,7 +117,8 @@ Route::group(['middleware' => ['auth']], function(){
|
||||
Route::get('/logistics/courier/form', 'Logistics\LogisticsController@displayContractForm');
|
||||
Route::post('/logistics/courier/form', 'Logistics\LogisticsController@displayContractDetails');
|
||||
Route::get('/logistics/contracts/display', 'Logistics\LogisticsController@displayLogisticsContracts');
|
||||
Route::get('/logistics/fuel/display', 'Fuel\FuelController@displayStructureFuel');
|
||||
Route::get('/logistics/fuel/structures', 'Fuel\FuelController@displayStructures');
|
||||
Route::get('/logistics/fuel/display/{id}/', 'Fuel\FuelController@displayStructureFuel');
|
||||
});
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user