diff --git a/app/Application.php b/app/Application.php index 319296a..729d610 100644 --- a/app/Application.php +++ b/app/Application.php @@ -13,4 +13,9 @@ class Application extends Model 'applicantStatus' ]; + + public function user() + { + return $this->belongsTo('App\User', 'applicantUserID', 'id'); + } } diff --git a/app/Http/Controllers/ApplicationController.php b/app/Http/Controllers/ApplicationController.php index 0d2cb5f..cfd2a9e 100644 --- a/app/Http/Controllers/ApplicationController.php +++ b/app/Http/Controllers/ApplicationController.php @@ -13,20 +13,13 @@ use Illuminate\Support\Facades\Validator; class ApplicationController extends Controller { - public function showPendingUserApps() + public function showUserApps() { - return view('dashboard.user.applications'); + + return view('dashboard.user.applications') + ->with('applications', Auth::user()->applications); } - public function showDeniedUserApps() - { - return view('dashboard.user.deniedapplications'); - } - - public function showApprovedApps() - { - return view('dashboard.user.approvedapplications'); - } public function showAllPendingApps() { diff --git a/app/User.php b/app/User.php index c45acbc..f2d62db 100644 --- a/app/User.php +++ b/app/User.php @@ -36,4 +36,9 @@ class User extends Authenticatable protected $casts = [ 'email_verified_at' => 'datetime', ]; + + public function applications() + { + return $this->hasMany('App\Application', 'applicantUserID', 'id'); + } } diff --git a/config/adminlte.php b/config/adminlte.php index 8c54c3f..51338db 100644 --- a/config/adminlte.php +++ b/config/adminlte.php @@ -214,19 +214,9 @@ return [ 'icon' => 'fas fa-fw fa-list-ul', 'submenu' => [ [ - 'text' => 'Under Review', + 'text' => 'Current Applications', 'icon' => 'fas fa-fw fa-check-double', - 'url' => '/applications/pending' - ], - [ - 'text' => 'Denied', - 'icon' => 'fas fa-fw fa-times', - 'url' => '/applications/denied' - ], - [ - 'text' => 'Approved', - 'icon' => 'fas fa-fw fa-user-check', - 'url' => '/applications/approved' + 'url' => '/applications/current' ] ] diff --git a/resources/views/dashboard/user/applications.blade.php b/resources/views/dashboard/user/applications.blade.php index 523974c..28deba7 100644 --- a/resources/views/dashboard/user/applications.blade.php +++ b/resources/views/dashboard/user/applications.blade.php @@ -39,6 +39,18 @@

If an interview is scheduled, you'll need to open your application here and confirm the time, date, and location assigned for you.

+
+ Account Standing + +

Your account is currently {{($isEligibleForApplication) ? 'eligible' : 'not eligible'}} for application.

+ + @if (!$isEligibleForApplication) +

As of today, there are {{$eligibilityDaysRemaining}} days remaining until you're permitted to submit another application.

+ @endif + + Powered by Carbon +
+ @@ -60,25 +72,59 @@ # Applicant Application Date - Updated On + Last Acted On Status Actions - - 1. - Jonathan Smith - 2020-04-28 - 2020-04-29 - Approved - - - + @foreach ($applications as $application) + + + {{$application->id}} + {{Auth::user()->name}} + {{$application->created_at}} + {{$application->updated_at}} + + @switch($application->applicationStatus) + + @case('STAGE_SUBMITTED') + Submitted + @break + + @case('STAGE_PEERAPPROVAL') + Peer Approval + @break + + @case('STAGE_INTERVIEW') + Interview + @break + + @case('STAGE_INTERVIEW_SCHEDULED') + Interview Scheduled + @break + + @case('APPROVED') + Approved + @break + + @case('DENIED') + Denied + @break + + @default + Unknown + @endswitch + + + + + + + + @endforeach - - @@ -88,8 +134,6 @@ diff --git a/routes/web.php b/routes/web.php index 4d7475b..0970412 100644 --- a/routes/web.php +++ b/routes/web.php @@ -21,16 +21,15 @@ Route::post('/form/contact', 'ContactController@create') Route::group(['middleware' => 'auth'], function(){ - Route::get('/dashboard', 'DashboardController@index')->middleware('eligibility'); + Route::get('/dashboard', 'DashboardController@index') + ->name('dashboard') + ->middleware('eligibility'); Route::group(['prefix' => '/applications'], function (){ - Route::get('/pending', 'ApplicationController@showPendingUserApps') - ->name('userPendingApps'); - Route::get('/denied', 'ApplicationController@showDeniedUserApps') - ->name('userDeniedApps'); - Route::get('/approved', 'ApplicationController@showApprovedApps') - ->name('userApprovedApps'); + Route::get('/current', 'ApplicationController@showUserApps') + ->name('showUserApps') + ->middleware('eligibility'); Route::get('/staff/outstanding', 'ApplicationController@showAllPendingApps')