diff --git a/app/Console/Commands/Flex/FlexStructureCommand.php b/app/Console/Commands/Flex/FlexStructureCommand.php deleted file mode 100644 index cb70a00b9..000000000 --- a/app/Console/Commands/Flex/FlexStructureCommand.php +++ /dev/null @@ -1,129 +0,0 @@ -SetStartStatus(); - - //Create other variables - $body = null; - $delay = 5; - - //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 flex structures - $contacts = FlexStructure::select('requestor_id')->orderBy('requestor_id')->get(); - - //For each of the contacts, send a reminder mail about the total of the structures they are paying for - foreach($contacts as $contact) { - //Get all of the structures for requestor - $structures = FlexStructure::where([ - 'requestor_id' => $contact->requestor_id, - ])->get(); - - //Totalize the total cost of everything - $totalCost = $this->TotalizeCost($structures); - - //Build the body of the mail - $body = "Flex Structure Overhead Cost is due for the following structures:
"; - foreach($structures as $structure) { - - $body .= "System: " . $structure->system . " - " . $structure->structure_type . ": " . $structure->structure_cost . " ISK
"; - } - $body .= "Total Cost: " . number_format($totalCost, 2,".", ","); - $body .= "Please remit payment to Spatial Forces by the 3rd of the month.
"; - $body .= "Sincerely,
"; - $body .= "Warped Intentions Leadership
"; - - //Dispatch the mail job - $subject = "Warped Intentions Flex Structures Payment Due for " . $today->englishMonth; - ProcessSendEveMailJob::dispatch($body, (int)$structure->requestor_id, 'character', $subject, $config['primary'])->onQueue('mail')->delay(Carbon::now()->addSeconds($delay)); - - //Increment the delay for the mail to not hit the rate limits - $delay += 60; - - //After the mail is dispatched, save the sent mail record - $this->SaveSentRecord($config['primary'], $subject, $body, (int)$structure->requestor_id, 'character'); - } - - //Mark the job as finished - $task->SetStopStatus(); - } - - private function TotalizeCost($structures) { - //Declare the total cost - $totalCost = 0.00; - - foreach($structures as $structure) { - $totalCost += $structure->structure_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(); - } -} diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 06f99c741..15c5d2b20 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -38,10 +38,6 @@ class Kernel extends ConsoleKernel */ Commands\Finances\HoldingFinancesCommand::class, Commands\Finances\SovBillsCommand::class, - /** - * Flex Commands - */ - Commands\Flex\FlexStructureCommand::class, /** * Moon Commands */ diff --git a/app/Http/Controllers/Flex/FlexAdminController.php b/app/Http/Controllers/Flex/FlexAdminController.php deleted file mode 100644 index 9aef2ea4f..000000000 --- a/app/Http/Controllers/Flex/FlexAdminController.php +++ /dev/null @@ -1,148 +0,0 @@ -middleware('auth'); - $this->middleware('role:Admin'); - } - - /** - * Function to display all active flex structures and - * the information regarding the flex structure - */ - public function displayFlexStructures() { - //Get the structures from the database - $structures = FlexStructure::all(); - - //Return the view with the data - return view('flex.list')->with('structures', $structures); - } - - /** - * Function to display form for adding new flex structure - */ - public function displayAddFlexStructure() { - return view('flex.add'); - } - - /** - * Function to add new flex structure to the database - */ - public function addFlexStructure(Request $request) { - $this->validate($request, [ - 'requestor_name' => 'required', - 'requestor_corp_name' => 'required', - 'system' => 'required', - 'structure_type' => 'required', - 'structure_cost' => 'required', - ]); - - //Delcare variables and classes - $lookup = new LookupHelper; - - //From the character name find the character id - $charId = $lookup->CharacterNameToId($request->requestor_name); - - //From the corporation name find the corporation id - $corpId = $lookup->CorporationNameToId($request->requestor_corp_name); - - //From the system name find the system id - $systemId = $lookup->SystemNameToId($request->system); - - //Create the database model - $flex = new FlexStructure; - $flex->requestor_id = $charId; - $flex->requestor_name = $request->requestor_name; - $flex->requestor_corp_id = $corpId; - $flex->requestor_corp_name = $request->requestor_corp_name; - $flex->system_id = $systemId; - $flex->system = $request->system; - $flex->structure_type = $request->structure_type; - $flex->structure_cost = $request->structure_cost; - if(isset($request->paid_until)) { - $flex->paid_until = $request->paid_until; - } - $flex->save(); - - return redirect('/flex/display')->with('success', 'Flex Structure Added.'); - } - - /** - * Function to update paid until section of the flex structure in the database - */ - public function updateFlexStructure(Request $request) { - $this->validate($request, [ - 'paid_until' => 'required', - 'requestor_id' => 'required', - 'requestor_corp_id' => 'required', - 'system_id' => 'required', - 'structure_type' => 'required', - ]); - - FlexStructure::where([ - 'requestor_id' => $request->requestor_id, - 'requestor_corp_id' => $request->requestor_corp_id, - 'system_id' => $request->system_id, - 'structure_type' => $request->structure_type, - ])->update([ - 'paid_until' => $request->paid_until, - ]); - - return redirect('/flex/display')->with('success', 'Flex Structure Updated.'); - } - - /** - * Funciton to remove flex structure from the database - */ - public function removeFlexStructure(Request $request) { - $this->validate($request, [ - 'requestor_id' => 'required', - 'requestor_corp_id' => 'required', - 'system_id' => 'required', - '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, - '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.'); - } - - - - - } - -} diff --git a/resources/views/flex/add.blade.php b/resources/views/flex/add.blade.php deleted file mode 100644 index 113398799..000000000 --- a/resources/views/flex/add.blade.php +++ /dev/null @@ -1,41 +0,0 @@ -@extends('layouts.admin.b4') -@section('content') -
-
-
-

