mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-09 23:24:06 -08:00
adds consumable checkout ms notification
This commit is contained in:
parent
e969f8808c
commit
7c529df49b
|
@ -9,6 +9,8 @@ use Illuminate\Bus\Queueable;
|
|||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Notifications\Messages\SlackMessage;
|
||||
use Illuminate\Notifications\Notification;
|
||||
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsChannel;
|
||||
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsMessage;
|
||||
|
||||
class CheckoutConsumableNotification extends Notification
|
||||
{
|
||||
|
@ -43,6 +45,11 @@ class CheckoutConsumableNotification extends Notification
|
|||
{
|
||||
$notifyBy = [];
|
||||
|
||||
if (Setting::getSettings()->webhook_selected == 'microsoft'){
|
||||
|
||||
$notifyBy[] = MicrosoftTeamsChannel::class;
|
||||
}
|
||||
|
||||
if (Setting::getSettings()->webhook_endpoint != '') {
|
||||
$notifyBy[] = 'slack';
|
||||
}
|
||||
|
@ -102,6 +109,25 @@ class CheckoutConsumableNotification extends Notification
|
|||
->content($note);
|
||||
});
|
||||
}
|
||||
public function toMicrosoftTeams()
|
||||
{
|
||||
$target = $this->target;
|
||||
$admin = $this->admin;
|
||||
$item = $this->item;
|
||||
$note = $this->note;
|
||||
|
||||
return MicrosoftTeamsMessage::create()
|
||||
->to($this->settings->webhook_endpoint)
|
||||
->type('success')
|
||||
->addStartGroupToSection('activityTitle')
|
||||
->title("Consumable Checked Out")
|
||||
->addStartGroupToSection('activityText')
|
||||
->fact(htmlspecialchars_decode($item->present()->name), '', 'activityTitle')
|
||||
->fact(trans('mail.Consumable_checkout_notification')." by ", $admin->present()->fullName())
|
||||
->fact('Checked out to', $target->present()->fullName())
|
||||
->fact('Number Remaining', $item->numRemaining())
|
||||
->fact('Notes', $note ?: 'No notes');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the mail representation of the notification.
|
||||
|
|
|
@ -12,6 +12,7 @@ return [
|
|||
'Confirm_asset_delivery' => 'Asset delivery confirmation',
|
||||
'Confirm_consumable_delivery' => 'Consumable delivery confirmation',
|
||||
'Confirm_license_delivery' => 'License delivery confirmation',
|
||||
'Consumable_checkout_notification' => 'Consumable checked out',
|
||||
'Days' => 'Days',
|
||||
'Expected_Checkin_Date' => 'An asset checked out to you is due to be checked back in on :date',
|
||||
'Expected_Checkin_Notification' => 'Reminder: :name checkin deadline approaching',
|
||||
|
|
Loading…
Reference in a new issue