dashboard srp stuff

This commit is contained in:
2019-07-02 00:23:31 -05:00
parent 8d1c597131
commit 9c4b23905d
2 changed files with 151 additions and 3 deletions

View File

@@ -7,6 +7,7 @@ use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;
use Khill\Lavacharts\Lavacharts;
//Models
use App\Models\Esi\EsiScope;
@@ -61,7 +62,7 @@ class DashboardController extends Controller
$approved = SRPShip::where([
'character_id' => auth()->user()->character_id,
'approved' => 'Approved',
])->get();
])->take(10)->get();
}
//See if we can get all of the closed and denied SRP requests
@@ -73,10 +74,40 @@ class DashboardController extends Controller
$denied = SRPShip::where([
'character_id' => auth()->user()->character_id,
'approved' => 'Denied',
])->get();
])->take(10)->get();
}
return view('dashboard');
//Create a chart of number of approved, denied, and open requests via a fuel gauge chart
$lava = new Lavacharts;
$adur = $lava->DataTable();
$adur->addStringColumn('Type')
->addNumberColumn('Number')
->addRow(['Under Review', $openCount]);
$lava->GaugeChart('SRP', $adur, [
'width' => 300,
'greenFrom' => 0,
'greenTo' => 5,
'yellowFrom' => 6,
'yellowTo' => 10,
'redFrom' => 11,
'redTo' => 15,
'majorTicks' => [
'Safe',
'Warning',
'Critical',
],
]);
return view('dashboard')->with('openCount', $openCount)
->with('approvedCount', $approvedCount)
->with('deniedCount', $deniedCount)
->with('open', $open)
->with('approved', $approved)
->with('denied', $denied)
->with('lava', $lava);
}
/**

View File

@@ -19,4 +19,121 @@
</div>
</div>
</div>
<br>
<div class="container">
<div class="row justify-content-center">
<div class="col-md-12">
<div class="card">
<div class="card-header">
Open SRP Requests<br>
# Open: {{ $openCount }}<br>
<div id="under-review-div"></div>
{!! $lava->redner('GaugeChart', 'SRP', 'under-review-div') !!}
</div>
<div class="card-body">
@if($openCount > 0)
<table class="table table-striped">
<thead>
<th>Fleet Commander</th>
<th>Ship Type</th>
<th>Loss Value</th>
<th>Status</th>
</thead>
<tbody>
@foreach($open as $o)
<tr>
<td>{{ $o->fleet_commander_name }}</td>
<td>{{ $o->ship_type }}</td>
<td>{{ $o->loss_value }}</td>
<td>{{ $o->approved }}</td>
</tr>
@endforeach
</tbody>
</table>
@else
No Open SRP Requests
@endif
</div>
</div>
</div>
</div>
</div>
<br>
<div class="container">
<div class="row justify-content-center">
<div class="col-md-12">
<div class="card">
<div class="card-header">
Denied SRP Requests<br>
# Denied: {{ $deniedCount }}
</div>
<div class="card-body">
@if($deniedCount > 0)
<table class="table table-striped">
<thead>
<th>Fleet Commander</th>
<th>Ship Type</th>
<th>Loss Value</th>
<th>Status</th>
<th>Notes</th>
</thead>
<tbody>
@foreach($denied as $d)
<tr>
<td>{{ $d->fleet_commander_name }}</td>
<td>{{ $d->ship_type }}</td>
<td>{{ $d->loss_value }}</td>
<td>{{ $d->approved }}</td>
<td>{{ $d->notes }}</td>
</tr>
@endforeach
</tbody>
</table>
@else
No Denied SRP Requests
@endif
</div>
</div>
</div>
</div>
</div>
<br>
<div class="container">
<div class="row justify-content-center">
<div class="col-md-12">
<div class="card">
<div class="card-header">
Approved SRP Requests<br>
# Approved: {{ $approvedCount }}
</div>
<div class="card-body">
@if($approvedCount > 0)
<table class="table table-striped">
<thead>
<th>Fleet Commander</th>
<th>Ship Type</th>
<th>Loss Value</th>
<th>Status</th>
</thead>
<tbody>
@foreach($approved as $a)
<tr>
<td>{{ $a->fleet_commander_name }}</td>
<td>{{ $a->ship_type }}</td>
<td>{{ $a->loss_value }}</td>
<td>{{ $a->approved }}</td>
</tr>
@endforeach
</tbody>
</table>
@else
No Approved SRP Requests
@endif
</div>
</div>
</div>
</div>
</div>
@endsection