Merge remote-tracking branch 'origin/develop'

This commit is contained in:
snipe 2024-11-06 14:16:09 +00:00
commit 9ce1e78c5c
12 changed files with 132 additions and 94 deletions

View file

@ -77,7 +77,3 @@ jobs:
DB_PORT: ${{ job.services.mysql.ports[3306] }} DB_PORT: ${{ job.services.mysql.ports[3306] }}
DB_USERNAME: root DB_USERNAME: root
run: php artisan test run: php artisan test
- name: Test failure
if: ${{ failure() }}
run: docker exec "$PROJECT_NAME-php-fpm" cat storage/logs/laravel.log

View file

@ -75,7 +75,3 @@ jobs:
DB_USERNAME: snipeit DB_USERNAME: snipeit
DB_PASSWORD: password DB_PASSWORD: password
run: php artisan test run: php artisan test
- name: Test failure
if: ${{ failure() }}
run: docker exec "$PROJECT_NAME-php-fpm" cat storage/logs/laravel.log

View file

@ -59,7 +59,3 @@ jobs:
env: env:
DB_CONNECTION: sqlite_testing DB_CONNECTION: sqlite_testing
run: php artisan test run: php artisan test
- name: Test failure
if: ${{ failure() }}
run: docker exec "$PROJECT_NAME-php-fpm" cat storage/logs/laravel.log

View file