New Flex Structure Registration

-
-
- {{ Form::open(['action' => 'Flex\FlexAdminController@addFlexStructure', 'method' => 'POST']) }} -
- {{ Form::label('requestor_name', 'Character Name') }} - {{ Form::text('requestor_name', '', ['class' => 'form-control']) }} -
-
- {{ Form::label('requestor_corp_name', 'Corporation Name') }} - {{ Form::text('requestor_corp_name', '', ['class' => 'form-control']) }} -
-
- {{ Form::label('system', 'System') }} - {{ Form::text('system', '', ['class' => 'form-control']) }} -
-
- {{ Form::label('structure_type', 'Structure Type') }} - {{ Form::select('structure_type', [ - 'Cyno Jammer' => 'Cyno Jammer', - 'Cyno Beacon' => 'Cyno Beacon', - 'Jump Bridge' => 'Jump Bridge', - 'Super Construction Facilities' => 'Super Construction Facilities', - 'Market' => 'Market', - ], 'None', ['class' => 'form-control']) }} -
-
- {{ Form::label('structure_cost', 'Structure Cost') }} - {{ Form::text('structure_cost', '', ['class' => 'form-control']) }} -
- {{ Form::submit('Submit', ['class' => 'btn btn-primary']) }} - {!! Form::close() !!} -
-
-
-@endsection \ No newline at end of file diff --git a/resources/views/flex/list.blade.php b/resources/views/flex/list.blade.php deleted file mode 100644 index ab20226d6..000000000 --- a/resources/views/flex/list.blade.php +++ /dev/null @@ -1,58 +0,0 @@ -@extends('layouts.admin.b4') -@section('content') -
-
-
-
-

Flex Structures

-
-
- - - - - - - - - - - - - @foreach($structures as $structure) - - - - - - - - - - - @endforeach - -
RequestorCorpSystemStructure TypeCostPaid UntilUpdateRemove?
{{ $structure->requestor_name }}{{ $structure->requestor_corp_name }}{{ $structure->system }}{{ $structure->structure_type }}{{ number_format($structure->structure_cost, "2", ".", ",") }} - {{ $structure->paid_until }} - - {!! Form::open(['action' => 'Flex\FlexAdminController@updateFlexStructure', 'method' => 'POST']) !!} - {{ Form::date('paid_until', \Carbon\Carbon::now()->endOfMonth(), ['class' => 'form-control']) }} - {{ Form::hidden('requestor_id', $structure->requestor_id) }} - {{ Form::hidden('requestor_corp_id', $structure->requestor_corp_id) }} - {{ Form::hidden('system_id', $structure->system_id) }} - {{ Form::hidden('structure_type', $structure->structure_type) }} - {{ Form::submit('Update', ['class' => 'btn btn-primary']) }} - {!! Form::close() !!} - - {!! Form::open(['action' => 'Flex\FlexAdminController@removeFlexStructure', 'method' => 'POST']) !!} - {{ 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) }} - {{ Form::submit('Remove', ['class' => 'btn btn-danger']) }} - {!! Form::close() !!} -
-
-
-
-@endsection \ No newline at end of file diff --git a/resources/views/layouts/admin/dashboard/main.blade.php b/resources/views/layouts/admin/dashboard/main.blade.php index 10b8990bb..630c1dd9c 100644 --- a/resources/views/layouts/admin/dashboard/main.blade.php +++ b/resources/views/layouts/admin/dashboard/main.blade.php @@ -20,9 +20,6 @@ @include('layouts.admin.sidebarmenu.general') - - @include('layouts.admin.sidebarmenu.flex') - @include('layouts.admin.sidebarmenu.moon') diff --git a/resources/views/layouts/admin/sidebarmenu/flex.blade.php b/resources/views/layouts/admin/sidebarmenu/flex.blade.php deleted file mode 100644 index 07f122d18..000000000 --- a/resources/views/layouts/admin/sidebarmenu/flex.blade.php +++ /dev/null @@ -1,27 +0,0 @@ - -@if(auth()->user()->hasRole('Admin')) - -@endif - \ No newline at end of file diff --git a/routes/web.php b/routes/web.php index cd9e84cd9..37c3897a8 100644 --- a/routes/web.php +++ b/routes/web.php @@ -71,15 +71,6 @@ Route::group(['middleware' => ['auth']], function(){ Route::post('/dashboard/alt/delete', 'Dashboard\DashboardController@removeAlt'); Route::get('/profile', 'Dashboard\DashboardController@profile'); - /** - * Flex Admin Controller display pages - */ - Route::get('/flex/display', 'Flex\FlexAdminController@displayFlexStructures'); - Route::get('/flex/display/add', 'Flex\FlexAdminController@displayAddFlexStructure'); - Route::post('/flex/display/add', 'Flex\FlexAdminController@addFlexStructure'); - Route::post('/flex/display/remove', 'Flex\FlexAdminController@removeFlexStructure'); - Route::post('/flex/display/update', 'Flex\FlexAdminController@updateFlexStructure'); - /** * Fuel Controller display pages */