diff --git a/app/Http/Controllers/Training/ApplicationsController.php b/app/Http/Controllers/Training/ApplicationsController.php index 08985eb1..c7ad8c3a 100644 --- a/app/Http/Controllers/Training/ApplicationsController.php +++ b/app/Http/Controllers/Training/ApplicationsController.php @@ -79,7 +79,7 @@ public function apply(Request $request) //Check Shanwick roster $shanwickRoster = json_decode(Cache::remember('shanwickroster', 86400, function () { $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, 'https://www.vatsim.uk/api/validations?position=EGGX'); + curl_setopt($ch, CURLOPT_URL, 'https://www.vatsim.uk/api/validations?position=EGGX_FSS'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $output = curl_exec($ch); curl_close($ch); diff --git a/app/Http/Controllers/Training/InstructingController.php b/app/Http/Controllers/Training/InstructingController.php index 00fbe435..19be9281 100644 --- a/app/Http/Controllers/Training/InstructingController.php +++ b/app/Http/Controllers/Training/InstructingController.php @@ -252,7 +252,7 @@ public function addStudent(Request $request) Session::flash('info', 'Unable to add Discord permissions automatically.'); } } catch (\Exception $e) { - Session::flash('info', 'Unable to remove Discord permissions automatically.'); + } //Give Awaiting Exam status label @@ -401,7 +401,7 @@ public function removeStudent($cid) $student->user->removeRole('Student'); //Discord Updates - if (!$student->user->hasDiscord()) { + if ($student->user->hasDiscord() && $student->user->member_of_czqo) { //Get Discord client $discord = new DiscordClient(); diff --git a/app/Http/Controllers/Training/SessionsController.php b/app/Http/Controllers/Training/SessionsController.php index 80d71904..4e437708 100644 --- a/app/Http/Controllers/Training/SessionsController.php +++ b/app/Http/Controllers/Training/SessionsController.php @@ -84,7 +84,7 @@ public function createTrainingSession(Request $request) $discord->sendEmbedInTrainingThread($session->student->user->fullName('FLC'), 'Training Session Booked', 'Hello, '. $session->student->user->fullName('F').'! -A training session has been created for you at '.Carbon::parse($request->get('scheduled_time'))->format('l, jS F H:i\z').'. +A training session has been created for you on get('scheduled_time'))->timestamp.':F>. Please reach out to your instructor in this training thread if you have any questions.'); @@ -139,7 +139,7 @@ public function editTrainingSessionTime(Request $request, $session_id) $discord->sendEmbedInTrainingThread($session->student->user->fullName('FLC'), 'Training Session Time Changed', 'Hello, '. $session->student->user->fullName('F').'! - A training session time has been updated. The new time is now '.Carbon::parse($request->get('new_time'))->format('l, jS F H:i\z').'. + A training session time has been updated. The new time is now get('new_time'))->timestamp.':F> Please reach out to your instructor in this training thread if you have any questions.'); diff --git a/app/Services/DiscordClient.php b/app/Services/DiscordClient.php index 73c3a7c4..ff43cd20 100644 --- a/app/Services/DiscordClient.php +++ b/app/Services/DiscordClient.php @@ -5,6 +5,7 @@ use GuzzleHttp\Client; use App\Jobs\ProcessDiscordRoles; use GuzzleHttp\Exception\ClientException; +use Carbon\Carbon; class DiscordClient { @@ -127,14 +128,6 @@ public function closeTrainingThread($name, $status) foreach ($threads_data['threads'] as $thread) { if ($thread['name'] == $name) { - // Lock and Archive the Thread - $data = $this->client->patch('channels/'.$thread['id'], [ - 'json' => [ - 'locked' => true, - 'archived' => true, - ] - ]); - if($status == "certify"){ $this->sendMessageWithEmbed($thread['id'], 'Oceanic Training Completed!', 'Congratulations, you have now been certified on Gander & Shanwick Oceanic! @@ -146,10 +139,18 @@ public function closeTrainingThread($name, $status) Enjoy controlling Gander & Shanwick OCA!'); } elseif($status == "cancel") { $this->sendMessageWithEmbed($thread['id'], 'Oceanic Training Cancelled', -'Your training request with Gander Oceanic has been terminated. +'Your training request with Gander Oceanic has been terminated on timestamp.':F> If you would like to begin training again, please re-apply via the Gander Website.'); } + + // Lock and Archive the Thread + $data = $this->client->patch('channels/'.$thread['id'], [ + 'json' => [ + 'locked' => true, + 'archived' => true, + ] + ]); } } diff --git a/resources/views/admin/training/instructing/students/student.blade.php b/resources/views/admin/training/instructing/students/student.blade.php index 82d2cfcb..304b438b 100644 --- a/resources/views/admin/training/instructing/students/student.blade.php +++ b/resources/views/admin/training/instructing/students/student.blade.php @@ -56,11 +56,11 @@
Actions
    - @if(Auth::user()->id == "1342084" || Auth::user()->hasRole('Instructor')) + @can('edit students') - @endif + @endcan @if($student->user->rosterProfile->certification == "training")