From ed4aa7dec203fe33a34d166366001fdc5b9b9bf5 Mon Sep 17 00:00:00 2001 From: snipe Date: Wed, 18 Oct 2017 04:48:52 -0700 Subject: [PATCH] Account for deleted suppliers in asset maintenances report This should all be reworked via the API though anyway --- .../reports/asset_maintenances.blade.php | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/resources/views/reports/asset_maintenances.blade.php b/resources/views/reports/asset_maintenances.blade.php index 79dbb806cd..31d61e0b76 100644 --- a/resources/views/reports/asset_maintenances.blade.php +++ b/resources/views/reports/asset_maintenances.blade.php @@ -41,25 +41,30 @@ $totalCost = 0; ?> @foreach ($assetMaintenances as $assetMaintenance) + asset_maintenance_time); ?> @if ($assetMaintenance->asset) {{ ($assetMaintenance->asset->company) ? $assetMaintenance->asset->company->name : '' }} {{ $assetMaintenance->asset->asset_tag }} {{ $assetMaintenance->asset->name }} - {{ $assetMaintenance->supplier->name }} + + @if ($assetMaintenance->supplier) + {{ $assetMaintenance->supplier->name }} + @else + (deleted supplier) + @endif + {{ $assetMaintenance->asset_maintenance_type }} {{ $assetMaintenance->title }} {{ $assetMaintenance->start_date }} {{ is_null($assetMaintenance->completion_date) ? trans('admin/asset_maintenances/message.asset_maintenance_incomplete') : $assetMaintenance->completion_date }} - @if (is_null($assetMaintenance->asset_maintenance_time)) - diffInDays(Carbon::parse($assetMaintenance->start_date))); - ?> - @else - asset_maintenance_time); - ?> - @endif + asset_maintenance_time)) { + $assetMaintenanceTime = intval(Carbon::now()->diffInDays(Carbon::parse($assetMaintenance->start_date))); + } + + ?> {{ $assetMaintenanceTime }} {{ $snipeSettings->default_currency }}