Compare commits

..

1 Commits

1978 changed files with 66315 additions and 65904 deletions

View File

@@ -2,31 +2,30 @@
namespace App\Console\Commands\Eve;
//Internal Library
use Illuminate\Console\Command;
use Log;
//Library
use Commands\Library\CommandHelper;
use App\Library\Moons\MoonCalc;
//Job
use App\Jobs\Commands\Eve\ItemPricesUpdateJob;
use App\Jobs\Commands\Eve\GetEveRegionsJob;
class ItemPricesUpdateCommand extends Command
class GetEveRegionsCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'services:ItemPriceUpdate';
protected $signature = 'eve:getRegions';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Update mineral and ore prices';
protected $description = 'Gets all of the information for regions from the eve esi';
/**
* Create a new command instance.
@@ -45,14 +44,6 @@ class ItemPricesUpdateCommand extends Command
*/
public function handle()
{
$task = new CommandHelper('ItemPriceUpdate');
$task->SetStartStatus();
$moonHelper = new MoonCalc;
$moonHelper->FetchNewPrices();
//ItemPricesUpdateJob::dispatch()->onQueue('default');
$task->SetStopStatus();
GetEveRegionsJob::dispatch();
}
}

View File

@@ -1,98 +0,0 @@
<?php
namespace App\Console\Commands\Files;
//Internal Stuff
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\File;
class UpdateItemCompositionFromSDECommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'sde:update:ItemCompositions';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Updates item compositions from sql file.';
/**
* The SDE storage path
*
* @var
*/
protected $storage_path;
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Query the sql file for the related database information
*
* @return mixed
*/
public function handle()
{
//Start by warning the user about the command which will be run
$this->comment('Warning! This Laravel command uses exec() to execute a ');
$this->comment('mysql shell command to import an extracted dump. Due');
$this->comment('to the way the command is constructed, should someone ');
$this->comment('view the current running processes of your server, they ');
$this->comment('will be able to see your SeAT database users password.');
$this->line('');
$this->line('Ensure that you understand this before continuing.');
//Test we have valid database parameters
DB::connection()->getDatabaseName();
//Warn the user about the operation to begin
if (! $this->confirm('Are you sure you want to update to the latest EVE SDE?', true)) {
$this->warn('Exiting');
return;
}
$fileName = $this->getSde();
$this->importSde($fileName);
}
/**
* Download the EVE Sde from Fuzzwork and save it
* in the storage_path/sde folder
*/
public function getSde() {
return $fileName;
}
/**
* Extract the SDE file downloaded and run the MySQL command to import the table into the database
*/
public function importSde($fileName) {
$import_command = 'mysql -u username -p password database < ' . $file;
//run the command
exec($import_command, $output, $exit_code);
if($exit_code !== 0) {
$this->error('Warning: Import failed with exit code ' .
$exit_code . ' and command outut: ' . implode('\n', $output));
}
}
}

View File

@@ -0,0 +1,70 @@
<?php
namespace App\Console\Commands;
//Internal Library
use Illuminate\Console\Command;
use Log;
//Library
use Commands\Library\CommandHelper;
//Jobs
use App\Jobs\Commands\Market\GetMarketRegionOrderJob;
class GetMarketDataCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'services:MarketData';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Get the market data for regions';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$task = new CommandHelper('GetMarketData');
$task->SetStartStatus();
$regions = [
'Immensea' => 10000025,
'Catch' => 10000014,
'Tenerifis' => 10000061,
'The Forge' => 10000002,
'Impass' => 10000031,
'Esoteria' => 10000039,
'Detorid' => 10000005,
'Omist' => 10000062,
'Feythabolis' => 10000056,
'Insmother' => 10000009,
];
foreach($regions as $key => $value) {
GetMarketRegionOrderJob::dispatch($value);
}
$task->SetStopStatus();
}
}

View File

@@ -0,0 +1,50 @@
<?php
namespace App\Console\Commands;
//Internal Library
use Illuminate\Console\Command;
use Log;
//Library
use Commands\Library\CommandHelper;
//Jobs
use App\Jobs\Commands\Market\PurgeMarketRegionOrderJob;
class PurgeMarketDataCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'services:PurgeMarketData';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Purges old market data from the database';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
PurgeMarketDataJob::dispatch();
}
}

View File

@@ -0,0 +1,70 @@
<?php
namespace App\Console\Commands;
//Internal Library
use Illuminate\Console\Command;
use Log;
//Library
use Commands\Library\CommandHelper;
//Jobs
use App\Jobs\Commands\PublicContracts\GetPublicContractsJob;
class PublicContractsCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'services:PublicContracts';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Get the public contracts in a region';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$task = new CommandHelper('PublicContracts');
$task->SetStartStatus();
$regions = [
'Immensea' => 10000025,
'Catch' => 10000014,
'Tenerifis' => 10000061,
'The Forge' => 10000002,
'Impass' => 10000031,
'Esoteria' => 10000039,
'Detorid' => 10000005,
'Omist' => 10000062,
'Feythabolis' => 10000056,
'Insmother' => 10000009,
];
foreach($regions as $key => $value) {
GetPublicContractsJob::dispatch($value);
}
$task->SetStopStatus();
}
}

View File

@@ -1,61 +0,0 @@
<?php
namespace App\Console\Commands\SupplyChain;
//Internal Library
use Illuminate\Console\Command;
use Log;
use Carbon\Carbon;
//Models
use App\Models\Contracts\SupplyChainContract;
//Job
use App\Jobs\Commands\SupplyChain\EndSupplyChainContractJob;
class EndSupplyChainContractCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'services:supplychain';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Checks and ends any supply chain contracts needs to be closed.';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$today = Carbon::now();
//Get the supply chain contracts which are open, but need to be closed.
$contracts = SupplyChainContract::where([
'state' => 'open',
])->where('end_date', '>', $today)->get();
//Create jobs to complete each contract
foreach($contracts as $contract) {
EndSupplyChainContractJob::dispatch($contract)->onQueue('default');
}
}
}

View File

@@ -1,133 +0,0 @@
<?php
namespace App\Console\Commands\SystemRental;
//Internal Library
use Illuminate\Console\Command;
use Carbon\Carbon;
//Jobs
use App\Jobs\ProcessSendEveMailJob;
//Library
use Command\Library\CommandHelper;
//Models
use App\Models\Rentals\RentalSystem;
use App\Models\Mail\SentMail;
class SystemRentalCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'services:SystemRentals';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Mail out bill for system rentals.';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
//Create the new command helper container
$task = new CommandHelper('SystemRentalMailer');
//Add the entry into the jobs table saying the job has started
$task->SetStartStatus();
//Create other variables
$body = null;
$delay = 30;
//Get today's date
$today = Carbon::now();
$today->second = 2;
$today->minute = 0;
$today->hour = 0;
//Get the esi configuration
$config = config('esi');
//Get all of the contacts for the system rentals
$contacts = RentalSystem::select('contact_id')->orderBy('contact_id')->get();
//For each of the contacts send a reminder mail about the total of the systems they are paying for
foreach($contacts as $contact) {
//Get all of the systems
$systems = RentalSystem::where([
'contact_id' => $contact->contact_id,
])->get();
//Totalize the total cost of all of the systems
$totalCost = $this->TotalizeCost($systems);
//Build the body of the mail
$body = "System Rental Cost is due for the following systems:<br>";
foreach($systems as $system) {
$body .= $system->system_name . "<br>";
}
//Create the rest of the email body
$body .= "Total Cost: " . number_format($totalCost, 2, ".", ",");
$body .= "Please remite payment to White Wolves Holding.<br>";
$body .= "Sincerely,<br>";
$body .= "Warped Intentions Leadership<br>";
//Fill in the subject
$subject = "Warped Intentions System Rental Bill Due";
//Dispatch the mail job
ProcessSendEveMailJob::dispatch($body, (int)$contact->contact_id, 'character', $subject, $config['primary'])->onQueue('mail')->delay(Carbon::now()->addSeconds($delay));
//Increase the delay for the next mail job
$delay += 60;
//After the mail is dispatched, save the sent mail record
$this->SaveSentRecord($config['primary'], $subject, $body, (int)$contact->contact_id, 'character');
}
//Mark the job as finished
$task->SetStopStatus();
}
private function TotalizeCost($systems) {
//Declare the starting total cost
$totalCost = 0.00;
foreach($systems as $system) {
$totalCost += $system->rental_cost;
}
return $totalCost;
}
private function SaveSentRecord($sender, $subject, $body, $recipient, $recipientType) {
$sentmail = new SentMail;
$sentmail->sender = $sender;
$sentmail->subject = $subject;
$sentmail->body = $body;
$sentmail->recipient = $recipient;
$sentmail->recipient_type = $recipientType;
$sentmail->save();
}
}

View File

@@ -0,0 +1,50 @@
<?php
namespace App\Console\Commands\Wormholes;
//Internal Library
use Illuminate\Console\Command;
use Carbon\Carbon;
//Models
use App\Models\Wormholes\AllianceWormhole;
class PurgeWormholes extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'services:PurgeWormholeData';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Purge stale wormhole data automatically';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
//Time of now
$currentTime = Carbon::now();
AllianceWormhole::where('created_at', '<', $currentTime->subHours(48))->delete();
}
}

View File

@@ -24,11 +24,11 @@ class Kernel extends ConsoleKernel
Commands\Users\PurgeUsers::class,
Commands\Flex\FlexStructureCommand::class,
Commands\Data\EmptyJumpBridges::class,
Commands\Wormholes\PurgeWormholes::class,
Commands\Finances\SovBillsCommand::class,
Commands\Data\CleanStaleDataCommand::class,
Commands\Moons\MoonsUpdateCommand::class,
Commands\Data\PurgeCorpMoonLedgers::class,
Commands\Eve\ItemPricesUpdateCommand::class,
/**
* Rental Moon Commands
*/
@@ -62,6 +62,9 @@ class Kernel extends ConsoleKernel
$schedule->command('services:HoldingJournal')
->hourlyAt('45')
->withoutOverlapping();
//$schedule->command('services:GetFinances')
// ->hourlyAt('35')
// ->withoutOverlapping();
/**
* Get Information Schedule
@@ -76,19 +79,14 @@ class Kernel extends ConsoleKernel
/**
* Purge Data Schedule
*/
$schedule->command('services:PurgeWormholeData')
->hourlyAt(20);
$schedule->command('services:CleanData')
->weekly(7, '11:00');
$schedule->command('data:PurgeCorpLedgers')
->monthly();
$schedule->command('services:PurgeUsers')
->dailyAt('23:00');
/**
* Item Update Schedule
*/
$schedule->command('services:ItemPriceUpdate')
->hourlyAt('30')
->withoutOverlapping();
}
/**

View File

@@ -0,0 +1,11 @@
<?php
namespace App\Http\Controllers\Api;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
class ApiController extends Controller
{
//
}

View File

@@ -38,7 +38,7 @@ class BlacklistController extends Controller
public function AddToBlacklist(Request $request) {
//Middleware needed for the function
$this->middleware('permission:blacklist.admin');
$this->middleware('permission:alliance.recruiter');
//Validate the user input
$this->validate($request, [
@@ -84,16 +84,15 @@ class BlacklistController extends Controller
}
//Store the entity in the table
$blacklist = new BlacklistEntity;
$blacklist->entity_id = $entityId;
$blacklist->entity_name = $request->name;
$blacklist->entity_type = $request->type;
$blacklist->reason = $request->reason;
$blacklist->alts = $request->alts;
$blacklist->lister_id = auth()->user()->getId();
$blacklist->lister_name = auth()->user()->getName();
$blacklist->validity = 'Valid';
$blacklist->save();
BlacklistEntity::insert([
'entity_id' => $entityId,
'entity_name' => $request->name,
'entity_type' => $request->type,
'reason' => $request->reason,
'alts' => $request->alts,
'lister_id' => auth()->user()->getId(),
'lister_name' => auth()->user()->getName(),
]);
//Return to the view
return redirect('/blacklist/display/add')->with('success', $request->name . ' added to the blacklist.');
@@ -109,22 +108,17 @@ class BlacklistController extends Controller
public function RemoveFromBlacklist(Request $request) {
//Middleware needed
$this->middleware('permission:blacklist.admin');
$this->middleware('permission:alliance.recruiter');
//Validate the input request
$this->validate($request, [
'name' => 'required',
]);
//Set the character on the blacklist to removed
//Delete the blacklist character
BlacklistEntity::where([
'entity_name' => $request->name,
])->update([
'validity' => 'Invalid',
'removed_by_id' => auth()->user()->getId(),
'removed_by_name' => auth()->user()->getName(),
'removed_notes' => $request->notes,
]);
])->delete();
//Return the view
return redirect('/blacklist/display')->with('success', 'Character removed from the blacklist.');
@@ -133,9 +127,7 @@ class BlacklistController extends Controller
public function DisplayBlacklist() {
//Get the entire blacklist
$blacklist = BlacklistEntity::where([
'validity' => 'Valid',
])->orderBy('entity_name', 'asc')->paginate(50);
$blacklist = BlacklistEntity::orderBy('entity_name', 'asc')->paginate(50);
//Return the view with the data
return view('blacklist.list')->with('blacklist', $blacklist);
@@ -149,9 +141,9 @@ class BlacklistController extends Controller
]);
$blacklist = DB::table('alliance_blacklist')->where('entity_name', 'like', $request->parameter . "%")
->orWhere('entity_type', 'like', "%" . $request->parameter . "%")
->orWhere('alts', 'like', "%" . $request->parameter . "%")
->orWhere('reason', 'like', "%" . $request->parameter . "%")
->orWhere('entity_type', 'like', $request->parameter . "%")
->orWhere('alts', 'like', $request->parameter . "%")
->orWhere('reason', 'like', $request->parameter . "%")
->orderBy('entity_name', 'asc')
->paginate(50);

View File

@@ -0,0 +1,186 @@
<?php
namespace App\Http\Controllers\Contracts;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Carbon\Carbon;
//Libraries
use App\Library\Esi\Mail;
//Jobs
use App\Jobs\ProcessSendEveMailJob;
//Models
use App\Models\User\User;
use App\Models\User\UserPermission;
use App\Models\Contracts\Contract;
use App\Models\Contracts\Bid;
use App\Models\Contracts\AcceptedBid;
class ContractAdminController extends Controller
{
public function __construct() {
$this->middleware('auth');
$this->middleware('role:User');
$this->middleware('permission:contract.admin');
}
/**
* Contract display functions
*/
public function displayContractDashboard() {
$contracts = Contract::where(['finished' => false])->get();
return view('contracts.admin.contractpanel')->with('contracts', $contracts);
}
public function displayPastContracts() {
$contracts = Contract::where(['finished' => true])->get();
return view('contracs.admin.past')->with('contracts', $contracts);
}
/**
* New contract functionality
*/
public function displayNewContract() {
return view('contracts.admin.newcontract');
}
public function storeNewContract(Request $request) {
$this->validate($request, [
'name' => 'required',
'date' => 'required',
'body' => 'required',
'type' => 'required',
]);
$date = new Carbon($request->date);
$body = nl2br($request->body);
//Store the contract in the database
$contract = new Contract;
$contract->title = $request->name;
$contract->end_date = $request->date;
$contract->body = $body;
$contract->type = $request->type;
$contract->save();
//Send a mail out to all of the people who can bid on a contract
$this->NewContractMail();
return redirect('/contracts/admin/display')->with('success', 'Contract written.');
}
/**
* Used to store a finished contract in the database
*/
public function storeAcceptContract(Request $request) {
$this->validate($request, [
'contract_id' => 'required',
'bid_id' => 'required',
'character_id' => 'required',
'bid_amount' => 'required',
]);
//Update the contract
Contract::where([
'contract_id' => $request->contract_id,
])->update([
'finished' => true,
'final_cost' => $request->bid_amount,
]);
//Save the accepted bid in the database
$accepted = new AcceptedBid;
$accepted->contract_id = $request->contract_id;
$accepted->bid_id = $request->bid_id;
$accepted->bid_amount = $request->bid_amount;
$accepted->save();
return redirect('/contracts/admin/display')->with('success', 'Contract accepted and closed.');
}
/**
* Delete a contract from every user
*/
public function deleteContract($id) {
Contract::where(['contract_id' => $id])->delete();
Bid::where(['contract_id' => $id])->delete();
return redirect('/contracts/admin/display')->with('success', 'Contract has been deleted.');
}
/**
* End Contract Functionality
*/
public function displayEndContract($id) {
//Gather the information for the contract, and all bids on the contract
$contract = Contract::where(['contract_id' => $id])->first()->toArray();
$bids = Bid::where(['contract_id' => $id])->get()->toArray();
return view('contracts.admin.displayend')->with('contract', $contract)
->with('bids', $bids);
}
public function storeEndContract(Request $request) {
$this->validate($request, [
'contract_id' => 'required',
'accept' => 'required',
]);
//Declare class variables
$tries = 1;
//Get the esi config
$config = config('esi');
$contract = Contract::where(['contract_id' => $request->contract_id])->first()->toArray();
$bid = Bid::where(['id' => $request->accept, 'contract_id' => $request->contract_id])->first()->toArray();
//Send mail out to winner of the contract
$subject = 'Contract Won';
$body = 'You have been accepted to perform the following contract:<br>';
$body .= $contract['contract_id'] . ' : ' . $contract['title'] . '<br>';
$body .= 'Notes:<br>';
$body .= $contract['body'] . '<br>';
$body .= 'Please remit contract when the items are ready to Spatial Forces. Description should be the contract identification number. Request ISK should be the bid amount.';
$body .= 'Sincerely,<br>Spatial Forces Contracting Department';
//Dispatch the mail job
ProcessSendEveMailJob::dispatch($body, $bid['character_id'], 'character', $subject, $config['primary'])->onQueue('mail')->delay(Carbon::now()->addSeconds(5));
//Tidy up the contract by doing a few things.
$this->TidyContract($contract, $bid);
//Redirect back to the contract admin dashboard.
return redirect('/contracts/admin/display')->with('success', 'Contract finalized. Mail has been sent to the queue for processing.');
}
private function TidyContract($contract, $bid) {
Contract::where(['contract_id' => $contract['contract_id']])->update([
'finished' => true,
]);
//Create the accepted contract entry into the table
$accepted = new AcceptedBid;
$accepted->contract_id = $contract['contract_id'];
$accepted->bid_id = $bid['id'];
$accepted->bid_amount = $bid['bid_amount'];
$accepted->notes = $bid['notes'];
$accepted->save();
}
private function NewContractMail() {
//Get the esi config
$config = config('esi');
$subject = 'New Alliance Production Contract Available';
$body = "A new contract is available for the alliance contracting system. Please check out <a href='https://services.w4rp.space'>Services Site</a> if you want to bid on the production contract.<br><br>Sincerely,<br>Warped Intentions Leadership";
ProcessSendEveMailJob::dispatch($body, $config['alliance'], 'alliance', $subject, $config['primary'])->onQueue('mail')->delay(Carbon::now()->addSeconds(5));
}
}

View File

