structure fuel
This commit is contained in:
@@ -23,58 +23,59 @@ class FuelController extends Controller
|
|||||||
//$this->middleware('permission:logistics.structures');
|
//$this->middleware('permission:logistics.structures');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function displayStructureFuel() {
|
public function displayStructures() {
|
||||||
$aHelper = new AssetHelper(null, null, null);
|
//Declare variables
|
||||||
|
$jumpGates = array();
|
||||||
|
|
||||||
|
//Declare the class helpers
|
||||||
$sHelper = new StructureHelper(null, null, null);
|
$sHelper = new StructureHelper(null, null, null);
|
||||||
$lava = new Lavacharts;
|
$aHelper = new AssetHelper(null, null, null);
|
||||||
$gates = array();
|
//Get all of the jump gates
|
||||||
$i = 1;
|
$gates = $sHelper->GetStructuresByType('Ansiblex Jump Gate');
|
||||||
|
|
||||||
$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++;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach($gates as $gate) {
|
foreach($gates as $gate) {
|
||||||
$gateChart = $lava->DataTable();
|
$liquidOzone = $aHelper->GetAssetByType(16273, $gate->structure_id);
|
||||||
$gateChart->addStringColumn($gate['structure_name'])
|
$temp = [
|
||||||
->addNumberColumn('Liquid Ozone')
|
'name' => $gate->structure_name,
|
||||||
->addRow([$gate['row'], $gate['liquid_ozone']]);
|
'system' => $gate->solar_system_name,
|
||||||
|
'fuel_expires' => $gate->fuel_expires,
|
||||||
$lava->GaugeChart($gate['row'], $gateChart, [
|
'liquid_ozone' => $liquidOzone,
|
||||||
'width' => 300,
|
'link' => '/logistics/fuel/display/' . $gate->structure_id . '/',
|
||||||
'redFrom' => 0,
|
];
|
||||||
'redTo' => 50000,
|
|
||||||
'yellowFrom' => 50000,
|
|
||||||
'yellowTo' => 150000,
|
|
||||||
'greenFrom' => 150000,
|
|
||||||
'greenTo' => 1000000,
|
|
||||||
'majorTicks' => [
|
|
||||||
'Critical',
|
|
||||||
'Ok',
|
|
||||||
],
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
* Get the liquid ozone asset
|
||||||
*/
|
*/
|
||||||
public function GetAssetByType($type, $structureId) {
|
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([
|
$asset = Asset::where([
|
||||||
'location_id' => $structureId,
|
'location_id' => $structureId,
|
||||||
'type_id' => $type,
|
'type_id' => $type,
|
||||||
'location_flag' => 'StructureFuel',
|
'location_flag' => 'StructureFuel',
|
||||||
])->first();
|
])->first();
|
||||||
|
|
||||||
return $asset['quantity'];
|
if($count == 0) {
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
return $asset['quantity'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,8 +1,32 @@
|
|||||||
@extends('layouts.b4')
|
@extends('layouts.b4')
|
||||||
@section('content')
|
@section('content')
|
||||||
@foreach($gates as $gate)
|
<div class="container">
|
||||||
<div id="{{ $gate['div'] }}"></div>
|
<div class="card">
|
||||||
{!! $lava->render('Gauge Chart', $gate['row'], $gate['div']) !!}
|
<div class="card-header">
|
||||||
<br>
|
<h2>Jump Gate Fuel Status</h2>
|
||||||
@endforeach
|
</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
|
@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::get('/logistics/courier/form', 'Logistics\LogisticsController@displayContractForm');
|
||||||
Route::post('/logistics/courier/form', 'Logistics\LogisticsController@displayContractDetails');
|
Route::post('/logistics/courier/form', 'Logistics\LogisticsController@displayContractDetails');
|
||||||
Route::get('/logistics/contracts/display', 'Logistics\LogisticsController@displayLogisticsContracts');
|
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