Add category to licenses

This commit is contained in:
snipe 2018-05-08 00:14:38 -07:00
parent 7b8362b64c
commit f48171dcab
7 changed files with 61 additions and 1 deletions

View file

@ -16,6 +16,14 @@ use Watson\Validating\ValidatingTrait;
class License extends Depreciable
{
protected $presenter = 'App\Presenters\LicensePresenter';
/**
* Set static properties to determine which checkout/checkin handlers we should use
*/
public static $checkoutClass = CheckoutLicenseNotification::class;
public static $checkinClass = CheckinLicenseNotification::class;
use SoftDeletes;
use CompanyableTrait;
use Loggable, Presentable;

View file

@ -76,6 +76,7 @@ trait Loggable
$checkoutClass = null;
if (method_exists($target, 'notify')) {
\Log::debug('This target is notifiable');
$target->notify(new static::$checkoutClass($params));
}
@ -83,6 +84,7 @@ trait Loggable
$recipient = new \App\Models\Recipients\AdminRecipient();
if (($settings->admin_cc_email!='') && (static::$checkoutClass!='')) {
\Log::debug('Send an email to the admin - '.$settings->admin_cc_email);
$recipient->notify(new static::$checkoutClass($params));
}

View file

@ -5,7 +5,8 @@ return array(
'about_categories' => 'Categories help you organize your items. Some example categories might be "Desktops", "Laptops", "Mobile Phones", "Tablets", and so on, but you can use categories any way that makes sense for you.',
'asset_categories' => 'Asset Categories',
'category_name' => 'Category Name',
'checkin_email' => 'Send email to user on checkin.',
'checkin_email' => 'Send email to user on checkin/checkout.',
'checkin_email_notification' => 'This user will be sent an email on checkin/checkout.',
'clone' => 'Clone Category',
'create' => 'Create Category',
'edit' => 'Edit Category',

View file

@ -57,6 +57,40 @@
</div>
</div>
</div>
@if ($license->requireAcceptance() || $license->getEula() || ($snipeSettings->slack_endpoint!=''))
<div class="form-group notification-callout">
<div class="col-md-8 col-md-offset-3">
<div class="callout callout-info">
@if ($license->requireAcceptance())
<i class="fa fa-envelope"></i>
{{ trans('admin/categories/general.required_acceptance') }}
<br>
@endif
@if ($license->getEula())
<i class="fa fa-envelope"></i>
{{ trans('admin/categories/general.required_eula') }}
<br>
@endif
@if (($license->category) && ($license->category->checkin_email))
<i class="fa fa-envelope"></i>
{{ trans('admin/categories/general.checkin_email_notification') }}
<br>
@endif
@if ($snipeSettings->slack_endpoint!='')
<i class="fa fa-slack"></i>
A slack message will be sent
@endif
</div>
</div>
</div>
@endif
<div class="box-footer">
<a class="btn btn-link" href="{{ route('licenses.index') }}">{{ trans('button.cancel') }}</a>
<button type="submit" class="btn btn-success pull-right"><i class="fa fa-check icon-white"></i> {{ trans('general.checkout') }}</button>

View file

@ -126,6 +126,15 @@
</tr>
@endif
@if ($license->category)
<tr>
<td>{{ trans('general.category') }}: </td>
<td style="word-wrap: break-word;overflow-wrap: break-word;word-break: break-word;">
<a href="{{ route('categories.show', $license->category->id) }}">{{ $license->category->name }}</a>
</td>
</tr>
@endif
@if ($license->license_name!='')
<tr>

View file

@ -13,6 +13,9 @@
@if ($target->can('update', $item))
| **Key** | {{ $item->serial }} |
@endif
@if (isset($item->category))
| **{{ trans('general.category') }}** | {{ $item->category->name }} |
@endif
@if ($admin)
| **{{ trans('general.administrator') }}** | {{ $admin->present()->fullName() }} |
@endif

View file

@ -13,6 +13,9 @@
@if (isset($item->manufacturer))
| **{{ trans('general.manufacturer') }}** | {{ $item->manufacturer->name }} |
@endif
@if (isset($item->category))
| **{{ trans('general.category') }}** | {{ $item->category->name }} |
@endif
@if ($target->can('update', $item))
| **Key** | {{ $item->serial }} |
@endif