From e9adf4fa4bf20955fe4e4053da4334c11f2165fe Mon Sep 17 00:00:00 2001 From: drkthunder02 Date: Sun, 8 Dec 2019 22:58:25 -0600 Subject: [PATCH] remove moon logistics --- .../Moons/MoonsAdminController.php | 76 ------------------- resources/views/layouts/navbar.blade.php | 3 - routes/web.php | 1 - 3 files changed, 80 deletions(-) diff --git a/app/Http/Controllers/Moons/MoonsAdminController.php b/app/Http/Controllers/Moons/MoonsAdminController.php index 44669a82b..1a91f9486 100644 --- a/app/Http/Controllers/Moons/MoonsAdminController.php +++ b/app/Http/Controllers/Moons/MoonsAdminController.php @@ -29,82 +29,6 @@ class MoonsAdminController extends Controller $this->middleware('auth'); } - /** - * Function to display the moons to logistics personnel - */ - public function displayMoonsLogistics() { - $this->middleware('permissions:logistics.manager'); - - $lookup = new LookupHelper; - $rentalEnd = ''; - $ticker = ''; - - //Setup calls to the MoonCalc class - $moonCalc = new MoonCalc(); - //Get all of the moons from the database - $moons = Moon::orderBy('System', 'asc')->get(); - //Declare the html variable and set it to null - $table = array(); - //Set carbon dates as needed - $lastMonth = Carbon::now()->subMonth(); - $today = Carbon::now(); - - foreach($moons as $moon) { - //Get the rental data for the moon - $count = MoonRental::where([ - 'System' => $moon->System, - 'Planet' => $moon->Planet, - 'Moon' => $moon->Moon, - ])->count(); - - //Check if their is a current rental for a moon going on - if($count == 0) { - //If we don't find a rental record, mark the moon as not paid - $paid = 'No'; - - //If we don't find a rental record, set the rental date as last month - $rentalTemp = $lastMonth; - $rentalEnd = $rentalTemp->format('m-d'); - - //Set the ticker info - $ticker = 'N/A'; - } else { - //Get the rental data for the moon - $rental = MoonRental::where([ - 'System' => $moon->System, - 'Planet' => $moon->Planet, - 'Moon' => $moon->Moon, - ])->first(); - - //If we find a rental record, mark the moon as whether it's paid or not - $paid = $rental->Paid; - - //Set the rental date up - $rentalTemp = new Carbon($rental->RentalEnd); - $rentalEnd = $rentalTemp->format('m-d'); - } - - //Set the color for the table - if($rentalTemp->diffInDays($today) < 3 ) { - $color = 'table-warning'; - } else if( $today > $rentalTemp) { - $color = 'table-success'; - } else { - $color = 'table-danger'; - } - - //Add the data to the html string to be passed to the view - array_push($table, [ - 'SPM' => $moon->System . ' - ' . $moon->Planet . ' - ' . $moon->Moon, - 'StructureName' => $moon->StructureName, - 'RentalEnd' => $rentalEnd, - 'RowColor' => $color, - ]); - } - - return view('moons.logistics.adminmoon')->with('table', $table); - } - /** * Function to display the moons to admins */ diff --git a/resources/views/layouts/navbar.blade.php b/resources/views/layouts/navbar.blade.php index 48fd77224..8fc0fb9b7 100644 --- a/resources/views/layouts/navbar.blade.php +++ b/resources/views/layouts/navbar.blade.php @@ -19,9 +19,6 @@ Update Moon Journal @endif - @if(auth()->user()->hasPermission('logistics.manager')) - Moons for Logistics - @endif @endif diff --git a/routes/web.php b/routes/web.php index 8f5ecaf28..8476c5f14 100644 --- a/routes/web.php +++ b/routes/web.php @@ -121,7 +121,6 @@ Route::group(['middleware' => ['auth']], function(){ Route::post('/moons/admin/updatemoon', 'Moons\MoonsAdminController@storeUpdateMoon'); Route::get('/moons/admin/journal', 'Moons\MoonsAdminController@showJournalEntries'); Route::post('/moons/admin/display', 'Moons\MoonsAdminController@storeMoonRemoval'); - Route::get('/moons/logistics/display', 'Moons\MoonsAdminController@displayMoonsLogistics'); /** * Scopes Controller display pages