@@ -0,0 +1,322 @@
<?php
namespace App\Http\Controllers\Contracts;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Carbon\Carbon;
//Libraries
use App\Library\Lookups\LookupHelper;
//Models
use App\Models\User\User;
use App\Models\User\UserPermission;
use App\Models\Contracts\Contract;
use App\Models\Contracts\Bid;
class ContractController extends Controller
{
public function __construct() {
$this->middleware('auth');
$this->middleware('role:User');
}
/**
* Controller function to display the bids placed on contracts
*/
public function displayBids($id) {
$bids = Bids::where(['contract_id' => $id, 'character_name' => auth()->user()->getName()])->get();
return view('contracts.bids')->with('bids', $bids);
}
/**
*
* Controller function to display all current open contracts
*
*/
public function displayContracts() {
//Calculate today's date to know which contracts to display
$today = Carbon::now();
//Declare our array variables
$bids = array();
$contracts = array();
$i = 0;
//Fetch all of the current contracts from the database
$contractsTemp = Contract::where('end_date', '>=', $today)
->where(['finished' => false])->get()->toArray();
//Count the number of bids, and add them to the arrays
for($i = 0; $i < sizeof($contractsTemp); $i++) {
$tempCount = Bid::where(['contract_id' => $contractsTemp[$i]['contract_id']])->count('contract_id');
$bids = Bid::where(['contract_id' => $contractsTemp[$i]['contract_id']])->get()->toArray();
//Assemble the finaly array
$contracts[$i] = $contractsTemp[$i];
$contracts[$i]['bid_count'] = $tempCount;
$contracts[$i]['bids'] = $bids;
}
//Call for the view to be displayed
return view('contracts.allcontracts')->with('contracts', $contracts);
}
/**
* Controller function to display all current public contracts
*/
public function displayPublicContracts() {
//Calculate today's date to know which contracts to display
$today = Carbon::now();
//Declare our array variables
$bids = array();
$contracts = array();
$i = 0;
$lowestBid = null;
$lowestCorp = null;
$lowestChar = null;
//Fetch all of the current contracts from the database
$contractsTemp = Contract::where('end_date', '>=', $today)
->where(['type' => 'Public', 'finished' => false])->get()->toArray();
//Count the number of bids, and add them to the arrays
for($i = 0; $i < sizeof($contractsTemp); $i++) {
$tempCount = Bid::where(['contract_id' => $contractsTemp[$i]['contract_id']])->count('contract_id');
$bids = Bid::where(['contract_id' => $contractsTemp[$i]['contract_id']])->get()->toArray();
foreach($bids as $bid) {
if($lowestBid == null) {
$lowestBid = $bid['bid_amount'];
$lowestCorp = $bid['corporation_name'];
$lowestChar = $bid['character_name'];
} else {
if($bid['bid_amount'] < $lowestBid) {
$lowestBid = $bid['bid_amount'];
$lowestCorp = $bid['corporation_name'];
$lowestChar = $bid['character_name'];
}
}
}
if($lowestBid == null) {
$lowestBid = 'No Bids Placed.';
$lowestCorp = 'No Corporation has placed a bid.';
}
//Assemble the finaly array
$contracts[$i] = $contractsTemp[$i];
$contracts[$i]['bid_count'] = $tempCount;
$contracts[$i]['bids'] = $bids;
$contracts[$i]['lowestbid'] = $lowestBid;
$contracts[$i]['lowestcorp'] = $lowestCorp;
$contracts[$i]['lowestchar'] = $lowestChar;
//Reset the lowestBid back to null
$lowestBid = null;
}
//Call for the view to be displayed
return view('contracts.publiccontracts')->with('contracts', $contracts);
}
/**
* Controller function to display current private contracts
*/
public function displayPrivateContracts() {
//Declare our array variables
$bids = array();
$contracts = array();
$lowestBid = null;
//Calucate today's date to know which contracts to display
$today = Carbon::now();
//Fetch all of the current contracts from the database
$contractsTemp = Contract::where('end_date', '>=', $today)
->where(['type' => 'Private', 'finished' => false])->get();
//Count the number of bids, and add them to the arrays
for($i = 0; $i < sizeof($contractsTemp); $i++) {
$tempCount = Bid::where(['contract_id' => $contractsTemp[$i]['contract_id']])->count('contract_id');
$bids = Bid::where(['contract_id' => $contractsTemp[$i]['contract_id']])->get()->toArray();
foreach($bids as $bid) {
if($lowestBid == null) {
$lowestBid = $bid['bid_amount'];
} else {
if($bid['bid_amount'] < $lowestBid) {
$lowestBid = $bid['bid_amount'];
}
}
}
if($lowestBid == null) {
$lowestBid = 'No Bids Placed.';
}
//Assemble the finaly array
$contracts[$i] = $contractsTemp[$i];
$contracts[$i]['bid_count'] = $tempCount;
$contracts[$i]['bids'] = $bids;
$contracts[$i]['lowestbid'] = $lowestBid;
}
return view ('contracts.privatecontracts')->with('contracts', $contracts);
}
/**
* Controller function to display expired contracts
*
*/
public function displayExpiredContracts() {
//Calculate today's date to know which contracts to display
$today = Carbon::now();
//Retrieve the contracts from the database
$contracts = Contract::where('end_date', '<', $today)->get();
return view('contracts.expiredcontracts')->with('contracts', $contracts);
}
/**
* Controller function to display a page to allow a bid
*
*/
public function displayNewBid($id) {
$contractId = $id;
return view('contracts.enterbid')->with('contractId', $contractId);
}
/**
* Controller function to store a new bid
*/
public function storeBid(Request $request) {
//Valid the request from the enter bid page
$this->validate($request, [
'contract_id' => 'required',
'bid' => 'required',
]);
//Delcare some class variables we will need
$lookup = new LookupHelper;
$amount = 0.00;
//Convert the amount to a whole number from abbreviations
if($request->suffix == 'B') {
$amount = $request->bid * 1000000000.00;
} else if($request->suffix == 'M') {
$amount = $request->bid * 1000000.00;
} else {
$amount = $request->bid * 1.00;
}
if(isset($request->notes)) {
$notes = nl2br($request->notes);
} else {
$notes = null;
}
//Get the character id and character name from the auth of the user calling
//this function
$characterId = auth()->user()->getId();
$characterName = auth()->user()->getName();
//Use the lookup helper in order to find the user's corporation id and name
$char = $lookup->GetCharacterInfo($characterId);
$corporationId = $char->corporation_id;
//use the lookup helper in order to find the corporation's name from it's id.
$corp = $lookup->GetCorporationInfo($corporationId);
$corporationName = $corp->name;
//Before saving a bid let's check to see if the user already placed a bid on the contract
$found = Bid::where([
'contract_id' => $request->contract_id,
'character_id' => $characterId,
])->first();
if(isset($found->contract_id)) {
return redirect('/contracts/display/all')->with('error', 'You have already placed a bid for this contract. Please modify the existing bid.');
} else {
//Create the model object to save data to
$bid = new Bid;
$bid->contract_id = $request->contract_id;
$bid->bid_amount = $amount;
$bid->character_id = $characterId;
$bid->character_name = $characterName;
$bid->corporation_id = $corporationId;
$bid->corporation_name = $corporationName;
$bid->notes = $notes;
$bid->save();
//Redirect to the correct page
return redirect('/contracts/display/all')->with('success', 'Bid accepted.');
}
}
/**
* Controller function to delete a bid
*/
public function deleteBid($id) {
//Delete the bid entry from the database
Bid::where([
'id' => $id,
])->delete();
return redirect('/contracts/display/public')->with('success', 'Bid deleted.');
}
/**
* Controller function to display modify bid page
*/
public function displayModifyBid($id) {
//With the bid id number, look up the bid in the database to get the contract information
$bid = Bid::where(['id' => $id])->first();
//Retrieve the contract from the database
$contract = Contract::where(['contract_id' => $bid->contract_id])->first()->toArray();
return view('contracts.modifybid')->with('contract', $contract)
->with('bid', $bid);
}
/**
* Controller function to modify a bid
*/
public function modifyBid(Request $request) {
$this->validate($request, [
'bid' => 'required',
]);
$amount = $request->bid;
$type = $request->type;
$contractId = $request->contract_id;
if($request->suffix == 'B') {
$amount = $amount * 1000000000.00;
} else if($request->suffix == 'M') {
$amount = $amount * 1000000.00;
} else {
$amount = $amount * 1.00;
}
Bid::where([
'character_id' => auth()->user()->getId(),
'contract_id' => $contractId,
])->update([
'bid_amount' => $amount,
]);
if($type == 'public') {
return redirect('/contracts/display/public')->with('success', 'Bid modified.');
} else {
return redirect('/contracts/display/private')->with('success', 'Bid modified');
}
}
}

View File

@@ -0,0 +1,60 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
//Models
use App\Models\Market\MarketRegionOrder;
use App\Models\PublicContracts\PublicContract;
use App\Models\PublicContracts\PublicContractItem;
class PublicContractController extends Controller
{
/**
* Private variables
*/
private $regions = [
'Immensea' => 10000025,
'Catch' => 10000014,
'Tenerifis' => 10000061,
'The Forge' => 10000002,
'Impass' => 10000031,
'Esoteria' => 10000039,
'Detorid' => 10000005,
'Omist' => 10000062,
'Feythabolis' => 10000056,
'Insmother' => 10000009,
];
/**
* Contracts construct
*/
public function __construct() {
$this->middleware('auth');
$this->middleware('role:User');
}
/**
* Display the contracts in a region
*/
public function displayRegionalContracts() {
//Declare variables
$arrContracts = array();
//Get the contracts by region
foreach($region as $key => $value) {
$contracts = PublicContract::where([
'region_id' => $value,
])->get()->toArray();
//Compile the array
foreach($contracts as $contract) {
array_push($arrContracts, $contract);
}
}
return view('contracts.regional.user.displaycontracts');
}
}

View File

@@ -1,501 +0,0 @@
<?php
namespace App\Http\Controllers\Contracts;
//Internal Libraries
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Carbon\Carbon;
//Libraries
use App\Library\Lookups\LookupHelper;
//Models
use App\Models\User\User;
use App\Models\Contracts\SupplyChainBid;
use App\Models\Contracts\SupplyChainContract;
//Jobs
use App\Jobs\ProcessSendEveMailJob;
class SupplyChainController extends Controller
{
/**
* Constructor
*/
public function __construct() {
$this->middleware('auth');
$this->middleware('role:Renter');
}
/**
* Display the supply chain dashboard
* Should contain a section for open contracts, closed contracts, and expired contracts.
*/
public function displaySupplyChainDashboard() {
$openContracts = SupplyChainContract::where([
'state' => 'open',
])->get();
$closedContracts = SupplyChainContract::where([
'state' => 'closed',
])->get();
$completedContracts = SupplyChainContract::where([
'state' => 'completed',
])->get();
return view('supplychain.dashboard.main')->with('openContracts', $openContracts)
->with('closedContracts', $closedContracts)
->with('completedContracts', $completedContracts);
}
/**
* Display my supply chain contracts dashboard
* Should contain a section for open contracts, closed contracts, and expired contracts
*/
public function displayMySupplyChainDashboard() {
$openContracts = SupplyChainContract::where([
'issuer_id' => auth()->user()->getId(),
'state' => 'open',
])->get();
$closedContracts = SupplyChainContract::where([
'issuer_id' => auth()->user()->getId(),
'state' => 'closed',
])->get();
$completedContracts = SupplyChainContract::where([
'issuer_id' => auth()->user()->getId(),
'state' => 'completed',
])->get();
return view('supplychain.dashboard.main')->with('openContracts', $openContracts)
->with('closedContracts', $closedContracts)
->with('completedContracts', $completedContracts);
}
/**
* Display new contract page
*/
public function displayNewSupplyChainContract() {
return view('supplychain.forms.newcontract');
}
/**
* Store new contract page
*/
public function storeNewSupplyChainContract(Request $request) {
$this->validate($request, [
'name' => 'required',
'date' => 'required',
'delivery' => 'required',
'body' => 'required',
]);
$contract = new SupplyChainContract;
$contract->issuer_id = auth()->user()->getId();
$contract->issuer_name = auth()->user()->getName();
$contract->title = $request->name;
$contract->end_date = $request->date;
$contract->delivery_by = $request->delivery;
$contract->body = $request->body;
$contract->state = 'open';
$contract->bids = 0;
$contract->save();
$this->NewSupplyChainContractMail($contract);
return redirect('/supplychain/dashboard')->with('success', 'New Contract created.');
}
/**
* Display the delete contract page
*/
public function displayDeleteSupplyChainContract() {
$contracts = SupplyChainContract::where([
'issuer_id' => auth()->user()->getId(),
'state' => 'open',
])->get();
return view('supplychain.forms.delete')->with('contracts', $contracts);
}
/**
* Delete a supply chain contract
*/
public function deleteSupplyChainContract(Request $request) {
$this->validate($request, [
'contractId' => 'required',
]);
$contractId = $request->contractId;
/**
* Remove the supply chain contract if it's yours.
*/
$count = SupplyChainContract::where([
'issuer_id' => auth()->user()->getId(),
'contract_id' => $contractId,
])->count();
if($count > 0) {
//Remove the supply chain contract
SupplyChainContract::where([
'issuer_id' => auth()->user()->getId(),
'contract_id' => $contractId,
])->delete();
//Remove all bids associated with the supply chain contract
SupplyChainBid::where([
'contract_id' => $contractId,
])->delete();
return redirect('/supplychain/dashboard')->with('success', 'Supply Chain Contract deleted successfully.');
} else {
return redirect('/supplychain/dashboard')->with('error', 'Unable to delete supply chain contract.');
}
}
/**
* Display the end supply chain contrage page
*/
public function displayEndSupplyChainContract() {
return view('supplychain.forms.end');
}
/**
* Process the end supply chain contract page
*/
public function storeEndSupplyChainContract(Request $request) {
$this->validate($request, [
'accept' => 'required',
'contractId' => 'required',
]);
//Check to make sure the user owns the contract
$count = SupplyChainContract::where([
'issuer_name' => auth()->user()->getName(),
'contract_id' => $request->contractId,
])->count();
//If the count is greater than 0, the user owns the contract.
//Proceed with ending the contract
if($count > 0) {
SupplyChainContract::where([
])->update([
]);
SupplyChainBid::where([
])->update([
]);
return redirect('/supplychain/dashboard')->with('success', 'Contract ended, and mails sent to the winning bidder.');
} else {
//If the count is zero, then redirect with error messsage
return redirect('/supplychain/dashboard')->with('error', 'Contract was not yours to end.');
}
}
/**
* Display supply chain contract bids page
*/
public function displaySupplyChainBids() {
//Display bids for the user on a page
$bids = array();
$bidsCount = SupplyChainBid::where([
'entity_id' => auth()->user()->getId(),
'bid_type' => 'pending',
])->count();
$myBids = SupplyChainBid::where([
'entity_id' => auth()->user()->getId(),
'bid_type' => 'pending',
])->get();
foreach($myBids as $bid) {
//Declare the temporary array
$temp = array();
//Get the contract information for the bid
$contract = SupplyChainContract::where([
'contract_id' => $bid->contract_id,
])->first();
$temp['bid_id'] = $bid->bid_id;
$temp['contract_id'] = $bid->contract_id;
$temp['issuer_name'] = $contract->issuer_name;
$temp['title'] = $contract->title;
$temp['end_date'] = $contract->end_date;
$temp['body'] = $contract->body;
$temp['bid_amount'] = $bid->bid_amount;
array_push($bids, $temp);
}
return view('supplychain.dashboard.bids')->with('bids', $bids)
->with('bidsCount', $bidsCount);
}
/**
* Display expired supply chain contracts page
*/
public function displayExpiredSupplyChainContracts() {
return view('supplychain.dashboard.expired');
}
/**
* Display the new bid on a supply chain contract page
*/
public function displaySupplyChainContractBid($contract) {
$contractId = $contract;
return view('supplychain.forms.enterbid')->with('contractId', $contractId);
}
/**
* Enter a new bid on a supply chain contract
*/
public function storeSupplyChainContractBid(Request $request) {
$this->validate($request, [
'bid' => 'required',
'contract_id' => 'required',
]);
//Declare some needed variables
$bidAmount = 0.00;
//See if a bid has been placed by the user for this contract
$count = SupplyChainBid::where([
'entity_id' => auth()->user()->getId(),
'entity_name' => auth()->user()->getName(),
'contract_id' => $request->contract_id,
])->count();
//If the person already has a bid in, then deny them the option to place another bid on the same contract.
//Otherwise, enter the bid into the database
if($count > 0) {
return redirect('/supplychain/dashboard')->with('error', 'Unable to insert bid as one is already present for the supply chain contract.');
} else {
//Sanitize the bid amount
if(preg_match('(m|M|b|B)', $request->bid) === 1) {
if(preg_match('(m|M)', $request->bid) === 1) {
$cStringSize = strlen($request->bid);
$tempCol = str_split($request->bid, $cStringSize - 1);
$bidAmount = $tempCol[0];
$bidAmount = $bidAmount * 1000000.00;
} else if(preg_match('(b|B)', $request->bid) === 1) {
$cStringSize = strlen($request->bid);
$tempCol = str_split($request->bid, $cStringSize - 1);
$bidAmount = $tempCol[0];
$bidAmount = $bidAmount * 1000000000.00;
}
} else {
$bidAmount = $request->bid;
}
//Create the database entry
$bid = new SupplyChainBid;
$bid->contract_id = $request->contract_id;
$bid->bid_amount = $bidAmount;
$bid->entity_id = auth()->user()->getId();
$bid->entity_name = auth()->user()->getName();
$bid->entity_type = 'character';
if(isset($request->notes)) {
$bid->bid_note = $request->notes;
}
$bid->bid_type = 'pending';
$bid->save();
//Update the database entry for the supply chain contract bid number
$num = SupplyChainContract::where([
'contract_id' => $request->contract_id,
])->select('bids')->first();
//Increment the number of bids
$numBids = $num->bids + 1;
//Update the database
SupplyChainContract::where([
'contract_id' => $request->contract_id,
])->update([
'bids' => $numBids,
]);
return redirect('/supplychain/dashboard')->with('success', 'Bid succesfully entered into the contract.');
}
}
/**
* Delete a bid on a supply chain contract
*
* @var contractId
* @var bidId
*/
public function deleteSupplyChainContractBid($contractId, $bidId) {
//See if the user has put in a bid. If not, then redirect to failure.
$count = SupplyChainBid::where([
'contract_id' => $contractId,
'entity_id' => auth()->user()->getId(),
'bid_id' => $bidId,
])->count();
if($count > 0) {
SupplyChainBid::where([
'contract_id' => $contractId,
'entity_id' => auth()->user()->getId(),
'bid_id' => $bidId,
])->delete();
//Update the database entry for the supply chain contract bid number
$num = SupplyChainContract::where([
'contract_id' => $contractId,
])->select('bids')->first();
//Decrement the number of bids
$numBids = $num->bids - 1;
//Update the database
SupplyChainContract::where([
'contract_id' => $contractId,
])->update([
'bids' => $numBids,
]);
return redirect('/supplychain/dashboard')->with('success', 'Deleted supply chain contract bid.');
} else {
return redirect('/supplychain/dashboard')->with('error', 'No bid found to delete.');
}
}
/**
* Display the modify a bid on supply chain contract page
*/
public function displayModifySupplyChainContractBid(Request $request) {
$this->validate($request, [
'contract_id' => 'required',
]);
//Get the contract id
$contractId = $request->contract_id;
//Get the bid id to be modified later
$bid = SupplyChainBid::where([
'contract_id' => $contractId,
'entity_id' => auth()->user()->getId(),
])->first();
$bidId = $bid->id;
return view('supplychain.forms.modifybid')->with('contractId', $contractId)
->with('bidId', $bidId);
}
/**
* Modify a bid on a supply chain contract
*/
public function modifySupplyChainContractBid(Request $request) {
$this->validate($request, [
'bid_id' => 'required',
'contract_id' => 'required',
'bid_amount' => 'required',
]);
//Check for the owner of the bid
$count = SupplyChainBid::where([
'bid_id' => $request->bid_id,
'contract_id' => $request->contract_id,
'entity_id' => auth()->user()->getId(),
])->count();
if($count > 0) {
if(isset($request->bid_note)) {
SupplyChainBid::where([
'bid_id' => $request->bid_id,
'contract_id' => $request->contract_id,
'entity_id' => auth()->user()->getId(),
])->update([
'bid_amount' => $request->bid_amount,
'bid_note' => $request->bid_note,
]);
} else {
SupplyChainBid::where([
'bid_id' => $request->bid_id,
'contract_id' => $request->contract_id,
'entity_id' => auth()->user()->getId(),
])->update([
'bid_amount' => $request->bid_amount,
]);
}
return redirect('/supplychain/dashboard')->with('success', 'Modified supply chain contract bid.');
} else {
return redirect('/supplychain/dashboard')->with('error', 'Not able to modify supply chain contract bid.');
}
}
/**
* Send out a new supply chain contract mail
*/
private function NewSupplyChainContractMail(SupplyChainContract $contract) {
//Get the config for the esi
$config = config('esi');
$todayDate = Carbon::now()->toFormattedDateString();
$subject = 'New Supply Chain Contract ' . $todayDate;
$body = "A supply chain contract is available.<br>";
$body .= "Contract: " . $contract->title . "<br>";
$body .= "Notes: " . $contract->body . "<br>";
$body .= "Delivery Date: " . $contract->delivery_date . "<br>";
$body .= "<br>Sincerely on behalf of,<br>" . $contract->issuer_name . "<br>";
ProcessSendEveMailJob::dispatch($body, 145223267, 'mailing_list', $subject, $config['primary'])->onQueue('mail')->delay(Carbon::now()->addSeconds(30));
}
/**
* Send out a mail when the supply chain contract has been deleted
*/
private function DeleteSupplyChainContractMail($contract) {
//Get the esi config
$config = config('esi');
$subject = 'Production Contract Removal';
$body = "A production contract has been deleted.<br>";
$body .= "Contract: " . $contract->title . "<br>";
$body .= "Notes: " . $contract->note . "<br>";
$body .= "<br>Sincerely on behalf of,<br>" . $contract->issuer_name;
ProcessSendEveMailJob::dispatch($body, 145223267, 'mailing_list', $subject, $config['primary'])->onQueue('mail')->delay(Carbon::now()->addSeconds(30));
}
/**
* Tidy up datatables from a completed supply chain contract
*/
private function TidySupplyChainContract($contract, $bid) {
//Set the contract as finished
SupplyChainContract::where([
'contract_id' => $contract->contract_id,
])->update([
'state' => 'finished',
]);
//Set all of the bids as not_accepted as default
SupplyChainBid::where([
'contract_id' => $contract->contract_id,
])->update([
'bid_type' => 'not_accepted',
]);
//Set the correct bid as accepted
SupplyChainBid::where([
'contract_id' => $contract->contract_id,
'bid_id' => $bid->bid_id,
])->update([
'bid_type' => 'accepted',
]);
}
}

