A free open source IT asset/license management system
add translations, brush up code
Godfrey M00f07ac2ce66
diff --git a/app/Http/Livewire/SlackSettingsForm.php b/app/Http/Livewire/SlackSettingsForm.phpindex 3b1894fadc..9e811adca6 100644--- a/app/Http/Livewire/SlackSettingsForm.php+++ b/app/Http/Livewire/SlackSettingsForm.php@@ -46,7 +46,7 @@ class SlackSettingsForm extends Component"general"=> array("name" => trans('admin/settings/general.general_webhook'),"icon" => "fab fa-hashtag",- "placeholder" => "Insert URL",+ "placeholder" => trans('general.url'),"link" => "",),"microsoft" => array(@@ -193,8 +193,8 @@ class SlackSettingsForm extends Component["@type" => "MessageCard","@context" => "http://schema.org/extensions",- "summary" => "Snipe-IT Integration Test Summary",- "title" => "Snipe-IT Integration Test",+ "summary" => trans('mail.snipe_webhook_summary'),+ "title" => trans('mail.snipe_webhook_test'),"text" => trans('general.webhook_test_msg', ['app' => $this->webhook_name]),];diff --git a/app/Notifications/CheckinAccessoryNotification.php b/app/Notifications/CheckinAccessoryNotification.phpindex 3a36af7019..fbe525376e 100644--- a/app/Notifications/CheckinAccessoryNotification.php+++ b/app/Notifications/CheckinAccessoryNotification.php@@ -37,11 +37,12 @@ class CheckinAccessoryNotification extends Notification*/public function via(){+ $notifyBy = [];+if (Setting::getSettings()->webhook_selected == 'microsoft'){- return [MicrosoftTeamsChannel::class];- }- $notifyBy = [];+ $notifyBy[] = MicrosoftTeamsChannel::class;+ }if (Setting::getSettings()->webhook_endpoint != '') {$notifyBy[] = 'slack';@@ -123,13 +124,13 @@ class CheckinAccessoryNotification extends Notification->to($this->settings->webhook_endpoint)->type('success')->addStartGroupToSection('activityTitle')- ->title("Accessory Checked In")+ ->title(trans('Accessory_Checkin_Notification'))->addStartGroupToSection('activityText')->fact(htmlspecialchars_decode($item->present()->name), '', 'activityTitle')- ->fact('Checked into ', $item->location->name ? $item->location->name : '')+ ->fact(trans('mail.checked_into'), $item->location->name ? $item->location->name : '')->fact(trans('mail.Accessory_Checkin_Notification')." by ", $admin->present()->fullName())- ->fact('Number Remaining', $item->numRemaining())- ->fact('Notes', $note ?: 'No notes');+ ->fact(trans('admin/consumables/general.remaining'), $item->numRemaining())+ ->fact(trans('mail.notes'), $note ?: 'No notes');}/**diff --git a/app/Notifications/CheckinAssetNotification.php b/app/Notifications/CheckinAssetNotification.phpindex 5af7c17fa6..171b41831a 100644--- a/app/Notifications/CheckinAssetNotification.php+++ b/app/Notifications/CheckinAssetNotification.php@@ -45,11 +45,12 @@ class CheckinAssetNotification extends Notification*/public function via(){+ $notifyBy = [];+if (Setting::getSettings()->webhook_selected == 'microsoft'){- return [MicrosoftTeamsChannel::class];+ $notifyBy[] = MicrosoftTeamsChannel::class;}- $notifyBy = [];if (Setting::getSettings()->webhook_endpoint != '') {\Log::debug('use webhook');$notifyBy[] = 'slack';@@ -99,13 +100,13 @@ class CheckinAssetNotification extends Notificationreturn MicrosoftTeamsMessage::create()->to($this->settings->webhook_endpoint)->type('success')- ->title("Asset Checked in")+ ->title(trans('mail.Asset_Checkin_Notification'))->addStartGroupToSection('activityText')->fact(htmlspecialchars_decode($item->present()->name), '', 'activityText')- ->fact('Checked into ', $item->location->name ? $item->location->name : $item->defaultLoc()->name)+ ->fact(trans('mail.checked_into'), $item->location->name ? $item->location->name : '')->fact(trans('mail.Asset_Checkin_Notification')." by ", $admin->present()->fullName())- ->fact('Asset Status', $item->assetstatus->name)- ->fact('Notes', $note ?: 'No notes');+ ->fact(trans('admin/hardware/form.status'), $item->assetstatus->name)+ ->fact(trans('mail.notes'), $note ?: trans('mail.no_notes'));}/**diff --git a/app/Notifications/CheckinLicenseSeatNotification.php b/app/Notifications/CheckinLicenseSeatNotification.phpindex d05f5ef6c1..2af301b7db 100644--- a/app/Notifications/CheckinLicenseSeatNotification.php+++ b/app/Notifications/CheckinLicenseSeatNotification.php@@ -105,13 +105,13 @@ class CheckinLicenseSeatNotification extends Notification->to($this->settings->webhook_endpoint)->type('success')->addStartGroupToSection('activityTitle')- ->title("License Checked in")+ ->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('Checked in from', $target->present()->fullName())- ->fact('Seats Remaining', $item->availCount()->count())- ->fact('Notes', $note ?: 'No notes');+ ->fact(trans('mail.checkedin_from'), $target->present()->fullName())+ ->fact(trans('admin/consumables/general.remaining'), $item->availCount()->count())+ ->fact(trans('mail.notes'), $note ?: trans('mail.no_notes'));}/**diff --git a/app/Notifications/CheckoutAccessoryNotification.php b/app/Notifications/CheckoutAccessoryNotification.phpindex a44c193b57..d0cb7d13d0 100644--- a/app/Notifications/CheckoutAccessoryNotification.php+++ b/app/Notifications/CheckoutAccessoryNotification.php@@ -40,7 +40,6 @@ class CheckoutAccessoryNotification extends Notificationif (Setting::getSettings()->webhook_selected == 'microsoft'){-// return [MicrosoftTeamsChannel::class];$notifyBy[] = MicrosoftTeamsChannel::class;}@@ -105,21 +104,24 @@ class CheckoutAccessoryNotification extends Notification}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("Accessory Checked Out")- ->addStartGroupToSection('activityText')- ->fact(htmlspecialchars_decode($item->present()->name), '', 'activityTitle')- ->fact('Checked out from ', $item->location->name ? $item->location->name : '')- ->fact(trans('mail.Accessory_Checkout_Notification')." by ", $admin->present()->fullName())- ->fact('Number Remaining', $item->numRemaining())- ->fact('Notes', $note ?: 'No notes');+ 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 ?: trans('mail.no_notes'));+}/**diff --git a/app/Notifications/CheckoutAssetNotification.php b/app/Notifications/CheckoutAssetNotification.phpindex 6a890c0991..652ec03f6a 100644--- a/app/Notifications/CheckoutAssetNotification.php+++ b/app/Notifications/CheckoutAssetNotification.php@@ -126,27 +126,22 @@ class CheckoutAssetNotification extends Notification}public function toMicrosoftTeams(){+ $target = $this->target;$admin = $this->admin;$item = $this->item;$note = $this->note;- try {-- return MicrosoftTeamsMessage::create()- ->to($this->settings->webhook_endpoint)- ->type('success')- ->title("Asset Checked Out")- ->addStartGroupToSection('activityText')- ->fact(htmlspecialchars_decode($item->present()->name), '', 'activityText')- ->fact('Checked out from ', $item->location ? $item->location->name : $item->assetLoc()->name)- ->fact(trans('mail.Asset_Checkout_Notification') . " by ", $admin->present()->fullName())- ->fact('Asset Status', $item->assetstatus->name)- ->fact('Notes', $note ?: 'No notes');- }- catch(Exception $e) {- dd($e);+ 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 ?: trans('mail.no_notes'));+- }}/**diff --git a/app/Notifications/CheckoutConsumableNotification.php b/app/Notifications/CheckoutConsumableNotification.phpindex 4b4fcc6ac6..c8cde7daf3 100644--- a/app/Notifications/CheckoutConsumableNotification.php+++ b/app/Notifications/CheckoutConsumableNotification.php@@ -120,13 +120,13 @@ class CheckoutConsumableNotification extends Notification->to($this->settings->webhook_endpoint)->type('success')->addStartGroupToSection('activityTitle')- ->title("Consumable Checked Out")+ ->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('Checked out to', $target->present()->fullName())- ->fact('Number Remaining', $item->numRemaining())- ->fact('Notes', $note ?: 'No notes');+ ->fact(trans('mail.assigned_to'), $target->present()->fullName())+ ->fact(trans('admin/consumables/general.remaining'), $item->numRemaining())+ ->fact(trans('mail.notes'), $note ?: trans('mail.no_notes'));}/**diff --git a/app/Notifications/CheckoutLicenseSeatNotification.php b/app/Notifications/CheckoutLicenseSeatNotification.phpindex 9a7861444c..33db588350 100644--- a/app/Notifications/CheckoutLicenseSeatNotification.php+++ b/app/Notifications/CheckoutLicenseSeatNotification.php@@ -121,13 +121,13 @@ class CheckoutLicenseSeatNotification extends Notification->to($this->settings->webhook_endpoint)->type('success')->addStartGroupToSection('activityTitle')- ->title("License Checked Out")+ ->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('Checked out to', $target->present()->fullName())- ->fact('Seats Remaining', $item->availCount()->count())- ->fact('Notes', $note ?: 'No notes');+ ->fact(trans('mail.assigned_to'), $target->present()->fullName())+ ->fact(trans('admin/consumables/general.remaining'), $item->availCount()->count())+ ->fact(trans('mail.notes'), $note ?: trans('mail.no_notes'));}/**diff --git a/resources/lang/en-US/admin/hardware/form.php b/resources/lang/en-US/admin/hardware/form.phpindex ee3fa20fb0..ae6b5646bd 100644--- a/resources/lang/en-US/admin/hardware/form.php+++ b/resources/lang/en-US/admin/hardware/form.php@@ -35,6 +35,7 @@ return ['months' => 'months','name' => 'Asset Name','notes' => 'Notes',+ 'no_notes' => 'No Notes','order' => 'Order Number','qr' => 'QR Code','requestable' => 'Users may request this asset',diff --git a/resources/lang/en-US/mail.php b/resources/lang/en-US/mail.phpindex ca323c76c6..418de5806f 100644--- a/resources/lang/en-US/mail.php+++ b/resources/lang/en-US/mail.php@@ -41,6 +41,8 @@ return ['canceled' => 'Canceled:','checkin_date' => 'Checkin Date:','checkout_date' => 'Checkout Date:',+ '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_asset' => 'Please click on the link at the bottom to confirm that you have received the asset.','click_to_confirm' => 'Please click on the following link to confirm your :web account:',@@ -61,6 +63,7 @@ return ['min_QTY' => 'Min QTY','name' => 'Name','new_item_checked' => 'A new item has been checked out under your name, details are below.',+ 'notes' => 'Notes','password' => 'Password:','password_reset' => 'Password Reset','read_the_terms' => 'Please read the terms of use below.',@@ -70,6 +73,8 @@ return ['reset_password' => 'Click here to reset your password:','rights_reserved' => 'All rights reserved.','serial' => 'Serial',+ 'snipe_webhook_test' => 'Snipe-IT Integration Test',+ 'snipe_webhook_summary' => 'Snipe-IT Integration Test Summary','supplier' => 'Supplier','tag' => 'Tag','test_email' => 'Test Email from Snipe-IT',