mirror of
https://github.com/snipe/snipe-it.git
synced 2025-02-02 08:21:09 -08:00
Merge remote-tracking branch 'origin/develop'
This commit is contained in:
commit
d8a9d93b1d
|
@ -3,6 +3,7 @@
|
||||||
namespace App\Http\Livewire;
|
namespace App\Http\Livewire;
|
||||||
|
|
||||||
use GuzzleHttp\Client;
|
use GuzzleHttp\Client;
|
||||||
|
use Illuminate\Support\Facades\Http;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
use App\Models\Setting;
|
use App\Models\Setting;
|
||||||
use App\Helpers\Helper;
|
use App\Helpers\Helper;
|
||||||
|
@ -45,17 +46,24 @@ class SlackSettingsForm extends Component
|
||||||
"general"=> array(
|
"general"=> array(
|
||||||
"name" => trans('admin/settings/general.general_webhook'),
|
"name" => trans('admin/settings/general.general_webhook'),
|
||||||
"icon" => "fab fa-hashtag",
|
"icon" => "fab fa-hashtag",
|
||||||
"placeholder" => "",
|
"placeholder" => trans('general.url'),
|
||||||
"link" => "",
|
"link" => "",
|
||||||
),
|
),
|
||||||
|
"microsoft" => array(
|
||||||
|
"name" => trans('admin/settings/general.ms_teams'),
|
||||||
|
"icon" => "fa-brands fa-microsoft",
|
||||||
|
"placeholder" => "https://abcd.webhook.office.com/webhookb2/XXXXXXX",
|
||||||
|
"link" => "https://learn.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/add-incoming-webhook?tabs=dotnet#create-incoming-webhooks-1",
|
||||||
|
),
|
||||||
];
|
];
|
||||||
|
|
||||||
$this->setting = Setting::getSettings();
|
$this->setting = Setting::getSettings();
|
||||||
$this->save_button = trans('general.save');
|
$this->save_button = trans('general.save');
|
||||||
$this->webhook_selected = $this->setting->webhook_selected;
|
$this->webhook_selected = $this->setting->webhook_selected;
|
||||||
$this->webhook_placeholder = $this->webhook_text[$this->setting->webhook_selected]["placeholder"];
|
|
||||||
$this->webhook_name = $this->webhook_text[$this->setting->webhook_selected]["name"];
|
$this->webhook_name = $this->webhook_text[$this->setting->webhook_selected]["name"];
|
||||||
$this->webhook_icon = $this->webhook_text[$this->setting->webhook_selected]["icon"];
|
$this->webhook_icon = $this->webhook_text[$this->setting->webhook_selected]["icon"];
|
||||||
|
$this->webhook_placeholder = $this->webhook_text[$this->setting->webhook_selected]["placeholder"];
|
||||||
|
$this->webhook_link = $this->webhook_text[$this->setting->webhook_selected]["link"];
|
||||||
$this->webhook_endpoint = $this->setting->webhook_endpoint;
|
$this->webhook_endpoint = $this->setting->webhook_endpoint;
|
||||||
$this->webhook_channel = $this->setting->webhook_channel;
|
$this->webhook_channel = $this->setting->webhook_channel;
|
||||||
$this->webhook_botname = $this->setting->webhook_botname;
|
$this->webhook_botname = $this->setting->webhook_botname;
|
||||||
|
@ -77,11 +85,13 @@ class SlackSettingsForm extends Component
|
||||||
$this->webhook_name = $this->webhook_text[$this->webhook_selected]['name'];
|
$this->webhook_name = $this->webhook_text[$this->webhook_selected]['name'];
|
||||||
$this->webhook_icon = $this->webhook_text[$this->webhook_selected]["icon"]; ;
|
$this->webhook_icon = $this->webhook_text[$this->webhook_selected]["icon"]; ;
|
||||||
$this->webhook_placeholder = $this->webhook_text[$this->webhook_selected]["placeholder"];
|
$this->webhook_placeholder = $this->webhook_text[$this->webhook_selected]["placeholder"];
|
||||||
|
$this->webhook_endpoint = null;
|
||||||
$this->webhook_link = $this->webhook_text[$this->webhook_selected]["link"];
|
$this->webhook_link = $this->webhook_text[$this->webhook_selected]["link"];
|
||||||
if($this->webhook_selected != 'slack'){
|
if($this->webhook_selected != 'slack'){
|
||||||
$this->isDisabled= '';
|
$this->isDisabled= '';
|
||||||
$this->save_button = trans('general.save');
|
$this->save_button = trans('general.save');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function isButtonDisabled() {
|
private function isButtonDisabled() {
|
||||||
|
@ -174,8 +184,40 @@ class SlackSettingsForm extends Component
|
||||||
$this->setting->save();
|
$this->setting->save();
|
||||||
|
|
||||||
session()->flash('success',trans('admin/settings/message.update.success'));
|
session()->flash('success',trans('admin/settings/message.update.success'));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
public function msTeamTestWebhook(){
|
||||||
|
|
||||||
|
$payload =
|
||||||
|
[
|
||||||
|
"@type" => "MessageCard",
|
||||||
|
"@context" => "http://schema.org/extensions",
|
||||||
|
"summary" => trans('mail.snipe_webhook_summary'),
|
||||||
|
"title" => trans('mail.snipe_webhook_test'),
|
||||||
|
"text" => trans('general.webhook_test_msg', ['app' => $this->webhook_name]),
|
||||||
|
];
|
||||||
|
|
||||||
|
try {
|
||||||
|
$response = Http::withHeaders([
|
||||||
|
'content-type' => 'applications/json',
|
||||||
|
])->post($this->webhook_endpoint,
|
||||||
|
$payload)->throw();
|
||||||
|
|
||||||
|
if(($response->getStatusCode() == 302)||($response->getStatusCode() == 301)){
|
||||||
|
return session()->flash('error' , trans('admin/settings/message.webhook.error_redirect', ['endpoint' => $this->webhook_endpoint]));
|
||||||
|
}
|
||||||
|
$this->isDisabled='';
|
||||||
|
$this->save_button = trans('general.save');
|
||||||
|
return session()->flash('success' , trans('admin/settings/message.webhook.success', ['webhook_name' => $this->webhook_name]));
|
||||||
|
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
|
||||||
|
$this->isDisabled='disabled';
|
||||||
|
$this->save_button = trans('admin/settings/general.webhook_presave');
|
||||||
|
return session()->flash('error' , trans('admin/settings/message.webhook.error', ['error_message' => $e->getMessage(), 'app' => $this->webhook_name]));
|
||||||
|
}
|
||||||
|
|
||||||
|
return session()->flash('error' , trans('admin/settings/message.webhook.error_misc'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,8 +58,13 @@ class CheckoutableListener
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->shouldSendWebhookNotification()) {
|
if ($this->shouldSendWebhookNotification()) {
|
||||||
Notification::route('slack', Setting::getSettings()->webhook_endpoint)
|
|
||||||
->notify($this->getCheckoutNotification($event));
|
//slack doesn't include the url in its messaging format so this is needed to hit the endpoint
|
||||||
|
if(Setting::getSettings()->webhook_selected =='slack') {
|
||||||
|
|
||||||
|
Notification::route('slack', Setting::getSettings()->webhook_endpoint)
|
||||||
|
->notify($this->getCheckoutNotification($event));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (ClientException $e) {
|
} catch (ClientException $e) {
|
||||||
Log::debug("Exception caught during checkout notification: " . $e->getMessage());
|
Log::debug("Exception caught during checkout notification: " . $e->getMessage());
|
||||||
|
@ -107,11 +112,15 @@ class CheckoutableListener
|
||||||
$this->getCheckinNotification($event)
|
$this->getCheckinNotification($event)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
//slack doesn't include the url in its messaging format so this is needed to hit the endpoint
|
||||||
|
if(Setting::getSettings()->webhook_selected =='slack') {
|
||||||
|
|
||||||
if ($this->shouldSendWebhookNotification()) {
|
if ($this->shouldSendWebhookNotification()) {
|
||||||
Notification::route('slack', Setting::getSettings()->webhook_endpoint)
|
Notification::route('slack', Setting::getSettings()->webhook_endpoint)
|
||||||
->notify($this->getCheckinNotification($event));
|
->notify($this->getCheckinNotification($event));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (ClientException $e) {
|
} catch (ClientException $e) {
|
||||||
Log::debug("Exception caught during checkout notification: " . $e->getMessage());
|
Log::debug("Exception caught during checkout notification: " . $e->getMessage());
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
@ -216,9 +225,10 @@ class CheckoutableListener
|
||||||
break;
|
break;
|
||||||
case LicenseSeat::class:
|
case LicenseSeat::class:
|
||||||
$notificationClass = CheckoutLicenseSeatNotification::class;
|
$notificationClass = CheckoutLicenseSeatNotification::class;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return new $notificationClass($event->checkoutable, $event->checkedOutTo, $event->checkedOutBy, $acceptance, $event->note);
|
return new $notificationClass($event->checkoutable, $event->checkedOutTo, $event->checkedOutBy, $acceptance, $event->note);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,8 @@ use Illuminate\Bus\Queueable;
|
||||||
use Illuminate\Notifications\Messages\MailMessage;
|
use Illuminate\Notifications\Messages\MailMessage;
|
||||||
use Illuminate\Notifications\Messages\SlackMessage;
|
use Illuminate\Notifications\Messages\SlackMessage;
|
||||||
use Illuminate\Notifications\Notification;
|
use Illuminate\Notifications\Notification;
|
||||||
|
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsChannel;
|
||||||
|
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsMessage;
|
||||||
|
|
||||||
class CheckinAccessoryNotification extends Notification
|
class CheckinAccessoryNotification extends Notification
|
||||||
{
|
{
|
||||||
|
@ -35,10 +37,14 @@ class CheckinAccessoryNotification extends Notification
|
||||||
*/
|
*/
|
||||||
public function via()
|
public function via()
|
||||||
{
|
{
|
||||||
\Log::debug('via called');
|
|
||||||
$notifyBy = [];
|
$notifyBy = [];
|
||||||
|
|
||||||
if (Setting::getSettings()->webhook_endpoint != '') {
|
if (Setting::getSettings()->webhook_selected == 'microsoft'){
|
||||||
|
|
||||||
|
$notifyBy[] = MicrosoftTeamsChannel::class;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Setting::getSettings()->webhook_selected == 'slack') {
|
||||||
$notifyBy[] = 'slack';
|
$notifyBy[] = 'slack';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,6 +114,24 @@ class CheckinAccessoryNotification extends Notification
|
||||||
->content($note);
|
->content($note);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
public function toMicrosoftTeams()
|
||||||
|
{
|
||||||
|
$admin = $this->admin;
|
||||||
|
$item = $this->item;
|
||||||
|
$note = $this->note;
|
||||||
|
|
||||||
|
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 ?: '');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the mail representation of the notification.
|
* Get the mail representation of the notification.
|
||||||
|
|
|
@ -10,6 +10,8 @@ use Illuminate\Bus\Queueable;
|
||||||
use Illuminate\Notifications\Messages\MailMessage;
|
use Illuminate\Notifications\Messages\MailMessage;
|
||||||
use Illuminate\Notifications\Messages\SlackMessage;
|
use Illuminate\Notifications\Messages\SlackMessage;
|
||||||
use Illuminate\Notifications\Notification;
|
use Illuminate\Notifications\Notification;
|
||||||
|
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsChannel;
|
||||||
|
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsMessage;
|
||||||
|
|
||||||
class CheckinAssetNotification extends Notification
|
class CheckinAssetNotification extends Notification
|
||||||
{
|
{
|
||||||
|
@ -44,7 +46,12 @@ class CheckinAssetNotification extends Notification
|
||||||
public function via()
|
public function via()
|
||||||
{
|
{
|
||||||
$notifyBy = [];
|
$notifyBy = [];
|
||||||
if (Setting::getSettings()->webhook_endpoint != '') {
|
|
||||||
|
if (Setting::getSettings()->webhook_selected == 'microsoft'){
|
||||||
|
|
||||||
|
$notifyBy[] = MicrosoftTeamsChannel::class;
|
||||||
|
}
|
||||||
|
if (Setting::getSettings()->webhook_selected == 'slack') {
|
||||||
\Log::debug('use webhook');
|
\Log::debug('use webhook');
|
||||||
$notifyBy[] = 'slack';
|
$notifyBy[] = 'slack';
|
||||||
}
|
}
|
||||||
|
@ -84,6 +91,23 @@ class CheckinAssetNotification extends Notification
|
||||||
->content($note);
|
->content($note);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
public function toMicrosoftTeams()
|
||||||
|
{
|
||||||
|
$admin = $this->admin;
|
||||||
|
$item = $this->item;
|
||||||
|
$note = $this->note;
|
||||||
|
|
||||||
|
return MicrosoftTeamsMessage::create()
|
||||||
|
->to($this->settings->webhook_endpoint)
|
||||||
|
->type('success')
|
||||||
|
->title(trans('mail.Asset_Checkin_Notification'))
|
||||||
|
->addStartGroupToSection('activityText')
|
||||||
|
->fact(htmlspecialchars_decode($item->present()->name), '', 'activityText')
|
||||||
|
->fact(trans('mail.checked_into'), $item->location->name ? $item->location->name : '')
|
||||||
|
->fact(trans('mail.Asset_Checkin_Notification')." by ", $admin->present()->fullName())
|
||||||
|
->fact(trans('admin/hardware/form.status'), $item->assetstatus->name)
|
||||||
|
->fact(trans('mail.notes'), $note ?: '');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the mail representation of the notification.
|
* Get the mail representation of the notification.
|
||||||
|
|
|
@ -9,6 +9,8 @@ use Illuminate\Bus\Queueable;
|
||||||
use Illuminate\Notifications\Messages\MailMessage;
|
use Illuminate\Notifications\Messages\MailMessage;
|
||||||
use Illuminate\Notifications\Messages\SlackMessage;
|
use Illuminate\Notifications\Messages\SlackMessage;
|
||||||
use Illuminate\Notifications\Notification;
|
use Illuminate\Notifications\Notification;
|
||||||
|
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsChannel;
|
||||||
|
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsMessage;
|
||||||
|
|
||||||
class CheckinLicenseSeatNotification extends Notification
|
class CheckinLicenseSeatNotification extends Notification
|
||||||
{
|
{
|
||||||
|
@ -41,7 +43,12 @@ class CheckinLicenseSeatNotification extends Notification
|
||||||
{
|
{
|
||||||
$notifyBy = [];
|
$notifyBy = [];
|
||||||
|
|
||||||
if (Setting::getSettings()->webhook_endpoint != '') {
|
if (Setting::getSettings()->webhook_selected == 'microsoft'){
|
||||||
|
|
||||||
|
$notifyBy[] = MicrosoftTeamsChannel::class;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Setting::getSettings()->webhook_selected == 'slack') {
|
||||||
$notifyBy[] = 'slack';
|
$notifyBy[] = 'slack';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,6 +94,25 @@ class CheckinLicenseSeatNotification extends Notification
|
||||||
->content($note);
|
->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(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 ?: '');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the mail representation of the notification.
|
* Get the mail representation of the notification.
|
||||||
|
|
|
@ -9,6 +9,8 @@ use Illuminate\Bus\Queueable;
|
||||||
use Illuminate\Notifications\Messages\MailMessage;
|
use Illuminate\Notifications\Messages\MailMessage;
|
||||||
use Illuminate\Notifications\Messages\SlackMessage;
|
use Illuminate\Notifications\Messages\SlackMessage;
|
||||||
use Illuminate\Notifications\Notification;
|
use Illuminate\Notifications\Notification;
|
||||||
|
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsChannel;
|
||||||
|
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsMessage;
|
||||||
|
|
||||||
class CheckoutAccessoryNotification extends Notification
|
class CheckoutAccessoryNotification extends Notification
|
||||||
{
|
{
|
||||||
|
@ -24,7 +26,6 @@ class CheckoutAccessoryNotification extends Notification
|
||||||
$this->note = $note;
|
$this->note = $note;
|
||||||
$this->target = $checkedOutTo;
|
$this->target = $checkedOutTo;
|
||||||
$this->acceptance = $acceptance;
|
$this->acceptance = $acceptance;
|
||||||
|
|
||||||
$this->settings = Setting::getSettings();
|
$this->settings = Setting::getSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +38,12 @@ class CheckoutAccessoryNotification extends Notification
|
||||||
{
|
{
|
||||||
$notifyBy = [];
|
$notifyBy = [];
|
||||||
|
|
||||||
if (Setting::getSettings()->webhook_endpoint != '') {
|
if (Setting::getSettings()->webhook_selected == 'microsoft'){
|
||||||
|
|
||||||
|
$notifyBy[] = MicrosoftTeamsChannel::class;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Setting::getSettings()->webhook_selected == 'slack') {
|
||||||
$notifyBy[] = 'slack';
|
$notifyBy[] = 'slack';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,6 +102,27 @@ class CheckoutAccessoryNotification extends Notification
|
||||||
->content($note);
|
->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(trans('mail.Accessory_Checkout_Notification'))
|
||||||
|
->addStartGroupToSection('activityText')
|
||||||
|
->fact(htmlspecialchars_decode($item->present()->name), '', 'activityTitle')
|
||||||
|
->fact(trans('mail.assigned_to'), $target->present()->name)
|
||||||
|
->fact(trans('mail.checkedout_from'), $item->location->name ? $item->location->name : '')
|
||||||
|
->fact(trans('mail.Accessory_Checkout_Notification') . " by ", $admin->present()->fullName())
|
||||||
|
->fact(trans('admin/consumables/general.remaining'), $item->numRemaining())
|
||||||
|
->fact(trans('mail.notes'), $note ?: '');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the mail representation of the notification.
|
* Get the mail representation of the notification.
|
||||||
|
|
|
@ -6,10 +6,13 @@ use App\Helpers\Helper;
|
||||||
use App\Models\Asset;
|
use App\Models\Asset;
|
||||||
use App\Models\Setting;
|
use App\Models\Setting;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
use Exception;
|
||||||
use Illuminate\Bus\Queueable;
|
use Illuminate\Bus\Queueable;
|
||||||
use Illuminate\Notifications\Messages\MailMessage;
|
use Illuminate\Notifications\Messages\MailMessage;
|
||||||
use Illuminate\Notifications\Messages\SlackMessage;
|
use Illuminate\Notifications\Messages\SlackMessage;
|
||||||
use Illuminate\Notifications\Notification;
|
use Illuminate\Notifications\Notification;
|
||||||
|
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsChannel;
|
||||||
|
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsMessage;
|
||||||
|
|
||||||
class CheckoutAssetNotification extends Notification
|
class CheckoutAssetNotification extends Notification
|
||||||
{
|
{
|
||||||
|
@ -51,9 +54,13 @@ class CheckoutAssetNotification extends Notification
|
||||||
*/
|
*/
|
||||||
public function via()
|
public function via()
|
||||||
{
|
{
|
||||||
|
if (Setting::getSettings()->webhook_selected == 'microsoft'){
|
||||||
|
|
||||||
|
return [MicrosoftTeamsChannel::class];
|
||||||
|
}
|
||||||
$notifyBy = [];
|
$notifyBy = [];
|
||||||
|
|
||||||
if ((Setting::getSettings()) && (Setting::getSettings()->webhook_endpoint != '')) {
|
if ((Setting::getSettings()) && (Setting::getSettings()->webhook_selected == 'slack')) {
|
||||||
\Log::debug('use webhook');
|
\Log::debug('use webhook');
|
||||||
$notifyBy[] = 'slack';
|
$notifyBy[] = 'slack';
|
||||||
}
|
}
|
||||||
|
@ -117,6 +124,25 @@ class CheckoutAssetNotification extends Notification
|
||||||
->content($note);
|
->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')
|
||||||
|
->title(trans('mail.Asset_Checkout_Notification'))
|
||||||
|
->addStartGroupToSection('activityText')
|
||||||
|
->fact(trans('mail.assigned_to'), $target->present()->name)
|
||||||
|
->fact(htmlspecialchars_decode($item->present()->name), '', 'activityText')
|
||||||
|
->fact(trans('mail.Asset_Checkout_Notification') . " by ", $admin->present()->fullName())
|
||||||
|
->fact(trans('mail.notes'), $note ?: '');
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the mail representation of the notification.
|
* Get the mail representation of the notification.
|
||||||
|
|
|
@ -9,6 +9,8 @@ use Illuminate\Bus\Queueable;
|
||||||
use Illuminate\Notifications\Messages\MailMessage;
|
use Illuminate\Notifications\Messages\MailMessage;
|
||||||
use Illuminate\Notifications\Messages\SlackMessage;
|
use Illuminate\Notifications\Messages\SlackMessage;
|
||||||
use Illuminate\Notifications\Notification;
|
use Illuminate\Notifications\Notification;
|
||||||
|
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsChannel;
|
||||||
|
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsMessage;
|
||||||
|
|
||||||
class CheckoutConsumableNotification extends Notification
|
class CheckoutConsumableNotification extends Notification
|
||||||
{
|
{
|
||||||
|
@ -43,7 +45,12 @@ class CheckoutConsumableNotification extends Notification
|
||||||
{
|
{
|
||||||
$notifyBy = [];
|
$notifyBy = [];
|
||||||
|
|
||||||
if (Setting::getSettings()->webhook_endpoint != '') {
|
if (Setting::getSettings()->webhook_selected == 'microsoft'){
|
||||||
|
|
||||||
|
$notifyBy[] = MicrosoftTeamsChannel::class;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Setting::getSettings()->webhook_selected == 'slack') {
|
||||||
$notifyBy[] = 'slack';
|
$notifyBy[] = 'slack';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,6 +109,25 @@ class CheckoutConsumableNotification extends Notification
|
||||||
->content($note);
|
->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(trans('mail.Consumable_checkout_notification'))
|
||||||
|
->addStartGroupToSection('activityText')
|
||||||
|
->fact(htmlspecialchars_decode($item->present()->name), '', 'activityTitle')
|
||||||
|
->fact(trans('mail.Consumable_checkout_notification')." by ", $admin->present()->fullName())
|
||||||
|
->fact(trans('mail.assigned_to'), $target->present()->fullName())
|
||||||
|
->fact(trans('admin/consumables/general.remaining'), $item->numRemaining())
|
||||||
|
->fact(trans('mail.notes'), $note ?: '');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the mail representation of the notification.
|
* Get the mail representation of the notification.
|
||||||
|
|
|
@ -9,6 +9,8 @@ use Illuminate\Bus\Queueable;
|
||||||
use Illuminate\Notifications\Messages\MailMessage;
|
use Illuminate\Notifications\Messages\MailMessage;
|
||||||
use Illuminate\Notifications\Messages\SlackMessage;
|
use Illuminate\Notifications\Messages\SlackMessage;
|
||||||
use Illuminate\Notifications\Notification;
|
use Illuminate\Notifications\Notification;
|
||||||
|
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsChannel;
|
||||||
|
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsMessage;
|
||||||
|
|
||||||
class CheckoutLicenseSeatNotification extends Notification
|
class CheckoutLicenseSeatNotification extends Notification
|
||||||
{
|
{
|
||||||
|
@ -41,9 +43,15 @@ class CheckoutLicenseSeatNotification extends Notification
|
||||||
*/
|
*/
|
||||||
public function via()
|
public function via()
|
||||||
{
|
{
|
||||||
|
|
||||||
$notifyBy = [];
|
$notifyBy = [];
|
||||||
|
|
||||||
if (Setting::getSettings()->webhook_endpoint != '') {
|
if (Setting::getSettings()->webhook_selected == 'microsoft'){
|
||||||
|
|
||||||
|
$notifyBy[] = MicrosoftTeamsChannel::class;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Setting::getSettings()->webhook_selected == 'slack') {
|
||||||
$notifyBy[] = 'slack';
|
$notifyBy[] = 'slack';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,6 +110,25 @@ class CheckoutLicenseSeatNotification extends Notification
|
||||||
->content($note);
|
->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(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 ?: '');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the mail representation of the notification.
|
* Get the mail representation of the notification.
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
"guzzlehttp/guzzle": "^7.0.1",
|
"guzzlehttp/guzzle": "^7.0.1",
|
||||||
"intervention/image": "^2.5",
|
"intervention/image": "^2.5",
|
||||||
"javiereguiluz/easyslugger": "^1.0",
|
"javiereguiluz/easyslugger": "^1.0",
|
||||||
|
"laravel-notification-channels/microsoft-teams": "^1.1",
|
||||||
"laravel/framework": "^8.46",
|
"laravel/framework": "^8.46",
|
||||||
"laravel/helpers": "^1.4",
|
"laravel/helpers": "^1.4",
|
||||||
"laravel/passport": "^10.1",
|
"laravel/passport": "^10.1",
|
||||||
|
|
61
composer.lock
generated
61
composer.lock
generated
|
@ -4,7 +4,7 @@
|
||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "f4f3b6b02d044ed3e54cdd509b01c3dc",
|
"content-hash": "89580c52de91168aac8321460bd428e2",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "alek13/slack",
|
"name": "alek13/slack",
|
||||||
|
@ -3188,6 +3188,63 @@
|
||||||
},
|
},
|
||||||
"time": "2015-04-12T19:57:10+00:00"
|
"time": "2015-04-12T19:57:10+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "laravel-notification-channels/microsoft-teams",
|
||||||
|
"version": "v1.1.4",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/laravel-notification-channels/microsoft-teams.git",
|
||||||
|
"reference": "e2df0129ba430666979eb2ad7033455fd0f6b577"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/laravel-notification-channels/microsoft-teams/zipball/e2df0129ba430666979eb2ad7033455fd0f6b577",
|
||||||
|
"reference": "e2df0129ba430666979eb2ad7033455fd0f6b577",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"guzzlehttp/guzzle": "^6.3 || ^7.0",
|
||||||
|
"illuminate/notifications": "~5.5 || ~6.0 || ~7.0 || ^8.0 || ^9.0 || ^10.0",
|
||||||
|
"illuminate/support": "~5.5 || ~6.0 || ~7.0 || ^8.0 || ^9.0 || ^10.0",
|
||||||
|
"php": ">=7.2"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"mockery/mockery": "^1.2.3",
|
||||||
|
"phpunit/phpunit": "^8.0|^9.5"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"laravel": {
|
||||||
|
"providers": [
|
||||||
|
"NotificationChannels\\MicrosoftTeams\\MicrosoftTeamsServiceProvider"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"NotificationChannels\\MicrosoftTeams\\": "src"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Tobias Madner",
|
||||||
|
"email": "tobias.madner@gmx.at",
|
||||||
|
"homepage": "https://www.pinpoll.com",
|
||||||
|
"role": "Developer"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "A Laravel Notification Channel for Microsoft Teams",
|
||||||
|
"homepage": "https://github.com/laravel-notification-channels/microsoft-teams",
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/laravel-notification-channels/microsoft-teams/issues",
|
||||||
|
"source": "https://github.com/laravel-notification-channels/microsoft-teams/tree/v1.1.4"
|
||||||
|
},
|
||||||
|
"time": "2023-01-25T16:56:40+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "laravel/framework",
|
"name": "laravel/framework",
|
||||||
"version": "v8.83.22",
|
"version": "v8.83.22",
|
||||||
|
@ -16974,5 +17031,5 @@
|
||||||
"ext-pdo": "*"
|
"ext-pdo": "*"
|
||||||
},
|
},
|
||||||
"platform-dev": [],
|
"platform-dev": [],
|
||||||
"plugin-api-version": "2.6.0"
|
"plugin-api-version": "2.3.0"
|
||||||
}
|
}
|
||||||
|
|
|
@ -204,6 +204,7 @@ return [
|
||||||
'integrations' => 'Integrations',
|
'integrations' => 'Integrations',
|
||||||
'slack' => 'Slack',
|
'slack' => 'Slack',
|
||||||
'general_webhook' => 'General Webhook',
|
'general_webhook' => 'General Webhook',
|
||||||
|
'ms_teams' => 'Microsoft Teams',
|
||||||
'webhook' => ':app',
|
'webhook' => ':app',
|
||||||
'webhook_presave' => 'Test to Save',
|
'webhook_presave' => 'Test to Save',
|
||||||
'webhook_title' => 'Update Webhook Settings',
|
'webhook_title' => 'Update Webhook Settings',
|
||||||
|
|
|
@ -1,10 +1,33 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'acceptance_asset_accepted' => 'A user has accepted an item',
|
|
||||||
'acceptance_asset_declined' => 'A user has declined an item',
|
'Accessory_Checkin_Notification' => 'Accessory checked in',
|
||||||
|
'Accessory_Checkout_Notification' => 'Accessory checked out',
|
||||||
|
'Asset_Checkin_Notification' => 'Asset checked in',
|
||||||
|
'Asset_Checkout_Notification' => 'Asset checked out',
|
||||||
|
'Confirm_Accessory_Checkin' => 'Accessory checkin confirmation',
|
||||||
|
'Confirm_Asset_Checkin' => 'Asset checkin confirmation',
|
||||||
|
'Confirm_accessory_delivery' => 'Accessory delivery confirmation',
|
||||||
|
'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',
|
||||||
|
'Expected_Checkin_Report' => 'Expected asset checkin report',
|
||||||
|
'Expiring_Assets_Report' => 'Expiring Assets Report.',
|
||||||
|
'Expiring_Licenses_Report' => 'Expiring Licenses Report.',
|
||||||
|
'Item_Request_Canceled' => 'Item Request Canceled',
|
||||||
|
'Item_Requested' => 'Item Requested',
|
||||||
|
'License_Checkin_Notification' => 'License checked in',
|
||||||
|
'License_Checkout_Notification' => 'License checked out',
|
||||||
|
'Low_Inventory_Report' => 'Low Inventory Report',
|
||||||
'a_user_canceled' => 'A user has canceled an item request on the website',
|
'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',
|
'a_user_requested' => 'A user has requested an item on the website',
|
||||||
|
'acceptance_asset_accepted' => 'A user has accepted an item',
|
||||||
|
'acceptance_asset_declined' => 'A user has declined an item',
|
||||||
'accessory_name' => 'Accessory Name:',
|
'accessory_name' => 'Accessory Name:',
|
||||||
'additional_notes' => 'Additional Notes:',
|
'additional_notes' => 'Additional Notes:',
|
||||||
'admin_has_created' => 'An administrator has created an account for you on the :web website.',
|
'admin_has_created' => 'An administrator has created an account for you on the :web website.',
|
||||||
|
@ -12,59 +35,51 @@ return [
|
||||||
'asset_name' => 'Asset Name:',
|
'asset_name' => 'Asset Name:',
|
||||||
'asset_requested' => 'Asset requested',
|
'asset_requested' => 'Asset requested',
|
||||||
'asset_tag' => 'Asset Tag',
|
'asset_tag' => 'Asset Tag',
|
||||||
|
'assets_warrantee_alert' => 'There is :count asset with a warranty expiring in the next :threshold days.|There are :count assets with warranties expiring in the next :threshold days.',
|
||||||
'assigned_to' => 'Assigned To',
|
'assigned_to' => 'Assigned To',
|
||||||
'best_regards' => 'Best regards,',
|
'best_regards' => 'Best regards,',
|
||||||
'canceled' => 'Canceled:',
|
'canceled' => 'Canceled:',
|
||||||
'checkin_date' => 'Checkin Date:',
|
'checkin_date' => 'Checkin Date:',
|
||||||
'checkout_date' => 'Checkout Date:',
|
'checkout_date' => 'Checkout Date:',
|
||||||
'click_to_confirm' => 'Please click on the following link to confirm your :web account:',
|
'checkedout_from' => 'Checked out 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_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.',
|
'click_on_the_link_asset' => 'Please click on the link at the bottom to confirm that you have received the asset.',
|
||||||
'Confirm_Asset_Checkin' => 'Asset checkin confirmation',
|
'click_to_confirm' => 'Please click on the following link to confirm your :web account:',
|
||||||
'Confirm_Accessory_Checkin' => 'Accessory checkin confirmation',
|
|
||||||
'Confirm_accessory_delivery' => 'Accessory delivery confirmation',
|
|
||||||
'Confirm_license_delivery' => 'License delivery confirmation',
|
|
||||||
'Confirm_asset_delivery' => 'Asset delivery confirmation',
|
|
||||||
'Confirm_consumable_delivery' => 'Consumable delivery confirmation',
|
|
||||||
'current_QTY' => 'Current QTY',
|
'current_QTY' => 'Current QTY',
|
||||||
'Days' => 'Days',
|
|
||||||
'days' => 'Days',
|
'days' => 'Days',
|
||||||
'expecting_checkin_date' => 'Expected Checkin Date:',
|
'expecting_checkin_date' => 'Expected Checkin Date:',
|
||||||
'expires' => 'Expires',
|
'expires' => 'Expires',
|
||||||
'Expiring_Assets_Report' => 'Expiring Assets Report.',
|
|
||||||
'Expiring_Licenses_Report' => 'Expiring Licenses Report.',
|
|
||||||
'hello' => 'Hello',
|
'hello' => 'Hello',
|
||||||
'hi' => 'Hi',
|
'hi' => 'Hi',
|
||||||
'i_have_read' => 'I have read and agree to the terms of use, and have received this item.',
|
'i_have_read' => 'I have read and agree to the terms of use, and have received this item.',
|
||||||
'item' => 'Item:',
|
|
||||||
'Item_Request_Canceled' => 'Item Request Canceled',
|
|
||||||
'Item_Requested' => 'Item Requested',
|
|
||||||
'link_to_update_password' => 'Please click on the following link to update your :web password:',
|
|
||||||
'login_first_admin' => 'Login to your new Snipe-IT installation using the credentials below:',
|
|
||||||
'login' => 'Login:',
|
|
||||||
'Low_Inventory_Report' => 'Low Inventory Report',
|
|
||||||
'inventory_report' => 'Inventory Report',
|
'inventory_report' => 'Inventory Report',
|
||||||
|
'item' => 'Item:',
|
||||||
|
'license_expiring_alert' => 'There is :count license expiring in the next :threshold days.|There are :count licenses expiring in the next :threshold days.',
|
||||||
|
'link_to_update_password' => 'Please click on the following link to update your :web password:',
|
||||||
|
'login' => 'Login:',
|
||||||
|
'login_first_admin' => 'Login to your new Snipe-IT installation using the credentials below:',
|
||||||
|
'low_inventory_alert' => 'There is :count item that is below minimum inventory or will soon be low.|There are :count items that are below minimum inventory or will soon be low.',
|
||||||
'min_QTY' => 'Min QTY',
|
'min_QTY' => 'Min QTY',
|
||||||
'name' => 'Name',
|
'name' => 'Name',
|
||||||
'new_item_checked' => 'A new item has been checked out under your name, details are below.',
|
'new_item_checked' => 'A new item has been checked out under your name, details are below.',
|
||||||
|
'notes' => 'Notes',
|
||||||
'password' => 'Password:',
|
'password' => 'Password:',
|
||||||
'password_reset' => 'Password Reset',
|
'password_reset' => 'Password Reset',
|
||||||
|
|
||||||
'read_the_terms' => 'Please read the terms of use below.',
|
'read_the_terms' => 'Please read the terms of use below.',
|
||||||
'read_the_terms_and_click' => 'Please read the terms of use below, and click on the link at the bottom to confirm that you read
|
'read_the_terms_and_click' => 'Please read the terms of use below, and click on the link at the bottom to confirm that you read and agree to the terms of use, and have received the asset.',
|
||||||
and agree to the terms of use, and have received the asset.',
|
|
||||||
'requested' => 'Requested:',
|
'requested' => 'Requested:',
|
||||||
'reset_link' => 'Your Password Reset Link',
|
'reset_link' => 'Your Password Reset Link',
|
||||||
'reset_password' => 'Click here to reset your password:',
|
'reset_password' => 'Click here to reset your password:',
|
||||||
|
'rights_reserved' => 'All rights reserved.',
|
||||||
'serial' => 'Serial',
|
'serial' => 'Serial',
|
||||||
|
'snipe_webhook_test' => 'Snipe-IT Integration Test',
|
||||||
|
'snipe_webhook_summary' => 'Snipe-IT Integration Test Summary',
|
||||||
'supplier' => 'Supplier',
|
'supplier' => 'Supplier',
|
||||||
'tag' => 'Tag',
|
'tag' => 'Tag',
|
||||||
'test_email' => 'Test Email from Snipe-IT',
|
'test_email' => 'Test Email from Snipe-IT',
|
||||||
'test_mail_text' => 'This is a test from the Snipe-IT Asset Management System. If you got this, mail is working :)',
|
'test_mail_text' => 'This is a test from the Snipe-IT Asset Management System. If you got this, mail is working :)',
|
||||||
'the_following_item' => 'The following item has been checked in: ',
|
'the_following_item' => 'The following item has been checked in: ',
|
||||||
'low_inventory_alert' => 'There is :count item that is below minimum inventory or will soon be low.|There are :count items that are below minimum inventory or will soon be low.',
|
|
||||||
'assets_warrantee_alert' => 'There is :count asset with a warranty expiring in the next :threshold days.|There are :count assets with warranties expiring in the next :threshold days.',
|
|
||||||
'license_expiring_alert' => 'There is :count license expiring in the next :threshold days.|There are :count licenses expiring in the next :threshold days.',
|
|
||||||
'to_reset' => 'To reset your :web password, complete this form:',
|
'to_reset' => 'To reset your :web password, complete this form:',
|
||||||
'type' => 'Type',
|
'type' => 'Type',
|
||||||
'upcoming-audits' => 'There is :count asset that is coming up for audit within :threshold days.|There are :count assets that are coming up for audit within :threshold days.',
|
'upcoming-audits' => 'There is :count asset that is coming up for audit within :threshold days.|There are :count assets that are coming up for audit within :threshold days.',
|
||||||
|
@ -72,14 +87,6 @@ return [
|
||||||
'username' => 'Username',
|
'username' => 'Username',
|
||||||
'welcome' => 'Welcome :name',
|
'welcome' => 'Welcome :name',
|
||||||
'welcome_to' => 'Welcome to :web!',
|
'welcome_to' => 'Welcome to :web!',
|
||||||
'your_credentials' => 'Your Snipe-IT credentials',
|
|
||||||
'Accessory_Checkin_Notification' => 'Accessory checked in',
|
|
||||||
'Asset_Checkin_Notification' => 'Asset checked in',
|
|
||||||
'Asset_Checkout_Notification' => 'Asset checked out',
|
|
||||||
'License_Checkin_Notification' => 'License checked in',
|
|
||||||
'Expected_Checkin_Report' => 'Expected asset checkin report',
|
|
||||||
'Expected_Checkin_Notification' => 'Reminder: :name checkin deadline approaching',
|
|
||||||
'Expected_Checkin_Date' => 'An asset checked out to you is due to be checked back in on :date',
|
|
||||||
'your_assets' => 'View Your Assets',
|
'your_assets' => 'View Your Assets',
|
||||||
'rights_reserved' => 'All rights reserved.',
|
'your_credentials' => 'Your Snipe-IT credentials',
|
||||||
];
|
];
|
||||||
|
|
|
@ -61,9 +61,9 @@
|
||||||
<div class="col-md-9 required" wire:ignore>
|
<div class="col-md-9 required" wire:ignore>
|
||||||
|
|
||||||
@if (Helper::isDemoMode())
|
@if (Helper::isDemoMode())
|
||||||
{{ Form::select('webhook_selected', array('slack' => trans('admin/settings/general.slack'), 'general' => trans('admin/settings/general.general_webhook')), old('webhook_selected', $webhook_selected), array('class'=>'select2 form-control', 'aria-label' => 'webhook_selected', 'id' => 'select2', 'style'=>'width:100%', 'disabled')) }}
|
{{ Form::select('webhook_selected', array('slack' => trans('admin/settings/general.slack'), 'general' => trans('admin/settings/general.general_webhook'), 'microsoft' => trans('admin/settings/general.ms_teams')), old('webhook_selected', $webhook_selected), array('class'=>'select2 form-control', 'aria-label' => 'webhook_selected', 'id' => 'select2', 'style'=>'width:100%', 'disabled')) }}
|
||||||
@else
|
@else
|
||||||
{{ Form::select('webhook_selected', array('slack' => trans('admin/settings/general.slack'), 'general' => trans('admin/settings/general.general_webhook')), old('webhook_selected', $webhook_selected), array('class'=>'select2 form-control', 'aria-label' => 'webhook_selected', 'id' => 'select2', 'data-minimum-results-for-search' => '-1', 'style'=>'width:100%')) }}
|
{{ Form::select('webhook_selected', array('slack' => trans('admin/settings/general.slack'), 'general' => trans('admin/settings/general.general_webhook'), 'microsoft' => trans('admin/settings/general.ms_teams')), old('webhook_selected', $webhook_selected), array('class'=>'select2 form-control', 'aria-label' => 'webhook_selected', 'id' => 'select2', 'data-minimum-results-for-search' => '-1', 'style'=>'width:100%')) }}
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -106,16 +106,17 @@
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
<!-- Webhook botname -->
|
<!-- Webhook botname -->
|
||||||
<div class="form-group{{ $errors->has('webhook_botname') ? ' error' : '' }}">
|
@if($webhook_selected != 'microsoft')
|
||||||
<div class="col-md-2">
|
<div class="form-group{{ $errors->has('webhook_botname') ? ' error' : '' }}">
|
||||||
{{ Form::label('webhook_botname', trans('admin/settings/general.webhook_botname',['app' => $webhook_name ])) }}
|
<div class="col-md-2">
|
||||||
|
{{ Form::label('webhook_botname', trans('admin/settings/general.webhook_botname',['app' => $webhook_name ])) }}
|
||||||
|
</div>
|
||||||
|
<div class="col-md-9">
|
||||||
|
<input type="text" wire:model.lazy="webhook_botname" class='form-control' placeholder="Snipe-Bot" {{ old('webhook_botname', $webhook_botname)}}{{ Helper::isDemoMode() ? ' disabled' : ''}}>
|
||||||
|
{!! $errors->first('webhook_botname', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
|
||||||
|
</div><!--col-md-10-->
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-9">
|
@endif
|
||||||
<input type="text" wire:model.lazy="webhook_botname" class='form-control' placeholder="Snipe-Bot" {{ old('webhook_botname', $webhook_botname)}}{{ Helper::isDemoMode() ? ' disabled' : ''}}>
|
|
||||||
{!! $errors->first('webhook_botname', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
|
|
||||||
</div><!--col-md-10-->
|
|
||||||
</div>
|
|
||||||
|
|
||||||
@if (!Helper::isDemoMode())
|
@if (!Helper::isDemoMode())
|
||||||
@include('partials.forms.demo-mode')
|
@include('partials.forms.demo-mode')
|
||||||
@endif
|
@endif
|
||||||
|
@ -124,7 +125,11 @@
|
||||||
@if($webhook_endpoint != null && $webhook_channel != null)
|
@if($webhook_endpoint != null && $webhook_channel != null)
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="col-md-offset-2 col-md-9">
|
<div class="col-md-offset-2 col-md-9">
|
||||||
<a href="#" wire:click.prevent="testWebhook"
|
@if($webhook_selected == "microsoft")
|
||||||
|
<a href="#" wire:click.prevent="msTeamTestWebhook"
|
||||||
|
@else
|
||||||
|
<a href="#" wire:click.prevent="testWebhook"
|
||||||
|
@endif
|
||||||
class="btn btn-default btn-sm pull-left">
|
class="btn btn-default btn-sm pull-left">
|
||||||
<i class="{{$webhook_icon}}" aria-hidden="true"></i>
|
<i class="{{$webhook_icon}}" aria-hidden="true"></i>
|
||||||
{!! trans('admin/settings/general.webhook_test',['app' => ucwords($webhook_selected) ]) !!}
|
{!! trans('admin/settings/general.webhook_test',['app' => ucwords($webhook_selected) ]) !!}
|
||||||
|
|
Loading…
Reference in a new issue