View File

@@ -18,7 +18,6 @@ use App\Models\User\User;
use App\Models\User\UserRole;
use App\Models\User\UserPermission;
use App\Models\User\AvailableUserPermission;
use App\Models\User\AvailableUserRole;
use App\Models\Admin\AllowedLogin;
use App\Models\Doku\DokuGroupNames;
use App\Models\Doku\DokuMember;
@@ -39,7 +38,7 @@ class AdminController extends Controller
$dateInit = Carbon::now();
$date = $dateInit->subDays(30);
$journal = DB::select('SELECT amount,reason,description,date FROM `player_donation_journal` WHERE corporation_id=98287666 AND date >= DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 2 MONTH) ORDER BY date DESC');
$journal = DB::select('SELECT amount,reason,description,date FROM `player_donation_journal` WHERE corporation_id=98287666 AND date >= DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 1 MONTH) ORDER BY date DESC');
return view('admin.dashboards.walletjournal')->with('journal', $journal);
}
@@ -221,41 +220,37 @@ class AdminController extends Controller
$permissions[$p->permission] = $p->permission;
}
$roles = AvailableUserRole::all();
$role = $user->getRole();
//Pass the user information to the page for hidden text entries
return view('admin.user.modify')->with('user', $user)
->with('permissions', $permissions)
->with('role', $role)
->with('roles', $roles);
->with('permissions', $permissions);
}
public function modifyRole(Request $request) {
$this->validate($request, [
'user' => 'required',
'role' => 'required|role!=None',
]);
public function modifyUser(Request $request) {
$type = $request->type;
if(isset($request->permission)) {
$permission = $request->permission;
}
if(isset($request->user)) {
$user = $request->user;
}
UserRole::where(['character_id' => $user])->update([
'role' => $request->role,
]);
return redirect('/admin/dashboard/users')->with('success', "User: " . $user . " has been modified to a new role: " . $request->role . ".");
return redirect('/admin/dashboard/users')->with('error', 'Not Implemented Yet.');
}
public function addPermission(Request $request) {
//Get the user and permission from the form
$character = $request->user;
$user = $request->user;
$permission = $request->permission;
//Get the character id from the username using the user table
$character = User::where(['name' => $user])->get(['character_id']);
//Check to see if the character already has the permission
$check = UserPermission::where(['character_id' => $character, 'permission' => $permission])->get(['permission']);
$check = UserPermission::where(['character_id' => $character[0]->character_id, 'permission' => $permission])->get(['permission']);
if(!isset($check[0]->permission)) {
$perm = new UserPermission;
$perm->character_id = $character;
$perm->character_id = $character[0]->character_id;
$perm->permission = $permission;
$perm->save();

View File

@@ -42,55 +42,18 @@ class AdminDashboardController extends Controller
}
//Declare variables we will need
$tHelper = new TaxesHelper();
$srpHelper = new SRPHelper();
$days = 30;
$months = 1;
$lava = new Lavacharts;
//Get the dates for the information being requested
$dates = $tHelper->GetTimeFrameInMonths($months);
$sovBills = array();
$pi = array();
$industry = array();
$reprocessing = array();
$office = array();
$sprActual = array();
$srpLoss = array();
//Get the data for the sov expenses for a graph
//Setup the charts
//Setup the chart to be able the show the categories for income
/*
$iChart = $lava->DataTable();
$iChart->addStringColumn('Categories')
->addNumberColumn('ISK')
->addRow(['pi', $pi])
->addRow(['industry', $industry])
->addRow(['reprocessing', $reprocessing])
->addRow(['offices', $office])
->addRow(['industry', $industry])
->addRow(['market', $market])
->addRow(['gate', $gate])
->addRow(['iBuyback', $iBuyback])
->addRow(['renters', $renters])
->addRow(['ops', $ops]);
*/
//Setup the chart to be able to show the categories for expenses
/*
$eChart = $lava->DataTable();
$eCjart->addStringColumn('Categories')
->addNumberColumn('ISK')
->addRow(['sov', $sovBills])
->addRow(['srp', $srpActual])
->addRow(['maintenance', $maintenance])
->addRow(['wardecs', $wardecs])
->addRow(['fcs', $fcs])
->addRow(['keepstar_fuel', $keepstarFuel])
->addRow(['fortizar_fuel', $fortizarFuel])
->addRow(['astrahus_fuel', $astrahusFuel])
->addRow(['sotiyo_fuel', $sotiyoFuel])
->addRow(['azbel_fuel', $azbelFuel])
->addRow(['raitaru_fuel', $raitaruFuel])
->addRow(['beacon_fuel', $beaconFuel])
->addRow(['bridge_fuel', $bridgeFuel])
->addRow(['jammer_fuel', $jammerFuel]);
*/
return view('admin.dashboards.dashboard');
}
}

View File

@@ -120,29 +120,14 @@ class FlexAdminController extends Controller
'structure_type' => 'required',
]);
$count = FlexStructure::where([
'requestor_id' => $request->requestor_id,
'requestor_corp_id' => $request->requestor_corp_id,
'system_id' => $request->system_id,
'structure_type' => $request->structure_type,
])->count();
if($count > 0) {
FlexStructure::where([
'requestor_id' => $request->requestor_id,
'requestor_corp_id' => $request->requestor_corp_id,
'system_id' => $request->system_id,
'system' => $request->system_id,
'structure_type' => $request->structure_type,
])->delete();
return redirect('/flex/display')->with('success', 'Flex Structure Entry Removed.');
} else {
return redirect('/flex/display')->with('error', 'Could not find flex structure to delete.');
}
}
}

View File

@@ -6,7 +6,6 @@ namespace App\Http\Controllers\Logistics;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Log;
use Carbon\Carbon;
//Jobs
use App\Jobs\ProcessSendEveMailJob;
@@ -63,7 +62,7 @@ class StructureRequestController extends Controller
])->get();
//Set the mail delay
$delay = 30;
$delay = 5;
foreach($fcTeam as $fc) {
$body = "Structure Anchor Request has been entered.<br>";
@@ -75,9 +74,9 @@ class StructureRequestController extends Controller
$subject = "New Structure Anchor Request";
ProcessSendEveMailJob::dispatch($body, (int)$fc->character_id, 'character', $subject, $config['primary'])->onQueue('mail')->delay(Carbon::now()->addSeconds($delay));
$delay += 30;
$delay += 15;
}
return redirect('/dashboard')->with('success', 'Structure request successfully submitted.');
return redirect('/structures/display/requests');
}
}

View File

@@ -29,25 +29,6 @@ use App\Jobs\ProcessSendEveMailJob;
class MoonsAdminController extends Controller
{
/**
* Variable for the class
*/
private $romans = [
'M' => 1000,
'CM' => 900,
'D' => 500,
'CD' => 400,
'C' => 100,
'XC' => 90,
'L' => 50,
'XL' => 40,
'X' => 10,
'IX' => 9,
'V' => 5,
'IV' => 4,
'I' => 1,
];
/**
* Constructor for the class
*/
@@ -149,7 +130,7 @@ class MoonsAdminController extends Controller
}
//Setup the mail model
ProcessSendEveMailJob::dispatch($body, (int)$moon->requestor_id, 'character', 'Warped Intentions Moon Request', $config['primary'])->onQueue('mail')->delay(Carbon::now()->addSeconds(30));
ProcessSendEveMailJob::dispatch($body, (int)$moon->requestor_id, 'character', 'Warped Intentions Moon Request', $config['primary'])->onQueue('mail')->delay(Carbon::now()->addSeconds(5));
return redirect('/moons/admin/display/request')->with('success', 'Moon has been processed, and mail has been sent out.');
}
@@ -261,6 +242,7 @@ class MoonsAdminController extends Controller
//Check if a current rental for the moon is on going
if(($moon->rental_type == 'In Alliance' || $moon->rental_type == 'Out of Alliance')) {
$paid = $moon->paid;
$paidUntil = new Carbon($moon->paid_until);
$paidUntil = $paidUntil->format('m-d');
@@ -269,28 +251,17 @@ class MoonsAdminController extends Controller
$rentalTemp = new Carbon($moon->rental_until);
$rentalEnd = $rentalTemp->format('m-d');
//Set the correct color for the table
if($rentalTemp->diffInDays(Carbon::now()) < 3 && $today->lessThan($rentalTemp)) {
$color = 'table-warning';
} else if($today->lessThan($rentalTemp)) {
$color = 'table-danger';
} else {
$color = 'table-primary';
}
//Set the contact name based on the contact type
if($moon->rental_contact_type == 'Alliance') {
$allianceInfo = $lookupHelper->GetAllianceInfo($moon->rental_contact_id);
//Set the contact name and ticker
$contact = $allianceInfo->name;
$ticker = $allianceInfo->ticker;
} else if($moon->rental_contact_type == 'Corporation') {
$corporationInfo = $lookupHelper->GetCorporationInfo($moon->rental_contact_id);
//Set the contact name and ticker
$contact = $corporationInfo->name;
$ticker = $corporationInfo->ticker;
} else if($moon->rental_contact_type == 'Character') {
$characterInfo = $lookupHelper->GetCharacterInfo($moon->rental_contact_id);
//Set the contact name
@@ -298,12 +269,21 @@ class MoonsAdminController extends Controller
//Get the ticker for the character from the corporation he belongs to
$corpInfo = $lookupHelper->GetCorporationInfo($characterInfo->corporation_id);
$ticker = $corpInfo->ticker;
} else {
$contact = 'N/A';
$ticker = 'N/A';
$type = 'N/A';
$color = 'table-primary';
}
//Set up the moon rental type
if($moon->rental_type == 'In Alliance') {
$type = 'IA';
} else if($moon->rental_type == 'Out of Alliance') {
$type = 'OOA';
} else if($moon->rental_type == 'Alliance') {
$type = 'W4RP';
} else {
$type = 'N/A';
}
//Check if the moon is currently being utilized by the alliance
@@ -312,10 +292,8 @@ class MoonsAdminController extends Controller
$paid = 'No';
//Setup the rental end time as the end of the month
$rentalTemp = Carbon::now()->endOfMonth();
$rentalTemp = $today->endOfMonth();
$rentalEnd = $rentalTemp->format('m-d');
//Set the color of the table
$color = 'table-info';
//Setup the paid time as the same as the rental end
$paidUntiltemp = $rentalTemp;
@@ -345,40 +323,19 @@ class MoonsAdminController extends Controller
$renter = 'None';
$ticker = 'N/A';
$type = 'N/A';
//Set the color of the table
$color = 'table-primary';
}
//Set up the moon rental type
if($moon->rental_type == 'In Alliance') {
$type = 'IA';
//Setup the row color
if($rentalTemp->diffInDays(Carbon::now()) < 3 && $today->lessThan($rentalTemp)) {
//Set the color for the table
if($moon->rental_type != 'Alliance') {
if($rentalTemp->diffInDays($today) < 3) {
$color = 'table-warning';
} else if($today->lessThan($rentalTemp)) {
$color = 'table-danger';
} else if($today > $rentalTemp) {
$color = 'table-success';
} else {
$color = 'table-primary';
}
} else if($moon->rental_type == 'Out of Alliance') {
$type = 'OOA';
//Setup the row color
if($rentalTemp->diffInDays(Carbon::now()) < 3 && $today->lessThan($rentalTemp)) {
$color = 'table-warning';
} else if($today->lessThan($rentalTemp)) {
$color = 'table-danger';
} else {
$color = 'table-primary';
}
} else if($moon->rental_type == 'Alliance') {
$type = 'W4RP';
//Set the row color
} else {
$color = 'table-info';
} else {
$type = 'N/A';
//Set the row color
$color = 'table-primary';
}
//Add the data to the html string to be passed to the view
@@ -518,78 +475,4 @@ class MoonsAdminController extends Controller
//Redirect to the previous screen.
return redirect('/moons/admin/updatemoon')->with('success', 'Moon Rental updated.');
}
public function ImportMoonSurveyData(Request $request) {
//Declare variables
$added = 0;
$updated = 0;
$moon = null;
$newMoon = false;
$num = 0;
$planet = null;
$moonNumber = null;
foreach(explode("\n", $request->input('data')) as $row) {
$cols = explode("\t", $row);
dd($cols);
}
return redirect('/admin/dashboard')->with('success', 'Import done: ' . $added . ' moons added ' . $updated . ' moons updated.');
}
private function romanNumberToInteger($roman) {
$result = 0;
foreach($this->romans as $key => $value) {
while(strpos($roman, $key) === 0) {
$result += $value;
$roman = substr($roman, strlen($key));
}
}
return $result;
}
private function integerToRomanNumber($number) {
$returnValue = '';
while($number > 0) {
foreach($this->romans as $roman => $int) {
if($number >= $int) {
$number -= $int;
$returnValue .= $roman;
break;
}
}
}
return $returnValue;
}
private function arrayToCsv(array $rows) {
//Declare needed variable as text null
$result = '';
//Open the temp file
$fp = fopen('php://temp', 'w');
//Process the file
foreach($rows as $fields) {
fputcsv($fp, $fields, ';', '"');
}
//Go back to the beginning of the file
rewind($fp);
//Continue through the buffer until the end
while(($buffer = fgets($fp, 4096)) !== false) {
$result .= $buffer;
}
//Close the temp file
fclose($fp);
//Return the result
return $result;
}
}

View File

