Add LOA feature, improve components

This commit is contained in:
2022-02-07 18:59:22 +00:00
parent d6e248b571
commit 23a191deb9
24 changed files with 780 additions and 90442 deletions

View File

@@ -0,0 +1,20 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
class AbsenceFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
//
];
}
}

View File

@@ -1,45 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateAppealsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('appeals', function (Blueprint $table) {
$table->id();
$table->bigInteger('appellant_id')->unsigned();
$table->bigInteger('appeal_assignee')->unsigned();
$table->enum('appeal_type', [
'discord_ban',
'discord_timeout'
]);
$table->text('appeal_reasoning_desc');
$table->enum('appeal_status', [
'IN_REVISION',
'AWAITING_DECISION',
'PUNISHMENT_LIFTED',
'PUNISHMENT_REDUCED',
'PUNISHMENT_MAINTAINED'
]);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('appeals');
}
}

View File

@@ -0,0 +1,47 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateAbsencesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('absences', function (Blueprint $table) {
$table->id();
$table->bigInteger('requesterID')->unsigned();
$table->date('start');
$table->date('predicted_end');
$table->boolean('available_assist');
$table->string('reason');
$table->enum('status', ['PENDING', 'APPROVED', 'DECLINED', 'CANCELLED', 'ENDED']);
$table->bigInteger('reviewer')->unsigned()->nullable();
$table->date('reviewed_date')->nullable();
$table->timestamps();
$table->foreign('requesterID')
->references('id')
->on('users');
$table->foreign('reviewer')
->references('id')
->on('users');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('absences');
}
}

View File

@@ -0,0 +1,18 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
class AbsenceSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
//
}
}

View File

@@ -59,6 +59,7 @@ class PermissionSeeder extends Seeder
]);
// Spatie wildcard permissions (same concept of MC permissions)
// TODO: Wildcard permissions are not suitable for the app, switch to simpler permission model, starting with permissions for new features
$permissions = [
'applications.submit',
@@ -76,6 +77,12 @@ class PermissionSeeder extends Seeder
'profiles.view.others',
'profiles.edit.others',
'admin.viewAllAbsences',
'admin.manageAbsences',
'reviewer.viewAbsence',
'reviewer.requestAbsence',
'reviewer.withdrawAbsence',
'admin.userlist',
'admin.stafflist',
'admin.hiring.forms',
@@ -104,7 +111,10 @@ class PermissionSeeder extends Seeder
// Able to view applications and vote on them once they reach the right stage, but not approve applications up to said stage
$reviewer->givePermissionTo([
'applications.view.all',
'applications.vote'
'applications.vote',
'reviewer.viewAbsence',
'reviewer.requestAbsence',
'reviewer.withdrawAbsence',
]);
$hiringManager->givePermissionTo('appointments.*', 'applications.*', 'admin.hiring.*');
@@ -117,7 +127,8 @@ class PermissionSeeder extends Seeder
'admin.notificationsettings.*',
'profiles.view.others',
'profiles.edit.others',
'admin.maintenance.logs.view'
'admin.viewAllAbsences',
'admin.manageAbsences',
]);
}
}