wormholes and srp dashboard modification
This commit is contained in:
@@ -41,6 +41,19 @@ class DashboardController extends Controller
|
|||||||
$open = null;
|
$open = null;
|
||||||
$approved = null;
|
$approved = null;
|
||||||
$denied = null;
|
$denied = null;
|
||||||
|
$alts = null;
|
||||||
|
|
||||||
|
//Get the number of the user's alt which are registered so we can process the alt's on the main dashboard page
|
||||||
|
$altCount = UserAlt::where([
|
||||||
|
'main_id' => auth()->user()->character_id,
|
||||||
|
])->count();
|
||||||
|
|
||||||
|
//If the alt count is greater than 0 get all of the alt accounts
|
||||||
|
if($altCount > 0) {
|
||||||
|
$alts = UserAlt::where([
|
||||||
|
'main_id' => auth()->user()->character,
|
||||||
|
])->get();
|
||||||
|
}
|
||||||
|
|
||||||
//See if we can get all of the open SRP requests
|
//See if we can get all of the open SRP requests
|
||||||
$openCount = SRPShip::where([
|
$openCount = SRPShip::where([
|
||||||
@@ -78,6 +91,56 @@ class DashboardController extends Controller
|
|||||||
])->take(10)->get();
|
])->take(10)->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Process all types of srp requests for the alt of the main and add to the main's page
|
||||||
|
if($altCount > 0) {
|
||||||
|
//For each alt, get the open requests, and increment the open request counter
|
||||||
|
foreach($alts as $alt) {
|
||||||
|
$altOpenCount = SRPShip::where([
|
||||||
|
'character_id' => $alt->character_id,
|
||||||
|
'approved' => 'Under Review',
|
||||||
|
])->count();
|
||||||
|
if($altOpenCount > 0) {
|
||||||
|
//If the number of open requests is greater than zero, add to the open count
|
||||||
|
$openCount += $altOpenCount;
|
||||||
|
//Get the alt's open srp requests
|
||||||
|
$altOpen = SRPShip::where([
|
||||||
|
'character_id' => $alt->character_id,
|
||||||
|
'approved' => 'Under Review',
|
||||||
|
])->get();
|
||||||
|
//Add the alt's open requests to the open requests array
|
||||||
|
array_push($open, $altOpen);
|
||||||
|
}
|
||||||
|
|
||||||
|
$altApprovedCount = SRPShip::where([
|
||||||
|
'character_id' => $alt->character_id,
|
||||||
|
'approved' => 'Approved',
|
||||||
|
])->count();
|
||||||
|
if($altApprovedCount > 0) {
|
||||||
|
$approvedCount += $altApprovedCount;
|
||||||
|
$altApproved = SRPShip::where([
|
||||||
|
'character_id' => $alt->character_id,
|
||||||
|
'approved' => 'Approved',
|
||||||
|
])->take(5)->get();
|
||||||
|
|
||||||
|
array_push($approved, $altApproved);
|
||||||
|
}
|
||||||
|
|
||||||
|
$altDeniedCount = SRPShip::where([
|
||||||
|
'character_id' => $alt->character_id,
|
||||||
|
'approved' => 'Denied',
|
||||||
|
])->count();
|
||||||
|
if($altDeniedCount > 0) {
|
||||||
|
$deniedCount += $altDeniedCount;
|
||||||
|
$altDenied = SRPShip::where([
|
||||||
|
'character_id' => $alt->character_id,
|
||||||
|
'approved' => 'Denied',
|
||||||
|
])->take(5)->get();
|
||||||
|
|
||||||
|
array_push($denied, $altDenied);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//Create a chart of number of approved, denied, and open requests via a fuel gauge chart
|
//Create a chart of number of approved, denied, and open requests via a fuel gauge chart
|
||||||
$lava = new Lavacharts;
|
$lava = new Lavacharts;
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ use Auth;
|
|||||||
//User Libraries
|
//User Libraries
|
||||||
|
|
||||||
//Models
|
//Models
|
||||||
|
use App\Models\Wormholes\AllianceWormhole;
|
||||||
|
use App\Models\Wormholes\WormholeType;
|
||||||
|
|
||||||
class WormholeController extends Controller
|
class WormholeController extends Controller
|
||||||
{
|
{
|
||||||
@@ -25,7 +27,6 @@ class WormholeController extends Controller
|
|||||||
$stability = array();
|
$stability = array();
|
||||||
$size = array();
|
$size = array();
|
||||||
|
|
||||||
|
|
||||||
//Get the duration from the table
|
//Get the duration from the table
|
||||||
$duration = [
|
$duration = [
|
||||||
'This wormhole has not yet begun its natural cycle of decay and should last at least another day.',
|
'This wormhole has not yet begun its natural cycle of decay and should last at least another day.',
|
||||||
@@ -81,14 +82,67 @@ class WormholeController extends Controller
|
|||||||
$this->validate($request, [
|
$this->validate($request, [
|
||||||
'sig' => 'required',
|
'sig' => 'required',
|
||||||
'duration' => 'required',
|
'duration' => 'required',
|
||||||
'date' => 'required',
|
'dateTiume' => 'required',
|
||||||
'class' => 'required',
|
'class' => 'required',
|
||||||
'size' => 'required',
|
'size' => 'required',
|
||||||
'stability' => 'required',
|
'stability' => 'required',
|
||||||
|
'type' => 'required',
|
||||||
|
'system' => 'required',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
//Declare some variables
|
||||||
|
$duration = null;
|
||||||
|
|
||||||
|
//Create the stable time for the database
|
||||||
|
if($request->duraiton == 'This wormhole has not yet begun its natural cycle of decay and should last at least another day.') {
|
||||||
|
$duration = '>24 hours';
|
||||||
|
} else if ($request->duration == 'This wormhole is beginning to decay, but will not last another day.') {
|
||||||
|
$duration = '>4 hours <24 hours';
|
||||||
|
} else if($request->duration == 'This wormhole is reaching the end of its natural lifetime') {
|
||||||
|
'<4 hours';
|
||||||
|
}
|
||||||
|
|
||||||
|
//Get the wormhole type from the database so we can enter other details
|
||||||
|
$wormholeType = WormholeType::where([
|
||||||
|
'type' => $request->type,
|
||||||
|
])->first();
|
||||||
|
|
||||||
|
$found = AllianceWormhole::where([
|
||||||
|
'system' => $request->system,
|
||||||
|
'sig_ig' => $request->sig,
|
||||||
|
])->count();
|
||||||
|
|
||||||
|
if($found == 0) {
|
||||||
|
AllianceWormhole::insert([
|
||||||
|
'system' => $request->system,
|
||||||
|
'sig_id' => $request->sig_id,
|
||||||
|
'duration_left' => $duration,
|
||||||
|
'dateTime' => $request->dateTime,
|
||||||
|
'class' => $request->class,
|
||||||
|
'type' => $request->type,
|
||||||
|
'hole_size' => $request->size,
|
||||||
|
'stability' => $request->stability,
|
||||||
|
'details' => $request->details,
|
||||||
|
'link' => $request->link,
|
||||||
|
'mass_allowed' => $wormholeType->mass_allowed,
|
||||||
|
'individual_mass' => $wormholeType->individual_mass,
|
||||||
|
'regeneration' => $wormholeType->regeneration,
|
||||||
|
'max_stable_time' => $wormholeType->max_stable_time,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return redirect('/wormholes/display')->with('success', 'Wormhole Info Added.');
|
||||||
|
} else {
|
||||||
|
return redirect('/wormholes/display')->with('error', 'Wormhole already in database.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function displayWormholes() {
|
public function displayWormholes() {
|
||||||
|
//Create the date and time
|
||||||
|
$dateTime = Carbon::now()->subDays(2);
|
||||||
|
|
||||||
|
//Get all of the wormholes from the last 48 hours from the database to display
|
||||||
|
$wormholes = AllianceWormholes::where('created_at', '>=', $dateTime)->get();
|
||||||
|
|
||||||
|
return view('wormholes.display')->with('wormholes', $wormholes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,10 +21,10 @@ class AllianceWormhole extends Model
|
|||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
|
'system',
|
||||||
'sig_id',
|
'sig_id',
|
||||||
'duration_left',
|
'duration_left',
|
||||||
'date_scanned',
|
'dateTime',
|
||||||
'time_scanned',
|
|
||||||
'class',
|
'class',
|
||||||
'type',
|
'type',
|
||||||
'hole_size',
|
'hole_size',
|
||||||
|
|||||||
@@ -16,10 +16,10 @@ class WormholesSpaceTable extends Migration
|
|||||||
if(!Schema::hasTable('alliance_wormholes')) {
|
if(!Schema::hasTable('alliance_wormholes')) {
|
||||||
Schema::create('alliance_wormholes', function (Blueprint $table) {
|
Schema::create('alliance_wormholes', function (Blueprint $table) {
|
||||||
$table->increments('id');
|
$table->increments('id');
|
||||||
|
$table->string('system');
|
||||||
$table->string('sig_id');
|
$table->string('sig_id');
|
||||||
$table->string('duration_left');
|
$table->string('duration_left');
|
||||||
$table->string('date_scanned');
|
$table->dateTime('dateTime');
|
||||||
$table->string('time_scanned');
|
|
||||||
$table->enum('class', [
|
$table->enum('class', [
|
||||||
'C1',
|
'C1',
|
||||||
'C2',
|
'C2',
|
||||||
@@ -48,8 +48,8 @@ class WormholesSpaceTable extends Migration
|
|||||||
'Non-Critical',
|
'Non-Critical',
|
||||||
'Critical',
|
'Critical',
|
||||||
]);
|
]);
|
||||||
$table->text('details');
|
$table->text('details')->nullable();
|
||||||
$table->string('link');
|
$table->string('link')->nullable();
|
||||||
$table->decimal('mass_allowed', 20, 2);
|
$table->decimal('mass_allowed', 20, 2);
|
||||||
$table->decimal('individual_mass', 20, 2);
|
$table->decimal('individual_mass', 20, 2);
|
||||||
$table->decimal('regeneration', 20, 2);
|
$table->decimal('regeneration', 20, 2);
|
||||||
|
|||||||
@@ -11,11 +11,6 @@
|
|||||||
{!! $lava->render('GaugeChart', 'SRP', 'under-review-div') !!}
|
{!! $lava->render('GaugeChart', 'SRP', 'under-review-div') !!}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="container">
|
|
||||||
<div id="fc-losses-div"></div>
|
|
||||||
{!! $lava->render('BarChart', 'FCs', 'fc-losses-div') !!}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div id="cost-codes-div"></div>
|
<div id="cost-codes-div"></div>
|
||||||
{!! $lava->render('ColumnChart', 'Cost Codes', 'cost-codes-div') !!}
|
{!! $lava->render('ColumnChart', 'Cost Codes', 'cost-codes-div') !!}
|
||||||
|
|||||||
26
resources/views/wormholes/display.blade.php
Normal file
26
resources/views/wormholes/display.blade.php
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
@extends('layouts.b4')
|
||||||
|
@section('content')
|
||||||
|
<div class="container">
|
||||||
|
<table class="table table-striped table-bordered">
|
||||||
|
<thead>
|
||||||
|
<th>System</th>
|
||||||
|
<th>Sig ID</th>
|
||||||
|
<th>Duration Left</th>
|
||||||
|
<th>Scan Time</th>
|
||||||
|
<th>WH Class</th>
|
||||||
|
<th>WH Type</th>
|
||||||
|
<th>Hole Size</th>
|
||||||
|
<th>Stability</th>
|
||||||
|
<th>Mass Allowed</th>
|
||||||
|
<th>Individual Mass</th>
|
||||||
|
<th>Regeneration</th>
|
||||||
|
<th>Max Stable Time</th>
|
||||||
|
<th>Details</th>
|
||||||
|
<th>Link</th>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
@@ -8,6 +8,10 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
{!! Form::open(['action' => 'Wormholes\WormholeController@storeWormhole', 'method' => 'POST']) !!}
|
{!! Form::open(['action' => 'Wormholes\WormholeController@storeWormhole', 'method' => 'POST']) !!}
|
||||||
|
<div class="form-group">
|
||||||
|
{{ Form::label('system', 'System') }}
|
||||||
|
{{ Form::text('system', '', ['class' => 'form-control']) }}
|
||||||
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
{{ Form::label('sig', 'Sig ID') }}
|
{{ Form::label('sig', 'Sig ID') }}
|
||||||
{{ Form::text('sig', '', ['class' => 'form-control', 'placeholder' => 'XXX-XXX']) }}
|
{{ Form::text('sig', '', ['class' => 'form-control', 'placeholder' => 'XXX-XXX']) }}
|
||||||
@@ -17,8 +21,8 @@
|
|||||||
{{ Form::select('duration', $duration, null, ['class' => 'form-control']) }}
|
{{ Form::select('duration', $duration, null, ['class' => 'form-control']) }}
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
{{ Form::label('date', 'Date Scanned') }}
|
{{ Form::label('dateTime', 'Date Scanned') }}
|
||||||
{{ Form::text('date', \Carbon\Carbon::now(), ['class' => 'form-control']) }}
|
{{ Form::date('dateTime', \Carbon\Carbon::now(), ['class' => 'form-control']) }}
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
{{ Form::label('class', 'WH Class') }}
|
{{ Form::label('class', 'WH Class') }}
|
||||||
|
|||||||
@@ -128,6 +128,13 @@ Route::group(['middleware' => ['auth']], function(){
|
|||||||
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/structures', 'Fuel\FuelController@displayStructures');
|
Route::get('/logistics/fuel/structures', 'Fuel\FuelController@displayStructures');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wormhole Controller display pages
|
||||||
|
*/
|
||||||
|
Route::get('/wormholes/form', 'Wormholes\WormholeController@displayWormholeForm');
|
||||||
|
Route::post('/wormholes/form', 'Wormholes\WormholeController@storeWormhole');
|
||||||
|
Route::get('/wormholes/display', 'Wormholes\WormholeController@displayWormholes');
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user