@@ -12,6 +12,7 @@ use Carbon\Carbon;
//Models
use App\Models\Moon\Config;
use App\Models\Moon\ItemComposition;
use App\Models\Moon\RentalMoon;
use App\Models\Moon\OrePrice;
use App\Models\Moon\Price;
use App\Models\Moon\AllianceMoon;
@@ -22,9 +23,6 @@ use App\Models\Moon\AllianceMoonRequest;
use App\Library\Moons\MoonCalc;
use App\Library\Lookups\LookupHelper;
//Jobs
use App\Jobs\ProcessSendEveMailJob;
class MoonsController extends Controller
{
public function __construct() {
@@ -32,10 +30,6 @@ class MoonsController extends Controller
$this->middleware('role:Renter');
}
public function displayRentalMoonPage() {
return view('moons.user.requestrental');
}
/**
* Function to display all alliance moons and pass data to the blade template
*/
@@ -156,7 +150,6 @@ class MoonsController extends Controller
'Z-H2MA',
'B-KDOZ',
'E8-YS9',
'DY-P7Q',
];
//Declare lookup variables
@@ -219,16 +212,6 @@ class MoonsController extends Controller
'Availability' => 'Request Pending',
]);
//Send a mail over to the site admins to approve the moon request
$config = config('esi');
$body = 'A new moon request has been entered into the services site. Please approve or deny the request within 3 business days.<br><br>';
$body .= 'Sincerely,<br>';
$body .= 'W4RP Services Site';
$subject = 'New Moon Request Available';
ProcessSendEveMailJob::dispatch($body, 92947432, 'character', $subject, $config['primary'])->onQueue('mail')->delay(Carbon::now()->addSeconds(30));
ProcessSendEveMailJob::dispatch($body, 92626011, 'character', $subject, $config['primary'])->onQueue('mail')->delay(Carbon::now()->addSeconds(60));
return redirect('/moons/display/request')->with('success', 'Moon request submitted.');
}
@@ -238,6 +221,7 @@ class MoonsController extends Controller
*/
public function displayRentalMoons() {
//Declare variables
$rentalEnd = null;
$lastMonth = Carbon::now()->subMonth();
$today = Carbon::now();
$table = array();
@@ -253,32 +237,17 @@ class MoonsController extends Controller
//For each of the moons let's format the data for the display table
foreach($moons as $moon) {
$color = null;
$rentalTemp = null;
$rentalEnd = null;
//Check if someone is currently renting the moon
if($moon->rental_type == 'In Alliance' || $moon->rental_type == 'Out of Alliance') {
if(($moon->rental_type == 'In Alliance' || $moon->rental_type == 'Out of Alliance') && ($moon->paid == 'Yes')) {
$rentalTemp = new Carbon($moon->rental_until);
$rentalEnd = $rentalTemp->format('m-d');
//Setup the correct color for the table
if($rentalTemp->diffInDays(Carbon::now()) < 3 && $today->lessThan($rentalTemp)) {
$color = 'table-warning';
} else if($today->lessThan($rentalTemp)) {
$color = 'table-danger';
} else {
$color = 'table-primary';
}
} else if($moon->rental_type == 'Alliance') {
$rentalTemp = Carbon::now()->endOfMonth();
$rentalTemp = $today->endOfMonth();
$rentalEnd = $rentalTemp->format('m-d');
$color = 'table-info';
} else {
//Set the rental date for if someone is not renting the moon
$rentalTemp = $lastMonth;
$rentalEnd = $rentalTemp->format('m-d');
$color = 'table-primary';
}
//Get the price of the moon from the database based on if the person is in Warped Intentions
@@ -289,6 +258,21 @@ class MoonsController extends Controller
$moonprice = $moon->out_of_alliance_rental_price;
}
//Get the color correct for the table
if($moon->rental_type == 'In Alliance' || $moon->rental_type == 'Out of Alliance') {
if($rentalTemp->diffInDays($today) < 3 && $today < $rentalTemp ) {
$color = 'table-danger';
} else if($today > $rentalTemp) {
$color = 'table-primary';
} else if($today < $rentalTemp) {
$color = 'table-danger';
}
} else if($moon->rental_type == 'Alliance') {
$color = 'table-info';
} else {
$color = 'table-primary';
}
//Add the data to the html array to be passed to the view
array_push($table, [
'SPM' => $moon->system . " - " . $moon->planet . " - " . $moon->moon,

View File

@@ -1,62 +0,0 @@
<?php
namespace App\Http\Controllers\Moons;
//Internal Library
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Auth;
use Log;
use Carbon\Carbon;
//Models
use App\Models\Moon\AllianceRentalMoon;
class RentalMoonsAdminController extends Controller
{
/**
* Construct
*/
public function __construct() {
$this->middleware('auth');
$this->middelware('role:user');
$this->middleware('permission:mining.director');
}
/**
* Function to display rental moons being used for the alliance
*/
public function displayAllianceUsageRentalMoons() {
}
/**
* Display the form for requesting new rental moon for the alliance
*/
public function displayRentalMoonForAllianceForm() {
}
/**
* Function to store when a new rental moon is requested
*/
public function storeRentalMoonForAlliance(Request $request) {
}
/**
* Function to display the form for figuring out item composition
*/
public function displayItemCompositionForm() {
}
/**
* Function to display the results of the form for figuring out item composition
*/
public function displayItemCompositionResults(Request $request) {
}
}

View File

@@ -85,13 +85,8 @@ class SRPAdminController extends Controller
//Calculate the recommended srp amount
foreach($payouts as $p) {
if($r['ship_type'] == $p->code) {
$payout = $p->payout;
if($temp['character_name'] == $temp['fleet_commander_name']) {
$payout = 100.00;
}
$temp['actual_srp'] = $r['loss_value'] * ($payout / 100.00 );
$temp['payout_percentage'] = $payout;
$temp['actual_srp'] = $r['loss_value'] * ($p->payout / 100.00 );
$temp['payout_percentage'] = $p->payout;
$sum_actual += $temp['actual_srp'];
}
}

View File

@@ -1,156 +0,0 @@
<?php
namespace App\Http\Controllers\SystemRentals;
//Internal Library
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Auth;
use DB;
use Carbon\Carbon;
//Models
use App\Models\SystemRentals\RentalSystem;
//Library
use App\Library\Lookups\LookupHelper;
use App\Library\Esi\Esi;
class RentalAdminController extends Controller
{
//Constructor
public function __construct() {
$this->middleware('auth');
$this->middleware('role:Admin');
}
/**
* Function to display all active rental systems and
* the information regarding the rental systems
*/
public function displayRentalSystems() {
//Get the rental systems from the database
$rentals = RentalSystem::all();
foreach($rentals as $rental) {
//Format the rental cost
if($rental->rental_cost > 1000000000.00) {
$rental->rental_cost = $rental->rental_cost / 1000000000.00;
$rental->rental_cost = $rental->rental_cost . "B";
} else if($rental->rental_cost > 1000000.00 && $rental->rental_cost < 999999999.99) {
$rental->rental_cost = $rental->rental_cost / 1000000.00;
$rental->rental_cost = $rental->rental_cost . "M";
}
//Format the date
$rental->paid_until = Carbon::parse($rental->paid_until)->format('Y-m-d');
}
//Return the view with the data
return view('rental.list')->with('rentals', $rentals);
}
/**
* Function to display form for adding new rental system
*/
public function displayAddRentalSystem() {
return view('rental.add');
}
/**
* Function to add new rental system to the database
*/
public function addRentalSystem(Request $request) {
$this->validate($request, [
'contact_name' => 'required',
'contact_corp_name' => 'required',
'system' => 'required',
'rental_cost' => 'required',
'paid_until' => 'required',
]);
//Declare the variables and classes needed
$lookup = new LookupHelper;
//From the character name find the character id
$charId = $lookup->CharacterNameToId($request->contact_name);
//From the corporation name find the corporation id
$corpId = $lookup->CorporationNameToId($request->contact_corp_name);
//From the system name find the system id
$systemId = $lookup->SystemNameToId($request->system);
//Sanitize the bid amount
if(preg_match('(m|M|b|B)', $request->rental_cost) === 1) {
if(preg_match('(m|M)', $request->rental_cost) === 1) {
$cStringSize = strlen($request->rental_cost);
$tempCol = str_split($request->rental_cost, $cStringSize - 1);
$rentalCost = $tempCol[0];
$rentalCost = $rentalCost * 1000000.00;
} else if(preg_match('(b|B)', $request->rental_cost) === 1) {
$cStringSize = strlen($request->rental_cost);
$tempCol = str_split($request->rental_cost, $cStringSize - 1);
$rentalCost = $tempCol[0];
$rentalCost = $rentalCost * 1000000000.00;
}
} else {
$rentalCost = $request->rental_cost;
}
//Create the database model
$rental = new RentalSystem;
$rental->contact_id = $charId;
$rental->contact_name = $request->contact_name;
$rental->corporation_id = $corpId;
$rental->corporation_name = $request->contact_corp_name;
$rental->system_id = $systemId;
$rental->system_name = $request->system;
$rental->rental_cost = $rentalCost;
$rental->paid_until = $request->paid_until;
$rental->save();
return redirect('/system/rental/dashboard')->with('success', 'Rental System Added.');
}
/**
* Function to update paid until section of the rental system in the database
*/
public function updateRentalSystem(Request $request) {
$this->validate($request, [
'paid_until' => 'required',
'contact_id' => 'required',
'corporation_id' => 'required',
'system_id' => 'required',
]);
RentalSystem::where([
'contact_id' => $request->contact_id,
'corporation_id' => $request->corporation_id,
'system_id' => $request->system_id,
])->update([
'paid_until' => $request->paid_until,
]);
return redirect('/system/rental/dashboard')->with('success', 'Rental System updated.');
}
/**
* Function to remove rental system from the database
*/
public function removeRentalSystem(Request $request) {
$this->validate($request, [
'contact_id' => 'required',
'corporation_id' => 'required',
'system_id' => 'required',
]);
RentalSystem::where([
'contact_id' => $request->contact_id,
'corporation_id' => $request->corporation_id,
'system_id' => $request->system_id,
])->delete();
return redirect('/system/rental/dashboard')->with('success', 'Removed renter from database.');
}
}

View File

@@ -0,0 +1,148 @@
<?php
namespace App\Http\Controllers\Wormholes;
//Laravel Libraries
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Auth;
use Carbon\Carbon;
//User Libraries
//Models
use App\Models\Wormholes\AllianceWormhole;
use App\Models\Wormholes\WormholeType;
class WormholeController extends Controller
{
public function __construct() {
$this->middleware('auth');
$this->middleware('role:User');
}
public function displayWormholeForm() {
//Declare a few array variables
$duration = array();
$class = array();
$stability = array();
$size = array();
//Get the duration from the table
$duration = [
'This wormhole has not yet begun its natural cycle of decay and should last at least another day.',
'This wormhole is beginning to decay, but will not last another day.',
'This wormhole is reaching the end of its natural lifetime',
];
//Get the wh classes from the table
$class = [
'C1',
'C2',
'C3',
'C4',
'C5',
'C6',
'C7',
'C8',
'C9',
'C13',
'Drifter',
'Thera',
'Exit WH',
];
//Get the wh types from the table
$type = WormholeType::groupBy('type')->pluck('type');
//Get the wh sizes from the table
$size = [
'XS',
'S',
'M',
'L',
'XL',
];
//Get the wh stabilities from the table
$stability = [
'Stable',
'Non-Critical',
'Critical',
];
//Return all the variables to the view
return view('wormholes.form')->with('class', $class)
->with('type', $type)
->with('size', $size)
->with('stability', $stability)
->with('duration', $duration);
}
public function storeWormhole() {
$this->validate($request, [
'sig' => 'required',
'duration' => 'required',
'dateTiume' => 'required',
'class' => 'required',
'size' => 'required',
'stability' => 'required',
'system' => 'required',
]);
//Declare some variables
$duration = null;
//Create the stable time for the database
if($request->duration == 'This wormhole has not yet begun its natural cycle of decay and should last at least another day.') {
$duration = '>24 hours';
} else if ($request->duration == 'This wormhole is beginning to decay, but will not last another day.') {
$duration = '>4 hours <24 hours';
} else if($request->duration == 'This wormhole is reaching the end of its natural lifetime') {
'<4 hours';
}
//Get the wormhole type from the database so we can enter other details
$wormholeType = WormholeType::where([
'type' => $request->type,
])->first();
$found = AllianceWormhole::where([
'system' => $request->system,
'sig_ig' => $request->sig,
])->count();
if($found == 0) {
AllianceWormhole::insert([
'system' => $request->system,
'sig_id' => $request->sig_id,
'duration_left' => $duration,
'dateTime' => $request->dateTime,
'class' => $request->class,
'type' => $request->class,
'hole_size' => $request->size,
'stability' => $request->stability,
'details' => $request->details,
'link' => $request->link,
'mass_allowed' => $wormholeType->mass_allowed,
'individual_mass' => $wormholeType->individual_mass,
'regeneration' => $wormholeType->regeneration,
'max_stable_time' => $wormholeType->max_stable_time,
]);
return redirect('/wormholes/display')->with('success', 'Wormhole Info Added.');
} else {
return redirect('/wormholes/display')->with('error', 'Wormhole already in database.');
}
}
public function displayWormholes() {
//Create the date and time
$dateTime = Carbon::now()->subDays(2);
//Get all of the wormholes from the last 48 hours from the database to display
$wormholes = AllianceWormhole::where('created_at', '>=', $dateTime)->get();
return view('wormholes.display')->with('wormholes', $wormholes);
}
}

View File

@@ -0,0 +1,56 @@
<?php
namespace App\Jobs\Commands\Eve;
//Internal Library
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Log;
//Library
use Seat\Eseye\Exceptions\RequestFailedException;
use App\Library\Esi\Esi;
//Models
use App\Models\Eve\EveRegion;
class GetEveRegionsJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
$esi = new Esi();
$regions = $esi->invoke('get', '/universe/regions/');
$responses = $esi->setBody($regions)->invoke('post', '/universe/names/');
foreach($responses as $resp) {
if($resp->category == 'region') {
EveRegion::insertOrIgnore([
'region_id' => $resp->id,
'region_name' => $resp->name,
]);
}
}
}
}

View File

@@ -0,0 +1,104 @@
<?php
namespace App\Jobs\Commands\Market;
//Internal Library
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Carbon\Carbon;
use Log;
//App Library
use Seat\Eseye\Exceptions\RequestFailedException;
use App\Library\Esi\Esi;
use App\Library\Lookups\LookupHelper;
class GetMarketRegionOrderJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/**
* Private variables
*/
private $esi;
private $region;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct($region, $esi = null)
{
//Setup the region variable
$this->region = $region;
//Setup the esi variable
if($esi == null) {
$this->esi = new Esi();
} else {
$this->esi = $esi;
}
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
//Get the market orders for a region
$orders = $this->esi->invoke('get', '/markets/{region_id}/orders/', [
'region_id' => $this->region,
]);
foreach($orders as $order) {
$count = MarketRegionOrder::where([
'order_id',
])->count();
if($count == 0) {
$newOrder = new MarketRegionOrder;
$newOrder->region_id = $this->region;
$newOrder->duration = $order->duration;
$newOrder->is_buy_order = $order->is_buy_order;
$newOrder->issued = $order->issued;
$newOrder->location_id = $order->location_id;
$newOrder->min_volume = $order->min_volume;
$newOrder->order_id = $order->order_id;
$newOrder->price = $order->price;
$newOrder->range = $order->range;
$newOrder->system_id = $order->system_id;
$newOrder->type_id = $order->type_id;
$newOrder->volume_remain = $order->volume_remain;
$newOrder->volume_total = $order->volume_total;
$newOrder->save();
} else if ($order->volume_remain == 0) {
MarketRegionOrder::where([
'order_id' => $order->order_id,
])->delete();
} else {
MarketRegionOrder::where([
'order_id' => $order->order_id,
])->update([
'region_id' => $this->region,
'duration' => $order->duration,
'is_buy_order' => $order->is_buy_order,
'issued' => $order->issued,
'location_id' => $order->location_id,
'min_volume' => $order->min_volume,
'order_id' => $order->order_id,
'price' => $order->price,
'range' => $order->range,
'system_id' => $order->system_id,
'type_id' => $order->type_id,
'volume_remain' => $order->volume_remain,
'volume_total' => $order->volume_total,
]);
}
}
}
}

View File

@@ -1,18 +1,14 @@
<?php
namespace App\Jobs\Commands\Eve;
namespace App\Jobs;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Log;
//Library
use App\Library\Moons\MoonCalc;
class ItemPricesUpdateJob implements ShouldQueue
class PurgeMarketRegionOrderJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
@@ -33,8 +29,6 @@ class ItemPricesUpdateJob implements ShouldQueue
*/
public function handle()
{
$moonHelper = new MoonCalc;
$moonHelper->FetchNewPrices();
//
}
}

View File

@@ -98,7 +98,7 @@ class SendMoonRentalPaymentReminderJob implements ShouldQueue
}
//Put the price for the moons
$body .= "The price for next month's rent is " . number_format($cost, 0, ".", ",") . "<br>";
$body .= "Rental Payment is due on the 1st of the month. If the rental payment is not remitted to Spatial Forces by the 3rd of the month, the rental claim shall be forfeited.<br>";
$body .= "Rental Payment is due on the 1st of the month should you continue to want to rent the moons.<br>";
$body .= "Rental Payment should be transferred to Spatial Forces.<br>";
$body .= "In the description of the payment please put the following transaction identification: " . $transId . "<br>";
$body .= "<br>";

View File

@@ -94,11 +94,6 @@ class UpdateMoonRentalPrice implements ShouldQueue
'alliance_rental_price' => $rentalPrice['alliance'],
'out_of_alliance_rental_price' => $rentalPrice['outofalliance'],
]);
Log::info('Alliance Rental Moon: ' . $rental->region . ' : ' . $rental->system . ' : ' . $rental->planet . ' : ' . $rental->moon . ' : ' . $rental->structure_name);
Log::info('Total Worth: ' . $totalWorth);
Log::info('Alliance Rental Price: ' . $rentalPrice['alliance']);
Log::info('Out of Alliance Rental Price: ' . $rentalPrice['outofalliance']);
}
}
}

View File

@@ -1,113 +0,0 @@
<?php
namespace App\Jobs\Commands\SupplyChain;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Carbon\Carbon;
use Log;
//Library
use App\Library\Lookups\LookupHelper;
//Models
use App\Models\Contracts\SupplyChainBid;
use App\Models\Contracts\SupplyChainContract;
//Jobs
use App\Jobs\ProcessSendEveMailJob;
class EndSupplyChainContractJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/**
* Timeout in seconds
*
* @var int
*/
public $timeout = 1200;
/**
* Retries
*
* @var int
*/
public $retries = 3;
/**
* Private Variables
*/
private $contractId;
private $issuerId;
private $issuerName;
private $title;
private $endDate;
private $deliveryBy;
private $body;
private $state;
private $finalCost;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct(SupplyChainContract $contract)
{
//Set the queue connection up
$this->connection = 'redis';
//Set the variables
$contractId = $contract->contract_id;
$issuerId = $contract->issuer_id;
$issuerName = $contract->issuer_name;
$title = $contract->title;
$endDate = $contract->end_date;
$deliveryBy = $contract->delivery_by;
$body = $contract->body;
$state = $contract->state;
$finalCost = $contract->final_cost;
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
//Declare variables
$bidId = null;
$bidAmount = null;
//Get all of the bids from the contract
$bids = SupplyChainBids::where([
'contract_id' => $contractId,
])->get();
//Loop through the bids and find the lowest bid
foreach($bids as $bid) {
if($bidId == null) {
$bidId = $bid->id;
$bidAmount = $bid->bid_amount;
} else {
if($bid->bid_amount < $bidAmount) {
$bidId = $bid->id;
$bidAmount = $bid->bid_amount;
}
}
}
//Clean up the bids and update the contract with the winning bid
SupplyChainContract::where([
'contract_id' => $this->contractId,
])->update([
'final_cost' => $bidAmount,
'winning_bid_id' => $bidId,
]);
}
}

View File

