Significant changes
Added several components and features too long to list here
This commit is contained in:
@@ -10,7 +10,7 @@ class Application extends Model
|
||||
|
||||
'applicantUserID',
|
||||
'applicantFormResponseID',
|
||||
'applicantStatus'
|
||||
'applicationStatus'
|
||||
|
||||
];
|
||||
|
||||
@@ -18,4 +18,21 @@ class Application extends Model
|
||||
{
|
||||
return $this->belongsTo('App\User', 'applicantUserID', 'id');
|
||||
}
|
||||
|
||||
public function response()
|
||||
{
|
||||
return $this->hasOne('App\Response', 'id', 'applicantFormResponseID');
|
||||
}
|
||||
|
||||
public function appointment() // 1 - 1
|
||||
{
|
||||
return $this->hasOne('App\Appointment', 'applicationID', 'id');
|
||||
}
|
||||
|
||||
public function setStatus($status)
|
||||
{
|
||||
return $this->update([
|
||||
'applicationStatus' => $status
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@@ -6,5 +6,23 @@ use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Appointment extends Model
|
||||
{
|
||||
//
|
||||
public $fillable = [
|
||||
'appointmentDescription',
|
||||
'appointmentDate',
|
||||
'applicationID',
|
||||
'appointmentStatus',
|
||||
'appointmentLocation'
|
||||
];
|
||||
|
||||
public function application()
|
||||
{
|
||||
return $this->belongsTo('App\Application', 'id', 'applicationID');
|
||||
}
|
||||
|
||||
public function setStatus($status)
|
||||
{
|
||||
$this->update([
|
||||
'appointmentStatus' => $status
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@@ -14,8 +14,13 @@ class Form extends Model
|
||||
|
||||
];
|
||||
|
||||
public function vacancy()
|
||||
public function vacancies()
|
||||
{
|
||||
return $this->hasMany('App\Vacancy');
|
||||
return $this->hasMany('vacancies', 'vacancyFormID', 'id');
|
||||
}
|
||||
|
||||
public function responses()
|
||||
{
|
||||
return $this->belongsTo('App\Response', 'id', 'id');
|
||||
}
|
||||
}
|
||||
|
@@ -3,6 +3,7 @@
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Application;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use App\Response;
|
||||
use App\Vacancy;
|
||||
@@ -20,20 +21,81 @@ class ApplicationController extends Controller
|
||||
->with('applications', Auth::user()->applications);
|
||||
}
|
||||
|
||||
public function showUserApp(Request $request, $applicationID)
|
||||
{
|
||||
$application = Application::find($applicationID);
|
||||
|
||||
if (!is_null($application))
|
||||
{
|
||||
return view('dashboard.user.viewapp')
|
||||
->with(
|
||||
[
|
||||
'application' => $application,
|
||||
'structuredResponses' => json_decode($application->response->responseData, true),
|
||||
'formStructure' => $application->response->form,
|
||||
'vacancy' => $application->response->vacancy
|
||||
]
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$request->session()->flash('error', 'The application you requested could not be found.');
|
||||
}
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
|
||||
public function showAllPendingApps()
|
||||
{
|
||||
return view('dashboard.appmanagement.outstandingapps');
|
||||
return view('dashboard.appmanagement.outstandingapps')
|
||||
->with('applications', Application::where('applicationStatus', 'STAGE_SUBMITTED')->get());
|
||||
}
|
||||
|
||||
|
||||
public function showPendingInterview()
|
||||
{
|
||||
$applications = Application::with('appointment', 'user')->get();
|
||||
$count = 0;
|
||||
|
||||
$pendingInterviews = collect([]);
|
||||
$upcomingInterviews = collect([]);
|
||||
|
||||
|
||||
foreach ($applications as $application)
|
||||
{
|
||||
if (!is_null($application->appointment) && $application->appointment->appointmentStatus == 'CONCLUDED')
|
||||
{
|
||||
$count =+ 1;
|
||||
}
|
||||
|
||||
switch ($application->applicationStatus)
|
||||
{
|
||||
case 'STAGE_INTERVIEW':
|
||||
$upcomingInterviews->push($application);
|
||||
|
||||
break;
|
||||
|
||||
case 'STAGE_INTERVIEW_SCHEDULED':
|
||||
$pendingInterviews->push($application);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return view('dashboard.appmanagement.interview')
|
||||
->with([
|
||||
'finishedCount' => $count,
|
||||
'applications' => $pendingInterviews,
|
||||
'upcomingApplications' => $upcomingInterviews
|
||||
]);
|
||||
}
|
||||
|
||||
public function showPeerReview()
|
||||
{
|
||||
return view('dashboard.appmanagement.peerreview');
|
||||
}
|
||||
|
||||
public function showPendingInterview()
|
||||
{
|
||||
return view('dashboard.appmanagement.interview');
|
||||
return view('dashboard.appmanagement.peerreview')
|
||||
->with('applications', Application::where('applicationStatus', 'STAGE_PEERAPPROVAL')->get());
|
||||
}
|
||||
|
||||
public function renderApplicationForm(Request $request, $vacancySlug)
|
||||
@@ -108,7 +170,7 @@ class ApplicationController extends Controller
|
||||
Log::info('Submitted application for user ' . Auth::user()->name . ' with response ID' . $response->id);
|
||||
|
||||
$request->session()->flash('success', 'Thank you for your application! It will be reviewed as soon as possible.');
|
||||
return redirect()->to(route('userPendingApps'));
|
||||
return redirect()->to(route('showUserApps'));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -119,4 +181,37 @@ class ApplicationController extends Controller
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
public function updateApplicationStatus(Request $request, $applicationID, $newStatus)
|
||||
{
|
||||
$application = Application::find($applicationID);
|
||||
|
||||
if (!is_null($application))
|
||||
{
|
||||
switch ($newStatus)
|
||||
{
|
||||
case 'deny':
|
||||
|
||||
Log::info('User ' . Auth::user()->name . ' has denied application ID ' . $application->id);
|
||||
$request->session()->flash('success', 'Application denied.');
|
||||
$application->setStatus('DENIED');
|
||||
break;
|
||||
|
||||
case 'interview':
|
||||
Log::info('User ' . Auth::user()->name . ' has moved application ID ' . $application->id . 'to interview stage');
|
||||
$request->session()->flash('success', 'Application moved to interview stage! (:');
|
||||
$application->setStatus('STAGE_INTERVIEW');
|
||||
break;
|
||||
|
||||
default:
|
||||
$request->session()->flash('error', 'There are no suitable statuses to update to. Do not mess with the URL.');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$request->session()->flash('The application you\'re trying to update does not exist.');
|
||||
}
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
}
|
||||
|
@@ -2,9 +2,87 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Application;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Appointment;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class AppointmentController extends Controller
|
||||
{
|
||||
//
|
||||
private $allowedPlatforms = [
|
||||
|
||||
'ZOOM',
|
||||
'DISCORD',
|
||||
'SKYPE',
|
||||
'MEET',
|
||||
'TEAMSPEAK'
|
||||
|
||||
];
|
||||
|
||||
public function saveAppointment(Request $request, $applicationID)
|
||||
{
|
||||
// Unrelated TODO: change if's in application page to a switch statement, & have the row encompass it
|
||||
|
||||
$app = Application::find($applicationID);
|
||||
|
||||
if (!is_null($app))
|
||||
{
|
||||
// make sure this is a valid date by parsing it first
|
||||
$appointmentDate = Carbon::parse($request->appointmentDateTime);
|
||||
|
||||
|
||||
$appointment = Appointment::create([
|
||||
'appointmentDescription' => $request->appointmentDescription,
|
||||
'appointmentDate' => $appointmentDate->toDateTimeString(),
|
||||
'applicationID' => $applicationID,
|
||||
'appointmentLocation' => (in_array($request->appointmentLocation, $this->allowedPlatforms)) ? $request->appointmentLocation : 'DISCORD',
|
||||
]);
|
||||
$app->setStatus('STAGE_INTERVIEW_SCHEDULED');
|
||||
|
||||
|
||||
Log::info('User ' . Auth::user()->name . ' has scheduled an appointment with ' . $app->user->name . ' for application ID' . $app->id, [
|
||||
'datetime' => $appointmentDate->toDateTimeString(),
|
||||
'scheduled' => now()
|
||||
]);
|
||||
|
||||
$request->session()->flash('success', 'Appointment successfully scheduled @ ' . $appointmentDate->toDateTimeString());
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$request->session()->flash('error', 'Cant\'t schedule an appointment for an application that doesn\'t exist.');
|
||||
}
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
public function updateAppointment(Request $request, $applicationID, $status)
|
||||
{
|
||||
$application = Application::find($applicationID);
|
||||
$validStatuses = [
|
||||
'SCHEDULED',
|
||||
'CONCLUDED'
|
||||
];
|
||||
|
||||
|
||||
if (!is_null($application))
|
||||
{
|
||||
$application->appointment->appointmentStatus = (in_array($status, $validStatuses)) ? strtoupper($status) : 'SCHEDULED';
|
||||
$application->appointment->save();
|
||||
|
||||
$application->setStatus('STAGE_PEERAPPROVAL');
|
||||
|
||||
$request->session()->flash('success', 'Interview finished! Staff members can now vote on it.');
|
||||
}
|
||||
else
|
||||
{
|
||||
$request->session()->flash('error', 'The application you\'re trying to update doesn\'t exist or have an appointment.');
|
||||
}
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -56,6 +56,8 @@ class RegisterController extends Controller
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
|
||||
'password' => ['required', 'string', 'min:8', 'confirmed'],
|
||||
], [
|
||||
'uuid.required' => 'Please enter a valid (and Premium) Minecraft username! We do not support cracked users.'
|
||||
]);
|
||||
}
|
||||
|
||||
|
@@ -11,4 +11,19 @@ class Response extends Model
|
||||
'associatedVacancyID',
|
||||
'responseData'
|
||||
];
|
||||
|
||||
public function form()
|
||||
{
|
||||
return $this->hasOne('App\Form', 'id', 'responseFormID');
|
||||
}
|
||||
|
||||
public function application()
|
||||
{
|
||||
return $this->belongsTo('App\Application', 'applicantFormResponseID', 'id');
|
||||
}
|
||||
|
||||
public function vacancy()
|
||||
{
|
||||
return $this->hasOne('App\Vacancy', 'id', 'associatedVacancyID');
|
||||
}
|
||||
}
|
||||
|
35
app/View/Components/Alert.php
Normal file
35
app/View/Components/Alert.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components;
|
||||
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class Alert extends Component
|
||||
{
|
||||
|
||||
public $alertType;
|
||||
|
||||
public $extraStyling;
|
||||
|
||||
/**
|
||||
* Create a new component instance.
|
||||
*
|
||||
* @param $alertType
|
||||
* @param string $extraStyling
|
||||
*/
|
||||
public function __construct($alertType, $extraStyling = '')
|
||||
{
|
||||
$this->alertType = $alertType;
|
||||
$this->extraStyling = $extraStyling;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\View\View|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view('components.alert');
|
||||
}
|
||||
}
|
40
app/View/Components/Card.php
Normal file
40
app/View/Components/Card.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components;
|
||||
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class Card extends Component
|
||||
{
|
||||
public $id;
|
||||
|
||||
|
||||
public $cardTitle;
|
||||
|
||||
|
||||
|
||||
public $footerStyle;
|
||||
|
||||
|
||||
/**
|
||||
* Create a new component instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($id, $cardTitle, $footerStyle)
|
||||
{
|
||||
$this->cardTitle = $cardTitle;
|
||||
$this->id = $id;
|
||||
$this->footerStyle = $footerStyle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\View\View|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view('components.card');
|
||||
}
|
||||
}
|
45
app/View/Components/Modal.php
Normal file
45
app/View/Components/Modal.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components;
|
||||
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class Modal extends Component
|
||||
{
|
||||
public $id;
|
||||
|
||||
|
||||
public $modalLabel;
|
||||
|
||||
|
||||
public $modalTitle;
|
||||
|
||||
|
||||
public $includeCloseButton;
|
||||
|
||||
/**
|
||||
* Create a new component instance.
|
||||
*
|
||||
* @param $id
|
||||
* @param $modalLabel
|
||||
* @param $modalTitle
|
||||
* @param $includeCloseButton
|
||||
*/
|
||||
public function __construct($id, $modalLabel, $modalTitle, $includeCloseButton)
|
||||
{
|
||||
$this->id = $id;
|
||||
$this->modalLabel = $modalLabel;
|
||||
$this->modalTitle = $modalTitle;
|
||||
$this->includeCloseButton = $includeCloseButton;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\View\View|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view('components.modal');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user