A free open source IT asset/license management system
adds translations for webhook names
Godfrey M1bd37b49e9a7
diff --git a/app/Http/Livewire/SlackSettingsForm.php b/app/Http/Livewire/SlackSettingsForm.phpindex 960ec2a925..f6bc366c20 100644--- a/app/Http/Livewire/SlackSettingsForm.php+++ b/app/Http/Livewire/SlackSettingsForm.php@@ -17,6 +17,7 @@ class SlackSettingsForm extends Componentpublic $webhook_placeholder;public $webhook_icon;public $webhook_selected;+ public array $webhook_text;public Setting $setting;@@ -25,34 +26,29 @@ class SlackSettingsForm extends Component'webhook_channel' => 'required_with:webhook_endpoint|starts_with:#|nullable','webhook_botname' => 'string|nullable',];- static $webhook_text= [- "slack" => array(- "name" => "Slack",+++ public function mount(){+ $this->webhook_text= [+ "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',),-// "Discord" => array(-// "name" => "Discord",-// "icon" => 'fab fa-discord',-// "placeholder" => "https://discord.com/api/webhooks/XXXXXXXXXXXXXXXXXXXXX",-// "link" => 'https://support.discord.com/hc/en-us/articles/360045093012-Server-Integrations-Page',-// ),- "general"=> array(- "name" => "General",- "icon" => "fab fa-hashtag",- "placeholder" => "",- "link" => "",- ),- ];-- public function mount(){+ "general"=> array(+ "name" => trans('admin/settings/general.general_webhook'),+ "icon" => "fab fa-hashtag",+ "placeholder" => "",+ "link" => "",+ ),+ ];$this->setting = Setting::getSettings();$this->webhook_selected = $this->setting->webhook_selected;- $this->webhook_placeholder = self::$webhook_text[$this->setting->webhook_selected]["placeholder"];- $this->webhook_name = self::$webhook_text[$this->setting->webhook_selected]["name"];- $this->webhook_icon = self::$webhook_text[$this->setting->webhook_selected]["icon"];+ $this->webhook_placeholder = $this->webhook_text[$this->setting->webhook_selected]["placeholder"];+ $this->webhook_name = $this->webhook_text[$this->setting->webhook_selected]["name"];+ $this->webhook_icon = $this->webhook_text[$this->setting->webhook_selected]["icon"];$this->webhook_endpoint = $this->setting->webhook_endpoint;$this->webhook_channel = $this->setting->webhook_channel;$this->webhook_botname = $this->setting->webhook_botname;@@ -66,10 +62,10 @@ class SlackSettingsForm extends Component}}public function updatedWebhookSelected(){- $this->webhook_name = self::$webhook_text[$this->webhook_selected]['name'];- $this->webhook_icon = self::$webhook_text[$this->webhook_selected]["icon"]; ;- $this->webhook_placeholder = self::$webhook_text[$this->webhook_selected]["placeholder"];- $this->webhook_link = self::$webhook_text[$this->webhook_selected]["link"];+ $this->webhook_name = $this->webhook_text[$this->webhook_selected]['name'];+ $this->webhook_icon = $this->webhook_text[$this->webhook_selected]["icon"]; ;+ $this->webhook_placeholder = $this->webhook_text[$this->webhook_selected]["placeholder"];+ $this->webhook_link = $this->webhook_text[$this->webhook_selected]["link"];}diff --git a/resources/lang/en/admin/settings/general.php b/resources/lang/en/admin/settings/general.phpindex 4ccb7419b2..3316ed09ff 100644--- a/resources/lang/en/admin/settings/general.php+++ b/resources/lang/en/admin/settings/general.php@@ -199,6 +199,8 @@ return ['show_images_in_email_help' => 'Uncheck this box if your Snipe-IT installation is behind a VPN or closed network and users outside the network will not be able to load images served from this installation in their emails.','site_name' => 'Site Name','integrations' => 'Integrations',+ 'slack' => 'Slack',+ 'general_webhook' => 'General Webhook','webhook' => ':app','webhook_title' => 'Update Webhook Settings','webhook_help' => 'Integration settings',diff --git a/resources/views/livewire/slack-settings-form.blade.php b/resources/views/livewire/slack-settings-form.blade.phpindex 8d9ae7183c..aed73af593 100644--- a/resources/views/livewire/slack-settings-form.blade.php+++ b/resources/views/livewire/slack-settings-form.blade.php@@ -64,9 +64,9 @@aria-label="webhook_selected"class="form-control ">- <option value="slack">Slack</option>+ <option value="slack">{{trans('admin/settings/general.slack')}}</option>{{-- <option value="Discord">Discord</option>--}}- <option value="general">General Webhook</option>+ <option value="general">{{trans('admin/settings/general.general_webhook')}}</option></select></div><br><br><br>