fixed target name for checkouts with licenses and assets

This commit is contained in:
Godfrey M
2025-08-07 15:12:23 -07:00
parent d91598a25e
commit e47972731b
4 changed files with 20 additions and 4 deletions
+9 -1
View File
@@ -30,10 +30,18 @@ class CheckoutAssetMail extends Mailable
$this->item = $asset;
$this->admin = $checkedOutBy;
$this->note = $note;
$this->target = $checkedOutTo;
$this->acceptance = $acceptance;
$this->settings = Setting::getSettings();
$this->target = $checkedOutTo;
// Location is a target option, but there are no emails currently associated with locations.
if($this->target instanceof User){
$this->target = $this->target->present()->fullName();
}
else if($this->target instanceof Asset){
$this->target = $this->target->assignedto->present()->fullName();
}
$this->last_checkout = '';
$this->expected_checkin = '';
+9 -1
View File
@@ -2,6 +2,7 @@
namespace App\Mail;
use App\Models\Asset;
use App\Models\LicenseSeat;
use App\Models\Setting;
use App\Models\User;
@@ -25,9 +26,16 @@ class CheckoutLicenseMail extends Mailable
$this->item = $licenseSeat;
$this->admin = $checkedOutBy;
$this->note = $note;
$this->target = $checkedOutTo;
$this->acceptance = $acceptance;
$this->settings = Setting::getSettings();
$this->target = $checkedOutTo;
if($this->target instanceof User){
$this->target = $this->target->present()->fullName();
}
elseif($this->target instanceof Asset){
$this->target = $this->target->assignedto->present()->fullName();
}
}
/**
@@ -1,5 +1,5 @@
@component('mail::message')
# {{ trans('mail.hello') }}{{ $target->assignedto?->present()->fullName() ? ' ' . $target->assignedto->present()->fullName() . ',' : ',' }}
# {{ trans('mail.hello').' '.$target.','}}
{{ $introduction_line }}
@@ -1,5 +1,5 @@
@component('mail::message')
# {{ trans('mail.hello') }} {{ $target->present()->fullName() }},
# {{ trans('mail.hello').' '.$target.','}}
{{ trans('mail.new_item_checked') }}