@ -16,6 +16,7 @@ use App\Models\CheckoutAcceptance;
use App\Models\Component; use App\Models\Component;
use App\Models\Consumable; use App\Models\Consumable;
use App\Models\LicenseSeat; use App\Models\LicenseSeat;
use App\Models\Location;
use App\Models\Setting; use App\Models\Setting;
use App\Models\User; use App\Models\User;
use App\Notifications\CheckinAccessoryNotification; use App\Notifications\CheckinAccessoryNotification;
@ -60,14 +61,14 @@ class CheckoutableListener
$adminCcEmailsArray = array_map('trim', explode(',', $adminCcEmail)); $adminCcEmailsArray = array_map('trim', explode(',', $adminCcEmail));
} }
$ccEmails = array_filter($adminCcEmailsArray); $ccEmails = array_filter($adminCcEmailsArray);
$notifiable = $event->checkedOutTo;
$mailable = $this->getCheckoutMailType($event, $acceptance); $mailable = $this->getCheckoutMailType($event, $acceptance);
$notifiable = $this->getNotifiables($event);
if (!$event->checkedOutTo->locale){
$mailable->locale($event->checkedOutTo->locale);
}
// Send email notifications // Send email notifications
try { try {
if (!$event->checkedOutTo->locale){
$mailable->locale($event->checkedOutTo->locale);
}
/** /**
* Send an email if any of the following conditions are met: * Send an email if any of the following conditions are met:
* 1. The asset requires acceptance * 1. The asset requires acceptance
@ -77,15 +78,20 @@ class CheckoutableListener
if ($event->checkoutable->requireAcceptance() || $event->checkoutable->getEula() || if ($event->checkoutable->requireAcceptance() || $event->checkoutable->getEula() ||
(method_exists($event->checkoutable, 'checkin_email') && $event->checkoutable->checkin_email())) { (method_exists($event->checkoutable, 'checkin_email') && $event->checkoutable->checkin_email())) {
if (!empty($notifiable->email)) { if (!empty($notifiable)) {
Mail::to($notifiable)->cc($ccEmails)->send($mailable); Mail::to($notifiable)->cc($ccEmails)->send($mailable);
} else { } elseif (!empty($ccEmails)) {
Mail::cc($ccEmails)->send($mailable); Mail::cc($ccEmails)->send($mailable);
} }
Log::info('Sending email, Locale: ' . ($event->checkedOutTo->locale ?? 'default')); Log::info('Sending email, Locale: ' . ($event->checkedOutTo->locale ?? 'default'));
} }
} catch (ClientException $e) {
Log::debug("Exception caught during checkout email: " . $e->getMessage());
} catch (Exception $e) {
Log::debug("Exception caught during checkout email: " . $e->getMessage());
}
// Send Webhook notification // Send Webhook notification
try{
if ($this->shouldSendWebhookNotification()) { if ($this->shouldSendWebhookNotification()) {
if (Setting::getSettings()->webhook_selected === 'microsoft') { if (Setting::getSettings()->webhook_selected === 'microsoft') {
$message = $this->getCheckoutNotification($event)->toMicrosoftTeams(); $message = $this->getCheckoutNotification($event)->toMicrosoftTeams();
@ -137,38 +143,43 @@ class CheckoutableListener
$adminCcEmailsArray = array_map('trim', explode(',', $adminCcEmail)); $adminCcEmailsArray = array_map('trim', explode(',', $adminCcEmail));
} }
$ccEmails = array_filter($adminCcEmailsArray); $ccEmails = array_filter($adminCcEmailsArray);
$notifiable = $event->checkedOutTo;
$mailable = $this->getCheckinMailType($event); $mailable = $this->getCheckinMailType($event);
$notifiable = $this->getNotifiables($event);
if (!$event->checkedOutTo->locale){
$mailable->locale($event->checkedOutTo->locale);
}
// Send email notifications // Send email notifications
try { try {
if (!$event->checkedOutTo->locale){
$mailable->locale($event->checkedOutTo->locale);
}
/** /**
* Send an email if any of the following conditions are met: * Send an email if any of the following conditions are met:
* 1. The asset requires acceptance * 1. The asset requires acceptance
* 2. The item has a EULA * 2. The item has a EULA
* 3. The item should send an email at check-in/check-out * 3. The item should send an email at check-in/check-out
*/ */
if ($event->checkoutable->requireAcceptance() || $event->checkoutable->getEula() || if ($event->checkoutable->requireAcceptance() || $event->checkoutable->getEula() ||
(method_exists($event->checkoutable, 'checkin_email') && $event->checkoutable->checkin_email())) { (method_exists($event->checkoutable, 'checkin_email') && $event->checkoutable->checkin_email())) {
if (!empty($notifiable->email)) { if (!empty($notifiable)) {
Mail::to($notifiable)->cc($ccEmails)->send($mailable); Mail::to($notifiable)->cc($ccEmails)->send($mailable);
} else { } elseif (!empty($ccEmails)){
Mail::cc($ccEmails)->send($mailable); Mail::cc($ccEmails)->send($mailable);
} }
Log::info('Sending email, Locale: ' . $event->checkedOutTo->locale); Log::info('Sending email, Locale: ' . $event->checkedOutTo->locale);
} }
} catch (ClientException $e) {
Log::debug("Exception caught during checkin email: " . $e->getMessage());
} catch (Exception $e) {
Log::debug("Exception caught during checkin email: " . $e->getMessage());
}
// Send Webhook notification // Send Webhook notification
try {
if ($this->shouldSendWebhookNotification()) { if ($this->shouldSendWebhookNotification()) {
Notification::route(Setting::getSettings()->webhook_selected, Setting::getSettings()->webhook_endpoint) Notification::route(Setting::getSettings()->webhook_selected, Setting::getSettings()->webhook_endpoint)
->notify($this->getCheckinNotification($event)); ->notify($this->getCheckinNotification($event));
} }
} catch (ClientException $e) { } catch (ClientException $e) {
Log::warning("Exception caught during checkout notification: " . $e->getMessage()); Log::warning("Exception caught during checkin notification: " . $e->getMessage());
} catch (Exception $e) { } catch (Exception $e) {
Log::warning("Exception caught during checkin notification: " . $e->getMessage()); Log::warning("Exception caught during checkin notification: " . $e->getMessage());
} }
@ -278,6 +289,19 @@ class CheckoutableListener
return new $mailable($event->checkoutable, $event->checkedOutTo, $event->checkedInBy, $event->note); return new $mailable($event->checkoutable, $event->checkedOutTo, $event->checkedInBy, $event->note);
} }
private function getNotifiables($event){
if($event->checkedOutTo instanceof Asset){
$event->checkedOutTo->load('assignedTo');
return $event->checkedOutTo->assignedto?->email ?? '';
}
else if($event->checkedOutTo instanceof Location) {
return $event->checkedOutTo->manager?->email ?? '';
}
else{
return $event->checkedOutTo->email;
}
}
/** /**
* Register the listeners for the subscriber. * Register the listeners for the subscriber.

View file

@ -23,7 +23,7 @@ class CheckinLicenseMail extends Mailable
public function __construct(LicenseSeat $licenseSeat, $checkedOutTo, User $checkedInBy, $note) public function __construct(LicenseSeat $licenseSeat, $checkedOutTo, User $checkedInBy, $note)
{ {
$this->target = $checkedOutTo; $this->target = $checkedOutTo;
$this->item = $licenseSeat->license; $this->item = $licenseSeat;
$this->admin = $checkedInBy; $this->admin = $checkedInBy;
$this->note = $note; $this->note = $note;
$this->settings = Setting::getSettings(); $this->settings = Setting::getSettings();
@ -50,7 +50,8 @@ class CheckinLicenseMail extends Mailable
return new Content( return new Content(
markdown: 'mail.markdown.checkin-license', markdown: 'mail.markdown.checkin-license',
with: [ with: [
'item' => $this->item, 'license_seat' => $this->item,
'license' => $this->item->license,
'admin' => $this->admin, 'admin' => $this->admin,
'note' => $this->note, 'note' => $this->note,
'target' => $this->target, 'target' => $this->target,

View file

@ -22,7 +22,7 @@ class CheckoutLicenseMail extends Mailable
*/ */
public function __construct(LicenseSeat $licenseSeat, $checkedOutTo, User $checkedOutBy, $acceptance, $note) public function __construct(LicenseSeat $licenseSeat, $checkedOutTo, User $checkedOutBy, $acceptance, $note)
{ {
$this->item = $licenseSeat->license; $this->item = $licenseSeat;
$this->admin = $checkedOutBy; $this->admin = $checkedOutBy;
$this->note = $note; $this->note = $note;
$this->target = $checkedOutTo; $this->target = $checkedOutTo;
@ -53,11 +53,11 @@ class CheckoutLicenseMail extends Mailable
$req_accept = method_exists($this->item, 'requireAcceptance') ? $this->item->requireAcceptance() : 0; $req_accept = method_exists($this->item, 'requireAcceptance') ? $this->item->requireAcceptance() : 0;
$accept_url = is_null($this->acceptance) ? null : route('account.accept.item', $this->acceptance); $accept_url = is_null($this->acceptance) ? null : route('account.accept.item', $this->acceptance);
return new Content( return new Content(
markdown: 'mail.markdown.checkout-license', markdown: 'mail.markdown.checkout-license',
with: [ with: [
'item' => $this->item, 'license_seat' => $this->item,
'license' => $this->item->license,
'admin' => $this->admin, 'admin' => $this->admin,
'note' => $this->note, 'note' => $this->note,
'target' => $this->target, 'target' => $this->target,

View file

@ -7,6 +7,7 @@ use App\Models\Asset;
use App\Models\Setting; use App\Models\Setting;
use App\Models\User; use App\Models\User;
use Illuminate\Bus\Queueable; use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Channels\SlackWebhookChannel;
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;
@ -62,7 +63,7 @@ class CheckinAssetNotification extends Notification
} }
if (Setting::getSettings()->webhook_selected == 'slack' || Setting::getSettings()->webhook_selected == 'general' ) { if (Setting::getSettings()->webhook_selected == 'slack' || Setting::getSettings()->webhook_selected == 'general' ) {
Log::debug('use webhook'); Log::debug('use webhook');
$notifyBy[] = 'slack'; $notifyBy[] = SlackWebhookChannel::class;
} }
return $notifyBy; return $notifyBy;

103
package-lock.json generated
View file

@ -37,7 +37,7 @@
"signature_pad": "^4.2.0", "signature_pad": "^4.2.0",
"tableexport.jquery.plugin": "1.30.0", "tableexport.jquery.plugin": "1.30.0",
"tether": "^1.4.0", "tether": "^1.4.0",
"webpack": "^5.94.0" "webpack": "^5.95.0"
}, },
"devDependencies": { "devDependencies": {
"all-contributors-cli": "^6.26.1", "all-contributors-cli": "^6.26.1",
@ -2105,10 +2105,28 @@
"@types/node": "*" "@types/node": "*"
} }
}, },
"node_modules/@types/eslint": {
"version": "9.6.1",
"resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-9.6.1.tgz",
"integrity": "sha512-FXx2pKgId/WyYo2jXw63kk7/+TY7u7AziEJxJAnSFzHlqTAS3Ync6SvgYAN/k4/PQpnnVuzoMuVnByKK2qp0ag==",
"dependencies": {
"@types/estree": "*",
"@types/json-schema": "*"
}
},
"node_modules/@types/eslint-scope": {
"version": "3.7.7",
"resolved": "https://registry.npmjs.org/@types/eslint-scope/-/eslint-scope-3.7.7.tgz",
"integrity": "sha512-MzMFlSLBqNF2gcHWO0G1vP/YQyfvrxZ0bF+u7mzUdZ1/xK4A4sru+nraZz5i3iEIk1l1uyicaDVTB4QbbEkAYg==",
"dependencies": {
"@types/eslint": "*",
"@types/estree": "*"
}
},
"node_modules/@types/estree": { "node_modules/@types/estree": {
"version": "1.0.5", "version": "1.0.6",
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz",
"integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==" "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw=="
}, },
"node_modules/@types/express": { "node_modules/@types/express": {
"version": "4.17.21", "version": "4.17.21",
@ -2467,9 +2485,9 @@
} }
}, },
"node_modules/acorn": { "node_modules/acorn": {
"version": "8.12.1", "version": "8.14.0",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz",
"integrity": "sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==", "integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==",
"bin": { "bin": {
"acorn": "bin/acorn" "acorn": "bin/acorn"
}, },
@ -2484,14 +2502,6 @@
"acorn": "^8" "acorn": "^8"
} }
}, },
"node_modules/acorn-import-attributes": {
"version": "1.9.5",
"resolved": "https://registry.npmjs.org/acorn-import-attributes/-/acorn-import-attributes-1.9.5.tgz",
"integrity": "sha512-n02Vykv5uA3eHGM/Z2dQrcD56kL8TyDb2p1+0P83PClMnC/nc+anbQRhIOWnSq4Ke/KvDPrY3C9hDtC/A3eHnQ==",
"peerDependencies": {
"acorn": "^8"
}
},
"node_modules/acorn-node": { "node_modules/acorn-node": {
"version": "1.8.2", "version": "1.8.2",
"license": "Apache-2.0", "license": "Apache-2.0",
@ -3940,7 +3950,9 @@
} }
}, },
"node_modules/browserslist": { "node_modules/browserslist": {
"version": "4.23.0", "version": "4.24.2",
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.24.2.tgz",
"integrity": "sha512-ZIc+Q62revdMcqC6aChtW4jz3My3klmCO1fEmINZY/8J3EpBg5/A/D0AKmBveUh6pgoeycoMkVMko84tuYS+Gg==",
"funding": [ "funding": [
{ {
"type": "opencollective", "type": "opencollective",
@ -3955,12 +3967,11 @@
"url": "https://github.com/sponsors/ai" "url": "https://github.com/sponsors/ai"
} }
], ],
"license": "MIT",
"dependencies": { "dependencies": {
"caniuse-lite": "^1.0.30001587", "caniuse-lite": "^1.0.30001669",
"electron-to-chromium": "^1.4.668", "electron-to-chromium": "^1.5.41",
"node-releases": "^2.0.14", "node-releases": "^2.0.18",
"update-browserslist-db": "^1.0.13" "update-browserslist-db": "^1.1.1"
}, },
"bin": { "bin": {
"browserslist": "cli.js" "browserslist": "cli.js"
@ -4067,7 +4078,9 @@
} }
}, },
"node_modules/caniuse-lite": { "node_modules/caniuse-lite": {
"version": "1.0.30001616", "version": "1.0.30001677",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001677.tgz",
"integrity": "sha512-fmfjsOlJUpMWu+mAAtZZZHz7UEwsUxIIvu1TJfO1HqFQvB/B+ii0xr9B5HpbZY/mC4XZ8SvjHJqtAY6pDPQEog==",
"funding": [ "funding": [
{ {
"type": "opencollective", "type": "opencollective",
@ -4081,8 +4094,7 @@
"type": "github", "type": "github",
"url": "https://github.com/sponsors/ai" "url": "https://github.com/sponsors/ai"
} }
], ]
"license": "CC-BY-4.0"
}, },
"node_modules/canvas-confetti": { "node_modules/canvas-confetti": {
"version": "1.9.3", "version": "1.9.3",
@ -5254,8 +5266,9 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/electron-to-chromium": { "node_modules/electron-to-chromium": {
"version": "1.4.756", "version": "1.5.52",
"license": "ISC" "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.52.tgz",
"integrity": "sha512-xtoijJTZ+qeucLBDNztDOuQBE1ksqjvNjvqFoST3nGC7fSpqJ+X6BdTBaY5BHG+IhWWmpc6b/KfpeuEDupEPOQ=="
}, },
"node_modules/elliptic": { "node_modules/elliptic": {
"version": "6.5.5", "version": "6.5.5",
@ -5388,8 +5401,9 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/escalade": { "node_modules/escalade": {
"version": "3.1.2", "version": "3.2.0",
"license": "MIT", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz",
"integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==",
"engines": { "engines": {
"node": ">=6" "node": ">=6"
} }
@ -8097,8 +8111,9 @@
} }
}, },
"node_modules/node-releases": { "node_modules/node-releases": {
"version": "2.0.14", "version": "2.0.18",
"license": "MIT" "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.18.tgz",
"integrity": "sha512-d9VeXT4SJ7ZeOqGX6R5EM022wpL+eWPooLI+5UpWn2jCT1aosUQEhQP214x33Wkwx3JQMvIm+tIoVOdodFS40g=="
}, },
"node_modules/normalize-path": { "node_modules/normalize-path": {
"version": "3.0.0", "version": "3.0.0",
@ -8549,8 +8564,9 @@
"optional": true "optional": true
}, },
"node_modules/picocolors": { "node_modules/picocolors": {
"version": "1.0.0", "version": "1.1.1",
"license": "ISC" "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
"integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA=="
}, },
"node_modules/picomatch": { "node_modules/picomatch": {
"version": "2.3.1", "version": "2.3.1",
@ -10703,7 +10719,9 @@
} }
}, },
"node_modules/update-browserslist-db": { "node_modules/update-browserslist-db": {
"version": "1.0.15", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.1.tgz",
"integrity": "sha512-R8UzCaa9Az+38REPiJ1tXlImTJXlVfgHZsglwBD/k6nj76ctsH1E3q4doGrukiLQd3sGQYu56r5+lo5r94l29A==",
"funding": [ "funding": [
{ {
"type": "opencollective", "type": "opencollective",
@ -10718,10 +10736,9 @@
"url": "https://github.com/sponsors/ai" "url": "https://github.com/sponsors/ai"
} }
], ],
"license": "MIT",
"dependencies": { "dependencies": {
"escalade": "^3.1.2", "escalade": "^3.2.0",
"picocolors": "^1.0.0" "picocolors": "^1.1.0"
}, },
"bin": { "bin": {
"update-browserslist-db": "cli.js" "update-browserslist-db": "cli.js"
@ -10866,17 +10883,17 @@
"license": "BSD-2-Clause" "license": "BSD-2-Clause"
}, },
"node_modules/webpack": { "node_modules/webpack": {
"version": "5.94.0", "version": "5.96.1",
"resolved": "https://registry.npmjs.org/webpack/-/webpack-5.94.0.tgz", "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.96.1.tgz",
"integrity": "sha512-KcsGn50VT+06JH/iunZJedYGUJS5FGjow8wb9c0v5n1Om8O1g4L6LjtfxwlXIATopoQu+vOXXa7gYisWxCoPyg==", "integrity": "sha512-l2LlBSvVZGhL4ZrPwyr8+37AunkcYj5qh8o6u2/2rzoPc8gxFJkLj1WxNgooi9pnoc06jh0BjuXnamM4qlujZA==",
"dependencies": { "dependencies": {
"@types/estree": "^1.0.5", "@types/eslint-scope": "^3.7.7",
"@types/estree": "^1.0.6",
"@webassemblyjs/ast": "^1.12.1", "@webassemblyjs/ast": "^1.12.1",
"@webassemblyjs/wasm-edit": "^1.12.1", "@webassemblyjs/wasm-edit": "^1.12.1",
"@webassemblyjs/wasm-parser": "^1.12.1", "@webassemblyjs/wasm-parser": "^1.12.1",
"acorn": "^8.7.1", "acorn": "^8.14.0",
"acorn-import-attributes": "^1.9.5", "browserslist": "^4.24.0",
"browserslist": "^4.21.10",
"chrome-trace-event": "^1.0.2", "chrome-trace-event": "^1.0.2",
"enhanced-resolve": "^5.17.1", "enhanced-resolve": "^5.17.1",
"es-module-lexer": "^1.2.1", "es-module-lexer": "^1.2.1",

View file

@ -57,6 +57,6 @@
"signature_pad": "^4.2.0", "signature_pad": "^4.2.0",
"tableexport.jquery.plugin": "1.30.0", "tableexport.jquery.plugin": "1.30.0",
"tether": "^1.4.0", "tether": "^1.4.0",
"webpack": "^5.94.0" "webpack": "^5.95.0"
} }
} }

File diff suppressed because one or more lines are too long

View file

@ -6,15 +6,15 @@
@component('mail::table') @component('mail::table')
| | | | | |
| ------------- | ------------- | | ------------- | ------------- |
| **{{ trans('mail.asset_name') }}** | {{ $item->name }} | | **{{ trans('mail.asset_name') }}** | {{ $license->name }} |
@if (isset($item->manufacturer)) @if (isset($license->manufacturer))
| **{{ trans('general.manufacturer') }}** | {{ $item->manufacturer->name }} | | **{{ trans('general.manufacturer') }}** | {{ $license->manufacturer->name }} |
@endif @endif
@if ($target->can('update', $item)) @if (($target instanceof \App\Models\User && $target->can('view', $license)) ||($target instanceof \App\Models\Asset && $license_seat->user->can('view', $license)))
| **Key** | {{ $item->serial }} | | **Key** | {{ $license->serial }} |
@endif @endif
@if (isset($item->category)) @if (isset($item->category))
| **{{ trans('general.category') }}** | {{ $item->category->name }} | | **{{ trans('general.category') }}** | {{ $license->category->name }} |
@endif @endif
@if ($admin) @if ($admin)
| **{{ trans('general.administrator') }}** | {{ $admin->present()->fullName() }} | | **{{ trans('general.administrator') }}** | {{ $admin->present()->fullName() }} |

View file

@ -9,15 +9,15 @@
@if (isset($checkout_date)) @if (isset($checkout_date))
| **{{ trans('mail.checkout_date') }}** | {{ $checkout_date }} | | **{{ trans('mail.checkout_date') }}** | {{ $checkout_date }} |
@endif @endif
| **{{ trans('general.license') }}** | {{ $item->name }} | | **{{ trans('general.license') }}** | {{ $license->name}} |
@if (isset($item->manufacturer)) @if (isset($license->manufacturer))
| **{{ trans('general.manufacturer') }}** | {{ $item->manufacturer->name }} | | **{{ trans('general.manufacturer') }}** | {{ $license->manufacturer->name }} |
@endif @endif
@if (isset($item->category)) @if (isset($license->category))
| **{{ trans('general.category') }}** | {{ $item->category->name }} | | **{{ trans('general.category') }}** | {{ $license->category->name }} |
@endif @endif
@if ($target->can('view', $item)) @if (($target instanceof \App\Models\User && $target->can('view', $license)) || ($target instanceof \App\Models\Asset && $license_seat->user->can('view', $license)))
| **Key** | {{ $item->serial }} | | **Key** | {{ $license->serial }} |
@endif @endif
@if ($note) @if ($note)
| **{{ trans('mail.additional_notes') }}** | {{ $note }} | | **{{ trans('mail.additional_notes') }}** | {{ $note }} |