diff --git a/app/Notifications/CheckinAccessoryNotification.php b/app/Notifications/CheckinAccessoryNotification.php
index cc721f3ad602..c4c16f31eec1 100644
--- a/app/Notifications/CheckinAccessoryNotification.php
+++ b/app/Notifications/CheckinAccessoryNotification.php
@@ -160,7 +160,6 @@ public function toGoogleChat()
trans('mail.checked_into').': '.$item->location->name ? $item->location->name : '',
trans('admin/consumables/general.remaining').': '.$item->numRemaining(),
trans('admin/hardware/form.notes').": ".$note ?: '',
-
)
->onClick(route('accessories.show', $item->id))
)
diff --git a/app/Notifications/CheckinLicenseSeatNotification.php b/app/Notifications/CheckinLicenseSeatNotification.php
index 2222f937f3f6..ba0621d078ac 100644
--- a/app/Notifications/CheckinLicenseSeatNotification.php
+++ b/app/Notifications/CheckinLicenseSeatNotification.php
@@ -9,6 +9,11 @@
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Messages\SlackMessage;
use Illuminate\Notifications\Notification;
+use NotificationChannels\GoogleChat\Card;
+use NotificationChannels\GoogleChat\GoogleChatChannel;
+use NotificationChannels\GoogleChat\GoogleChatMessage;
+use NotificationChannels\GoogleChat\Section;
+use NotificationChannels\GoogleChat\Widgets\KeyValue;
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsChannel;
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsMessage;
@@ -43,6 +48,10 @@ public function via()
{
$notifyBy = [];
+ if (Setting::getSettings()->webhook_selected == 'google'){
+
+ $notifyBy[] = GoogleChatChannel::class;
+ }
if (Setting::getSettings()->webhook_selected == 'microsoft'){
$notifyBy[] = MicrosoftTeamsChannel::class;
@@ -113,6 +122,34 @@ public function toMicrosoftTeams()
->fact(trans('admin/consumables/general.remaining'), $item->availCount()->count())
->fact(trans('mail.notes'), $note ?: '');
}
+ public function toGoogleChat()
+ {
+ $target = $this->target;
+ $item = $this->item;
+ $note = $this->note;
+
+ return GoogleChatMessage::create()
+ ->to($this->settings->webhook_endpoint)
+ ->card(
+ Card::create()
+ ->header(
+ ''.trans('mail.License_Checkin_Notification').'' ?: '',
+ htmlspecialchars_decode($item->present()->name) ?: '',
+ )
+ ->section(
+ Section::create(
+ KeyValue::create(
+ trans('mail.checkedin_from') ?: '',
+ $target->present()->fullName() ?: '',
+ trans('admin/consumables/general.remaining').': '.$item->availCount()->count(),
+ )
+ ->onClick(route('licenses.show', $item->id))
+ )
+ )
+ );
+
+ }
+
/**
* Get the mail representation of the notification.
diff --git a/app/Notifications/CheckoutLicenseSeatNotification.php b/app/Notifications/CheckoutLicenseSeatNotification.php
index d5c9871f3b86..fcaa4761cbb6 100644
--- a/app/Notifications/CheckoutLicenseSeatNotification.php
+++ b/app/Notifications/CheckoutLicenseSeatNotification.php
@@ -9,6 +9,11 @@
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Messages\SlackMessage;
use Illuminate\Notifications\Notification;
+use NotificationChannels\GoogleChat\Card;
+use NotificationChannels\GoogleChat\GoogleChatChannel;
+use NotificationChannels\GoogleChat\GoogleChatMessage;
+use NotificationChannels\GoogleChat\Section;
+use NotificationChannels\GoogleChat\Widgets\KeyValue;
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsChannel;
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsMessage;
@@ -43,9 +48,12 @@ public function __construct(LicenseSeat $licenseSeat, $checkedOutTo, User $check
*/
public function via()
{
-
$notifyBy = [];
+ if (Setting::getSettings()->webhook_selected == 'google'){
+
+ $notifyBy[] = GoogleChatChannel::class;
+ }
if (Setting::getSettings()->webhook_selected == 'microsoft'){
$notifyBy[] = MicrosoftTeamsChannel::class;
@@ -129,6 +137,33 @@ public function toMicrosoftTeams()
->fact(trans('admin/consumables/general.remaining'), $item->availCount()->count())
->fact(trans('mail.notes'), $note ?: '');
}
+ public function toGoogleChat()
+ {
+ $target = $this->target;
+ $item = $this->item;
+ $note = $this->note;
+
+ return GoogleChatMessage::create()
+ ->to($this->settings->webhook_endpoint)
+ ->card(
+ Card::create()
+ ->header(
+ ''.trans('mail.License_Checkout_Notification').'' ?: '',
+ htmlspecialchars_decode($item->present()->name) ?: '',
+ )
+ ->section(
+ Section::create(
+ KeyValue::create(
+ trans('mail.assigned_to') ?: '',
+ $target->present()->name ?: '',
+ trans('admin/consumables/general.remaining').': '.$item->availCount()->count(),
+ )
+ ->onClick(route('users.show', $target->id))
+ )
+ )
+ );
+
+ }
/**
* Get the mail representation of the notification.
diff --git a/resources/lang/en-US/mail.php b/resources/lang/en-US/mail.php
index 418de5806fcd..759ff0f5e8b2 100644
--- a/resources/lang/en-US/mail.php
+++ b/resources/lang/en-US/mail.php
@@ -42,6 +42,7 @@
'checkin_date' => 'Checkin Date:',
'checkout_date' => 'Checkout Date:',
'checkedout_from' => 'Checked out from',
+ 'checkedin_from' => 'Checked in from',
'checked_into' => 'Checked into',
'click_on_the_link_accessory' => 'Please click on the link at the bottom to confirm that you have received the accessory.',
'click_on_the_link_asset' => 'Please click on the link at the bottom to confirm that you have received the asset.',