Skip to content

Commit

Permalink
Merge pull request #341 from MineTrax/develop
Browse files Browse the repository at this point in the history
Feat: Staff Recruitment System v1
  • Loading branch information
Xinecraft authored Mar 21, 2024
2 parents f5c6c15 + fab8946 commit f94b5e6
Show file tree
Hide file tree
Showing 246 changed files with 7,652 additions and 1,366 deletions.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,5 @@ SFTP_DISK_PORT=22

PLAYER_SKIN_CHANGER_ENABLED=true
PLAYER_SKIN_CHANGER_COOLDOWN_IN_SECONDS=60

HIDE_COUNTRY_FOR_PRIVACY=false
25 changes: 25 additions & 0 deletions app/Enums/CommentType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

namespace App\Enums;

use BenSampo\Enum\Enum;

final class CommentType extends Enum
{
const DEFAULT = null;

const RECRUITMENT_APPLICANT_MESSAGE = 'recruitment_applicant_message';
const RECRUITMENT_STAFF_MESSAGE = 'recruitment_staff_message';

const RECRUITMENT_STAFF_WHISPER = 'recruitment_staff_whisper';

const RECRUITMENT_ACTION = 'recruitment_action';

public function toArray(): mixed
{
return [
'key' => $this->key,
'value' => $this->value,
];
}
}
24 changes: 24 additions & 0 deletions app/Enums/RecruitmentFormStatus.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

namespace App\Enums;

use BenSampo\Enum\Enum;

final class RecruitmentFormStatus extends Enum
{
const DRAFT = 'draft';

const ACTIVE = 'active';

const DISABLED = 'disabled';

const ARCHIVED = 'archived';

public function toArray(): mixed
{
return [
'key' => $this->key,
'value' => $this->value,
];
}
}
28 changes: 28 additions & 0 deletions app/Enums/RecruitmentSubmissionStatus.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

namespace App\Enums;

use BenSampo\Enum\Enum;

final class RecruitmentSubmissionStatus extends Enum
{
const PENDING = 'pending';

const INPROGRESS = 'inprogress';

const APPROVED = 'approved';

const REJECTED = 'rejected';

const WITHDRAWN = 'withdrawn';

const ONHOLD = 'onhold';

public function toArray(): mixed
{
return [
'key' => $this->key,
'value' => $this->value,
];
}
}
36 changes: 36 additions & 0 deletions app/Events/RecruitmentSubmissionCommentCreated.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

namespace App\Events;

use App\Models\Comment;
use App\Models\RecruitmentSubmission;
use App\Models\User;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;

class RecruitmentSubmissionCommentCreated
{
use Dispatchable, InteractsWithSockets, SerializesModels;

/**
* Create a new event instance.
*/
public function __construct(public Comment $comment, public RecruitmentSubmission $submission, public User $causer)
{
//
}

/**
* Get the channels the event should broadcast on.
*
* @return array<int, \Illuminate\Broadcasting\Channel>
*/
public function broadcastOn(): array
{
return [
new PrivateChannel('channel-name'),
];
}
}
37 changes: 37 additions & 0 deletions app/Events/RecruitmentSubmissionCreated.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

namespace App\Events;

use App\Models\RecruitmentSubmission;
use Illuminate\Broadcasting\Channel;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;

class RecruitmentSubmissionCreated
{
use Dispatchable, InteractsWithSockets, SerializesModels;

/**
* Create a new event instance.
*/
public function __construct(public RecruitmentSubmission $submission)
{
//
}

/**
* Get the channels the event should broadcast on.
*
* @return array<int, \Illuminate\Broadcasting\Channel>
*/
public function broadcastOn(): array
{
return [
new PrivateChannel('channel-name'),
];
}
}
38 changes: 38 additions & 0 deletions app/Events/RecruitmentSubmissionStatusChanged.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

namespace App\Events;

use App\Enums\RecruitmentSubmissionStatus;
use App\Models\RecruitmentSubmission;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;

class RecruitmentSubmissionStatusChanged
{
use Dispatchable, InteractsWithSockets, SerializesModels;

/**
* Create a new event instance.
*/
public function __construct(
public RecruitmentSubmission $submission,
public $causer,
public RecruitmentSubmissionStatus $previousStatus
) {
//
}

/**
* Get the channels the event should broadcast on.
*
* @return array<int, \Illuminate\Broadcasting\Channel>
*/
public function broadcastOn(): array
{
return [
new PrivateChannel('channel-name'),
];
}
}
14 changes: 4 additions & 10 deletions app/Http/Controllers/Admin/CustomFormSubmissionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,8 @@ public function index(Request $request)
->when($selectedForms, function ($query, $selectedForms) {
$query->whereIn('custom_form_id', $selectedForms);
})
->with(['user:id,name,username', 'country:id,iso_code,flag,name', 'customForm' => function ($q) use ($maxRoleWeightOfStaffMember) {
$q->select(['id', 'title', 'status', 'slug', 'min_role_weight_to_view_submission'])
->where('min_role_weight_to_view_submission', '<=', $maxRoleWeightOfStaffMember)
->orWhereNull('min_role_weight_to_view_submission');
}])
->whereIn('custom_form_id', $customForms->keys())
->with(['user:id,name,username', 'country:id,iso_code,flag,name', 'customForm'])
->select($fields)
->allowedFilters([
...$fields,
Expand Down Expand Up @@ -111,11 +108,8 @@ public function indexArchived(Request $request)
->when($selectedForms, function ($query, $selectedForms) {
$query->whereIn('custom_form_id', $selectedForms);
})
->with(['user:id,name,username', 'country:id,iso_code,flag,name', 'customForm' => function ($q) use ($maxRoleWeightOfStaffMember) {
$q->select(['id', 'title', 'status', 'slug', 'min_role_weight_to_view_submission'])
->where('min_role_weight_to_view_submission', '<=', $maxRoleWeightOfStaffMember)
->orWhereNull('min_role_weight_to_view_submission');
}])
->whereIn('custom_form_id', $customForms->keys())
->with(['user:id,name,username', 'country:id,iso_code,flag,name', 'customForm'])
->select($fields)
->allowedFilters([
...$fields,
Expand Down
Loading

0 comments on commit f94b5e6

Please sign in to comment.