login dashboard and other lookup changes
This commit is contained in:
@@ -6,20 +6,49 @@ use Illuminate\Http\Request;
|
|||||||
|
|
||||||
//Library
|
//Library
|
||||||
use App\Library\Contracts\ContractHelper;
|
use App\Library\Contracts\ContractHelper;
|
||||||
|
use App\Library\Lookups\LookupHelper;
|
||||||
|
|
||||||
class DashboardController extends Controller
|
class DashboardController extends Controller
|
||||||
{
|
{
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
|
$this->middleware('auth');
|
||||||
$this->middleware('role:User');
|
$this->middleware('role:User');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function index() {
|
public function index() {
|
||||||
|
//Declare the contract helper
|
||||||
|
$contractHelper = new ContractHelper;
|
||||||
|
$lookupHelper = new LookupHelper;
|
||||||
|
|
||||||
|
//Declare array variable
|
||||||
|
$contracts = array();
|
||||||
|
|
||||||
//Get the current amount of contracts availabe to the corporation for displaying on the dashboard with the relevant
|
//Get the current amount of contracts availabe to the corporation for displaying on the dashboard with the relevant
|
||||||
//information such as pickup and destination, jumps, and profit margin.
|
//information such as pickup and destination, jumps, and profit margin.
|
||||||
|
$tempContracts = $contractHelper->GetContracts(98615428);
|
||||||
|
|
||||||
return redirect('/');
|
foreach($tempContracts as $con) {
|
||||||
|
$startSystem = $lookupHelper->GetSolarSystemName($con->start_location_id);
|
||||||
|
$endSystem = $lookupHelper->GetSolarSystemName($con->end_location_id);
|
||||||
|
|
||||||
|
$final = [
|
||||||
|
'pickup' => $startSystem,
|
||||||
|
'destination' => $endSystem,
|
||||||
|
'type' => $con->type,
|
||||||
|
'volume' => $con->volume,
|
||||||
|
'expired' => $con->date_expired,
|
||||||
|
'collateral' => $con->collateral,
|
||||||
|
'reward' => $con->reward,
|
||||||
|
'availability' => $con->availability,
|
||||||
|
];
|
||||||
|
|
||||||
|
array_push($contracts, $final);
|
||||||
|
}
|
||||||
|
|
||||||
|
$num = sizeof($contracts);
|
||||||
|
|
||||||
|
return view('dashboard.dashboard')->with('contracts', $contracts)
|
||||||
|
->with('num', $num);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function profile() {
|
public function profile() {
|
||||||
|
|||||||
@@ -38,12 +38,18 @@ class ContractHelper {
|
|||||||
$this->esi = $esiHelper->SetupEsiAuthentication($token);
|
$this->esi = $esiHelper->SetupEsiAuthentication($token);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function GetNumOfContracts() {
|
public function GetContracts($corpId) {
|
||||||
|
$contracts = null;
|
||||||
}
|
|
||||||
|
|
||||||
public function GetContractDetails($contract) {
|
try {
|
||||||
|
$contracts = $this->esi->invoke('get', '/corporations/{corporation_id}/contracts/', [
|
||||||
|
'corporation_id' => $corpId,
|
||||||
|
]);
|
||||||
|
} catch(RequestFailedException $e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $contracts;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ use App\Library\Esi\Esi;
|
|||||||
use App\Models\Lookups\CharacterLookup;
|
use App\Models\Lookups\CharacterLookup;
|
||||||
use App\Models\Lookups\CorporationLookup;
|
use App\Models\Lookups\CorporationLookup;
|
||||||
use App\Models\Lookups\AllianceLookup;
|
use App\Models\Lookups\AllianceLookup;
|
||||||
|
use App\Models\Lookups\SolarSystem;
|
||||||
|
|
||||||
class NewLookupHelper {
|
class NewLookupHelper {
|
||||||
//Variables
|
//Variables
|
||||||
@@ -692,6 +693,16 @@ class NewLookupHelper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function GetSolarSystemName($systemId) {
|
||||||
|
$count = SolarSystem::where(['solar_system_id' => $systemId])->count();
|
||||||
|
if($count != 0) {
|
||||||
|
$system = SolarSystem::where(['solar_system_id' => $systemId])->first();
|
||||||
|
return $system->name;
|
||||||
|
} else {
|
||||||
|
return 'N/A';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -52,7 +52,7 @@ return [
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'prefix' => env('HORIZON_PREFIX', 'horizon:'),
|
'prefix' => env('HORIZON_PREFIX', 'unitedhauling:'),
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -1,50 +1,32 @@
|
|||||||
<?php
|
@extends('layouts.b4')
|
||||||
|
@section('content')
|
||||||
namespace App\Http\Controllers\Dashboard;
|
<br>
|
||||||
|
<div class="container">
|
||||||
//Internal Libraries
|
<table class="table table-striped table-bordered">
|
||||||
use App\Http\Controllers\Controller;
|
<thead>
|
||||||
use Auth;
|
<th>Pickup System</th>
|
||||||
use DB;
|
<th>Destination System</th>
|
||||||
use Log;
|
<th>Type</th>
|
||||||
|
<th>Volume</th>
|
||||||
//Models
|
<th>Date Expired</th>
|
||||||
use App\Models\Esi\EsiScope;
|
<th>Collateral</th>
|
||||||
use App\Models\Esi\EsiToken;
|
<th>Reward</th>
|
||||||
use App\Models\User\UserPermission;
|
<th>Availability</th>
|
||||||
use App\Models\User\UserRole;
|
</thead>
|
||||||
|
<tbody>
|
||||||
class DashboardController extends Controller
|
@foreach($contracts as $contract)
|
||||||
{
|
<tr>
|
||||||
/**
|
<td>{{ $contract['pickup'] }}</td>
|
||||||
* Create a new controller instance.
|
<td>{{ $contract['destination'] }}</td>
|
||||||
*
|
<td>{{ $contract['type'] }}</td>
|
||||||
* @return void
|
<td>{{ $contract['volume'] }}</td>
|
||||||
*/
|
<td>{{ $contract['expired'] }}</td>
|
||||||
public function __construct()
|
<td>{{ $contract['collateral'] }}</td>
|
||||||
{
|
<td>{{ $contract['reward'] }}</td>
|
||||||
$this->middleware('auth');
|
<td>{{ $contract['availability'] }}</td>
|
||||||
$this->middleware('role:Guest');
|
</tr>
|
||||||
}
|
@endforeach
|
||||||
|
</tbody>
|
||||||
/**
|
</table>
|
||||||
* Create dashboard where user logs in
|
</div>
|
||||||
*
|
@endsection
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function index() {
|
|
||||||
return view('dashboard.dashboard');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create profile for user
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function profile() {
|
|
||||||
return view('dashboard.profile');
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
Reference in New Issue
Block a user