From ada1a593a4e43bb8dcb02bbc58b39662c62b6ff4 Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Wed, 24 Jan 2024 11:29:32 -0800 Subject: [PATCH 01/15] add google placeholder --- app/Http/Livewire/SlackSettingsForm.php | 8 +++++++- resources/lang/en-US/admin/settings/general.php | 1 + resources/views/livewire/slack-settings-form.blade.php | 4 ++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/Http/Livewire/SlackSettingsForm.php b/app/Http/Livewire/SlackSettingsForm.php index 7fc53c7818..865bd10b26 100644 --- a/app/Http/Livewire/SlackSettingsForm.php +++ b/app/Http/Livewire/SlackSettingsForm.php @@ -42,12 +42,18 @@ class SlackSettingsForm extends Component "placeholder" => "https://hooks.slack.com/services/XXXXXXXXXXXXXXXXXXXXX", "link" => 'https://api.slack.com/messaging/webhooks', ), - "general"=> array( + "general" => array( "name" => trans('admin/settings/general.general_webhook'), "icon" => "fab fa-hashtag", "placeholder" => "", "link" => "", ), + "google" => array( + "name" => trans('admin/settings/general.google_workspaces'), + "icon" => "fa-brands fa-google", + "placeholder" => "", + "link" => "", + ), ]; $this->setting = Setting::getSettings(); diff --git a/resources/lang/en-US/admin/settings/general.php b/resources/lang/en-US/admin/settings/general.php index c8d6306036..a05b0b6b71 100644 --- a/resources/lang/en-US/admin/settings/general.php +++ b/resources/lang/en-US/admin/settings/general.php @@ -204,6 +204,7 @@ return [ 'integrations' => 'Integrations', 'slack' => 'Slack', 'general_webhook' => 'General Webhook', + 'google_workspaces' => 'Google Workspaces', 'webhook' => ':app', 'webhook_presave' => 'Test to Save', 'webhook_title' => 'Update Webhook Settings', diff --git a/resources/views/livewire/slack-settings-form.blade.php b/resources/views/livewire/slack-settings-form.blade.php index 0c67ca067e..a33aad6abd 100644 --- a/resources/views/livewire/slack-settings-form.blade.php +++ b/resources/views/livewire/slack-settings-form.blade.php @@ -61,9 +61,9 @@
@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'), 'google' => trans('admin/settings/general.google_workspaces')), old('webhook_selected', $webhook_selected), array('class'=>'select2 form-control', 'aria-label' => 'webhook_selected', 'id' => 'select2', 'style'=>'width:100%', 'disabled')) }} @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'), 'google' => trans('admin/settings/general.google_workspaces')), 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
From 1d3124f89f681fb4ab4050ed0abb57bfc06073bd Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Wed, 24 Jan 2024 14:38:45 -0800 Subject: [PATCH 02/15] adding a test variable for test methods --- app/Http/Livewire/SlackSettingsForm.php | 11 +++++++++-- .../livewire/slack-settings-form.blade.php | 18 ++++++++++-------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/app/Http/Livewire/SlackSettingsForm.php b/app/Http/Livewire/SlackSettingsForm.php index 865bd10b26..092df38511 100644 --- a/app/Http/Livewire/SlackSettingsForm.php +++ b/app/Http/Livewire/SlackSettingsForm.php @@ -15,6 +15,7 @@ class SlackSettingsForm extends Component public $isDisabled ='disabled' ; public $webhook_name; public $webhook_link; + public $webhook_test; public $webhook_placeholder; public $webhook_icon; public $webhook_selected; @@ -41,18 +42,21 @@ class SlackSettingsForm extends Component "icon" => 'fab fa-slack', "placeholder" => "https://hooks.slack.com/services/XXXXXXXXXXXXXXXXXXXXX", "link" => 'https://api.slack.com/messaging/webhooks', + "test" => 'testWebhook' ), "general" => array( "name" => trans('admin/settings/general.general_webhook'), "icon" => "fab fa-hashtag", "placeholder" => "", "link" => "", + "test" => 'testWebhook' ), "google" => array( "name" => trans('admin/settings/general.google_workspaces'), "icon" => "fa-brands fa-google", - "placeholder" => "", - "link" => "", + "placeholder" => "https://chat.googleapis.com/v1/spaces/xxxxxxxx/messages?key=xxxxxx", + "link" => "https://developers.google.com/chat/how-tos/webhooks#register_the_incoming_webhook", + "test" => 'googleWebhookTest' ), ]; @@ -145,6 +149,9 @@ class SlackSettingsForm extends Component return session()->flash('error' , trans('admin/settings/message.webhook.error_misc')); + } + public function googleWebhookTest(){ + } public function clearSettings(){ diff --git a/resources/views/livewire/slack-settings-form.blade.php b/resources/views/livewire/slack-settings-form.blade.php index a33aad6abd..fd8696c6a7 100644 --- a/resources/views/livewire/slack-settings-form.blade.php +++ b/resources/views/livewire/slack-settings-form.blade.php @@ -106,15 +106,17 @@ @endif -
-
- {{ Form::label('webhook_botname', trans('admin/settings/general.webhook_botname',['app' => $webhook_name ])) }} + @if($webhook_selected != 'microsoft' && $webhook_selected != 'google') +
+
+ {{ Form::label('webhook_botname', trans('admin/settings/general.webhook_botname',['app' => $webhook_name ])) }} +
+
+ + {!! $errors->first('webhook_botname', '') !!} +
-
- - {!! $errors->first('webhook_botname', '') !!} -
-
+ @endif @if (!Helper::isDemoMode()) @include('partials.forms.demo-mode') From 6e9a46e582f4d6f99b28919bf644f3b34caa482f Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Wed, 24 Jan 2024 15:50:36 -0800 Subject: [PATCH 03/15] working on Chat integration test --- app/Http/Livewire/SlackSettingsForm.php | 30 +++++++++++++++++-- .../livewire/slack-settings-form.blade.php | 2 +- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/app/Http/Livewire/SlackSettingsForm.php b/app/Http/Livewire/SlackSettingsForm.php index 092df38511..030202b941 100644 --- a/app/Http/Livewire/SlackSettingsForm.php +++ b/app/Http/Livewire/SlackSettingsForm.php @@ -3,6 +3,7 @@ namespace App\Http\Livewire; use GuzzleHttp\Client; +use Illuminate\Support\Facades\Http; use Livewire\Component; use App\Models\Setting; use App\Helpers\Helper; @@ -42,21 +43,21 @@ class SlackSettingsForm extends Component "icon" => 'fab fa-slack', "placeholder" => "https://hooks.slack.com/services/XXXXXXXXXXXXXXXXXXXXX", "link" => 'https://api.slack.com/messaging/webhooks', - "test" => 'testWebhook' + "test" => "testWebhook" ), "general" => array( "name" => trans('admin/settings/general.general_webhook'), "icon" => "fab fa-hashtag", "placeholder" => "", "link" => "", - "test" => 'testWebhook' + "test" => "testWebhook" ), "google" => array( "name" => trans('admin/settings/general.google_workspaces'), "icon" => "fa-brands fa-google", "placeholder" => "https://chat.googleapis.com/v1/spaces/xxxxxxxx/messages?key=xxxxxx", "link" => "https://developers.google.com/chat/how-tos/webhooks#register_the_incoming_webhook", - "test" => 'googleWebhookTest' + "test" => "googleWebhookTest" ), ]; @@ -70,6 +71,7 @@ class SlackSettingsForm extends Component $this->webhook_channel = $this->setting->webhook_channel; $this->webhook_botname = $this->setting->webhook_botname; $this->webhook_options = $this->setting->webhook_selected; + $this->webhook_test = $this->webhook_text[$this->setting->webhook_selected]["test"]; if($this->setting->webhook_endpoint != null && $this->setting->webhook_channel != null){ @@ -151,7 +153,29 @@ class SlackSettingsForm extends Component } public function googleWebhookTest(){ + $url = $this->webhook_endpoint; + $data = [ 'text' => trans('general.webhook_test_msg', ['app' => $this->webhook_name])]; + $headers = [ + 'Authorization' => 'Bearer'. 'AIzaSyBu-61gEOhYGfrmT3fHQj6vS8TDWpo1B5U', + 'Content-Type' => 'application/json', + ]; + $client = new Client(); + try { + $response = $client->post($url,[ + 'headers' => $headers, + 'json' => $data, + ]); + + if (($response->getStatusCode() == 302) || ($response->getStatusCode() == 301)) { + return session()->flash('error', trans('admin/settings/message.webhook.error_redirect', ['endpoint' => $this->webhook_endpoint])); + } + } 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])); + } } public function clearSettings(){ diff --git a/resources/views/livewire/slack-settings-form.blade.php b/resources/views/livewire/slack-settings-form.blade.php index fd8696c6a7..e24b820f86 100644 --- a/resources/views/livewire/slack-settings-form.blade.php +++ b/resources/views/livewire/slack-settings-form.blade.php @@ -126,7 +126,7 @@ @if($webhook_endpoint != null && $webhook_channel != null)
- {!! trans('admin/settings/general.webhook_test',['app' => ucwords($webhook_selected) ]) !!} From e8159d97fa187dc9613e44e3762b8457c8dbabe7 Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Mon, 29 Jan 2024 11:12:25 -0800 Subject: [PATCH 04/15] changes --- app/Http/Livewire/SlackSettingsForm.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Livewire/SlackSettingsForm.php b/app/Http/Livewire/SlackSettingsForm.php index 030202b941..a5c3dffd3d 100644 --- a/app/Http/Livewire/SlackSettingsForm.php +++ b/app/Http/Livewire/SlackSettingsForm.php @@ -154,7 +154,7 @@ class SlackSettingsForm extends Component } public function googleWebhookTest(){ $url = $this->webhook_endpoint; - $data = [ 'text' => trans('general.webhook_test_msg', ['app' => $this->webhook_name])]; + $data = json_encode([ 'text' => trans('general.webhook_test_msg', ['app' => $this->webhook_name])]); $headers = [ 'Authorization' => 'Bearer'. 'AIzaSyBu-61gEOhYGfrmT3fHQj6vS8TDWpo1B5U', 'Content-Type' => 'application/json', From dfa33f651acdbfd7b41f585bf198b09b62024b00 Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Mon, 29 Jan 2024 12:58:09 -0800 Subject: [PATCH 05/15] webhook test works --- app/Http/Livewire/SlackSettingsForm.php | 43 ++++++++++++++++++- .../lang/en-US/admin/settings/general.php | 1 + .../livewire/slack-settings-form.blade.php | 31 +++++++------ 3 files changed, 57 insertions(+), 18 deletions(-) diff --git a/app/Http/Livewire/SlackSettingsForm.php b/app/Http/Livewire/SlackSettingsForm.php index ee63e7a48f..101583f582 100644 --- a/app/Http/Livewire/SlackSettingsForm.php +++ b/app/Http/Livewire/SlackSettingsForm.php @@ -42,18 +42,28 @@ class SlackSettingsForm extends Component "icon" => 'fab fa-slack', "placeholder" => "https://hooks.slack.com/services/XXXXXXXXXXXXXXXXXXXXX", "link" => 'https://api.slack.com/messaging/webhooks', + "test" => "testWebhook" ), "general"=> array( "name" => trans('admin/settings/general.general_webhook'), "icon" => "fab fa-hashtag", "placeholder" => trans('general.url'), "link" => "", + "test" => "testWebhook" + ), + "google" => array( + "name" => trans('admin/settings/general.google_workspaces'), + "icon" => "fa-brands fa-google", + "placeholder" => "https://chat.googleapis.com/v1/spaces/xxxxxxxx/messages?key=xxxxxx", + "link" => "https://developers.google.com/chat/how-tos/webhooks#register_the_incoming_webhook", + "test" => "googleWebhookTest" ), "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", + "test" => "msTeamTestWebhook" ), ]; @@ -64,6 +74,7 @@ class SlackSettingsForm extends Component $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_test = $this->webhook_text[$this->setting->webhook_selected]["test"]; $this->webhook_endpoint = $this->setting->webhook_endpoint; $this->webhook_channel = $this->setting->webhook_channel; $this->webhook_botname = $this->setting->webhook_botname; @@ -87,11 +98,11 @@ class SlackSettingsForm extends Component $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_test = $this->webhook_text[$this->webhook_selected]["test"]; if($this->webhook_selected != 'slack'){ $this->isDisabled= ''; $this->save_button = trans('general.save'); } - } private function isButtonDisabled() { @@ -188,7 +199,35 @@ class SlackSettingsForm extends Component } } - public function msTeamTestWebhook(){ + public function googleWebhookTest(){ + + $payload = [ + "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])); + } + } + public function msTeamTestWebhook(){ $payload = [ diff --git a/resources/lang/en-US/admin/settings/general.php b/resources/lang/en-US/admin/settings/general.php index 21e5759053..0c572e0676 100644 --- a/resources/lang/en-US/admin/settings/general.php +++ b/resources/lang/en-US/admin/settings/general.php @@ -70,6 +70,7 @@ return [ 'general_settings_keywords' => 'company support, signature, acceptance, email format, username format, images, per page, thumbnail, eula, tos, dashboard, privacy', 'general_settings_help' => 'Default EULA and more', 'generate_backup' => 'Generate Backup', + 'google_workspaces' => 'Google Workspaces', 'header_color' => 'Header Color', 'info' => 'These settings let you customize certain aspects of your installation.', 'label_logo' => 'Label Logo', diff --git a/resources/views/livewire/slack-settings-form.blade.php b/resources/views/livewire/slack-settings-form.blade.php index ad3271bbc7..8182647098 100644 --- a/resources/views/livewire/slack-settings-form.blade.php +++ b/resources/views/livewire/slack-settings-form.blade.php @@ -61,9 +61,9 @@
@if (Helper::isDemoMode()) - {{ 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')) }} + {{ Form::select('webhook_selected', array('slack' => trans('admin/settings/general.slack'), 'general' => trans('admin/settings/general.general_webhook'),'google' => trans('admin/settings/general.google_workspaces'), '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 - {{ 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%')) }} + {{ Form::select('webhook_selected', array('slack' => trans('admin/settings/general.slack'), 'general' => trans('admin/settings/general.general_webhook'),'google' => trans('admin/settings/general.google_workspaces'), '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
@@ -90,23 +90,25 @@ -
-
- {{ Form::label('webhook_channel', trans('admin/settings/general.webhook_channel',['app' => $webhook_name ])) }} -
-
- + @if($webhook_selected != 'microsoft' && $webhook_selected!= 'google') +
+
+ {{ Form::label('webhook_channel', trans('admin/settings/general.webhook_channel',['app' => $webhook_name ])) }} +
+
+ - {!! $errors->first('webhook_channel', '') !!} + {!! $errors->first('webhook_channel', '') !!} +
-
+ @endif @if (Helper::isDemoMode()) @include('partials.forms.demo-mode') @endif - @if($webhook_selected != 'microsoft') + @if($webhook_selected != 'microsoft' && $webhook_selected != 'google')
{{ Form::label('webhook_botname', trans('admin/settings/general.webhook_botname',['app' => $webhook_name ])) }} @@ -122,14 +124,11 @@ @endif + @if($webhook_endpoint != null && $webhook_channel != null)
- @if($webhook_selected == "microsoft") - {!! trans('admin/settings/general.webhook_test',['app' => ucwords($webhook_selected) ]) !!} From 87bce0c097a9e64f6d6031836f4f8f37323b6ca1 Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Tue, 30 Jan 2024 12:38:17 -0800 Subject: [PATCH 06/15] adds google notifs for asset check in and out --- app/Http/Livewire/SlackSettingsForm.php | 8 +-- app/Listeners/CheckoutableListener.php | 2 +- .../CheckinAssetNotification.php | 36 +++++++++++ .../CheckoutAssetNotification.php | 45 +++++++++++++- composer.json | 1 + composer.lock | 59 ++++++++++++++++++- resources/lang/en-US/admin/hardware/form.php | 2 +- 7 files changed, 143 insertions(+), 10 deletions(-) diff --git a/app/Http/Livewire/SlackSettingsForm.php b/app/Http/Livewire/SlackSettingsForm.php index 101583f582..e2f1b4ef14 100644 --- a/app/Http/Livewire/SlackSettingsForm.php +++ b/app/Http/Livewire/SlackSettingsForm.php @@ -37,11 +37,11 @@ class SlackSettingsForm extends Component public function mount() { $this->webhook_text= [ - "slack" => array( + "slack" => array( "name" => trans('admin/settings/general.slack') , - "icon" => 'fab fa-slack', - "placeholder" => "https://hooks.slack.com/services/XXXXXXXXXXXXXXXXXXXXX", - "link" => 'https://api.slack.com/messaging/webhooks', + "icon" => 'fab fa-slack', + "placeholder" => "https://hooks.slack.com/services/XXXXXXXXXXXXXXXXXXXXX", + "link" => 'https://api.slack.com/messaging/webhooks', "test" => "testWebhook" ), "general"=> array( diff --git a/app/Listeners/CheckoutableListener.php b/app/Listeners/CheckoutableListener.php index 162b07d276..86a0957839 100644 --- a/app/Listeners/CheckoutableListener.php +++ b/app/Listeners/CheckoutableListener.php @@ -60,7 +60,7 @@ class CheckoutableListener if ($this->shouldSendWebhookNotification()) { //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(Setting::getSettings()->webhook_selected =='slack' || Setting::getSettings()->webhook_selected =='general') { Notification::route('slack', Setting::getSettings()->webhook_endpoint) ->notify($this->getCheckoutNotification($event)); diff --git a/app/Notifications/CheckinAssetNotification.php b/app/Notifications/CheckinAssetNotification.php index 8e9467c54f..d0e34bc87f 100644 --- a/app/Notifications/CheckinAssetNotification.php +++ b/app/Notifications/CheckinAssetNotification.php @@ -10,6 +10,11 @@ use Illuminate\Bus\Queueable; 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; @@ -46,6 +51,10 @@ class CheckinAssetNotification extends Notification public function via() { $notifyBy = []; + if (Setting::getSettings()->webhook_selected == 'google'){ + + $notifyBy[] = GoogleChatChannel::class; + } if (Setting::getSettings()->webhook_selected == 'microsoft'){ @@ -108,6 +117,33 @@ class CheckinAssetNotification extends Notification ->fact(trans('admin/hardware/form.status'), $item->assetstatus->name) ->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.Asset_Checkin_Notification').'' ?: '', + htmlspecialchars_decode($item->present()->name) ?: '', + ) + ->section( + Section::create( + KeyValue::create( + trans('mail.checked_into') ?: '', + $item->location->name ? $item->location->name : '', + trans('admin/hardware/form.status').":".$item->assetstatus->name, + ) + ->onClick(route('hardware.show', $item->id)) + ) + ) + ); + + } /** * Get the mail representation of the notification. diff --git a/app/Notifications/CheckoutAssetNotification.php b/app/Notifications/CheckoutAssetNotification.php index 7350a7736b..a2fe275ae2 100644 --- a/app/Notifications/CheckoutAssetNotification.php +++ b/app/Notifications/CheckoutAssetNotification.php @@ -11,6 +11,13 @@ use Illuminate\Bus\Queueable; use Illuminate\Notifications\Messages\MailMessage; use Illuminate\Notifications\Messages\SlackMessage; use Illuminate\Notifications\Notification; +use NotificationChannels\GoogleChat\Card; +use NotificationChannels\GoogleChat\Enums\Icon; +use NotificationChannels\GoogleChat\Enums\ImageStyle; +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; @@ -54,13 +61,18 @@ class CheckoutAssetNotification extends Notification */ public function via() { + $notifyBy = []; + if (Setting::getSettings()->webhook_selected == 'google'){ + + $notifyBy[] = GoogleChatChannel::class; + } + if (Setting::getSettings()->webhook_selected == 'microsoft'){ - return [MicrosoftTeamsChannel::class]; + $notifyBy[] = MicrosoftTeamsChannel::class; } - $notifyBy = []; - if ((Setting::getSettings()) && (Setting::getSettings()->webhook_selected == 'slack')) { + if ((Setting::getSettings()->webhook_selected == 'slack') || (Setting::getSettings()->webhook_selected == '')) { \Log::debug('use webhook'); $notifyBy[] = 'slack'; } @@ -143,6 +155,33 @@ class CheckoutAssetNotification extends Notification } +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.Asset_Checkout_Notification').'' ?: '', + htmlspecialchars_decode($item->present()->name) ?: '', + ) + ->section( + Section::create( + KeyValue::create( + trans('mail.assigned_to') ?: '', + $target->present()->name ?: '', + $note ?: '', + ) + ->onClick(route('users.show', $target->id)) + ) + ) + ); + + } /** * Get the mail representation of the notification. diff --git a/composer.json b/composer.json index a378f15900..502cb796e2 100644 --- a/composer.json +++ b/composer.json @@ -42,6 +42,7 @@ "guzzlehttp/guzzle": "^7.0.1", "intervention/image": "^2.5", "javiereguiluz/easyslugger": "^1.0", + "laravel-notification-channels/google-chat": "*", "laravel-notification-channels/microsoft-teams": "^1.1", "laravel/framework": "^8.46", "laravel/helpers": "^1.4", diff --git a/composer.lock b/composer.lock index f4baccc092..8fb4ae80e8 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "89580c52de91168aac8321460bd428e2", + "content-hash": "bc968c279762208bd4856bb6ebed42c3", "packages": [ { "name": "alek13/slack", @@ -3188,6 +3188,63 @@ }, "time": "2015-04-12T19:57:10+00:00" }, + { + "name": "laravel-notification-channels/google-chat", + "version": "v1.0.1", + "source": { + "type": "git", + "url": "https://github.com/laravel-notification-channels/google-chat.git", + "reference": "843078439403a925b484cef99a26b447e30a9c32" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laravel-notification-channels/google-chat/zipball/843078439403a925b484cef99a26b447e30a9c32", + "reference": "843078439403a925b484cef99a26b447e30a9c32", + "shasum": "" + }, + "require": { + "guzzlehttp/guzzle": "^6.3 || ^7.0", + "illuminate/notifications": "~8.0", + "illuminate/support": "~8.0", + "php": ">=7.3" + }, + "require-dev": { + "orchestra/testbench": "^6.0", + "phpunit/phpunit": "^9.0" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "NotificationChannels\\GoogleChat\\GoogleChatServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "NotificationChannels\\GoogleChat\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Frank Dixon", + "email": "frank@thetreehouse.family", + "homepage": "https://thetreehouse.family", + "role": "Developer" + } + ], + "description": "Google Chat Notification Channel for Laravel (fka. Hangouts Chat)", + "homepage": "https://github.com/laravel-notification-channels/google-chat", + "support": { + "issues": "https://github.com/laravel-notification-channels/google-chat/issues", + "source": "https://github.com/laravel-notification-channels/google-chat/tree/v1.0.1" + }, + "time": "2021-07-15T22:40:51+00:00" + }, { "name": "laravel-notification-channels/microsoft-teams", "version": "v1.1.4", diff --git a/resources/lang/en-US/admin/hardware/form.php b/resources/lang/en-US/admin/hardware/form.php index a7aba0813c..d37d9eac98 100644 --- a/resources/lang/en-US/admin/hardware/form.php +++ b/resources/lang/en-US/admin/hardware/form.php @@ -16,7 +16,7 @@ return [ 'checkedout_to' => 'Checked Out To', 'checkout_date' => 'Checkout Date', 'checkin_date' => 'Checkin Date', - 'checkout_to' => 'Checkout to', + 'checkout_to' => 'Checked out to', 'cost' => 'Purchase Cost', 'create' => 'Create Asset', 'date' => 'Purchase Date', From e074ca0bf958c52063127205ecd77d072bb00566 Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Tue, 30 Jan 2024 12:57:45 -0800 Subject: [PATCH 07/15] adds google notifs to accessories check in and out --- .../CheckinAccessoryNotification.php | 36 ++++++++++++++++++ .../CheckinAssetNotification.php | 2 +- .../CheckoutAccessoryNotification.php | 37 +++++++++++++++++++ 3 files changed, 74 insertions(+), 1 deletion(-) diff --git a/app/Notifications/CheckinAccessoryNotification.php b/app/Notifications/CheckinAccessoryNotification.php index f376c26a84..cc721f3ad6 100644 --- a/app/Notifications/CheckinAccessoryNotification.php +++ b/app/Notifications/CheckinAccessoryNotification.php @@ -9,6 +9,11 @@ use Illuminate\Bus\Queueable; 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; @@ -38,6 +43,10 @@ class CheckinAccessoryNotification extends Notification public function via() { $notifyBy = []; + if (Setting::getSettings()->webhook_selected == 'google'){ + + $notifyBy[] = GoogleChatChannel::class; + } if (Setting::getSettings()->webhook_selected == 'microsoft'){ @@ -132,6 +141,33 @@ class CheckinAccessoryNotification extends Notification ->fact(trans('admin/consumables/general.remaining'), $item->numRemaining()) ->fact(trans('mail.notes'), $note ?: ''); } + public function toGoogleChat() + { + $item = $this->item; + $note = $this->note; + + return GoogleChatMessage::create() + ->to($this->settings->webhook_endpoint) + ->card( + Card::create() + ->header( + ''.trans('mail.Accessory_Checkin_Notification').'' ?: '', + htmlspecialchars_decode($item->present()->name) ?: '', + ) + ->section( + Section::create( + KeyValue::create( + 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)) + ) + ) + ); + + } /** * Get the mail representation of the notification. diff --git a/app/Notifications/CheckinAssetNotification.php b/app/Notifications/CheckinAssetNotification.php index d0e34bc87f..71632ca0e0 100644 --- a/app/Notifications/CheckinAssetNotification.php +++ b/app/Notifications/CheckinAssetNotification.php @@ -136,7 +136,7 @@ class CheckinAssetNotification extends Notification KeyValue::create( trans('mail.checked_into') ?: '', $item->location->name ? $item->location->name : '', - trans('admin/hardware/form.status').":".$item->assetstatus->name, + trans('admin/hardware/form.status').": ".$item->assetstatus->name, ) ->onClick(route('hardware.show', $item->id)) ) diff --git a/app/Notifications/CheckoutAccessoryNotification.php b/app/Notifications/CheckoutAccessoryNotification.php index 62fce8e176..868b1ced46 100644 --- a/app/Notifications/CheckoutAccessoryNotification.php +++ b/app/Notifications/CheckoutAccessoryNotification.php @@ -9,6 +9,11 @@ use Illuminate\Bus\Queueable; 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; @@ -37,6 +42,10 @@ class CheckoutAccessoryNotification extends Notification public function via() { $notifyBy = []; + if (Setting::getSettings()->webhook_selected == 'google'){ + + $notifyBy[] = GoogleChatChannel::class; + } if (Setting::getSettings()->webhook_selected == 'microsoft'){ @@ -123,6 +132,34 @@ class CheckoutAccessoryNotification extends Notification ->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.Accessory_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->numRemaining(), + ) + ->onClick(route('users.show', $target->id)) + ) + ) + ); + + } + /** * Get the mail representation of the notification. From 2406d2cfdb9bcc28f7b96867ab8491d858fbb4aa Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Tue, 30 Jan 2024 13:14:24 -0800 Subject: [PATCH 08/15] adds google notifs to license seats check in and out --- .../CheckinAccessoryNotification.php | 1 - .../CheckinLicenseSeatNotification.php | 37 +++++++++++++++++++ .../CheckoutLicenseSeatNotification.php | 37 ++++++++++++++++++- resources/lang/en-US/mail.php | 1 + 4 files changed, 74 insertions(+), 2 deletions(-) diff --git a/app/Notifications/CheckinAccessoryNotification.php b/app/Notifications/CheckinAccessoryNotification.php index cc721f3ad6..c4c16f31ee 100644 --- a/app/Notifications/CheckinAccessoryNotification.php +++ b/app/Notifications/CheckinAccessoryNotification.php @@ -160,7 +160,6 @@ class CheckinAccessoryNotification extends Notification 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 2222f937f3..ba0621d078 100644 --- a/app/Notifications/CheckinLicenseSeatNotification.php +++ b/app/Notifications/CheckinLicenseSeatNotification.php @@ -9,6 +9,11 @@ use Illuminate\Bus\Queueable; 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 @@ class CheckinLicenseSeatNotification extends Notification { $notifyBy = []; + if (Setting::getSettings()->webhook_selected == 'google'){ + + $notifyBy[] = GoogleChatChannel::class; + } if (Setting::getSettings()->webhook_selected == 'microsoft'){ $notifyBy[] = MicrosoftTeamsChannel::class; @@ -113,6 +122,34 @@ class CheckinLicenseSeatNotification extends Notification ->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 d5c9871f3b..fcaa4761cb 100644 --- a/app/Notifications/CheckoutLicenseSeatNotification.php +++ b/app/Notifications/CheckoutLicenseSeatNotification.php @@ -9,6 +9,11 @@ use Illuminate\Bus\Queueable; 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 @@ class CheckoutLicenseSeatNotification extends Notification */ 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 @@ class CheckoutLicenseSeatNotification extends Notification ->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 418de5806f..759ff0f5e8 100644 --- a/resources/lang/en-US/mail.php +++ b/resources/lang/en-US/mail.php @@ -42,6 +42,7 @@ return [ '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.', From 0eabb147b2c0e37dff7a88103bfd2c50a0d99995 Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Tue, 30 Jan 2024 13:19:28 -0800 Subject: [PATCH 09/15] adds google notif to consumable check out --- .../CheckoutConsumableNotification.php | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/app/Notifications/CheckoutConsumableNotification.php b/app/Notifications/CheckoutConsumableNotification.php index 228c4c2e95..d7999e9387 100644 --- a/app/Notifications/CheckoutConsumableNotification.php +++ b/app/Notifications/CheckoutConsumableNotification.php @@ -9,6 +9,11 @@ use Illuminate\Bus\Queueable; 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; @@ -44,6 +49,10 @@ class CheckoutConsumableNotification extends Notification public function via() { $notifyBy = []; + if (Setting::getSettings()->webhook_selected == 'google'){ + + $notifyBy[] = GoogleChatChannel::class; + } if (Setting::getSettings()->webhook_selected == 'microsoft'){ @@ -128,6 +137,33 @@ class CheckoutConsumableNotification extends Notification ->fact(trans('admin/consumables/general.remaining'), $item->numRemaining()) ->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.Consumable_checkout_notification').'' ?: '', + htmlspecialchars_decode($item->present()->name) ?: '', + ) + ->section( + Section::create( + KeyValue::create( + trans('mail.assigned_to') ?: '', + $target->present()->fullName() ?: '', + trans('admin/consumables/general.remaining').': '.$item->numRemaining(), + ) + ->onClick(route('users.show', $target->id)) + ) + ) + ); + + } /** * Get the mail representation of the notification. From f452204d624e049544b9a3b2c7a803cfa911eee4 Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Wed, 31 Jan 2024 10:47:25 -0800 Subject: [PATCH 10/15] applies a conditional to have the the integration test button function properly --- app/Http/Livewire/SlackSettingsForm.php | 7 +++++++ composer.json | 2 +- resources/lang/en-US/admin/hardware/form.php | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app/Http/Livewire/SlackSettingsForm.php b/app/Http/Livewire/SlackSettingsForm.php index e2f1b4ef14..fa611afe85 100644 --- a/app/Http/Livewire/SlackSettingsForm.php +++ b/app/Http/Livewire/SlackSettingsForm.php @@ -79,6 +79,9 @@ class SlackSettingsForm extends Component $this->webhook_channel = $this->setting->webhook_channel; $this->webhook_botname = $this->setting->webhook_botname; $this->webhook_options = $this->setting->webhook_selected; + if($this->webhook_selected == 'microsoft' ||$this->webhook_selected == 'google'){ + $this->webhook_channel = 'NA'; + } if($this->setting->webhook_endpoint != null && $this->setting->webhook_channel != null){ @@ -103,6 +106,10 @@ class SlackSettingsForm extends Component $this->isDisabled= ''; $this->save_button = trans('general.save'); } + if($this->webhook_selected == 'microsoft' ||$this->webhook_selected == 'google'){ + $this->webhook_channel = 'NA'; + } + } private function isButtonDisabled() { diff --git a/composer.json b/composer.json index 502cb796e2..207d7d9f8c 100644 --- a/composer.json +++ b/composer.json @@ -42,7 +42,7 @@ "guzzlehttp/guzzle": "^7.0.1", "intervention/image": "^2.5", "javiereguiluz/easyslugger": "^1.0", - "laravel-notification-channels/google-chat": "*", + "laravel-notification-channels/google-chat": "^1.0", "laravel-notification-channels/microsoft-teams": "^1.1", "laravel/framework": "^8.46", "laravel/helpers": "^1.4", diff --git a/resources/lang/en-US/admin/hardware/form.php b/resources/lang/en-US/admin/hardware/form.php index d37d9eac98..a7aba0813c 100644 --- a/resources/lang/en-US/admin/hardware/form.php +++ b/resources/lang/en-US/admin/hardware/form.php @@ -16,7 +16,7 @@ return [ 'checkedout_to' => 'Checked Out To', 'checkout_date' => 'Checkout Date', 'checkin_date' => 'Checkin Date', - 'checkout_to' => 'Checked out to', + 'checkout_to' => 'Checkout to', 'cost' => 'Purchase Cost', 'create' => 'Create Asset', 'date' => 'Purchase Date', From 01bb8d8c9a0df905041c2c9c493962e596b2a680 Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Wed, 31 Jan 2024 10:48:23 -0800 Subject: [PATCH 11/15] spacing --- app/Http/Livewire/SlackSettingsForm.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Livewire/SlackSettingsForm.php b/app/Http/Livewire/SlackSettingsForm.php index fa611afe85..3b4a9e0afe 100644 --- a/app/Http/Livewire/SlackSettingsForm.php +++ b/app/Http/Livewire/SlackSettingsForm.php @@ -106,7 +106,7 @@ class SlackSettingsForm extends Component $this->isDisabled= ''; $this->save_button = trans('general.save'); } - if($this->webhook_selected == 'microsoft' ||$this->webhook_selected == 'google'){ + if($this->webhook_selected == 'microsoft' || $this->webhook_selected == 'google'){ $this->webhook_channel = 'NA'; } From a876703f8f7675d55674f3c8e714cb159597dcdc Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Wed, 31 Jan 2024 10:48:48 -0800 Subject: [PATCH 12/15] spacing --- app/Http/Livewire/SlackSettingsForm.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Livewire/SlackSettingsForm.php b/app/Http/Livewire/SlackSettingsForm.php index 3b4a9e0afe..c971236d52 100644 --- a/app/Http/Livewire/SlackSettingsForm.php +++ b/app/Http/Livewire/SlackSettingsForm.php @@ -79,7 +79,7 @@ class SlackSettingsForm extends Component $this->webhook_channel = $this->setting->webhook_channel; $this->webhook_botname = $this->setting->webhook_botname; $this->webhook_options = $this->setting->webhook_selected; - if($this->webhook_selected == 'microsoft' ||$this->webhook_selected == 'google'){ + if($this->webhook_selected == 'microsoft' || $this->webhook_selected == 'google'){ $this->webhook_channel = 'NA'; } From ed06f32a7aaef495c49e10b6ba6818d3fdd904f1 Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Wed, 31 Jan 2024 12:53:56 -0800 Subject: [PATCH 13/15] adds # to webhook channel trigger --- app/Http/Livewire/SlackSettingsForm.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Http/Livewire/SlackSettingsForm.php b/app/Http/Livewire/SlackSettingsForm.php index c971236d52..97f0c5bb73 100644 --- a/app/Http/Livewire/SlackSettingsForm.php +++ b/app/Http/Livewire/SlackSettingsForm.php @@ -80,12 +80,12 @@ class SlackSettingsForm extends Component $this->webhook_botname = $this->setting->webhook_botname; $this->webhook_options = $this->setting->webhook_selected; if($this->webhook_selected == 'microsoft' || $this->webhook_selected == 'google'){ - $this->webhook_channel = 'NA'; + $this->webhook_channel = null; } if($this->setting->webhook_endpoint != null && $this->setting->webhook_channel != null){ - $this->isDisabled= ''; + $this->isDisabled= '#NA'; } } @@ -107,7 +107,7 @@ class SlackSettingsForm extends Component $this->save_button = trans('general.save'); } if($this->webhook_selected == 'microsoft' || $this->webhook_selected == 'google'){ - $this->webhook_channel = 'NA'; + $this->webhook_channel = '#NA'; } } From 8a5b469ff853a5156ec55b4e61bd8a2a819385a6 Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Wed, 31 Jan 2024 12:54:30 -0800 Subject: [PATCH 14/15] adds # to webhook channel trigger --- app/Http/Livewire/SlackSettingsForm.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Http/Livewire/SlackSettingsForm.php b/app/Http/Livewire/SlackSettingsForm.php index 97f0c5bb73..86f21e0152 100644 --- a/app/Http/Livewire/SlackSettingsForm.php +++ b/app/Http/Livewire/SlackSettingsForm.php @@ -80,12 +80,12 @@ class SlackSettingsForm extends Component $this->webhook_botname = $this->setting->webhook_botname; $this->webhook_options = $this->setting->webhook_selected; if($this->webhook_selected == 'microsoft' || $this->webhook_selected == 'google'){ - $this->webhook_channel = null; + $this->webhook_channel = '#NA'; } if($this->setting->webhook_endpoint != null && $this->setting->webhook_channel != null){ - $this->isDisabled= '#NA'; + $this->isDisabled= ''; } } From 9dc428b720fe7f847717ecd081a9e5f62fc189bb Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Wed, 31 Jan 2024 17:30:56 -0800 Subject: [PATCH 15/15] ran composer update on the package since the version was explicitized --- composer.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.lock b/composer.lock index 8fb4ae80e8..961467e19c 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "bc968c279762208bd4856bb6ebed42c3", + "content-hash": "9cca85cd0074df9154765b1ab52f83fa", "packages": [ { "name": "alek13/slack",