mining taxes
This commit is contained in:
@@ -5,14 +5,26 @@ namespace App\Http\Controllers\MiningTaxes;
|
||||
//Internal Library
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use Log;
|
||||
use Carbon\Carbon;
|
||||
use Khill\Lavacharts\Lavacharts;
|
||||
use Auth;
|
||||
|
||||
//Application Library
|
||||
use App\Library\Helpers\LookupHelper;
|
||||
use App\Library\Helpers\StructureHelper;
|
||||
use Seat\Eseye\Exceptions\RequestFailedException;
|
||||
use App\Library\Esi\Esi;
|
||||
|
||||
//Models
|
||||
use App\Models\MiningTax\Invoice;
|
||||
use App\Models\MiningTax\Observer;
|
||||
use App\Models\MiningTax\Ledger;
|
||||
|
||||
use App\Models\MiningTax\Payment;
|
||||
use App\Models\Moon\ItemComposition;
|
||||
use App\Models\Moon\MineralPrice;
|
||||
use App\Models\Esi\EsiToken;
|
||||
use App\Models\Esi\EsiScope;
|
||||
|
||||
class MiningTaxesAdminController extends Controller
|
||||
{
|
||||
@@ -82,13 +94,5 @@ class MiningTaxesAdminController extends Controller
|
||||
])->get()->paginate(50);
|
||||
|
||||
return view('miningtax.admin.display.paidinvoices')->with('invoices', $invoices);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display admin mining ledgers by month
|
||||
*/
|
||||
public function DisplayMonthlyMiningLedgers() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,10 +93,16 @@ class MiningTaxesController extends Controller
|
||||
//Declare variables
|
||||
$structures = array();
|
||||
$sHelper = new StructureHelper;
|
||||
$esiHelper = new Esi;
|
||||
$config = config('esi');
|
||||
|
||||
if(!$esiHelper->HaveEsiScope($config['primary'], 'esi-industry.read_corporation_mining.v1')) {
|
||||
return redirect('/dashboard')->with('error', 'Tell the nub Minerva to register the correct scopes for the services site.');
|
||||
}
|
||||
|
||||
//Get the esi data for extractions
|
||||
try {
|
||||
$extractions = $this->esi->invoke('get', '/corporation/{corporation_id}/mining/extractions/', [
|
||||
$extractions = $esi->invoke('get', '/corporation/{corporation_id}/mining/extractions/', [
|
||||
'corporation_id' => $config['corporation'],
|
||||
]);
|
||||
} catch(RequestFailedException $e) {
|
||||
@@ -119,6 +125,78 @@ class MiningTaxesController extends Controller
|
||||
return view('miningtax.user.display.upcoming')->with('extractions', $extractions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a calendar of upcoming extractions
|
||||
*/
|
||||
public function DisplayExtractionCalendar() {
|
||||
//Declare variables
|
||||
$structures = array();
|
||||
$sHelper = new StructureHelper;
|
||||
$lava = new Lavacharts;
|
||||
$esiHelper = new Esi;
|
||||
$config = config('esi');
|
||||
|
||||
//Check for the correct scopes
|
||||
if(!$esiHelper->HaveEsiScope($config['primary'], 'esi-industry.read_corporation_mining.v1')) {
|
||||
return redirect('/dashboard')->with('error', 'Tell the nub Minerva to register the correct scopes for the services site.');
|
||||
}
|
||||
|
||||
//Get the esi data for extractions
|
||||
try {
|
||||
$response = $esi->invoke('get', '/corporation/{corporation_id}/mining/extractions', [
|
||||
'corporation_id' => $config['corporation'],
|
||||
]);
|
||||
} catch(RequestFailedException $e) {
|
||||
Log::critical('Could not retrieve the extractions from ESI in DisplayExtractionCalendar in MiningTaxesController');
|
||||
return redirect('/dashboard')->with('error', 'Failed to get extraction data from ESI');
|
||||
}
|
||||
|
||||
//Decode the extraction data from ESI
|
||||
$extractions = json_decode($response, false);
|
||||
|
||||
/**
|
||||
* Create a 3 month calendar for the past, current, and future extractions
|
||||
*/
|
||||
//Create the data tables
|
||||
$calendar = $lava->DataTable();
|
||||
|
||||
$calendar->addDateTimeColumn('Date')
|
||||
->addBooleanColumn('YesNo')
|
||||
->addStringColumn('Extractions');
|
||||
|
||||
foreach($extractions as $extract) {
|
||||
$calendar->addRow([
|
||||
$extract->chunk_arrival_time,
|
||||
1
|
||||
]);
|
||||
}
|
||||
|
||||
$lava->CalendarChart('Extractions', $calendar, [
|
||||
'title' => 'Upcoming Extractions',
|
||||
'unusedMonthOutlineColor' => [
|
||||
'stroke' => '#ECECEC',
|
||||
'strokeOpacity' => 0.75,
|
||||
'strokeWidth' => 1,
|
||||
],
|
||||
'dayOfWeekLabel' => [
|
||||
'color' => '#4f5b0d',
|
||||
'fontSize' => 16,
|
||||
'italic' => true,
|
||||
],
|
||||
'noDataPattern' => [
|
||||
'color' => '#DDD',
|
||||
'backgroundColor' => '#11FFFF',
|
||||
],
|
||||
'colorAxis' => [
|
||||
'values' => [0, 100],
|
||||
'colors' => ['black', 'green'],
|
||||
],
|
||||
]);
|
||||
|
||||
return view('miningtax.user.display.calendar')->with('calendar', $calendar)
|
||||
->with('lava', $lava);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the ledger for the moons.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user