From 8e18ce74b25aab169981f7ae0cab9906309c85e1 Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 2 Aug 2022 19:12:18 -0700 Subject: [PATCH 1/6] Update method name Signed-off-by: snipe --- app/Http/Controllers/ReportsController.php | 2 +- app/Presenters/AssetPresenter.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/ReportsController.php b/app/Http/Controllers/ReportsController.php index 52032114e..06629c175 100644 --- a/app/Http/Controllers/ReportsController.php +++ b/app/Http/Controllers/ReportsController.php @@ -789,7 +789,7 @@ class ReportsController extends Controller if ($request->filled('warranty')) { $row[] = ($asset->warranty_months) ? $asset->warranty_months : ''; - $row[] = $asset->present()->warrantee_expires(); + $row[] = $asset->present()->warranty_expires(); } if ($request->filled('depreciation')) { diff --git a/app/Presenters/AssetPresenter.php b/app/Presenters/AssetPresenter.php index f334906c8..e54f9d559 100644 --- a/app/Presenters/AssetPresenter.php +++ b/app/Presenters/AssetPresenter.php @@ -501,7 +501,7 @@ class AssetPresenter extends Presenter * Date the warantee expires. * @return false|string */ - public function warrantee_expires() + public function warranty_expires() { if (($this->purchase_date) && ($this->warranty_months)) { $date = date_create($this->purchase_date); From ac72b69ece8779dd6d6001349eef458cf4689289 Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 2 Aug 2022 19:12:28 -0700 Subject: [PATCH 2/6] Update method name Signed-off-by: snipe --- app/Presenters/DepreciationReportPresenter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Presenters/DepreciationReportPresenter.php b/app/Presenters/DepreciationReportPresenter.php index 525552a64..ea8834237 100644 --- a/app/Presenters/DepreciationReportPresenter.php +++ b/app/Presenters/DepreciationReportPresenter.php @@ -371,7 +371,7 @@ class DepreciationReportPresenter extends Presenter * Date the warantee expires. * @return false|string */ - public function warrantee_expires() + public function warranty_expires() { if (($this->purchase_date) && ($this->warranty_months)) { $date = date_create($this->purchase_date); From 10e64deafebd79822f7ddaf1be1383c9fa372503 Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 2 Aug 2022 19:12:44 -0700 Subject: [PATCH 3/6] Updated method name in mail Signed-off-by: snipe --- .../notifications/markdown/report-expiring-assets.blade.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/views/notifications/markdown/report-expiring-assets.blade.php b/resources/views/notifications/markdown/report-expiring-assets.blade.php index b5a262903..4311096a6 100644 --- a/resources/views/notifications/markdown/report-expiring-assets.blade.php +++ b/resources/views/notifications/markdown/report-expiring-assets.blade.php @@ -6,8 +6,8 @@  {{ trans('mail.name') }}{{ trans('mail.Days') }}{{ trans('mail.expires') }}{{ trans('mail.supplier') }}{{ trans('mail.assigned_to') }} @foreach ($assets as $asset) @php -$expires = Helper::getFormattedDateObject($asset->present()->warrantee_expires, 'date'); -$diff = round(abs(strtotime($asset->present()->warrantee_expires) - strtotime(date('Y-m-d')))/86400); +$expires = Helper::getFormattedDateObject($asset->present()->warranty_expires, 'date'); +$diff = round(abs(strtotime($asset->present()->warranty_expires) - strtotime(date('Y-m-d')))/86400); $icon = ($diff <= ($threshold / 2)) ? '🚨' : (($diff <= $threshold) ? '⚠️' : ' '); @endphp {{ $icon }} {{ $asset->present()->name }} {{ $diff }} {{ trans('mail.Days') }} {{ $expires['formatted'] }} {{ ($asset->supplier ? e($asset->supplier->name) : '') }} {{ ($asset->assignedTo ? e($asset->assignedTo->present()->name()) : '') }} From 56b69045646e5c61b8b83b35cb7f440e9c498f60 Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 2 Aug 2022 19:13:02 -0700 Subject: [PATCH 4/6] Added time difference Signed-off-by: snipe --- resources/views/hardware/view.blade.php | 51 ++++++++++++------------- 1 file changed, 25 insertions(+), 26 deletions(-) diff --git a/resources/views/hardware/view.blade.php b/resources/views/hardware/view.blade.php index a1452767d..d08b9e562 100755 --- a/resources/views/hardware/view.blade.php +++ b/resources/views/hardware/view.blade.php @@ -574,7 +574,7 @@ @if ($asset->warranty_months) -
+
{{ trans('admin/hardware/form.warranty') }} @@ -584,10 +584,24 @@ {{ $asset->warranty_months }} {{ trans('admin/hardware/form.months') }} - ({{ trans('admin/hardware/form.expires') }} - {{ $asset->present()->warrantee_expires() }}) +
+ +
+
+ + {{ trans('admin/hardware/form.warranty_expires') }} + +
+
+ {{ Helper::getFormattedDateObject($asset->present()->warranty_expires(), 'date', false) }} + - + {{ Carbon::parse($asset->present()->warranty_expires())->diffForHumans() }} + +
+
+ @endif @if (($asset->model) && ($asset->depreciation)) @@ -600,8 +614,7 @@
{{ $asset->depreciation->name }} ({{ $asset->depreciation->months }} - {{ trans('admin/hardware/form.months') }} - ) + {{ trans('admin/hardware/form.months') }})
@@ -611,13 +624,10 @@
- @if ($asset->time_until_depreciated()->y > 0) - {{ $asset->time_until_depreciated()->y }} - {{ trans('admin/hardware/form.years') }}, - @endif - {{ $asset->time_until_depreciated()->m }} - {{ trans('admin/hardware/form.months') }} - ({{ $asset->depreciated_date()->format('Y-m-d') }}) + {{ Helper::getFormattedDateObject($asset->depreciated_date()->format('Y-m-d'), 'date', false) }} + - + {{ Carbon::parse($asset->depreciated_date())->diffForHumans() }} +
@endif @@ -644,20 +654,9 @@
{{ Helper::getFormattedDateObject($asset->present()->eol_date(), 'date', false) }} - - - @if ($asset->present()->months_until_eol()) - - - @if ($asset->present()->months_until_eol()->y > 0) - {{ $asset->present()->months_until_eol()->y }} - {{ trans('general.years') }}, - @endif - - {{ $asset->present()->months_until_eol()->m }} - {{ trans('general.months') }} - - @endif - + - + {{ Carbon::parse($asset->present()->eol_date())->diffForHumans() }} +
@endif From da1c1dbdd9316d12a37fce98187247358ff60941 Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 2 Aug 2022 19:19:08 -0700 Subject: [PATCH 5/6] Added warning icon Signed-off-by: snipe --- resources/views/hardware/view.blade.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/resources/views/hardware/view.blade.php b/resources/views/hardware/view.blade.php index d08b9e562..bcc862990 100755 --- a/resources/views/hardware/view.blade.php +++ b/resources/views/hardware/view.blade.php @@ -574,7 +574,7 @@ @if ($asset->warranty_months) -
+
{{ trans('admin/hardware/form.warranty') }} @@ -588,13 +588,15 @@
-
+
{{ trans('admin/hardware/form.warranty_expires') }} + {!! $asset->present()->warranty_expires() < date("Y-m-d") ? '' : '' !!}
+ {{ Helper::getFormattedDateObject($asset->present()->warranty_expires(), 'date', false) }} - {{ Carbon::parse($asset->present()->warranty_expires())->diffForHumans() }} From 87bed9b294156e9766881659fe49c73eacf7e631 Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 2 Aug 2022 19:24:46 -0700 Subject: [PATCH 6/6] Fixed typo in code comments Signed-off-by: snipe --- app/Presenters/AssetPresenter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Presenters/AssetPresenter.php b/app/Presenters/AssetPresenter.php index e54f9d559..bd03f29a1 100644 --- a/app/Presenters/AssetPresenter.php +++ b/app/Presenters/AssetPresenter.php @@ -498,7 +498,7 @@ class AssetPresenter extends Presenter } /** - * Date the warantee expires. + * Date the warranty expires. * @return false|string */ public function warranty_expires()