Entrypoint: Add Application Page
This commit finally adds the dynamically rendered form that changes according to how the user builds their form. It also fragments the header and footer for the main page into their own separate files for ease of access later. Vacancy status has also been added to the Vacancies in DB. All staff application endpoints have also been moved to under the user application endpoints group, for ease of use (duplicated route group).
This commit is contained in:
@@ -16,6 +16,6 @@ class Form extends Model
|
||||
|
||||
public function vacancy()
|
||||
{
|
||||
return $this->hasMany('App\Vacancy', 'vacancyFormID');
|
||||
return $this->hasMany('App\Vacancy');
|
||||
}
|
||||
}
|
||||
|
@@ -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.');
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -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,
|
||||
|
@@ -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()
|
||||
|
Reference in New Issue
Block a user