form
This commit is contained in:
@@ -8,6 +8,7 @@ use App\Http\Controllers\Controller;
|
|||||||
use Auth;
|
use Auth;
|
||||||
use DB;
|
use DB;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
|
use Khill\Lavacharts\Lavacharts;
|
||||||
|
|
||||||
//Models
|
//Models
|
||||||
use App\Models\Contracts\EveContract;
|
use App\Models\Contracts\EveContract;
|
||||||
@@ -18,55 +19,96 @@ use App\Library\Lookups\LookupHelper;
|
|||||||
|
|
||||||
class LogisticsController extends Controller
|
class LogisticsController extends Controller
|
||||||
{
|
{
|
||||||
|
public function __construct() {
|
||||||
|
$this->middleware('auth');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to display available contracts
|
* Function to display available contracts
|
||||||
*/
|
*/
|
||||||
public function displayLogisticsContracts() {
|
public function displayLogisticsContracts() {
|
||||||
|
$this->middelware('permissions:logistics.courier');
|
||||||
|
|
||||||
//Get the non-accepted contracts
|
//Get the non-accepted contracts
|
||||||
|
$openCount == EveContract::where(['status' => 'outstanding'])->count();
|
||||||
$open = EveContract::where([
|
$open = EveContract::where([
|
||||||
'status' => 'outstanding',
|
'status' => 'outstanding',
|
||||||
])->get();
|
])->get();
|
||||||
|
|
||||||
|
$inProgressCount = EveContract::where(['status' => 'in_progress'])->count();
|
||||||
$inProgress = EveContract::where([
|
$inProgress = EveContract::where([
|
||||||
'status' => 'in_progress',
|
'status' => 'in_progress',
|
||||||
])->get();
|
])->get();
|
||||||
|
|
||||||
|
$cancelledCount = EveContract::where(['status' => 'cancelled'])->count();
|
||||||
$cancelled = EveContract::where([
|
$cancelled = EveContract::where([
|
||||||
'status' => 'cancelled',
|
'status' => 'cancelled',
|
||||||
])->get();
|
])->get();
|
||||||
|
|
||||||
|
$failedCount = EveContract::where(['status' => 'failed'])->count();
|
||||||
$failed = EveContract::where([
|
$failed = EveContract::where([
|
||||||
'status' => 'failed',
|
'status' => 'failed',
|
||||||
])->get();
|
])->get();
|
||||||
|
|
||||||
|
$deletedCount = EveContract::where(['status' => 'deleted'])->count();
|
||||||
$deleted = EveContract::where([
|
$deleted = EveContract::where([
|
||||||
'status' => 'deleted',
|
'status' => 'deleted',
|
||||||
])->get();
|
])->get();
|
||||||
|
|
||||||
|
$finishedCount = EveContract::where(['status' => 'finished'])->count();
|
||||||
$finished = EveContract::where([
|
$finished = EveContract::where([
|
||||||
'status' => 'finished',
|
'status' => 'finished',
|
||||||
])->get();
|
])->get();
|
||||||
|
|
||||||
|
$totalCount = $openCount + $inProgressCount + $cancelledCoutn + $failedCount + $deletedCount + $finishedCount;
|
||||||
|
|
||||||
|
//Fuel Gauge Chart Declarations
|
||||||
|
$lava = new Lavacharts;
|
||||||
|
|
||||||
|
$openChart = $lava->DataTable();
|
||||||
|
$openChart->addStringColumn('Contracts')
|
||||||
|
->addNumberColumn('Number')
|
||||||
|
->addRow(['Open Contracts', $openCount]);
|
||||||
|
|
||||||
|
$lava->GaugeChart('Open Contracts', $openChart, [
|
||||||
|
'width' => 300,
|
||||||
|
'greenFrom' => 0,
|
||||||
|
'greenTo' => 10,
|
||||||
|
'yellowFrom' => 10,
|
||||||
|
'yellowTo', 30,
|
||||||
|
'redFrom' => 30,
|
||||||
|
'redTo' => 100,
|
||||||
|
'majorTicks' => [
|
||||||
|
'Normal',
|
||||||
|
'Delayed',
|
||||||
|
'Backed Up',
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
|
||||||
return view('logistics.display.contracts')->with('open', $open)
|
return view('logistics.display.contracts')->with('open', $open)
|
||||||
->with('inProgress', $inProgress)
|
->with('inProgress', $inProgress)
|
||||||
->with('cancelled', $cancelled)
|
->with('cancelled', $cancelled)
|
||||||
->with('failed', $failed)
|
->with('failed', $failed)
|
||||||
->with('deleted', $deleted)
|
->with('deleted', $deleted)
|
||||||
->with('finished', $finished);
|
->with('finished', $finished)
|
||||||
}
|
->with('openCount', $openCount)
|
||||||
|
->with('inProgressCount', $inProgressCount)
|
||||||
/**
|
->with('cancelledCount', $cancelledCount)
|
||||||
* Function to display current contracts user holds
|
->with('failedCount', $failedCount)
|
||||||
*/
|
->with('deletedCount', $deletedCount)
|
||||||
public function displayUserContracts() {
|
->with('finishedCount', $finishedCount)
|
||||||
|
->with('totalCount', $totalCount)
|
||||||
|
->with('lava', $lava);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to calculate details needing to be set for contracts
|
* Function to calculate details needing to be set for contracts
|
||||||
*/
|
*/
|
||||||
public function displayContractForm() {
|
public function displayContractForm() {
|
||||||
|
$distances = SolarSystemDistance::all();
|
||||||
|
|
||||||
|
return view('logistics.display.courierform');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -74,9 +116,8 @@ class LogisticsController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function displayContractDetails(Request $request) {
|
public function displayContractDetails(Request $request) {
|
||||||
$this->validate($request, [
|
$this->validate($request, [
|
||||||
'start_location',
|
'route',
|
||||||
'end_location',
|
'volume',
|
||||||
'type',
|
|
||||||
'collateral',
|
'collateral',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|||||||
@@ -75,6 +75,22 @@ class EveContractsHelper {
|
|||||||
public function StoreNewContract($contract) {
|
public function StoreNewContract($contract) {
|
||||||
//Declare esi helper for decoding the date
|
//Declare esi helper for decoding the date
|
||||||
$esiHelper = new Esi;
|
$esiHelper = new Esi;
|
||||||
|
$endLocationName = null;
|
||||||
|
$issuerCorporationName = null;
|
||||||
|
$issuerName = null;
|
||||||
|
$startLocationName = null;
|
||||||
|
|
||||||
|
//Setup the esi authentication container
|
||||||
|
$config = config('esi');
|
||||||
|
//Get the refresh token from the database
|
||||||
|
$token = EsiToken::where(['character_id', $this->charId])->get(['refresh_token']);
|
||||||
|
$authentication = new EsiAuthentication([
|
||||||
|
'client_id' => $config['client_id'],
|
||||||
|
'secret' => $config['secret'],
|
||||||
|
'refresh_token' => $token[0]->refresh_token,
|
||||||
|
]);
|
||||||
|
//Setup the ESI variable
|
||||||
|
$esi = new Eseye($authentication);
|
||||||
|
|
||||||
//See if we find the contract in the database
|
//See if we find the contract in the database
|
||||||
$found = LogisticsContract::where([
|
$found = LogisticsContract::where([
|
||||||
|
|||||||
27
app/Models/Logistics/LogisticContract.php
Normal file
27
app/Models/Logistics/LogisticContract.php
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models\Logistics;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class LogisticContract extends Model
|
||||||
|
{
|
||||||
|
//Table Name
|
||||||
|
public $table = 'logistics_contracts';
|
||||||
|
|
||||||
|
//Timestamps
|
||||||
|
public $timestamps = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that are mass assignable
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $fillable = [
|
||||||
|
'contract_id',
|
||||||
|
'accepted',
|
||||||
|
'accepted_by_id',
|
||||||
|
'accepted_by_name',
|
||||||
|
'status',
|
||||||
|
];
|
||||||
|
}
|
||||||
27
app/Models/Logistics/SolarSystemDistance.php
Normal file
27
app/Models/Logistics/SolarSystemDistance.php
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class SolarSystemDistance extends Model
|
||||||
|
{
|
||||||
|
//Table Name
|
||||||
|
public $table = 'solar_system_distances';
|
||||||
|
|
||||||
|
//Timestamps
|
||||||
|
public $timestamps = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that are fillable
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $fillable = [
|
||||||
|
'start_id',
|
||||||
|
'start_name',
|
||||||
|
'end_id',
|
||||||
|
'end_name',
|
||||||
|
'distance',
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -45,7 +45,10 @@ class CreateLogisticsTables extends Migration
|
|||||||
$table->increments('id');
|
$table->increments('id');
|
||||||
$table->string('contract_id');
|
$table->string('contract_id');
|
||||||
$table->string('accepted')->default('No');
|
$table->string('accepted')->default('No');
|
||||||
|
$table->string('accepted_by_id')->nullalbe();
|
||||||
|
$table->string('accepted_by_name')->nullalbe();
|
||||||
$table->string('status')->default('N/A');
|
$table->string('status')->default('N/A');
|
||||||
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,6 +70,14 @@ class CreateLogisticsTables extends Migration
|
|||||||
$table->decimal('distance', 20, 6);
|
$table->decimal('distance', 20, 6);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DB::table('solar_system_distances')->insert([
|
||||||
|
'start_id'
|
||||||
|
'start_name'
|
||||||
|
'end_id'
|
||||||
|
'end_name'
|
||||||
|
'distance'
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
110
resources/views/logistics/display/contracts.blade.php
Normal file
110
resources/views/logistics/display/contracts.blade.php
Normal file
@@ -0,0 +1,110 @@
|
|||||||
|
@extends('layouts.b4')
|
||||||
|
@section('content')
|
||||||
|
@if($totalCount == 0)
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<h2>Logistics Contracts</h2>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<h3>No open logistics contracts</h3>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@else
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<h2>Status</h2>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<div id="gauge-status-div"></div>
|
||||||
|
{!! $lava->render('GaugeChart', 'Open Contracts', 'gauge-status-div') !!}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<h2>Open Contracts</h2>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<table class="table table-striped">
|
||||||
|
<thead>
|
||||||
|
<th>Date Issued</th>
|
||||||
|
<th>Days To Complete</th>
|
||||||
|
<th>Collateral</th>
|
||||||
|
<th>Reward</th>
|
||||||
|
<th>Volume</th>
|
||||||
|
<th>Status</th>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach($open as $op)
|
||||||
|
<tr>
|
||||||
|
<td>{{ $op->date_issued }}</td>
|
||||||
|
<td>{{ $op->days_to_complete }}</td>
|
||||||
|
<td>{{ $op->collateral }}</td>
|
||||||
|
<td>{{ $op->reward }}</td>
|
||||||
|
<td>{{ $op->volume }}</td>
|
||||||
|
<td>{{ $op->status }}</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<h2>In Progress Contracts</h2>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<table class="table table-striped">
|
||||||
|
<thead>
|
||||||
|
<th>Date Issued</th>
|
||||||
|
<th>Days To Complete</th>
|
||||||
|
<th>Collateral</th>
|
||||||
|
<th>Reward</th>
|
||||||
|
<th>Volume</th>
|
||||||
|
<th>Status</th>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach($inProgress as $in)
|
||||||
|
<tr>
|
||||||
|
<td>{{ $in->date_issued }}</td>
|
||||||
|
<td>{{ $in->days_to_complete }}</td>
|
||||||
|
<td>{{ $in->collateral }}</td>
|
||||||
|
<td>{{ $in->reward }}</td>
|
||||||
|
<td>{{ $in->volume }}</td>
|
||||||
|
<td>{{ $in->status }}</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<h2>Finished Contracts</h2>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<table class="table table-striped">
|
||||||
|
<thead>
|
||||||
|
<th>Date Issued</th>
|
||||||
|
<th>Days To Complete</th>
|
||||||
|
<th>Collateral</th>
|
||||||
|
<th>Reward</th>
|
||||||
|
<th>Volume</th>
|
||||||
|
<th>Status</th>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach($finished as $fin)
|
||||||
|
<tr>
|
||||||
|
<td>{{ $fin->date_issued }}</td>
|
||||||
|
<td>{{ $fin->days_to_complete }}</td>
|
||||||
|
<td>{{ $fin->collateral }}</td>
|
||||||
|
<td>{{ $fin->reward }}</td>
|
||||||
|
<td>{{ $fin->volume }}</td>
|
||||||
|
<td>{{ $fin->status }}</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
@endsection
|
||||||
4
resources/views/logistics/display/courier.blade.php
Normal file
4
resources/views/logistics/display/courier.blade.php
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
@extends('layouts.b4')
|
||||||
|
@section('content')
|
||||||
|
|
||||||
|
@endsection
|
||||||
33
resources/views/logistics/display/courierform.blade.php
Normal file
33
resources/views/logistics/display/courierform.blade.php
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
@extends('layouts.b4')
|
||||||
|
@section('content')
|
||||||
|
<div class="container">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<h2>Courier Calculation Form</h2>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
{!! Form::open([
|
||||||
|
'action' => 'Logistics\LogisticsController@displayContractDetails',
|
||||||
|
'method' => 'POST',
|
||||||
|
]) !!}
|
||||||
|
<div class="form-group">
|
||||||
|
{{ Form::label('route', 'Route') }}
|
||||||
|
{{ Form::select('route', $routes, 'None', ['class' => 'form-control']) }}
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
{{ Form::label('volume', 'Volume') }}
|
||||||
|
{{ Form::text('volume', null, ['class' => 'form-control']) }}
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
{{ Form::label('collateral', 'Collateral') }}
|
||||||
|
{{ Form::text('collateral', null, ['class' => 'form-control']) }}
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
{{ Form::label('type', 'Type') }}
|
||||||
|
{{ Form::select('type', $type, 'None', ['class' => 'form-control']) }}
|
||||||
|
</div>
|
||||||
|
{{ Form::submit('Submit', ['class' => 'btn btn-primary']) }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
Reference in New Issue
Block a user