Skip to content

Commit

Permalink
Merge pull request #262 from czqoocavatsim/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
mufassilyasir authored Apr 1, 2024
2 parents 4bc2775 + 5d28d00 commit ca51782
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 39 deletions.
6 changes: 3 additions & 3 deletions app/Http/Controllers/Training/ApplicationsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ public function applyPost(Request $request)
$processingUpdate->save();

//Dispatch event
Notification::route('mail', CoreSettings::find(1)->emailfirchief)->notify(new NewApplicationStaff($application));
Notification::route('mail', CoreSettings::find(1)->emaildepfirchief)->notify(new NewApplicationStaff($application));
// Notification::route('mail', CoreSettings::find(1)->emailfirchief)->notify(new NewApplicationStaff($application));
// Notification::route('mail', CoreSettings::find(1)->emaildepfirchief)->notify(new NewApplicationStaff($application));
Notification::route('mail', CoreSettings::find(1)->emailcinstructor)->notify(new NewApplicationStaff($application));

//Redirect to application page
Expand Down Expand Up @@ -440,7 +440,7 @@ public function adminAcceptApplication($reference_id, Request $request)

//Status label
$label = new StudentStatusLabelLink([
'student_status_label_id' => StudentStatusLabel::whereName('Not Ready')->first()->id,
'student_status_label_id' => StudentStatusLabel::whereName('Awaiting Exam')->first()->id,
'student_id' => $student->id,
]);
$label->save();
Expand Down
14 changes: 11 additions & 3 deletions app/Http/Controllers/Training/InstructingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function board()
$instructors = Instructor::whereCurrent(true)->get();

//Get all lists
$lists = StudentStatusLabel::whereName('Ready For Pick-up')->orWhere('name', 'Not Ready')->orWhere('name', 'Solo Certification')->orWhere('name', 'Ready for Assessment')->orWhere('name', 'Inactive')->get();
$lists = StudentStatusLabel::whereName('Ready For Pick-up')->orWhere('name', 'Awaiting Exam')->orWhere('name', 'Solo Certification')->orWhere('name', 'Ready for Assessment')->orWhere('name', 'Inactive')->get();

//Return view
return view('admin.training.instructing.board', compact('instructors', 'lists'));
Expand Down Expand Up @@ -545,11 +545,19 @@ public function assignStatusLabelToStudent(Request $request, $student_id)
$label = StudentStatusLabel::whereId($request->get('label_id'))->firstOrFail();

//Does user already have this label?
if ($l = StudentStatusLabelLink::where('student_id', $student->id)->where('student_status_label_id', $label->id)->first()) {
if (StudentStatusLabelLink::where('student_id', $student->id)->where('student_status_label_id', $label->id)->exists()) {
//Return error
return redirect()->back()->with('error', "Label {$label->name} already assigned.");
return back()->with('error', "Label {$label->name} already assigned.");
}

if ($label->name == 'Ready For Pick-Up'){
//Discord notification in instructors channel
$discord = new DiscordClient();
$discord->sendMessageWithEmbed(intval(config('services.discord.instructors')), 'A new student is available for pick-up by an Instructor', $student->user->fullName('FLC') . ' is available to be picked up by an instructor!');
}



//Create the link
$link = new StudentStatusLabelLink([
'student_id' => $student->id,
Expand Down
27 changes: 0 additions & 27 deletions app/Http/Controllers/Training/TrainingPortalController.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,33 +53,6 @@ public function submitAvailabilityPost(Request $request)
]);
$submission->save();

//If they have the "Not Ready" label, process them as new student submitting availability
$student = auth()->user()->studentProfile;
foreach ($student->labels as $label) {
//Find Not Ready label
if (strtolower($label->label()->name) == 'not ready') {
//Remove label
$label->delete();

//Find Ready For Pick-Up label
$readyForPickUp = StudentStatusLabel::whereName('Ready For Pick-Up')->first();

//Assign it with link
$link = new StudentStatusLabelLink([
'student_id' => $student->id,
'student_status_label_id' => $readyForPickUp->id,
]);
$link->save();

//Discord notification in instructors channel
$discord = new DiscordClient();
$discord->sendMessageWithEmbed(intval(config('services.discord.instructors')), 'A new student is available for pick-up by an Instructor', $student->user->fullName('FLC') . ' is available to be picked up by an instructor!');

//Break
break;
}
}

//Return
return redirect()->route('training.portal.index')->with('success', 'Thank you for submitting your availability, ' . auth()->user()->fullName('F') . '!');
}
Expand Down
2 changes: 1 addition & 1 deletion app/Jobs/ProcessRosterInactivity.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function handle()
}
}

if ($rosterMember->active && $rosterMember->currency < 0.25) {
if ($rosterMember->active && $rosterMember->currency < 3) {
$rosterMember->active = false;
$rosterMember->save();
}
Expand Down
4 changes: 2 additions & 2 deletions database/seeds/StudentStatusLabelsSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ class StudentStatusLabelsSeeder extends Seeder
public function run()
{
$notReady = new StudentStatusLabel([
'name' => 'Not Ready',
'name' => 'Awaiting Exam',
'colour' => 'grey',
'fa_icon' => 'far fa-pause-circle',
'description' => 'Student yet to submit timings for sessions.',
'description' => 'Student yet to complete entry exam.',
'restricted' => false,
]);
$notReady->save();
Expand Down
4 changes: 3 additions & 1 deletion resources/views/my/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ class="list-group-item list-group-item-action p-4 z-depth-1 shadow-none mb-3">
<h3 class="font-weight-bold blue-text mt-3 pb-2">Activity</h3>
@php
$currency = $user->rosterProfile->currency;
$class = $currency < 0.1 ? 'red' : 'green';
$class = $currency < 3 ? 'red' : 'green';
@endphp

<h3>
Expand All @@ -368,6 +368,8 @@ class='badge rounded {{ $class }} text-white p-2 shadow-none'>
{{ $currency }} hours recorded
</span>
</h3>

<p class="mt-4">You require 3 hours of activity every quarter, unless you were certified within the current activity cycle.</p>
@else
<h3>
<span style='font-weight: 400' class='badge rounded p-2 red text-white shadow-none'>
Expand Down
2 changes: 1 addition & 1 deletion resources/views/training/portal/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
Completed!
</div>
</div>
@if ($studentProfile->hasLabel("Not Ready"))
@if ($studentProfile->hasLabel("Awaiting Exam"))
<script>
$('#studentProgressBar').css('width', '0%')
</script>
Expand Down
2 changes: 1 addition & 1 deletion resources/views/training/portal/progress.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
Completed!
</div>
</div>
@if ($studentProfile->hasLabel("Not Ready"))
@if ($studentProfile->hasLabel("Awaiting Exam"))
<script>
$('#studentProgressBar').css('width', '0%')
</script>
Expand Down

0 comments on commit ca51782

Please sign in to comment.