adds check in and checkout messag for accessories
This commit is contained in:
parent
e27ff13377
commit
cce75a8185
3 changed files with 30 additions and 35 deletions
|
@ -49,16 +49,16 @@ class CheckoutableListener
|
||||||
|
|
||||||
// Send email notifications
|
// Send email notifications
|
||||||
try {
|
try {
|
||||||
foreach ($notifiables as $notifiable) {
|
// foreach ($notifiables as $notifiable) {
|
||||||
if ($notifiable instanceof User && $notifiable->email != '') {
|
// if ($notifiable instanceof User && $notifiable->email != '') {
|
||||||
if (! $event->checkedOutTo->locale){
|
// if (! $event->checkedOutTo->locale){
|
||||||
Notification::locale(Setting::getSettings()->locale)->send($notifiable, $this->getCheckoutNotification($event, $acceptance));
|
// Notification::locale(Setting::getSettings()->locale)->send($notifiable, $this->getCheckoutNotification($event, $acceptance));
|
||||||
}
|
// }
|
||||||
else {
|
// else {
|
||||||
Notification::send($notifiable, $this->getCheckoutNotification($event, $acceptance));
|
// Notification::send($notifiable, $this->getCheckoutNotification($event, $acceptance));
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
// Send Webhook notification
|
// Send Webhook notification
|
||||||
if ($this->shouldSendWebhookNotification()) {
|
if ($this->shouldSendWebhookNotification()) {
|
||||||
|
|
|
@ -104,17 +104,15 @@ class CheckinAccessoryNotification extends Notification
|
||||||
$item = $this->item;
|
$item = $this->item;
|
||||||
$note = $this->note;
|
$note = $this->note;
|
||||||
|
|
||||||
return MicrosoftTeamsMessage::create()
|
$message = trans('mail.Accessory_Checkin_Notification');
|
||||||
->to($this->settings->webhook_endpoint)
|
$details = [
|
||||||
->type('success')
|
trans('mail.accessory_name') => htmlspecialchars_decode($item->present()->name),
|
||||||
->addStartGroupToSection('activityTitle')
|
trans('mail.checked_into') => $item->location->name ? $item->location->name : '',
|
||||||
->title(trans('Accessory_Checkin_Notification'))
|
trans('mail.Accessory_Checkin_Notification'). ' by' => $admin->present()->fullName(),
|
||||||
->addStartGroupToSection('activityText')
|
trans('admin/consumables/general.remaining')=> $item->numRemaining(),
|
||||||
->fact(htmlspecialchars_decode($item->present()->name), '', 'activityTitle')
|
trans('mail.notes') => $note ?: '',
|
||||||
->fact(trans('mail.checked_into'), $item->location->name ? $item->location->name : '')
|
];
|
||||||
->fact(trans('mail.Accessory_Checkin_Notification')." by ", $admin->present()->fullName())
|
return array($message, $details);
|
||||||
->fact(trans('admin/consumables/general.remaining'), $item->numRemaining())
|
|
||||||
->fact(trans('mail.notes'), $note ?: '');
|
|
||||||
}
|
}
|
||||||
public function toGoogleChat()
|
public function toGoogleChat()
|
||||||
{
|
{
|
||||||
|
|
|
@ -120,20 +120,17 @@ class CheckoutAccessoryNotification extends Notification
|
||||||
$item = $this->item;
|
$item = $this->item;
|
||||||
$note = $this->note;
|
$note = $this->note;
|
||||||
|
|
||||||
return MicrosoftTeamsMessage::create()
|
$message = trans('mail.Accessory_Checkout_Notification');
|
||||||
->to($this->settings->webhook_endpoint)
|
$details = [
|
||||||
->type('success')
|
trans('mail.assigned_to') => $target->present()->name,
|
||||||
->addStartGroupToSection('activityTitle')
|
trans('mail.accessory_name') => htmlspecialchars_decode($item->present()->name),
|
||||||
->title(trans('mail.Accessory_Checkout_Notification'))
|
trans('general.qty') => $this->checkout_qty,
|
||||||
->addStartGroupToSection('activityText')
|
trans('mail.checkedout_from') => $item->location->name ? $item->location->name : '',
|
||||||
->fact(htmlspecialchars_decode($item->present()->name), '', 'activityTitle')
|
trans('mail.Accessory_Checkout_Notification'). ' by' => $admin->present()->fullName(),
|
||||||
->fact(trans('mail.assigned_to'), $target->present()->name)
|
trans('admin/consumables/general.remaining')=> $item->numRemaining(),
|
||||||
->fact(trans('general.qty'), $this->checkout_qty)
|
trans('mail.notes') => $note ?: '',
|
||||||
->fact(trans('mail.checkedout_from'), $item->location->name ? $item->location->name : '')
|
];
|
||||||
->fact(trans('mail.Accessory_Checkout_Notification') . " by ", $admin->present()->fullName())
|
return array($message, $details);
|
||||||
->fact(trans('admin/consumables/general.remaining'), $item->numRemaining())
|
|
||||||
->fact(trans('mail.notes'), $note ?: '');
|
|
||||||
|
|
||||||
}
|
}
|
||||||
public function toGoogleChat()
|
public function toGoogleChat()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue