diff --git a/app/Http/Controllers/Dashboard/DashboardController.php b/app/Http/Controllers/Dashboard/DashboardController.php
index 0b9a34c..5ceb112 100644
--- a/app/Http/Controllers/Dashboard/DashboardController.php
+++ b/app/Http/Controllers/Dashboard/DashboardController.php
@@ -6,20 +6,49 @@ use Illuminate\Http\Request;
//Library
use App\Library\Contracts\ContractHelper;
+use App\Library\Lookups\LookupHelper;
class DashboardController extends Controller
{
public function __construct() {
+ $this->middleware('auth');
$this->middleware('role:User');
}
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
//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() {
diff --git a/app/Library/Contracts/ContractHelper.php b/app/Library/Contracts/ContractHelper.php
index 0c0d8ec..72c0537 100644
--- a/app/Library/Contracts/ContractHelper.php
+++ b/app/Library/Contracts/ContractHelper.php
@@ -38,12 +38,18 @@ class ContractHelper {
$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;
}
}
diff --git a/app/Library/Lookups/LookupHelper.php b/app/Library/Lookups/LookupHelper.php
index 3800e40..3d79479 100644
--- a/app/Library/Lookups/LookupHelper.php
+++ b/app/Library/Lookups/LookupHelper.php
@@ -18,6 +18,7 @@ use App\Library\Esi\Esi;
use App\Models\Lookups\CharacterLookup;
use App\Models\Lookups\CorporationLookup;
use App\Models\Lookups\AllianceLookup;
+use App\Models\Lookups\SolarSystem;
class NewLookupHelper {
//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';
+ }
+ }
}
?>
\ No newline at end of file
diff --git a/config/horizon.php b/config/horizon.php
index 8a40c6a..6f11963 100644
--- a/config/horizon.php
+++ b/config/horizon.php
@@ -52,7 +52,7 @@ return [
|
*/
- 'prefix' => env('HORIZON_PREFIX', 'horizon:'),
+ 'prefix' => env('HORIZON_PREFIX', 'unitedhauling:'),
/*
|--------------------------------------------------------------------------
diff --git a/resources/views/dashboard/dashboard.blade.php b/resources/views/dashboard/dashboard.blade.php
index 2992b2b..4277850 100644
--- a/resources/views/dashboard/dashboard.blade.php
+++ b/resources/views/dashboard/dashboard.blade.php
@@ -1,50 +1,32 @@
-middleware('auth');
- $this->middleware('role:Guest');
- }
-
- /**
- * Create dashboard where user logs in
- *
- * @return void
- */
- public function index() {
- return view('dashboard.dashboard');
- }
-
- /**
- * Create profile for user
- *
- * @return void
- */
- public function profile() {
- return view('dashboard.profile');
- }
-
-}
-
-?>
+@extends('layouts.b4')
+@section('content')
+
+
| Pickup System | +Destination System | +Type | +Volume | +Date Expired | +Collateral | +Reward | +Availability | + + + @foreach($contracts as $contract) +
|---|---|---|---|---|---|---|---|
| {{ $contract['pickup'] }} | +{{ $contract['destination'] }} | +{{ $contract['type'] }} | +{{ $contract['volume'] }} | +{{ $contract['expired'] }} | +{{ $contract['collateral'] }} | +{{ $contract['reward'] }} | +{{ $contract['availability'] }} | +