diff --git a/app/Form.php b/app/Form.php index e234d94..5118486 100644 --- a/app/Form.php +++ b/app/Form.php @@ -16,6 +16,6 @@ class Form extends Model public function vacancy() { - return $this->hasMany('App\Vacancy', 'vacancyFormID'); + return $this->hasMany('App\Vacancy'); } } diff --git a/app/Http/Controllers/ApplicationController.php b/app/Http/Controllers/ApplicationController.php index ccf225c..aecf4a9 100644 --- a/app/Http/Controllers/ApplicationController.php +++ b/app/Http/Controllers/ApplicationController.php @@ -2,6 +2,7 @@ namespace App\Http\Controllers; +use App\Vacancy; use Illuminate\Http\Request; class ApplicationController extends Controller @@ -36,4 +37,26 @@ class ApplicationController extends Controller { return view('dashboard.appmanagement.interview'); } + + public function renderApplicationForm(Request $request, $vacancySlug) + { + $vacancyWithForm = Vacancy::with('forms')->where('vacancySlug', $vacancySlug)->get(); + + if (!$vacancyWithForm->isEmpty()) + { + + return view('dashboard.application-rendering.apply') + ->with([ + + 'vacancy' => $vacancyWithForm->first(), + 'preprocessedForm' => json_decode($vacancyWithForm->first()->forms->formStructure, true) + + ]); + } + else + { + abort(404, 'We\'re ssssorry, but the application form you\'re looking for could not be found.'); + } + + } } diff --git a/app/Http/Controllers/VacancyController.php b/app/Http/Controllers/VacancyController.php index 919af13..cbd0d0b 100644 --- a/app/Http/Controllers/VacancyController.php +++ b/app/Http/Controllers/VacancyController.php @@ -6,6 +6,7 @@ use App\Form; use App\Http\Requests\VacancyRequest; use App\Vacancy; use Illuminate\Http\Request; +use Illuminate\Support\Str; class VacancyController extends Controller { @@ -28,6 +29,7 @@ class VacancyController extends Controller 'vacancyName' => $request->vacancyName, 'vacancyDescription' => $request->vacancyDescription, + 'vacancySlug' => Str::slug($request->vacancyName), 'permissionGroupName' => $request->permissionGroup, 'discordRoleID' => $request->discordRole, 'vacancyFormID' => $request->vacancyFormID, diff --git a/app/Vacancy.php b/app/Vacancy.php index 464bcf9..8f4995d 100644 --- a/app/Vacancy.php +++ b/app/Vacancy.php @@ -16,13 +16,14 @@ class Vacancy extends Model 'discordRoleID', 'vacancyFormID', 'vacancyCount', - 'vacancyStatus' + 'vacancyStatus', + 'vacancySlug' ]; public function forms() { - return $this->belongsTo('App\Form'); + return $this->belongsTo('App\Form', 'vacancyFormID', 'id'); } public function open() diff --git a/database/migrations/2020_05_08_024654_add_slug_to_vacancy.php b/database/migrations/2020_05_08_024654_add_slug_to_vacancy.php new file mode 100644 index 0000000..5daa2c6 --- /dev/null +++ b/database/migrations/2020_05_08_024654_add_slug_to_vacancy.php @@ -0,0 +1,32 @@ +string('vacancySlug')->after('vacancyDescription'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('vacancies', function (Blueprint $table) { + $table->dropColumn('vacancySlug'); + }); + } +} diff --git a/resources/views/breadcrumbs/app.blade.php b/resources/views/breadcrumbs/app.blade.php index 9fcf391..b9cf000 100644 --- a/resources/views/breadcrumbs/app.blade.php +++ b/resources/views/breadcrumbs/app.blade.php @@ -1,99 +1,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
-
-
-
-
-

Raspberry Network Application Center

-
Welcome to our team management center!
-
-

Here, you can apply for open staff member positions, view your application status, and manage your profile.

-

Sign up with Twitch or Email to continue.

-
-
-
-
-
- -
- +@include('breadcrumbs.header') - + @if (session()->has('error')) + + + + + + + + + + + + + + + +
+ + + +
+
+
+
+
+

Raspberry Network Application Center

+
Welcome to our team management center!
+
+

Here, you can apply for open staff member positions, view your application status, and manage your profile.

+

Sign up with Twitch or Email to continue.

+
+
+
+
+
+ +
diff --git a/resources/views/dashboard/application-rendering/apply.blade.php b/resources/views/dashboard/application-rendering/apply.blade.php new file mode 100644 index 0000000..8001dee --- /dev/null +++ b/resources/views/dashboard/application-rendering/apply.blade.php @@ -0,0 +1,115 @@ +@extends('adminlte::page') + +@section('title', 'Raspberry Network Team Management') + +@section('content_header') +

My Account / Apply / {{$vacancy->vacancyName}} Application

+@stop + +@section('content') + + + +
+ +
+ +
+ +

You are applying for: {{$vacancy->vacancyName}}

+ +

We're glad you've decided to apply. Generally, applications take 48 hours to be processed and reviewed. Depending on the circumstances and the volume of applications, you may receive an answer in a shorter time.

+

Please fill out the form below. Keep all answers concise and complete. Please keep in mind that the age requirement is at least 18 years old.

+

Asking about your application will result in instant denial. Everything you need to know is here.

+ +
+ +
+ +
+ + +
+ +
+ + +
+ +
+ +

{{$vacancy->forms->formName}}

+ +
+ +
+ + @foreach($preprocessedForm['fields'] as $fieldName => $field) + + @switch ($field['type']) + + @case('textarea') + +
+ + + + +
+ + @break + + @case('textbox') + +
+ + + + + +
+ + @break + + @endswitch + + @endforeach + +
+ + + +
+ +
+ +
+ +@stop diff --git a/resources/views/home.blade.php b/resources/views/home.blade.php index 5be0a57..a69c941 100644 --- a/resources/views/home.blade.php +++ b/resources/views/home.blade.php @@ -30,7 +30,11 @@

{{$position->vacancyName}}

- + @if ($position->vacancyCount == 1) +

There is {{$position->vacancyCount}} open position!

+ @else +

There are {{$position->vacancyCount}} open positions!

+ @endif
@@ -45,8 +49,7 @@ diff --git a/routes/web.php b/routes/web.php index 03efed6..66c0e61 100644 --- a/routes/web.php +++ b/routes/web.php @@ -32,15 +32,6 @@ Route::group(['middleware' => 'auth'], function(){ Route::get('/approved', 'ApplicationController@showApprovedApps') ->name('userApprovedApps'); - }); - - Route::group(['prefix' => '/profile'], function (){ - - Route::get('/settings', 'ProfileController@index'); - - }); - - Route::group(['prefix' => '/applications'], function (){ Route::get('/staff/outstanding', 'ApplicationController@showAllPendingApps') ->name('staffPendingApps'); @@ -51,8 +42,23 @@ Route::group(['middleware' => 'auth'], function(){ Route::get('/staff/pending-interview', 'ApplicationController@showPendingInterview') ->name('pendingInterview'); + }); + Route::group(['prefix' => 'apply'], function (){ + + Route::get('positions/{vacancySlug}', 'ApplicationController@renderApplicationForm') + ->name('renderApplicationForm'); + + }); + + Route::group(['prefix' => '/profile'], function (){ + + Route::get('/settings', 'ProfileController@index'); + + }); + + Route::group(['prefix' => '/hr'], function (){ Route::get('staff-members', 'UserController@showStaffMembers')