From 278bc5e52a133189cfaf5348d709dcf229229e2f Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Thu, 24 Oct 2024 14:59:10 -0700 Subject: [PATCH] ads check in and checkout message for license seats --- .../CheckinLicenseSeatNotification.php | 21 +++++++++---------- .../CheckoutLicenseSeatNotification.php | 20 ++++++++---------- resources/lang/en-US/mail.php | 1 + 3 files changed, 20 insertions(+), 22 deletions(-) diff --git a/app/Notifications/CheckinLicenseSeatNotification.php b/app/Notifications/CheckinLicenseSeatNotification.php index 289e63a162..9fdb0521d2 100644 --- a/app/Notifications/CheckinLicenseSeatNotification.php +++ b/app/Notifications/CheckinLicenseSeatNotification.php @@ -110,17 +110,16 @@ class CheckinLicenseSeatNotification extends Notification $item = $this->item; $note = $this->note; - return MicrosoftTeamsMessage::create() - ->to($this->settings->webhook_endpoint) - ->type('success') - ->addStartGroupToSection('activityTitle') - ->title(trans('mail.License_Checkin_Notification')) - ->addStartGroupToSection('activityText') - ->fact(htmlspecialchars_decode($item->present()->name), '', 'header') - ->fact(trans('mail.License_Checkin_Notification')." by ", $admin->present()->fullName() ?: 'CLI tool') - ->fact(trans('mail.checkedin_from'), $target->present()->fullName()) - ->fact(trans('admin/consumables/general.remaining'), $item->availCount()->count()) - ->fact(trans('mail.notes'), $note ?: ''); + $message = trans('mail.License_Checkin_Notification'); + $details = [ + trans('mail.checkedin_from')=> $target->present()->fullName(), + trans('mail.license_for') => htmlspecialchars_decode($item->present()->name), + trans('mail.License_Checkin_Notification')." by " => $admin->present()->fullName() ?: 'CLI tool', + trans('admin/consumables/general.remaining') => $item->availCount()->count(), + trans('mail.notes') => $note ?: '', + ]; + + return array($message, $details); } public function toGoogleChat() { diff --git a/app/Notifications/CheckoutLicenseSeatNotification.php b/app/Notifications/CheckoutLicenseSeatNotification.php index 8e0273c66e..769b1f9e4a 100644 --- a/app/Notifications/CheckoutLicenseSeatNotification.php +++ b/app/Notifications/CheckoutLicenseSeatNotification.php @@ -125,17 +125,15 @@ class CheckoutLicenseSeatNotification extends Notification $item = $this->item; $note = $this->note; - return MicrosoftTeamsMessage::create() - ->to($this->settings->webhook_endpoint) - ->type('success') - ->addStartGroupToSection('activityTitle') - ->title(trans('mail.License_Checkout_Notification')) - ->addStartGroupToSection('activityText') - ->fact(htmlspecialchars_decode($item->present()->name), '', 'activityTitle') - ->fact(trans('mail.License_Checkout_Notification')." by ", $admin->present()->fullName()) - ->fact(trans('mail.assigned_to'), $target->present()->fullName()) - ->fact(trans('admin/consumables/general.remaining'), $item->availCount()->count()) - ->fact(trans('mail.notes'), $note ?: ''); + $message = trans('mail.License_Checkout_Notification'); + $details = [ + trans('mail.assigned_to') => $target->present()->fullName(), + trans('mail.license_for') => htmlspecialchars_decode($item->present()->name), + trans('mail.License_Checkout_Notification').' by' => $admin->present()->fullName(), + trans('admin/consumables/general.remaining') => $item->availCount()->count(), + trans('mail.notes') => $note ?: '', + ]; + return array($message, $details); } public function toGoogleChat() { diff --git a/resources/lang/en-US/mail.php b/resources/lang/en-US/mail.php index 72fb70db80..76c0c1773d 100644 --- a/resources/lang/en-US/mail.php +++ b/resources/lang/en-US/mail.php @@ -23,6 +23,7 @@ return [ 'Item_Requested' => 'Item Requested', 'License_Checkin_Notification' => 'License checked in', 'License_Checkout_Notification' => 'License checked out', + 'license_for' => 'License for', 'Low_Inventory_Report' => 'Low Inventory Report', 'a_user_canceled' => 'A user has canceled an item request on the website', 'a_user_requested' => 'A user has requested an item on the website',