A free open source IT asset/license management system
Improved expiring assets and licenses email
snipeae43f93d0aa9
diff --git a/resources/views/notifications/markdown/report-expiring-assets.blade.php b/resources/views/notifications/markdown/report-expiring-assets.blade.phpindex 7fad77e022..be961ec620 100644--- a/resources/views/notifications/markdown/report-expiring-assets.blade.php+++ b/resources/views/notifications/markdown/report-expiring-assets.blade.php@@ -1,38 +1,22 @@@component('mail::message'){{ trans_choice('mail.assets_warrantee_alert', $assets->count(), ['count'=>$assets->count(), 'threshold' => $threshold]) }}-<style>-- th, td {- vertical-align: top;- }- hr {- display: block;- height: 1px;- border: 0;- border-top: 1px solid #ccc;- margin: 1em 0;- padding: 0;- }-</style><x-mail::table>-| | | || ------------- | ------------- | ------------- |@foreach ($assets as $asset)-@php- $warranty_expires = \App\Helpers\Helper::getFormattedDateObject($asset->present()->warranty_expires, 'date');- $eol_date = \App\Helpers\Helper::getFormattedDateObject($asset->asset_eol_date, 'date');- $warranty_diff = ($asset->present()->warranty_expires) ? round(\Carbon\Carbon::now()->diffInDays(\Carbon\Carbon::parse($warranty_expires['date']), false), 1) : '';- $eol_diff = round(\Carbon\Carbon::now()->diffInDays(\Carbon\Carbon::parse($asset->asset_eol_date), false), 1);- $icon = ($warranty_diff <= $threshold && $warranty_diff >= 0) ? '⚠️' : (($eol_diff <= $threshold && $eol_diff >= 0) ? '🚨' : 'ℹ️');-@endphp-| {{ $icon }} **{{ trans('mail.name') }}** | <a href="{{ route('hardware.show', $asset->id) }}">{{ $asset->display_name }}</a> <br><small>{{trans('mail.serial').': '.$asset->serial}}</small> |-@if ($warranty_expires)-| **{{ trans('mail.expires') }}** | {{ !is_null($warranty_expires) ? $warranty_expires['formatted'] : '' }} (<strong>{{ $warranty_diff }} {{ trans('mail.Days') }}</strong>) |+| {{ ($asset->eol_diff_for_humans <= ($threshold / 2)) ? '🚨' : (($asset->eol_diff_for_humans <= $threshold) ? '⚠️' : ' ') }} **{{ trans('mail.name') }}** | <a href="{{ route('hardware.show', $asset->id) }}">{{ $asset->display_name }}</a> |+@if ($asset->serial)+| **{{ trans('general.serial_number') }}** | {{ $asset->serial }} |+@endif+@if ($asset->purchase_date)+| **{{ trans('general.purchase_date') }}** | {{ $asset->purchase_date_formatted }} |+@endif+@if ($asset->warranty_expires)+| **{{ trans('mail.expires') }}** | {{ $asset->warranty_expires_formatted_date }} ({{ $asset->warranty_expires_diff_for_humans }}) |@endif-@if ($eol_date)-| **{{ trans('mail.eol') }}** | {{ !is_null($eol_date) ? $eol_date['formatted'] : '' }} (<strong>{{ $eol_diff }} {{ trans('mail.Days') }}</strong>) |+@if ($asset->eol_date && $asset->eol_diff_for_humans)+| **{{ trans('mail.eol') }}** | {{ $asset->eol_formatted_date }} ({{ $asset->eol_diff_for_humans }}) |@endif@if ($asset->supplier)| **{{ trans('mail.supplier') }}** | {{ ($asset->supplier ? e($asset->supplier->name) : '') }} |diff --git a/resources/views/notifications/markdown/report-expiring-licenses.blade.php b/resources/views/notifications/markdown/report-expiring-licenses.blade.phpindex d7a68cfb32..e165e74433 100644--- a/resources/views/notifications/markdown/report-expiring-licenses.blade.php+++ b/resources/views/notifications/markdown/report-expiring-licenses.blade.php@@ -1,17 +1,13 @@@component('mail::message'){{ trans_choice('mail.license_expiring_alert', $licenses->count(), ['count'=>$licenses->count(), 'threshold' => $threshold]) }}-@component('mail::table')-<table width="100%">-<tr><td> </td><td>{{ trans('mail.name') }}</td><td>{{ trans('mail.Days') }}</td><td>{{ trans('mail.expires') }}</td></tr>+<x-mail::table>++| | {{ trans('mail.name') }} | {{ trans('mail.expires') }} | {{ trans('mail.terminates') }} |+| :------------- | :------------- | :------------- | :------------- |@foreach ($licenses as $license)-@php-$expires = Helper::getFormattedDateObject($license->expiration_date, 'date');-$diff = round(abs(strtotime($license->expiration_date->format('Y-m-d')) - strtotime(date('Y-m-d')))/86400);-$icon = ($diff <= ($threshold / 2)) ? '🚨' : (($diff <= $threshold) ? '⚠️' : ' ');-@endphp-<tr><td>{{ $icon }} </td><td> <a href="{{ route('licenses.show', $license->id) }}">{{ $license->name }}</a> </td><td> {{ $diff }} {{ trans('mail.Days') }} </td><td>{{ $expires['formatted'] }}</td></tr>+| {{ ($license->expires_diff_for_humans <= ($threshold / 2)) ? '🚨' : (($license->expires_diff_for_humans <= $threshold) ? '⚠️' : ' ') }} | <a href="{{ route('licenses.show', $license->id) }}">{{ $license->name }}</a> | {{ $license->expires_formatted_date }} {!! $license->expires_diff_for_humans ? ' ('.$license->expires_diff_for_humans .')' : '' !!} | {{ $license->terminates_formatted_date }} {!! $license->terminates_diff_for_humans ? ' ('.$license->terminates_diff_for_humans .')' : '' !!} |+| <hr> | <hr> | <hr> | <hr> |@endforeach-</table>+</x-mail::table>@endcomponent-@endcomponent\ No newline at end of file