From e7c4343c902961268792bd4951930cec56959384 Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Mon, 28 Oct 2024 14:56:48 -0700 Subject: [PATCH] readd checkin accessory format --- app/Helpers/Helper.php | 2 +- app/Livewire/SlackSettingsForm.php | 2 +- app/Notifications/CheckinAccessoryNotification.php | 14 +++++++++++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/app/Helpers/Helper.php b/app/Helpers/Helper.php index d1a1a3e726..2683a1a7a0 100644 --- a/app/Helpers/Helper.php +++ b/app/Helpers/Helper.php @@ -721,7 +721,7 @@ class Helper // The check and message that the user is still using the deprecated version $deprecations = [ 'ms_teams_deprecated' => array( - 'check' => !Str::contains(Setting::getSettings()->webhook_endpoint, 'workflows'), + 'check' => Str::contains(Setting::getSettings()->webhook_endpoint, 'workflows'), 'message' => 'The Microsoft Teams webhook URL being used will be deprecated Jan 31st, 2025. Change your webhook URL'), ]; diff --git a/app/Livewire/SlackSettingsForm.php b/app/Livewire/SlackSettingsForm.php index 39f965f87a..9f2fb4ea48 100644 --- a/app/Livewire/SlackSettingsForm.php +++ b/app/Livewire/SlackSettingsForm.php @@ -89,7 +89,7 @@ class SlackSettingsForm extends Component if($this->setting->webhook_endpoint != null && $this->setting->webhook_channel != null){ $this->isDisabled= ''; } - if($this->webhook_selected === 'microsoft' && $this->teams_webhook_deprecated) { + if($this->webhook_selected === 'microsoft' && !$this->teams_webhook_deprecated) { session()->flash('warning', 'The selected Microsoft Teams webhook URL will be deprecated Jan 31st, 2025. Please use a workflow URL. Microsofts Documentation on creating a workflow can be found here.'); } } diff --git a/app/Notifications/CheckinAccessoryNotification.php b/app/Notifications/CheckinAccessoryNotification.php index a29596719e..92c3574eb7 100644 --- a/app/Notifications/CheckinAccessoryNotification.php +++ b/app/Notifications/CheckinAccessoryNotification.php @@ -104,7 +104,19 @@ class CheckinAccessoryNotification extends Notification $admin = $this->admin; $item = $this->item; $note = $this->note; - if(!Str::contains(Setting::getSettings()->webhook_endpoint, 'workflows')) {} + if(!Str::contains(Setting::getSettings()->webhook_endpoint, 'workflows')) { + return MicrosoftTeamsMessage::create() + ->to($this->settings->webhook_endpoint) + ->type('success') + ->addStartGroupToSection('activityTitle') + ->title(trans('Accessory_Checkin_Notification')) + ->addStartGroupToSection('activityText') + ->fact(htmlspecialchars_decode($item->present()->name), '', 'activityTitle') + ->fact(trans('mail.checked_into'), $item->location->name ? $item->location->name : '') + ->fact(trans('mail.Accessory_Checkin_Notification')." by ", $admin->present()->fullName()) + ->fact(trans('admin/consumables/general.remaining'), $item->numRemaining()) + ->fact(trans('mail.notes'), $note ?: ''); + } $message = trans('mail.Accessory_Checkin_Notification'); $details = [