@@ -12,7 +12,6 @@ use DB;
use Carbon\Carbon;
use GuzzleHttp\Exception\GuzzleException;
use GuzzleHttp\Client;
use Log;
//Models
use App\Models\Moon\Config;
@@ -21,14 +20,8 @@ use App\Models\Moon\RentalMoon;
use App\Models\Moon\OrePrice;
use App\Models\Moon\MineralPrice;
/**
* MoonCalc Library
*/
class MoonCalc {
/**
* Get the ore composition of an ore
*/
public function GetOreComposition($ore) {
$composition = ItemComposition::where([
'Name' => $ore,
@@ -37,12 +30,10 @@ class MoonCalc {
return $composition;
}
/**
* Calculate the total worth of a moon
*/
public function SpatialMoonsTotalWorth($firstOre, $firstQuan, $secondOre, $secondQuan, $thirdOre, $thirdQuan, $fourthOre, $fourthQuan) {
//Declare variables
$totalPriceMined = 0.00;
//Get the total moon pull in m3
$totalPull = $this->CalculateTotalMoonPull();
//Get the configuration for pricing calculations
$config = DB::table('Config')->get();
@@ -51,29 +42,21 @@ class MoonCalc {
$this->ConvertPercentages($firstPerc, $firstQuan, $secondPerc, $secondQuan, $thirdPerc, $thirdQuan, $fourthPerc, $fourthQuan);
//Calculate the prices from the ores
if($firstOre != 'None') {
$totalPriceMined += $this->CalcMoonPrice($firstOre, $firstPerc);
}
if($secondOre != 'None') {
$totalPriceMined += $this->CalcMoonPrice($secondOre, $secondPerc);
}
if($thirdOre != 'None') {
$totalPriceMined += $this->CalcMoonPrice($thirdOre, $thirdPerc);
}
if($fourthOre != 'None') {
$totalPriceMined += $this->CalcMoonPrice($fourthOre, $fourthPerc);
}
$this->CalculateTotalPrice($firstOre, $firstPerc, $firstTotal);
$this->CalculateTotalPrice($secondOre, $secondPerc, $secondTotal);
$this->CalculateTotalPrice($thirdOre, $thirdPerc, $thirdTotal);
$this->CalculateTotalPrice($fourthOre, $fourthPerc, $fourthTotal);
//Calculate the total to price to be mined in one month
$totalPriceMined = $firstTotal + $secondTotal + $thirdTotal + $fourthTotal;
//Return the rental price to the caller
return $totalPriceMined;
}
/**
* Calculate the rental price
*/
public function SpatialMoons($firstOre, $firstQuan, $secondOre, $secondQuan, $thirdOre, $thirdQuan, $fourthOre, $fourthQuan) {
//Declare variables
$totalPrice = 0.00;
//Get the total moon pull in m3
$totalPull = $this->CalculateTotalMoonPull();
//Get the configuration for pricing calculations
$config = DB::table('Config')->get();
@@ -82,30 +65,22 @@ class MoonCalc {
$this->ConvertPercentages($firstPerc, $firstQuan, $secondPerc, $secondQuan, $thirdPerc, $thirdQuan, $fourthPerc, $fourthQuan);
//Calculate the prices from the ores
if($firstOre != 'None') {
$totalPrice += $this->CalcRentalPrice($firstOre, $firstPerc);
}
if($secondOre != 'None') {
$totalPrice += $this->CalcRentalPrice($secondOre, $secondPerc);
}
if($thirdOre != 'None') {
$totalPrice += $this->CalcRentalPrice($thirdOre, $thirdPerc);
}
if($fourthOre != 'None') {
$totalPrice += $this->CalcRentalPrice($fourthOre, $fourthPerc);
}
$this->CalculateTotalPrice($firstOre, $firstPerc, $firstTotal);
$this->CalculateTotalPrice($secondOre, $secondPerc, $secondTotal);
$this->CalculateTotalPrice($thirdOre, $thirdPerc, $thirdTotal);
$this->CalculateTotalPrice($fourthOre, $fourthPerc, $fourthTotal);
//Calculate the total to price to be mined in one month
$totalPriceMined = $firstTotal + $secondTotal + $thirdTotal + $fourthTotal;
//Calculate the rental price. Refined rate is already included in the price from rental composition
$rentalPrice['alliance'] = $totalPrice * ($config[0]->RentalTax / 100.00);
$rentalPrice['outofalliance'] = $totalPrice * ($config[0]->AllyRentalTax / 100.00);
$rentalPrice['alliance'] = $totalPriceMined * ($config[0]->RentalTax / 100.00);
$rentalPrice['outofalliance'] = $totalPriceMined * ($config[0]->AllyRentalTax / 100.00);
//Return the rental price to the caller
return $rentalPrice;
}
/**
* Fetch new prices for items from the market
*/
public function FetchNewPrices() {
//Create the item id array which we will pull data for from Fuzzwork market api
$ItemIDs = array(
@@ -178,9 +153,6 @@ class MoonCalc {
$this->UpdateItemPricing();
}
/**
* Calculate the ore units
*/
public function CalcOreUnits($ore, $percentage) {
//Specify the total pull amount
$totalPull = 5.55 * (3600.00 * 24.00 *30.00);
@@ -203,9 +175,6 @@ class MoonCalc {
return $units;
}
/**
* Update item pricing after new prices were pulled
*/
private function UpdateItemPricing() {
//Get the configuration from the config table
$config = DB::table('Config')->first();
@@ -219,42 +188,42 @@ class MoonCalc {
$pastTime = Carbon::now()->subDays(30);
//Get the price of the basic minerals
$tritaniumPrice = MineralPrice::where(['ItemId' => 34])->where('Time', '>', $pastTime)->avg('Price');
$pyeritePrice = MineralPrice::where(['ItemId' => 35])->where('Time', '>', $pastTime)->avg('Price');
$mexallonPrice = MineralPrice::where(['ItemId' => 36])->where('Time', '>', $pastTime)->avg('Price');
$isogenPrice = MineralPrice::where(['ItemId' => 37])->where('Time', '>', $pastTime)->avg('Price');
$nocxiumPrice = MineralPrice::where(['ItemId' => 38])->where('Time', '>', $pastTime)->avg('Price');
$zydrinePrice = MineralPrice::where(['ItemId' => 39])->where('Time', '>', $pastTime)->avg('Price');
$megacytePrice = MineralPrice::where(['ItemId' => 40])->where('Time', '>', $pastTime)->avg('Price');
$morphitePrice = MineralPrice::where(['ItemId' => 11399])->where('Time', '>', $pastTime)->avg('Price');
$heliumIsotopesPrice = MineralPrice::where(['ItemId' => 16274])->where('Time', '>', $pastTime)->avg('Price');
$nitrogenIsotopesPrice = MineralPrice::where(['ItemId' => 17888])->where('Time', '>', $pastTime)->avg('Price');
$oxygenIsotopesPrice = MineralPrice::where(['ItemId' => 17887])->where('Time', '>', $pastTime)->avg('Price');
$hydrogenIsotopesPrice = MineralPrice::where(['ItemId' => 17889])->where('Time', '>', $pastTime)->avg('Price');
$liquidOzonePrice = MineralPrice::where(['ItemId' => 16273])->where('Time', '>', $pastTime)->avg('Price');
$heavyWaterPrice = MineralPrice::where(['ItemId' => 16272])->where('Time', '>', $pastTime)->avg('Price');
$strontiumClathratesPrice = MineralPrice::where(['ItemId' => 16275])->where('Time', '>', $pastTime)->avg('Price');
$tritaniumPrice = MineralPrice::where(['ItemId' => 34])->whereDate('Time', '>', $pastTime)->avg('Price');
$pyeritePrice = MineralPrice::where(['ItemId' => 35])->whereDate('Time', '>', $pastTime)->avg('Price');
$mexallonPrice = MineralPrice::where(['ItemId' => 36])->whereDate('Time', '>', $pastTime)->avg('Price');
$isogenPrice = MineralPrice::where(['ItemId' => 37])->whereDate('Time', '>', $pastTime)->avg('Price');
$nocxiumPrice = MineralPrice::where(['ItemId' => 38])->whereDate('Time', '>', $pastTime)->avg('Price');
$zydrinePrice = MineralPrice::where(['ItemId' => 39])->whereDate('Time', '>', $pastTime)->avg('Price');
$megacytePrice = MineralPrice::where(['ItemId' => 40])->whereDate('Time', '>', $pastTime)->avg('Price');
$morphitePrice = MineralPrice::where(['ItemId' => 11399])->whereDate('Time', '>', $pastTime)->avg('Price');
$heliumIsotopesPrice = MineralPrice::where(['ItemId' => 16274])->whereDate('Time', '>', $pastTime)->avg('Price');
$nitrogenIsotopesPrice = MineralPrice::where(['ItemId' => 17888])->whereDate('Time', '>', $pastTime)->avg('Price');
$oxygenIsotopesPrice = MineralPrice::where(['ItemId' => 17887])->whereDate('Time', '>', $pastTime)->avg('Price');
$hydrogenIsotopesPrice = MineralPrice::where(['ItemId' => 17889])->whereDate('Time', '>', $pastTime)->avg('Price');
$liquidOzonePrice = MineralPrice::where(['ItemId' => 16273])->whereDate('Time', '>', $pastTime)->avg('Price');
$heavyWaterPrice = MineralPrice::where(['ItemId' => 16272])->whereDate('Time', '>', $pastTime)->avg('Price');
$strontiumClathratesPrice = MineralPrice::where(['ItemId' => 16275])->whereDate('Time', '>', $pastTime)->avg('Price');
//Get the price of the moongoo
$atmosphericGasesPrice = MineralPrice::where(['ItemId' => 16634])->where('Time', '>', $pastTime)->avg('Price');
$evaporiteDepositsPirce = MineralPrice::where(['ItemId' => 16635])->where('Time', '>', $pastTime)->avg('Price');
$hydrocarbonsPrice = MineralPrice::where(['ItemId' => 16633])->where('Time', '>', $pastTime)->avg('Price');
$silicatesPrice = MineralPrice::where(['ItemId' => 16636])->where('Time', '>', $pastTime)->avg('Price');
$cobaltPrice = MineralPrice::where(['ItemId' => 16640])->where('Time', '>', $pastTime)->avg('Price');
$scandiumPrice = MineralPrice::where(['ItemId' => 16639])->where('Time', '>', $pastTime)->avg('Price');
$titaniumPrice = MineralPrice::where(['ItemId' => 16638])->where('Time', '>', $pastTime)->avg('Price');
$tungstenPrice = MineralPrice::where(['ItemId' => 16637])->where('Time', '>', $pastTime)->avg('Price');
$cadmiumPrice = MineralPrice::where(['ItemId' => 16643])->where('Time', '>', $pastTime)->avg('Price');
$platinumPrice = MineralPrice::where(['ItemId' => 16644])->where('Time', '>', $pastTime)->avg('Price');
$vanadiumPrice = MineralPrice::where(['ItemId' => 16642])->where('Time', '>', $pastTime)->avg('Price');
$chromiumPrice = MineralPrice::where(['ItemId' => 16641])->where('Time', '>', $pastTime)->avg('Price');
$technetiumPrice = MineralPrice::where(['ItemId' => 16649])->where('Time', '>', $pastTime)->avg('Price');
$hafniumPrice = MineralPrice::where(['ItemId' => 16648])->where('Time', '>', $pastTime)->avg('Price');
$caesiumPrice = MineralPrice::where(['ItemId' => 16647])->where('Time', '>', $pastTime)->avg('Price');
$mercuryPrice = MineralPrice::where(['ItemId' => 16646])->where('Time', '>', $pastTime)->avg('Price');
$dysprosiumPrice = MineralPrice::where(['ItemId' => 16650])->where('Time', '>', $pastTime)->avg('Price');
$neodymiumPrice = MineralPrice::where(['ItemId' => 16651])->where('Time', '>', $pastTime)->avg('Price');
$promethiumPrice = MineralPrice::where(['ItemId' => 16652])->where('Time', '>', $pastTime)->avg('Price');
$thuliumPrice = MineralPrice::where(['ItemId' => 16653])->where('Time', '>', $pastTime)->avg('Price');
$atmosphericGasesPrice = MineralPrice::where(['ItemId' => 16634])->whereDate('Time', '>', $pastTime)->avg('Price');
$evaporiteDepositsPirce = MineralPrice::where(['ItemId' => 16635])->whereDate('Time', '>', $pastTime)->avg('Price');
$hydrocarbonsPrice = MineralPrice::where(['ItemId' => 16633])->whereDate('Time', '>', $pastTime)->avg('Price');
$silicatesPrice = MineralPrice::where(['ItemId' => 16636])->whereDate('Time', '>', $pastTime)->avg('Price');
$cobaltPrice = MineralPrice::where(['ItemId' => 16640])->whereDate('Time', '>', $pastTime)->avg('Price');
$scandiumPrice = MineralPrice::where(['ItemId' => 16639])->whereDate('Time', '>', $pastTime)->avg('Price');
$titaniumPrice = MineralPrice::where(['ItemId' => 16638])->whereDate('Time', '>', $pastTime)->avg('Price');
$tungstenPrice = MineralPrice::where(['ItemId' => 16637])->whereDate('Time', '>', $pastTime)->avg('Price');
$cadmiumPrice = MineralPrice::where(['ItemId' => 16643])->whereDate('Time', '>', $pastTime)->avg('Price');
$platinumPrice = MineralPrice::where(['ItemId' => 16644])->whereDate('Time', '>', $pastTime)->avg('Price');
$vanadiumPrice = MineralPrice::where(['ItemId' => 16642])->whereDate('Time', '>', $pastTime)->avg('Price');
$chromiumPrice = MineralPrice::where(['ItemId' => 16641])->whereDate('Time', '>', $pastTime)->avg('Price');
$technetiumPrice = MineralPrice::where(['ItemId' => 16649])->whereDate('Time', '>', $pastTime)->avg('Price');
$hafniumPrice = MineralPrice::where(['ItemId' => 16648])->whereDate('Time', '>', $pastTime)->avg('Price');
$caesiumPrice = MineralPrice::where(['ItemId' => 16647])->whereDate('Time', '>', $pastTime)->avg('Price');
$mercuryPrice = MineralPrice::where(['ItemId' => 16646])->whereDate('Time', '>', $pastTime)->avg('Price');
$dysprosiumPrice = MineralPrice::where(['ItemId' => 16650])->whereDate('Time', '>', $pastTime)->avg('Price');
$neodymiumPrice = MineralPrice::where(['ItemId' => 16651])->whereDate('Time', '>', $pastTime)->avg('Price');
$promethiumPrice = MineralPrice::where(['ItemId' => 16652])->whereDate('Time', '>', $pastTime)->avg('Price');
$thuliumPrice = MineralPrice::where(['ItemId' => 16653])->whereDate('Time', '>', $pastTime)->avg('Price');
//Get the item compositions
$items = DB::select('SELECT Name,ItemId FROM ItemComposition');
@@ -333,31 +302,18 @@ class MoonCalc {
}
}
/**
* Calculate the total amount pulled from a moon
*/
private function CalculateTotalMoonPull() {
//Always assume a 1 month pull which equates to 5.55m3 per second or 2,592,000 seconds
//Total pull size is 14,385,600 m3
$totalPull = 5.55 * 3600.00 * 24.00 *30.00;
$totalPull = 5.55 * (3600.00 * 24.00 *30.00);
//Return the total pull
return $totalPull;
}
/**
* Calculate the rental price of a moon ore from the moon
*/
private function CalcRentalPrice($ore, $percentage) {
private function CalcPrice($ore, $percentage) {
//Specify the total pull amount
$totalPull = $this->CalculateTotalMoonPull();
//Setup the total value at 0.00
$totalPrice = 0.00;
//Check to see what type of moon goo the moon is
$gasMoonOre = $this->IsGasMoonGoo($ore);
//Find the size of the asteroid from the database
$m3Size = DB::table('ItemComposition')->where('Name', $ore)->value('m3Size');
@@ -370,78 +326,18 @@ class MoonCalc {
//Look up the unit price from the database
$unitPrice = DB::table('ore_prices')->where('Name', $ore)->value('UnitPrice');
//If the ore is a gas ore, then take only 50% of the price.
if($gasMoonOre == true) {
$totalPrice = $units * ($unitPrice / 2.00);
Log::warning('Found gas ore: ' . $totalPrice);
} else {
$totalPrice = $units * $unitPrice;
}
//Return the total
return $totalPrice;
}
/**
* Calculate the moon's total price
*/
private function CalcMoonPrice($ore, $percentage) {
//Specify the total pull amount
$totalPull = $this->CalculateTotalMoonPull();
//Setup the total value at 0.00
$totalPrice = 0.00;
//Find the size of the asteroid from the database
$m3Size = DB::table('ItemComposition')->where('Name', $ore)->value('m3Size');
//Calculate the actual m3 from the total pull amount in m3 using the percentage of the ingredient
$actualm3 = floor($percentage * $totalPull);
//Calculate the units once we have the size and actual m3 value
$units = floor($actualm3 / $m3Size);
//Look up the unit price from the database
$unitPrice = DB::table('ore_prices')->where('Name', $ore)->value('UnitPrice');
//Calculate the total amount from the units and the unit price.
$totalPrice = $units * $unitPrice;
//Calculate the total amount from the units and unit price
$total = $units * $unitPrice;
//Return the value
return $totalPrice;
return $total;
}
/**
* Convert a number to a percentage
*/
private function ConvertToPercentage($quantity) {
//Perform the calculation and return the data
return $quantity / 100.00;
}
/**
* Return if a type of ore is a gas moon goo
*/
private function IsGasMoonGoo($ore) {
$ores = [
'Zeolites' => 'Gas',
'Sylvite' => 'Gas',
'Bitumens' => 'Gas',
'Coesite' => 'Gas',
];
foreach($ores as $key => $value) {
if(strtolower($key) == strtolower($ore)) {
return $value;
}
}
return false;
}
/**
* Return the type of ore a particular moon ore is.
*/
private function IsRMoonGoo($ore) {
$ores = [
'Zeolites' => 'Gas',
@@ -466,44 +362,6 @@ class MoonCalc {
'Ytterbite' => 'R64',
];
foreach($ores as $key => $value) {
if(strtolower($key) == strtolower($ore)) {
return $value;
}
}
//Return false if the ore is not found in an array
return false;
}
/**
* Return true if a moon ore is a moon ore, and false
* if the ore is not a moon ore.
*/
private function IsRMoonOre($ore) {
$ores = [
'Zeolites' => 'Gas',
'Sylvite' => 'Gas',
'Bitumens' => 'Gas',
'Coesite' => 'Gas',
'Cobaltite' => 'R8',
'Euxenite' => 'R8',
'Titanite' => 'R8',
'Scheelite' => 'R8',
'Otavite' => 'R16',
'Sperrylite' => 'R16',
'Vanadinite' => 'R16',
'Chromite' => 'R16',
'Carnotite' => 'R32',
'Zircon' => 'R32',
'Pollucite' => 'R32',
'Cinnabar' => 'R32',
'Xenotime' => 'R64',
'Monazite' => 'R64',
'Loparite' => 'R64',
'Ytterbite' => 'R64',
];
foreach($ores as $key => $value) {
if(strtolower($key) == strtolower($ore)) {
@@ -514,9 +372,44 @@ class MoonCalc {
return false;
}
/**
* Convert percentages from quantities into a normalized percentage
*/
private function IsRMoon($ore) {
$ores = [
'Prime Arkonor' => 'Null',
'Cubic Bistot' => 'Null',
'Pellucid Crokite' => 'Null',
'Jet Ochre' => 'Null',
'Zeolites' => 'Gas',
'Sylvite' => 'Gas',
'Bitumens' => 'Gas',
'Coesite' => 'Gas',
'Cobaltite' => 'R8',
'Euxenite' => 'R8',
'Titanite' => 'R8',
'Scheelite' => 'R8',
'Otavite' => 'R16',
'Sperrylite' => 'R16',
'Vanadinite' => 'R16',
'Chromite' => 'R16',
'Carnotite' => 'R32',
'Zircon' => 'R32',
'Pollucite' => 'R32',
'Cinnabar' => 'R32',
'Xenotime' => 'R64',
'Monazite' => 'R64',
'Loparite' => 'R64',
'Ytterbite' => 'R64',
];
foreach($ores as $key => $value) {
if(strtolower($key) == strtolower($ore)) {
return true;
}
}
return false;
}
private function ConvertPercentages(&$firstPerc, $firstQuan, &$secondPerc, $secondQuan, &$thirdPerc, $thirdQuan, &$fourthPerc, $fourthQuan) {
//Set the base percentages for the if statements
$firstPerc = 0.00;
@@ -576,4 +469,16 @@ class MoonCalc {
}
}
}
/**
* Calculate the total price, then pass it by reference to the calling function
*/
private function CalculateTotalPrice($ore, $perc, &$total) {
//Calculate the prices from the ores
if($ore != 'None') {
$total = $this->CalcPrice($ore, $perc);
} else {
$total = 0.00;
}
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Models\Contracts;
use Illuminate\Database\Eloquent\Model;
class AcceptedBid extends Model
{
// Table Name
public $table = 'accepted_bids';
//Timestamps
public $timestamps = true;
/**
* The attributes that are mass assignable
*
* @var array
*/
protected $fillable = [
'contract_id',
'bid_id',
'bid_amount',
'notes',
];
public function Contract() {
return $this->belongsTo(Contract::class);
}
}

View File

@@ -0,0 +1,39 @@
<?php
namespace App\Models\Contracts;
use Illuminate\Database\Eloquent\Model;
class Bid extends Model
{
// Table Name
public $table = 'contract_bids';
// Timestamps
public $timestamps = true;
/**
* The attributes that are mass assignable
*
* @var array
*/
protected $fillable = [
'contract_id',
'bid_amount',
'character_name',
'character_id',
'corporation_name',
'corporation_id',
'notes',
];
protected $guarded = [];
public function ContractId() {
return $this->hasOne('App\Models\Contracts\Contract', 'id', 'contract_id');
}
public function Contract() {
return $this->belongsTo(Contract::class);
}
}

View File

@@ -0,0 +1,38 @@
<?php
namespace App\Models\Contracts;
use Illuminate\Database\Eloquent\Model;
class Contract extends Model
{
// Table Name
public $table = 'contracts';
// Timestamps
public $timestamps = true;
/**
* The attributes that are mass assignable
*
* @var array
*/
protected $fillable = [
'title',
'type',
'end_date',
'body',
'final_cost',
'finished',
];
//One-to-Many relationship for the bids on a contract
public function Bids() {
return $this->hasMany('App\Models\Contracts\Bid', 'contract_id', 'id');
}
//One-to-One relationship for the accepted bid.
public function AcceptedBid() {
return $this->hasOne('App\Models\Contracts\AcceptedBid', 'contract_id', 'id');
}
}

View File

@@ -1,43 +0,0 @@
<?php
namespace App\Models\Contracts;
use Illuminate\Database\Eloquent\Model;
class SupplyChainBid extends Model
{
//Table Name
public $table = 'supply_chain_bids';
// Timestamps
public $timestamps = true;
/**
* The attributes that are mass assignable
*
* @var array
*/
protected $fillable = [
'contract_id',
'bid_amount',
'entity_id',
'entity_name',
'entity_type',
'bid_type',
'bid_note',
];
//Relationships
public function ContractId() {
return $this->hasOne('App\Models\Contracts\SupplyChainContract', 'contract_id', 'contract_id');
}
public function Contract() {
return $this->belongsTo(SupplyChainContract::class);
}
//Model functions
public function getContractId() {
return $this->contract_id;
}
}

View File

@@ -1,37 +0,0 @@
<?php
namespace App\Models\Contracts;
use Illuminate\Database\Eloquent\Model;
class SupplyChainContract extends Model
{
//Table Name
public $table = 'supply_chain_contracts';
//Timestamps
public $timestamps = true;
/**
* The attributes that are mass assignable
*
* @var array
*/
protected $fillable = [
'issuer_id',
'issuer_name',
'title',
'end_date',
'delivery_by',
'body',
'state',
'final_cost',
];
//Relationship
public function Bids() {
return $this->hasMany('App\Models\Contracts\SupplyChainBid', 'contract_id', 'id');
}
}

View File

@@ -0,0 +1,43 @@
<?php
namespace App\Models\PublicContracts;
use Illuminate\Database\Eloquent\Model;
class PublicContract extends Model
{
//Table Name
protected $table = 'public_contracts';
//Timestamps
public $timestamps = false;
/**
* Items which are mass assignable
*
* @var array
*/
protected $fillable = [
'region_id',
'buyout',
'collateral',
'contract_id',
'date_expired',
'date_issued',
'days_to_complete',
'end_location_id',
'for_corporation',
'issuer_corporation_id',
'issuer_id',
'price',
'reward',
'start_location_id',
'title',
'type',
'volume',
];
public function items() {
return $this->hasMany('App\Models\PublicContracts\PublicContractItem', 'contract_id', 'contract_id');
}
}

View File

@@ -0,0 +1,36 @@
<?php
namespace App\Models\PublicContracts;
use Illuminate\Database\Eloquent\Model;
class PublicContractItem extends Model
{
//Table Name
protected $table = 'public_contract_items';
//Timestamps
public $timestamps = true;
/**
* Items which are mass assignable
*
* @var array
*/
protected $fillable = [
'contract_id',
'is_blueprint_copy',
'is_included',
'item_id',
'material_efficency',
'quantity',
'record_id',
'runs',
'time_efficiency',
'type_id',
];
public function contract() {
return $this->hasOne('App\Models\PublicContracts\PublicContract', 'contract_id', 'contract_id');
}
}

View File

@@ -1,34 +0,0 @@
<?php
namespace App\Models\SystemRentals;
use Illuminate\Database\Eloquent\Model;
class RentalSystem extends Model
{
/**
* Table Name
*/
public $table = 'alliance_rental_systems';
/**
* Timestamps
*/
public $timestamps = true;
/**
* The attributes that are mass assignable
*
* @var array
*/
protected $fillable = [
'contact_id',
'contact_name',
'corporation_id',
'corporation_name',
'system_id',
'system_name',
'rental_cost',
'paid_until',
];
}

View File

@@ -10,8 +10,8 @@
"eveseat/eseye": "^1.1",
"fideloper/proxy": "^4.0",
"guzzlehttp/guzzle": "^6.3",
"khill/lavacharts": "^3.1.14",
"laravel/framework": "^5.8",
"khill/lavacharts": "3.1.*",
"laravel/framework": "5.8.*",
"laravel/horizon": "^3.1",
"laravel/socialite": "^3.1",
"laravel/tinker": "^1.0",

1456
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -27,7 +27,6 @@ class CreateFlexStructuresTable extends Migration
'Cyno Beacon',
'Jump Bridge',
'Super Construction Facilities',
'Market',
]);
$table->double('structure_cost', 20, 2);
$table->dateTime('paid_until');

View File

@@ -1,82 +0,0 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateNewContractsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//Remove this group of tables
Schema::dropIfExists('eve_regions');
Schema::dropIfExists('public_contracts');
Schema::dropIfExists('public_contract_items');
Schema::dropIfExists('market_region_orders');
Schema::dropIfExists('market_groups');
Schema::dropIfExists('market_prices');
Schema::dropIfExists('contracts');
Schema::dropIfExists('contract_bids');
Schema::dropIfExists('accepted_bids');
//Add these new tables for the contracts
if(!Schema::hasTable('supply_chain_contracts')) {
Schema::create('supply_chain_contracts', function(Blueprint $table) {
$table->increments('contract_id')->unique();
$table->unsignedBigInteger('issuer_id');
$table->string('issuer_name');
$table->string('title');
$table->dateTime('end_date');
$table->dateTime('delivery_by');
$table->text('body')->nullable();
$table->enum('state', [
'open',
'closed',
'completed',
]);
$table->unsignedInteger('bids')->default(0);
$table->decimal('final_cost', 20, 2)->default(0.00);
$table->unsignedInteger('winning_bid_id')->default(0);
$table->timestamps();
});
}
if(!Schema::hasTable('supply_chain_bids')) {
Schema::create('supply_chain_bids', function(Blueprint $table) {
$table->increments('bid_id')->unique();
$table->unsignedBigInteger('contract_id');
$table->decimal('bid_amount', 20, 2)->default(0.00);
$table->unsignedBigInteger('entity_id');
$table->string('entity_name')->nullable();
$table->enum('entity_type', [
'character',
'corporation',
'alliance',
]);
$table->enum('bid_type', [
'accepted',
'pending',
'not_accepted',
]);
$table->text('bid_note');
$table->timestamps();
});
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('supply_chain_contract');
Schema::dropIfExists('supply_chain_bids');
}
}

View File

@@ -1,35 +0,0 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateEveMailTemplateTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
if(!Schema::hasTable('eve_mail_template')) {
Schema::create('eve_mail_template', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('subject');
$table->text('body');
$table->timestamps();
});
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('eve_mail_template');
}
}

View File

@@ -1,29 +0,0 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class RemoveWormholeTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::dropIfExists('alliance_wormholes');
Schema::dropIfExists('wormhole_types');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@@ -1,41 +0,0 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateRentalRecordsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
if(!Schema::hasTable('alliance_rental_systems')) {
Schema::create('alliance_rental_systems', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('contact_id');
$table->string('contact_name');
$table->unsignedBigInteger('corporation_id');
$table->string('corporation_name');
$table->unsignedBigInteger('system_id');
$table->string('system_name');
$table->double('rental_cost', 20, 2);
$table->dateTime('paid_until');
$table->timestamps();
});
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('alliance_rental_systems');
}
}

View File

@@ -1,45 +0,0 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class ModifyBlackListTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
if(Schema::hasTable('alliance_blacklist')) {
Schema::table('alliance_blacklist', function(Blueprint $table) {
$table->enum('validity', [
'Valid',
'Invalid',
])->default('Valid');
$table->string('removed_by_id')->nullable();
$table->string('removed_by_name')->nullable();
$table->string('removed_notes')->nullable();
});
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('alliance_blacklist', function(Blueprint $table) {
$table->dropColumn([
'validity',
'removed_by_id',
'removed_by_name',
'removed_notes',
]);
});
}
}

File diff suppressed because one or more lines are too long

26
package-lock.json generated
View File

@@ -3822,7 +3822,8 @@
"ansi-regex": {
"version": "2.1.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"aproba": {
"version": "1.2.0",
@@ -4031,12 +4032,14 @@
"minimist": {
"version": "0.0.8",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"minipass": {
"version": "2.3.5",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"safe-buffer": "^5.1.2",
"yallist": "^3.0.0"
@@ -4055,6 +4058,7 @@
"version": "0.5.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"minimist": "0.0.8"
}
@@ -4234,7 +4238,8 @@
"safe-buffer": {
"version": "5.1.2",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"safer-buffer": {
"version": "2.1.2",
@@ -4290,6 +4295,7 @@
"version": "3.0.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"ansi-regex": "^2.0.0"
}
@@ -4333,12 +4339,14 @@
"wrappy": {
"version": "1.0.2",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"yallist": {
"version": "3.0.3",
"bundled": true,
"dev": true
"dev": true,
"optional": true
}
}
},
@@ -7219,7 +7227,7 @@
},
"readable-stream": {
"version": "2.3.6",
"resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz",
"integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==",
"dev": true,
"requires": {
@@ -9193,9 +9201,9 @@
}
},
"websocket-extensions": {
"version": "0.1.3",
"resolved": "https://registry.npmjs.org/websocket-extensions/-/websocket-extensions-0.1.3.tgz",
"integrity": "sha512-nqHUnMXmBzT0w570r2JpJxfiSD1IzoI+HGVdd3aZ0yNi3ngvQ4jv1dtHt5VGxfI2yj5yqImPhOK4vmIh2xMbGg==",
"version": "0.1.4",
"resolved": "https://registry.npmjs.org/websocket-extensions/-/websocket-extensions-0.1.4.tgz",
"integrity": "sha512-OqedPIGOfsDlo31UNwYbCFMSaO9m9G/0faIHj5/dZFDMFqPTcx6UwqyOy3COEaEOg/9VsGIpdqn62W5KhoKSpg==",
"dev": true
},
"which": {

View File

@@ -15,7 +15,7 @@
</div>
<div class="form-group">
{{ Form::label('allowedEntityType', 'Allowed Entity Type') }}
{{ Form::select('allowedEntityType', ['Corporation' => 'Corporation', 'Alliance' => 'Alliance'], null, ['class' => 'form-control']) }}
{{ Form::select('allowedEtntityType', ['Corporation' => 'Corporation', 'Alliance' => 'Alliance'], null, ['class' => 'form-control']) }}
</div>
<div class="form-group">
{{ Form::label('allowedEntityName', 'Allowed Entity Name') }}

View File

@@ -21,35 +21,24 @@
<div class="card-body">
{{ Form::open(['action' => 'Dashboard\AdminController@addPermission', 'method' => 'POST']) }}
<div class="form-group">
{{ Form::hidden('user', $user->character_id) }}
{{ Form::hidden('user', $user->name) }}
{{ Form::select('permission', $permissions, 'None', ['class' => 'form-control']) }}
{{ Form::hidden('type', 'addPermission') }}
</div>
<div class="form-group col-md-2">
{{ Form::submit('Add Permission', ['class' => 'btn btn-primary']) }}
</div>
{!! Form::close() !!}
</div>
</div>
</div>
</div>
<div class="col">
<div class="card">
<div class="card-header">
<h2>Modify Role</h2>
</div>
<div class="card-body">
<div class="container">
<h2>Current Role: {{ $role }}</h2>
</div>
{{ Form::open(['action' => 'Dashboard\AdminController@modifyRole', 'method' => 'POST']) }}
<div class="form-group">
{{ Form::hidden('user', $user->character_id) }}
{{ Form::select('role', $roles, 'None', ['class' => 'form-control']) }}
{{ Form::hidden('type', 'modifyRole') }}
</div>
<div class="form-group col-md-2">
{{ Form::submit('Modify Role', ['class' => 'btn btn-primary']) }}
</div>
{!! Form::close() !!}
</div>
</div>
</div>

View File

@@ -6,10 +6,6 @@
{{ Form::label('name', 'Entity Name') }}
{{ Form::text('name', '', ['class' => 'form-control', 'placeholder' => 'CCP Antiquarian']) }}
</div>
<div class="form-group">
{{ Form::label('notes', 'Notes') }}
{{ Form::textarea('notes', '', ['class' => 'form-control']) }}
</div>
{{ Form::submit('Submit', ['class' => 'btn btn-primary']) }}
{!! Form::close() !!}
</div>

View File

@@ -0,0 +1,67 @@
@extends('layouts.admin.b4')
@section('content')
<div class="container">
<div class="row justify-content-center">
<h2>Contract Dashboard</h2>
</div>
</div>
<br>
<div class="container">
<div class="row justify-content-center">
<a href="/contracts/admin/new" class="btn btn-primary" role="button">Create New Contract</a>
</div>
</div>
<br>
@if(count($contracts))
@foreach($contracts as $contract)
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">
<div class="row">
<div class="col-sm" align="left">
{{ $contract['title'] }}
</div>
<div class="col-sm" align="center">
Type: {{ $contract['type'] }}
</div>
<div class="col-sm" align="right">
<a href="/contracts/admin/delete/{{ $contract['contract_id'] }}" class="btn btn-primary" role="button">Delete Contract</a>
<br><br>
<a href="/contracts/admin/end/{{ $contract['contract_id'] }}" class="btn btn-primary" role="button">End Contract</a>
</div>
</div>
</div>
<div class="card-body">
<div class="container">
End Date: {{ $contract['end_date'] }}
</div>
<span class="border-dark">
<div class="container">
{!! $contract['body'] !!}
</div>
</span>
</div>
</div>
</div>
</div>
</div>
<br>
@endforeach
@else
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">
No Contracts Issued
</div>
<div class="card-body">
</div>
</div>
</div>
</div>
</div>
@endif
@endsection

View File

@@ -1,52 +1,54 @@
@extends('layouts.user.dashb4')
@extends('layouts.admin.b4')
@section('content')
<div class="container">
<h2>Supply Chain Contract Completion</h2>
<h2>Contract End</h2>
</div>
<br>
<div class="container">
<div class="row justify-content-center">
<div class="col-md-10">
<div class="col-md-12">
<div class="card">
<!-- Card Header display Contract Information -->
<div class="card-header">
<table class="table table-striped table-bordered">
<!-- Card Header display the supply chain contract information -->
<table class="table table-striped">
<thead>
<th>Supply Chain Contract Id</th>
<th>Contract Id</th>
<th>Contract Type</th>
<th>Title</th>
<th>End Date</th>
<th>Delivery Date</th>
<th>Description</th>
</thead>
<tbody>
<tr>
<td>{{ $contract['contract_id'] }}</td>
<td>{{ $contract['type'] }}</td>
<td>{{ $contract['title'] }}</td>
<td>{{ $contract['end_date'] }}</td>
<td>{{ $contract['delivery_by'] }}</td>
<td>{{ $contract['body'] }}</td>
</tr>
</tbody>
</table>
</div>
<!-- Card Body display all of the bids and allows for selection of the bid for the supply chain contract -->
<!-- Card Body displays all of the bids and allows for selection of which bid to accept -->
<div class="card-body">
<table class="table table-striped table-bordered">
<table class="table table-striped">
<thead>
<th>Bid Amount</th>
<th>Entity</th>
<th>Character Name</th>
<th>Corporation Name</th>
<th>Notes</th>
<th>Accept?</th>
</thead>
<tbody>
{!! Form::open(['action' => 'Contracts\SupplyChainController@storeEndSupplyChainContract']) !!}
{!! Form::open(['action' => 'Contracts\ContractAdminController@storeEndContract', 'method' => 'POST']) !!}
{{ Form::hidden('contract_id', $contract['contract_id']) }}
@foreach($bids as $bid)
<tr>
<td>{{ $bid['amount'] }}</td>
<td>{{ $bid['name'] }}</td>
<td>{{ $bid['bid_amount'] }}</td>
<td>{{ $bid['character_name'] }}</td>
<td>{{ $bid['corporation_name'] }}</td>
<td><pre>{{ $bid['notes'] }}</pre></td>
<td>{{ Form::radio('accept', $bid['id'], false, ['class' => 'form-control']) }}
<td>{{ Form::radio('accept', $bid['id'], false, ['class' => 'form-control']) }}</td>
</tr>
@endforeach
</tbody>
@@ -58,5 +60,4 @@
</div>
</div>
</div>
@endforeach
@endsection

View File

@@ -0,0 +1,45 @@
@extends('layouts.admin.b4')
@section('content')
<div class="container">
<div class="row justify-content-center">
<h2>Create New Contract</h2>
</div>
</div>
<br>
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">
New Contracts
</div>
<div class="card-body">
{!! Form::open(['action' => 'Contracts\ContractAdminController@storeNewContract', 'method' => 'POST']) !!}
<div class="form-group">
{{ Form::label('name', 'Contract Name') }}
{{ Form::text('name', '', ['class' => 'form-control', 'placeholder' => 'Some Name']) }}
</div>
<div class="form-group">
{{ Form::label('body', 'Description') }}
{{ Form::textarea('body', '', ['class' => 'form-control']) }}
</div>
<div class="form-group">
{{ Form::label('date', 'End Date') }}
{{ Form::date('date', \Carbon\Carbon::now()->addWeek(), ['class' => 'form-control', 'placeholder' => '4/24/2019']) }}
</div>
<div class="form-group">
{{ Form::label('type', 'Public Contract') }}
{{ Form::radio('type', 'Public', true) }}
</div>
<div class="form-group">
{{ Form::label('type', 'Private Contract') }}
{{ Form::radio('type', 'Private', false) }}
</div>
{{ Form::submit('Submit', ['class' => 'btn btn-primary']) }}
{!! Form::close() !!}
</div>
</div>
</div>
</div>
</div>
@endsection

View File

@@ -2,13 +2,13 @@
@section('content')
<div class="container">
<div class="row justify-content-center">
<h2>Past Supply Chain Contracts</h2>
<h2>All Contracts</h2>
</div>
</div>
<br>
@if(count($contracts))
@include('supplychain.includes.contracts')
@include('contracts.includes.all')
@else
@include('supplychain.includes.nocontracts')
@include('contracts.includes.nocontracts')
@endif
@endsection

View File

@@ -14,11 +14,15 @@
Enter Bid
</div>
<div class="card-body">
{!! Form::open(['action' => 'Contracts\SupplyChainController@storeSupplyChainContractBid', 'method' => 'POST']) !!}
{!! Form::open(['action' => 'Contracts\ContractController@storeBid', 'method' => 'POST']) !!}
<div class="form-group">
{{ Form::label('bid', 'Bid') }}
{{ Form::text('bid', '', ['class' => 'form-control', 'placeholder' => '0.00']) }}
{{ Form::text('bid', '', ['class' => 'form-control', 'placeholder' => '1.0']) }}
{{ Form::hidden('contract_id', $contractId) }}
{{ Form::label('suffix', 'M') }}
{{ Form::radio('suffix', 'M', false) }}
{{ Form::label('suffix', 'B') }}
{{ Form::radio('suffix', 'B', false) }}
</div>
<div class="form-group">
{{ Form::label('notes', 'Notes') }}
@@ -31,4 +35,5 @@
</div>
</div>
</div>
@endsection

View File

@@ -0,0 +1,72 @@
@foreach($contracts as $contract)
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">
<div class="row">
<div class="col-sm" align="left">
{{ $contract['title'] }}
</div>
<div class="col-sm" align="center">
Type: {{ $contract['type'] }}
</div>
<div class="col-sm" align="right">
<a href="/contracts/display/newbid/{{ $contract['contract_id'] }}" class="btn btn-primary" role="button">Bid on Contract</a>
</div>
</div>
</div>
<div class="card-body">
<div class="container">
End Date: {{ $contract['end_date'] }}
</div>
<span class="border-dark">
<div class="container">
{!! $contract['body'] !!}
</div>
</span>
<hr>
<!-- Count the number of bids for the current contract -->
@if($contract['bid_count'] > 0)
<span class="border-dark">
@if($contract['type'] == 'Public')
<table class="table table-striped">
<thead>
<th>Corporation / Character</th>
<th>Amount</th>
<th></th>
</thead>
<tbody>
@foreach($contract['bids'] as $bid)
<tr>
<td>{{ $bid['corporation_name'] }} : {{ $bid['character_name'] }}</td>
<td>{{ number_format($bid['bid_amount'], 2, '.', ',') }}</td>
@if(auth()->user()->character_id == $bid['character_id'])
<td>
<a href="/contracts/modify/bid/{{ $bid['id'] }}" class="btn btn-primary" role="button">Modify Bid</a>
<a href="/contracts/delete/bid/{{ $bid['id'] }}" class="btn btn-primary" role="button">Delete Bid</a>
</td>
@else
<td></td>
@endif
</tr>
@endforeach
</tbody>
</table>
@else
@foreach($contract['bids'] as $bid)
@if(auth()->user()->character_id == $bid['character_id'])
<a href="/contracts/modify/bid/{{ $bid['id'] }}" class="btn btn-primary" role="button">Modify Bid</a>
<a href="/contracts/delete/bid/{{ $bid['id'] }}" class="btn btn-primary" role="button">Delete Bid</a>
@endif
@endforeach
@endif
</span>
@endif
</div>
</div>
</div>
</div>
</div>
<br>
@endforeach

View File

@@ -0,0 +1,27 @@
<table class="table table-striped">
<thead>
<th>Corporation</th>
<th>Amount</th>
</thead>
<tbody>
@foreach($data['bids'] as $bid)
<tr>
<td>{{ $bid['corporation_name'] }}</td>
<td>{{ $bid['bid_amount'] }}</td>
@if(auth()->user()->character_id == $bid['character_id'])
{{ Form::open(['action' => 'Contracts\ContractController@displayModifyBid', 'method' => 'POST']) }}
{{ Form::hidden('id', $bid['id']) }}
{{ Form::hidden('contract_id', $bid['contract_id']) }}
{{ Form::submit('Modify Bid', ['class' => 'btn btn-primary']) }}
{!! Form::close() !!}
{{ Form::open(['action' => 'Contracts\ContractController@deleteBid', 'method' => 'POST']) }}
{{ Form::hidden('id', $bid['id']) }}
{{ Form::hidden('contract_id', $bid['contract_id']) }}
{{ Form::submit('Delete Bid', ['class' => 'btn btn-primary']) }}
{!! Form::close() !!}
@endif
</tr>
@endforeach
</tbody>
</table>

View File

@@ -0,0 +1,13 @@
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">
No Contracts Issued
</div>
<div class="card-body">
</div>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,51 @@
@foreach($contracts as $contract)
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">
<div class="row">
<div class="col-sm" align="left">
{{ $contract['title'] }}
</div>
<div class="col-sm" align="center">
Type: Private
</div>
<div class="col-sm" align="right">
<a href="/contracts/display/newbid/{{ $contract['contract_id'] }}" class="btn btn-primary" role="button">Bid on Contract</a>
</div>
</div>
</div>
<div class="card-body">
<div class="container">
End Date: {{ $contract['end_date'] }}
</div>
<hr>
<div class="container">
<pre>
{!! $contract['body'] !!}
</pre>
</div>
<hr>
<div class="container">
@if($contract['lowestbid'] == 'No Bids Placed.')
No Bids Placed.<br>
@else
Lowest Bid: {{ number_format($contract['lowestbid'], 2, '.', ',') }}<br>
@endif
</div>
<hr>
@foreach($contract['bids'] as $bid)
@if(auth()->user()->character_id == $bid['character_id'])
Your Bid: {{ number_format($bid['bid_amount'], 2, '.', ',') }}<br>
<a href="/contracts/modify/bid/{{ $bid['id'] }}" class="btn btn-primary" role="button">Modify Bid</a>
<a href="/contracts/delete/bid/{{ $bid['id'] }}" class="btn btn-primary" role="button">Delete Bid</a>
@endif
@endforeach
</div>
</div>
</div>
</div>
</div>
<br>
@endforeach

View File

@@ -0,0 +1,72 @@
@foreach($contracts as $contract)
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">
<div class="row">
<div class="col-sm" align="left">
{{ $contract['title'] }}
</div>
<hr>
<div class="col-sm" align="center">
Type: Public
</div>
<hr>
<div class="col-sm" align="right">
<a href="/contracts/display/newbid/{{ $contract['contract_id'] }}" class="btn btn-primary" role="button">Bid on Contract</a>
</div>
</div>
</div>
<div class="card-body">
<div class="container">
End Date: {{ $contract['end_date'] }}
</div>
<hr>
<div class="container">
{!! $contract['body'] !!}
</div>
<hr>
<div class="container">
@if($contract['lowestbid'] == 'No Bids Placed.')
No Bids Placed.<br>
No Corproation has placed a bid.<br>
@else
Lowest Bid: {{ number_format($contract['lowestbid'], 2, '.', ',') }}<br>
Lowest Bid Corp: {{ $contract['lowestcorp'] }}<br>
@endif
</div>
<hr>
<!-- Count the number of bids for the current contract -->
@if($contract['bid_count'] > 0)
<table class="table table-striped">
<thead>
<th>Corporation / Character</th>
<th>Amount</th>
<th></th>
</thead>
<tbody>
@foreach($contract['bids'] as $bid)
<tr>
<td>{{ $bid['corporation_name'] }} : {{ $bid['character_name'] }}</td>
<td>{{ number_format($bid['bid_amount'], 2, '.', ',') }}</td>
@if(auth()->user()->character_id == $bid['character_id'])
<td>
<a href="/contracts/modify/bid/{{ $bid['id'] }}" class="btn btn-primary" role="button">Modify Bid</a>
<a href="/contracts/delete/bid/{{ $bid['id'] }}" class="btn btn-primary" role="button">Delete Bid</a>
</td>
@else
<td></td>
@endif
</tr>
@endforeach
</tbody>
</table>
@endif
</div>
</div>
</div>
</div>
</div>
<br>
@endforeach

View File

@@ -0,0 +1,39 @@
@extends('layouts.user.dashb4')
@section('content')
<div class="container">
<div class="row justify-content-center">
<h2>Modify Bid</h2>
</div>
</div>
<br>
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">
{{ $contract['title'] }}
</div>
<div class="card-body">
Type: {{ $contract['type'] }}<br>
End Date: {{ $contract['end_date'] }}<br>
Description: {{ $contract['body'] }}<br>
{!! Form::open(['action' => 'Contracts\ContractController@modifyBid', 'method' => 'POST']) !!}
<div class="form-group">
{{ Form::label('bid', 'Bid') }}
{{ Form::text('bid', '', ['class' => 'form-control', 'placeholder' => '1.0']) }}
{{ Form::label('suffix', 'M') }}
{{ Form::radio('suffix', 'M', false) }}
{{ Form::label('suffix', 'B') }}
{{ Form::radio('suffix', 'B', false) }}
{{ Form::hidden('type', $contract['type']) }}
{{ Form::hidden('contract_id', $contract['contract_id']) }}
</div>
{{ Form::submit('Modify Bid', ['class' => 'btn btn-primary']) }}
{!! Form::close() !!}
</div>
</div>
</div>
</div>
</div>
@endsection

View File

@@ -0,0 +1,14 @@
@extends('layouts.user.dashb4')
@section('content')
<div class="container">
<div class="row justify-content-center">
<h2>Private Contracts</h2>
</div>
</div>
<br>
@if(count($contracts))
@include('contracts.includes.private')
@else
@include('contracts.includes.nocontracts')
@endif
@endsection

View File

@@ -0,0 +1,14 @@
@extends('layouts.user.dashb4')
@section('content')
<div class="container">
<div class="row justify-content-center">
<h2>Public Contracts</h2>
</div>
</div>
<br>
@if(count($contracts))
@include('contracts.includes.public')
@else
@include('contracts.includes.nocontracts')
@endif
@endsection

View File

@@ -26,7 +26,6 @@
'Cyno Beacon' => 'Cyno Beacon',
'Jump Bridge' => 'Jump Bridge',
'Super Construction Facilities' => 'Super Construction Facilities',
'Market' => 'Market',
], 'None', ['class' => 'form-control']) }}
</div>
<div class="form-group">

View File

@@ -17,6 +17,7 @@
<th>Paid Until</th>
<th>Update</th>
<th>Remove?</th>
<th> </th>
</thead>
<tbody>
@foreach($structures as $structure)
@@ -41,10 +42,13 @@
</td>
<td>
{!! Form::open(['action' => 'Flex\FlexAdminController@removeFlexStructure', 'method' => 'POST']) !!}
{{ Form::radio('remove', 'Yes', false, ['class' => 'form-control']) }}
{{ Form::hidden('structure_type', $structure->structure_type) }}
{{ Form::hidden('requestor_id', $structure->requestor_id) }}
{{ Form::hidden('requestor_corp_id', $structure->requestor_corp_id) }}
{{ Form::hidden('system_id', $structure->system_id) }}
</td>
<td>
{{ Form::submit('Remove', ['class' => 'btn btn-danger']) }}
{!! Form::close() !!}
</td>

View File

@@ -29,9 +29,9 @@
<!-- SRP Admin -->
@include('layouts.admin.sidebarmenu.srp')
<!-- End SRP Admin -->
<!-- System Rental Admin -->
@include('layouts.admin.sidebarmenu.rentalsystem')
<!-- End System Rental Admin -->
<!-- Contract Admin -->
@include('layouts.admin.sidebarmenu.contract')
<!-- End Contract Admin -->
</ul>
</nav>
<!-- /.sidebar-menu -->

View File

@@ -21,12 +21,6 @@
<p>New Contract</p>
</a>
</li>
<li class="nav-item">
<a href="/contracts/admin/past" class="nav-link">
<i class="far fa-circle nav-icon"></i>
<p>Past Contracts</p>
</a>
</li>
</ul>
</li>
@endif

View File

@@ -1,27 +0,0 @@
<!-- System Rentals -->
@if(auth()->user()->hasRole('Admin'))
<li class="nav-item has-treeview">
<a href="#" class="nav-link">
<i class="nav-icon fas fa-tachometer-alt"></i>
<p>
System Rental<br>
<i class="right fas fa-angle-left"></i>
</p>
</a>
<ul class="nav nav-treeview">
<li class="nav-item">
<a href="/system/rental/dashboard" class="nav-link">
<i class="far fa-circle nav-icon"></i>
<p>Display</p>
</a>
</li>
<li class="nav-item">
<a href="/system/rental/add" class="nav-link">
<i class="far fa-circle nav-icon"></i>
<p>Add</p>
</a>
</li>
</u>
</li>
@endif
<!-- End System Rentals -->

View File

@@ -205,7 +205,7 @@
</a>
</li>
@endif
@if(auth()->user()->isMoonRenter() || auth()->user()->hasPermission('rentalmoon.viewer'))
@if(auth()->user()->isMoonRenter())
<li class="nav-item">
<a href="/moons/ledger/display/rentals" class="nav-link">
<i class="far fa-circle nav-icon"></i>
@@ -319,7 +319,7 @@
<p>Search</p>
</a>
</li>
@if(auth()->user()->hasPermission('blacklist.admin'))
@if(auth()->user()->hasPermission('alliance.recruiter'))
<li class="nav-item">
<a href="/blacklist/display/add" class="nav-link">
<i class="far fa-circle nav-icon"></i>

View File

@@ -1,7 +1,5 @@
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Included Messages -->
@include('inc.messages')
<!-- Main content -->
<div class="content">
@yield('content')

View File

@@ -18,7 +18,7 @@
<p>Search</p>
</a>
</li>
@if(auth()->user()->hasPermission('blacklist.admin'))
@if(auth()->user()->hasPermission('alliance.recruiter'))
<li class="nav-item">
<a href="/blacklist/display/add" class="nav-link">
<i class="far fa-circle nav-icon"></i>

View File

@@ -2,27 +2,27 @@
<li class="nav-item has-treeview">
<a href="#" class="nav-link">
<i class="nav-icon fas fa-file-contract"></i>
<p>Supply Chain<br>
<p>Contracts<br>
<i class="right fas fa-angle-left"></i>
</p>
</a>
<ul class="nav nav-treeview">
<li class="nav-item">
<a href="/supplychain/dashboard" class="nav-link">
<a href="/contracts/display/all" class="nav-link">
<i class="far fa-circle nav-icon"></i>
<p>Dashboard</p>
<p>Display All Contracts</p>
</a>
</li>
<li class="nav-item">
<a href="/supplychain/my/dashboard" class="nav-link">
<a href="/contracts/display/public" class="nav-link">
<i class="far fa-circle nav-icon"></i>
<p>My Dashboard</p>
<p>Display Public Contracts</p>
</a>
</li>
<li class="nav-item">
<a href="/supplychain/display/bids" class="nav-link">
<a href="/contracts/display/private" class="nav-link">
<i class="far fa-circle nav-icon"></i>
<p>Display Bids</p>
<p>Display Private Contracts</p>
</a>
</li>
</ul>

View File

@@ -30,5 +30,17 @@
<p>Buyback Program</p>
</a>
</li>
<li class="nav-item">
<a href="/wormholes/display" class="nav-link">
<i class="far fa-circle nav-icon"></i>
<p>Wormholes</p>
</a>
</li>
<li class="nav-item">
<a href="/wormholes/form" class="nav-link">
<i class="far fa-circle nav-icon"></i>
<p>Wormhole Form</p>
</a>
</li>
</ul>
</li>

View File

@@ -20,12 +20,6 @@
<p>Display Rental Moons</p>
</a>
</li>
<li class="nav-item">
<a href="/moons/display/rental/request" class="nav-link">
<i class="far fa-circle nav-icon"></i>
<p>Request Rental Moon</p>
</a>
</li>
<li class="nav-item">
<a href="/moons/display/form/worth" class="nav-link">
<i class="far fa-circle nav-icon"></i>
@@ -48,7 +42,7 @@
</a>
</li>
@endif
@if(auth()->user()->isMoonRenter() || auth()->user()->hasPermission('rentalmoon.viewer') || auth()->user()->hasRole('Admin'))
@if(auth()->user()->isMoonRenter())
<li class="nav-item">
<a href="/moons/ledger/display/rentals" class="nav-link">
<i class="far fa-circle nav-icon"></i>

View File

@@ -52,7 +52,7 @@
<div class="card-body">
<table class="table table-striped">
<tbody>
<tr class="table-primary">
<tr class="table-success">
<td>Moon Available</td>
</tr>
<tr class="table-danger">

View File

@@ -1,23 +0,0 @@
@extends('layous.admin.b4')
@section('content')
<div class="container">
<div class="card">
<div class="card-header">
<h2>Set Rental Moons for Alliance</h2>
</div>
<div class="card-body">
{!! Form::open(['action' => 'Moons\MoonsAdminController@storeRentalMoonForAlliance', 'method' => 'POST']) !!}
<div class="form-group">
{{ Form::label('moon', 'Moon') }}
{{ Form::select('moon', $moons, ['class' => 'form-control']) }}
</div>
<div class="form-group">
{{ Form::label('until', 'End Date') }}
{{ Form::date('until', \Carbon\Carbon::now()->endOfMonth(), ['class' => 'form-control']) }}
</div>
{{ Form::submit('Submit', ['class' => 'btn btn-primary']) }}
{!! Form::close() !!}
</div>
</div>
</div>
@endsection

View File

@@ -21,7 +21,6 @@
'B-S347' => 'B-S347',
'B9E-H6' => 'B9E-H6',
'CJNF-J' => 'CJNF-J',
'DY-P7Q' => 'DY-P7Q',
'E8-YS9' => 'E8-YS9',
'EA-HSA' => 'EA-HSA',
'FYI-49' => 'FYI-49',

View File

@@ -1,13 +0,0 @@
@extends('layouts.user.dashb4')
@section('content')
<div class="container">
<div class="card">
<div class="card-header">
<h2>Request Rental Moon</h2>
</div>
<div class="card-body">
Send an in game mail to Rock Onzo about requesting a rental moon.
</div>
</div>
</div>
@endsection

View File

@@ -1,35 +0,0 @@
@extends('layouts.admin.b4')
@section('content')
<div class="container">
<div class="card">
<div class="card-header">
<h2>New Rental Contract</h2>
</div>
<div class="card-body">
{!! Form::open(['action' => 'SystemRentals\RentalAdminController@addRentalSystem', 'method' => 'POST']) !!}
<div class="form-group">
{{ Form::label('contact_name', 'Contact Name') }}
{{ Form::text('contact_name', '', ['class' => 'form-control']) }}
</div>
<div class="form-group">
{{ Form::label('contact_corp_name', 'Corporation Name') }}
{{ Form::text('contact_corp_name', '', ['class' => 'form-control']) }}
</div>
<div class="form-group">
{{ Form::label('system', 'System') }}
{{ Form::text('system', '', ['class' => 'form-control']) }}
</div>
<div class="form-group">
{{ Form::label('rental_cost', 'Rental Cost') }}
{{ Form::text('rental_cost', '', ['class' => 'form-control']) }}
</div>
<div class="form-group">
{{ Form::label('paid_until', 'Paid Until') }}
{{ Form::date('paid_until', \Carbon\Carbon::now()->addMonth(), ['class' => 'form-control']) }}
</div>
{{ Form::submit('Add Rental', ['class' => 'btn btn-primary']) }}
{!! Form::close() !!}
</div>
</div>
</div>
@endsection

View File

@@ -1,56 +0,0 @@
@extends('layouts.admin.b4')
@section('content')
<br>
<div class="container">
<div class="card">
<div class="card-header">
<h2>Rental Systems</h2>
</div>
<div class="card-body">
<table class="table table-bordered table-striped">
<thead>
<th>Contact</th>
<th>Corporation</th>
<th>System</th>
<th>Cost</th>
<th>Paid Until</th>
<th>Update</th>
<th>Remove?</th>
<th> </th>
</thead>
<tbody>
@foreach($rentals as $rental)
<tr>
<td>{{ $rental->contact_name }}</td>
<td>{{ $rental->corporation_name }}</td>
<td>{{ $rental->system_name }}</td>
<td>{{ $rental->rental_cost }}</td>
<td>{{ $rental->paid_until }}</td>
<td>
{!! Form::open(['action' => 'SystemRentals\RentalAdminController@updateRentalSystem', 'method' => 'POST']) !!}
{{ Form::date('paid_until', \Carbon\Carbon::now()->endOfMonth(), ['class' => 'form-control']) }}
{{ Form::hidden('contact_id', $rental->contact_id) }}
{{ Form::hidden('corporation_id', $rental->corporation_id) }}
{{ Form::hidden('system_id', $rental->system_id) }}
{{ Form::submit('Update', ['class' => 'btn btn-primary']) }}
{!! Form::close() !!}
</td>
<td>
{!! Form::open(['action' => 'SystemRentals\RentalAdminController@removeRentalSystem', 'method' => 'POST']) !!}
{{ Form::radio('remove', 'Yes', false, ['class' => 'form-control']) }}
{{ Form::hidden('contact_id', $rental->contact_id) }}
{{ Form::hidden('corporation_id', $rental->corporation_id) }}
{{ Form::hidden('system_id', $rental->system_id) }}
</td>
<td>
{{ Form::submit('Remove', ['class' => 'btn btn-danger']) }}
{!! Form::close() !!}
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
@endsection

View File

@@ -18,11 +18,11 @@
</div>
<div class="form-group">
{{ Form::label('structure_size', 'Structure Size') }}
{{ Form::select('structure_size', ['M' => 'M', 'L' => 'L', 'XL' => 'XL'], null, ['class' => 'form-control']) }}
{{ Form::select('structure_size', ['M', 'L', 'XL'], null, ['class' => 'form-control']) }}
</div>
<div class="form-group">
{{ Form::label('structure_type', 'Structure Type') }}
{{ Form::select('structure_type', ['Citadel' => 'Citadel', 'Refinery' => 'Refinery', 'Engineering' => 'Engineering', 'Flex' => 'Flex'], null, ['class' => 'form-control']) }}
{{ Form::select('structure_type', ['Flex', 'Citadel', 'Refinery', 'Engineering'], null, ['class' => 'form-control']) }}
</div>
<div class="form-group">
{{ Form::label('requested_drop_time', 'Requested Drop Time') }}

View File

@@ -1,43 +0,0 @@
@extends('layouts.user.dashb4')
@section('content')
<div class="container">
<div class="row justify-content-center">
<h2>Personal Bids on Contracts</h2>
</div>
</div>
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
@if($bidsCount > 0)
@foreach($bids as $bid)
<div class="card">
<div class="card-header">
<div class="col-md" align="left">
Contract Id: {{ $bid['contract_id'] }}<br>
Contract Title: {{ $bid['title'] }}<br>
Issuer: {{ $bid['issuer_name'] }}<br>
</div>
<div class="col-md" align="right">
<a href="/supplychain/delete/bid/{{ $bid['contract_id'] }}/{{ $bid['bid_id'] }} "><button type="button" class="btn btn-danger">Delete Bid</button></a>
</div>
</div>
<div class="card-body">
Bid Id: {{ $bid['bid_id'] }}<br>
Bid Amount: {{ $bid['bid_amount'] }}<br>
</div>
</div>
@endforeach
@else
<div class="card">
<div class="card-header">
<h2>No Bids on Open Contracts</h2>
</div>
<div class="card-body">
<h3> </h3>
</div>
</div>
@endif
</div>
</div>
</div>
@endsection

View File

@@ -1,56 +0,0 @@
@extends('layouts.user.dashb4')
@section('content')
<div class="container">
<div class="row justify-content-center">
<h2>Supply Chain Contracts</h2>
</div>
<br>
<div class="row justify-content-center">
<div class="btn toolbar" role="toolbar" aria-label="Toolbar">
<div class="btn-group mr-2" role="group" aria-label="Create">
<a class="btn btn-primary" href="/supplychain/contracts/new" role="button">Create Contract</a>
</div>
<div class="btn-group mr-2" role="group" aria-label="Delete">
<a class="btn btn-danger" href="/supplychain/contracts/delete" role="button">Delete Contract</a>
</div>
</div>
</div>
</div>
<br>
@if(count($openContracts))
@include('supplychain.includes.opencontracts')
@else
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">
<h2>No Open Supply Chain Contracts</h2>
</div>
<div class="card-body">
</div>
</div>
</div>
</div>
</div>
@endif
@if(count($closedContracts))
@include('supplychain.includes.closedcontracts')
@else
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">
<h2>No Closed Supply Chain Contracts</h2>
</div>
<div class="card-body">
</div>
</div>
</div>
</div>
</div>
@endif
@endsection

View File

@@ -1,35 +0,0 @@
@extends('layouts.user.dashb4')
@section('content')
<!-- Delete a contract the user has created -->
<div class="container">
<div class="row justify-content-center">
@if(count($contracts) > 0)
@foreach($contracts as $contract)
<div class="card">
<div class="card-header">
<h2>{{ $contract['title'] }}</h2>
</div>
<div class="card-body">
{!! $contract['body'] !!}<br>
{!! Form::open(['action' => 'Contracts\SupplyChainController@deleteSupplyChainContract', 'method' => 'POST']) !!}
{{ Form::hidden('contractId', $contract['contract_id']) }}
{{ Form::submit('Delete', ['class' => 'btn btn-danger']) }}
{!! Form::close() !!}
</div>
</div>
@endforeach
@else
<div class="card">
<div class="card-header">
<h2>User currently has no supply chain contracts open.</h2>
</div>
<div class="card-body">
<div class="container">
</div>
</div>
</div>
@endif
</div>
</div>
@endsection

View File

@@ -1,4 +0,0 @@
@extends('layouts.user.dashb4')
@section('content')
@endsection

View File

@@ -1,25 +0,0 @@
@extends('layouts.user.dashb4')
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">
Modify Bid
</div>
<div class="card-body">
{!! Form::open(['action' => 'Contracts\SupplyChainController@storeModifyBid', 'method' => 'POST']) !!}
<div class="form-group">
{{ Form::hidden('bid_id', $bidId) }}
{{ Form::hidden('contract_id', $contractId) }}
{{ Form::label('bid_amount', 'Bid Amount') }}
{{ Form::text('bid_amount', '', ['class' => 'form-control']) }}
</div>
{{ Form::submit('Submit', ['class' => 'btn btn-primary']) }}
{!! Form::close() !!}
</div>
</div>
</div>
</div>
</div>
@endsection

View File

@@ -1,41 +0,0 @@
@extends('layouts.user.dashb4')
@section('content')
<div class="container">
<div class="row justify-content-center">
<h2>Create New Supply Chain Contract</h2>
</div>
</div>
<br>
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">
Enter New Supply Chain Contract Information
</div>
<div class="card-body">
{!! Form::open(['action' => 'Contracts\SupplyChainController@storeNewSupplyChainContract', 'method' => 'POST']) !!}
<div class="form-group">
{{ Form::label('name', 'Contract Name') }}
{{ Form::text('name', '', ['class' => 'form-control', 'placeholder' => 'Supply Chain Contract Name']) }}
</div>
<div class="form-group">
{{ Form::label('body', 'Contract Items') }}
{{ Form::textarea('body', '', ['class' => 'form-control', 'placeholder' => 'Enter description.']) }}
</div>
<div class="form-group">
{{ Form::label('date', 'End Date') }}
{{ Form::date('date', \Carbon\Carbon::now()->addWeek(), ['class' => 'form-control']) }}
</div>
<div class="form-group">
{{ Form::label('delivery', 'Delivery Date') }}
{{ Form::date('delivery', \Carbon\Carbon::now()->addWeeks(2), ['class' => 'form-control']) }}
</div>
{{ Form::submit('Submit', ['class' => 'btn btn-primary']) }}
{!! Form::close() !!}
</div>
</div>
</div>
</div>
</div>
@endsection

View File

@@ -1,44 +0,0 @@
@foreach($closedContracts as $contract)
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">
<div class="row">
<div class="col-sm" align="left">
{{ $contract['title'] }}
</div>
<div class="col-sm" align="right">
{!! Form::open(['action' => 'Contracts\SupplyChainController@displaySupplyChainContractBid', 'method' => 'POST']) !!}
{{ Form::hidden('contract_id', $contract['contract_id'], ['class' => 'form-control']) }}
{{ Form::submit('Bid', ['class' => 'btn btn-primary']) }}
{!! Form::close() !!}
</div>
</div>
</div>
<div class="card-body">
<div class="container">
Delivery Date: {{ $contract['delivery_by'] }}<br>
End Date: {{ $contract['end_date'] }}<br>
</div>
<span class="border-dark">
<div class="container">
{!! $contract['body'] !!}
</div>
</span>
<hr>
<!-- If there is more than one bid display the lowest bid, and the number of bids -->
@if($contract['bid_count'] > 0)
<span class="border-dark">
<table class="table table-striped">
{{ $contract['lowest_bid']['name'] }}<br>
{{ $contract['lowest_bid']['amount'] }}<br>
</table>
</span>
@endif
</div>
</div>
</div>
</div>
</div>
@endforeach

View File

@@ -1,41 +0,0 @@
@foreach($openContracts as $contract)
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">
<div class="row">
<div class="col-sm" align="left">
{{ $contract['title'] }}
</div>
<div class="col-sm" align="right">
<a href="/supplychain/display/newbid/{{ $contract['contract_id'] }}"><button type="button" class="btn btn-primary">Bid</button></a>
</div>
</div>
</div>
<div class="card-body">
<div class="container">
Delivery Date: {{ $contract['delivery_by'] }}<br>
End Date: {{ $contract['end_date'] }}<br>
</div>
<span class="border-dark">
<div class="container">
{!! $contract['body'] !!}
</div>
</span>
<hr>
<!-- If there is more than one bid display the lowest bid, and the number of bids -->
@if($contract['bid_count'] > 0)
<span class="border-dark">
<table class="table table-striped">
{{ $contract['lowest_bid']['name'] }}<br>
{{ $contract['lowest_bid']['amount'] }}<br>
</table>
</span>
@endif
</div>
</div>
</div>
</div>
</div>
@endforeach

View File

@@ -0,0 +1,41 @@
@extends('layouts.user.dashb4')
@section('content')
<div class="container">
<table class="table table-striped table-bordered">
<thead>
<th>System</th>
<th>Sig ID</th>
<th>Duration Left</th>
<th>Scan Time</th>
<th>WH Class</th>
<th>Hole Size</th>
<th>Stability</th>
<th>Mass Allowed</th>
<th>Individual Mass</th>
<th>Regeneration</th>
<th>Max Stable Time</th>
<th>Details</th>
<th>Link</th>
</thead>
<tbody>
@foreach($wormholes as $wormhole)
<tr>
<td>{{ $wormhole->system }}</td>
<td>{{ $wormhole->sig_id }}</td>
<td>{{ $wormhole->duration_left }}</td>
<td>{{ $wormhole->dateTime }}</td>
<td>{{ $wormhole->class }}</td>
<td>{{ $wormhole->hole_size }}</td>
<td>{{ $wormhole->stability }}</td>
<td>{{ $wormhole->mass_allowed }}</td>
<td>{{ $wormhole->individual_mass }}</td>
<td>{{ $wormhole->regeneration }}</td>
<td>{{ $wormhole->max_stable_time }}</td>
<td>{{ $wormhole->details }}</td>
<td>{{ $wormhole->link }}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@endsection

View File

@@ -0,0 +1,53 @@
@extends('layouts.user.dashb4')
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="card">
<div class="card-header">
<h2>Enter Wormhole Info</h2>
</div>
<div class="card-body">
{!! Form::open(['action' => 'Wormholes\WormholeController@storeWormhole', 'method' => 'POST']) !!}
<div class="form-group">
{{ Form::label('system', 'System') }}
{{ Form::text('system', '', ['class' => 'form-control']) }}
</div>
<div class="form-group">
{{ Form::label('sig', 'Sig ID') }}
{{ Form::text('sig', '', ['class' => 'form-control', 'placeholder' => 'XXX-XXX']) }}
</div>
<div class="form-group">
{{ Form::label('duration', 'Duration Left') }}
{{ Form::select('duration', $duration, null, ['class' => 'form-control']) }}
</div>
<div class="form-group">
{{ Form::label('dateTime', 'Date Scanned') }}
{{ Form::date('dateTime', \Carbon\Carbon::now(), ['class' => 'form-control']) }}
</div>
<div class="form-group">
{{ Form::label('class', 'WH Class') }}
{{ Form::select('class', $class, null, ['class' => 'form-control']) }}
</div>
<div class="form-group">
{{ Form::label('size', 'WH Size') }}
{{ Form::select('size', $size, null, ['class' => 'form-control']) }}
</div>
<div class="form-group">
{{ Form::label('stability', 'Stability') }}
{{ Form::select('stability', $stability, null, ['class' => 'form-control']) }}
</div>
<div class="form-group">
{{ Form::label('points', 'Points of Interest') }}
{{ Form::textarea('points', null, ['class' => 'form-control']) }}
</div>
<div class="form-group">
{{ Form::label('link', 'WH Link') }}
{{ Form::text('link', null, ['class' => 'form-control']) }}
</div>
</div>
{{ Form::submit('Submit', ['class' => 'btn btn-primary']) }}
{!! Form::close() !!}
</div>
</div>
</div>
@endsection

View File

@@ -37,9 +37,9 @@ Route::group(['middleware' => ['auth']], function(){
Route::post('/admin/add/role', 'Dashboard\AdminController@addRole');
Route::post('/admin/remove/role', 'Dashboard\AdminController@removeRole');
Route::post('/admin/add/permission', 'Dashboard\AdminController@addPermission');
Route::post('/admin/modify/role', 'Dashboard\AdminController@modifyRole');
Route::post('/admin/remove/user', 'Dashboard\AdminController@removeUser');
Route::post('/admin/modify/user/display', 'Dashboard\AdminController@displayModifyUser');
Route::post('/admin/modify/user', 'Dashboard\AdminController@modifyUser');
Route::post('/admin/add/allowedlogin', 'Dashboard\AdminController@addAllowedLogin');
Route::post('/admin/rmoeve/allowedlogin', 'Dashboard\AdminController@removeAllowedLogin');
Route::get('/admin/dashboard/journal', 'Dashboard\AdminController@showJournalEntries');
@@ -64,6 +64,19 @@ Route::group(['middleware' => ['auth']], function(){
Route::post('/blacklist/remove', 'Blacklist\BlacklistController@RemoveFromBlacklist');
Route::post('/blacklist/search', 'Blacklist\BlacklistController@SearchInBlacklist');
/**
* Contract Controller display pages
*/
Route::get('/contracts/display/all', 'Contracts\ContractController@displayContracts');
Route::get('/contracts/display/public', 'Contracts\ContractController@displayPublicContracts');
Route::get('/contracts/display/private', 'Contracts\ContractController@displayPrivateContracts');
Route::get('/contracts/display/newbid/{id}', 'Contracts\ContractController@displayNewBid');
Route::get('/contracts/modify/bid/{id}', 'Contracts\ContractController@displayModifyBid');
Route::get('/contracts/display/bids/{id}', 'Contracts\ContractController@displayBids');
Route::get('/contracts/delete/bid/{id}', 'Contracts\ContractController@deleteBid');
Route::post('/contracts/modify/bid', 'Contracts\ContractController@modifyBid');
Route::post('/contracts/bids/store', 'Contracts\ContractController@storeBid');
/**
* Contract Admin Controller display pages
*/
@@ -106,7 +119,6 @@ Route::group(['middleware' => ['auth']], function(){
Route::get('/moons/display/all', 'Moons\MoonsController@displayMoons');
Route::get('/moons/display/request', 'Moons\MoonsController@displayRequestAllianceMoon');
Route::post('/moon/display/request', 'Moons\MoonsController@storeRequestAllianceMoon');
Route::get('/moons/display/rental/request', 'Moons\MoonsController@displayRentalMoonPage');
/**
* Moon Admin Controller display pages
@@ -125,15 +137,6 @@ Route::group(['middleware' => ['auth']], function(){
Route::get('/moons/ledger/display/rentals', 'Moons\MoonLedgerController@displayRentalMoonLedger');
Route::get('/moons/ledger/register', 'Moons\MoonLedgerController@registerStructures');
/**
* Moon Rental Controller display pages
*/
Route::get('/rentals/moons/alliance/display', 'Moons\RentalMoonsAdminController@displayAllianceUsageRentalMoons');
Route::get('/rentals/moons/alliance/request', 'Moons\RentalMoonsAdminController@displayRentalMoonForAllianceForm');
Route::post('/rentals/moons/alliance/request', 'Moons\RentalMoonsAdminController@storeREntalMoonForAlliance');
Route::get('/moons/composition/display', 'Moons\RentalMoonsAdminController@displayItemCompositionForm');
Route::post('/moons/composition/display', 'Moons\RentalMoonsAdminController@displayItemCompositionResults');
/**
* Scopes Controller display pages
*/
@@ -173,33 +176,6 @@ Route::group(['middleware' => ['auth']], function(){
Route::get('/structures/display/requests', 'Logistics\StructureRequestAdminController@displayRequests');
Route::post('/structures/display/requests/delete', 'Logistics\StructureRequestAdminController@deleteRequest');
/**
* Supply Chain Contracts Controller display pages
*/
Route::get('/supplychain/dashboard', 'Contracts\SupplyChainController@displaySupplyChainDashboard');
Route::get('/supplychain/my/dashboard', 'Contracts\SupplyChainController@displayMySupplyChainDashboard');
Route::get('/supplychain/contracts/new', 'Contracts\SupplyChainController@displayNewSupplyChainContract');
Route::post('/supplychain/contracts/new', 'Contracts\SupplyChainController@storeNewSupplyChainContract');
Route::get('/supplychain/contracts/delete', 'Contracts\SupplyChainController@displayDeleteSupplyChainContract');
Route::post('/supplychain/contracts/delete', 'Contracts\SupplyChainController@deleteSupplyChainContract');
Route::get('/supplychain/contracts/end', 'Contracts\SupplyChainController@displayEndSupplyChainContract');
Route::post('/supplychain/contracts/end', 'Contracts\SupplyChainController@storeEndSupplyChainContract');
Route::get('/supplychain/display/bids', 'Contracts\SupplyChainController@displaySupplyChainBids');
Route::get('/supplychain/display/newbid/{contract}', 'Contracts\SupplyChainController@displaySupplyChainContractBid');
Route::post('/supplychain/display/newbid', 'Contracts\SupplyChainController@storeSupplyChainContractBid');
Route::get('/supplychain/delete/bid/{contractId}/{bidId}', 'Contracts\SupplyChainController@deleteSupplyChainContractBid');
Route::get('/supplychain/modify/bid', 'Contracts\SupplyChainController@displayModifySupplyChainContractBid');
Route::post('/supplychain/modify/bid', 'Contracts\SupplyChainController@modifySupplyChainContractBid');
/**
* System Rentals Controller display pages
*/
Route::get('/system/rental/dashboard', 'SystemRentals\RentalAdminController@displayRentalSystems');
Route::get('/system/rental/add', 'SystemRentals\RentalAdminController@displayAddRentalSystem');
Route::post('/system/rental/add', 'SystemRentals\RentalAdminController@addRentalSystem');
Route::post('/system/rental/update', 'SystemRentals\RentalAdminController@updateRentalSystem');
Route::post('/system/rental/remove', 'SystemRentals\RentalAdminController@removeRentalSystem');
/**
* Test Controller display pages
*/

View File

@@ -0,0 +1 @@
vendor/

View File

@@ -24,8 +24,8 @@ Suppose you need to pass a callback to a JSON object.
];
?>
<script>
let bar = <?php echo json_encode($array); ?>;
<scrtip>
let bar = <?php echo $json_encode($array); ?>
bar.callback('hello'); //error
</script>
```
@@ -52,8 +52,8 @@ To get around this problem, use `Raw` objects provided by this package:
];
?>
<script>
let bar = <?php echo Encoder::encode($array); ?>;
<scrtip>
let bar = <?php echo Encoder::encode($array); ?>
bar.callback('hello'); //prints hello
</script>
```
@@ -100,7 +100,3 @@ Result:
## License
This package is licensed under GPLv3.
## Download statistics
[![statistics](https://packagist-statistics.dura.hu/balping/json-raw-encoder/10days.svg)](https://packagist-statistics.dura.hu/balping/json-raw-encoder/10days.svg)

1474
vendor/balping/json-raw-encoder/composer.lock generated vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false">
<testsuites>
<testsuite name="Package Test Suite">
<directory suffix=".php">./tests/</directory>
</testsuite>
</testsuites>
</phpunit>

Some files were not shown because too many files have changed in this diff Show More