From 0e5209e80fdd1470c99ce17a997146badfc1ae10 Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 2 Aug 2016 05:06:17 -0700 Subject: [PATCH] Few more dashboard fixes --- app/Models/Actionlog.php | 7 +++++++ resources/views/dashboard.blade.php | 13 ++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/app/Models/Actionlog.php b/app/Models/Actionlog.php index 65698561bd..75f831d0d3 100755 --- a/app/Models/Actionlog.php +++ b/app/Models/Actionlog.php @@ -85,6 +85,13 @@ class Actionlog extends Model implements ICompanyableChild ->withTrashed(); } + public function userasassetlog() + { + + return $this->belongsTo('\App\Models\User', 'asset_id') + ->withTrashed(); + } + public function childlogs() { diff --git a/resources/views/dashboard.blade.php b/resources/views/dashboard.blade.php index 53df8bd1e2..e8d78fc37d 100755 --- a/resources/views/dashboard.blade.php +++ b/resources/views/dashboard.blade.php @@ -140,7 +140,7 @@ {{ strtolower(trans('general.'.str_replace(' ','_',$activity->action_type))) }} - @if (($activity->assetlog) && ($activity->asset_type=="hardware")) + @if (($activity->assetlog) && ($activity->asset_type=="hardware")) {{ $activity->assetlog->showAssetName() }} @elseif (($activity->licenselog) && ($activity->asset_type=="software")) {{ $activity->licenselog->name }} @@ -150,18 +150,17 @@ {{ $activity->accessorylog->name }} @elseif (($activity->componentlog) && ($activity->asset_type=="component")) {{ $activity->componentlog->name }} - @elseif (($activity->assetlog) && ($activity->action_type=="uploaded")) + @elseif (($activity->assetlog) && ($activity->action_type=="uploaded") && ($activity->asset_type=="hardware")) {{ $activity->assetlog->showAssetName() }} - @elseif (($activity->userlog) && ($activity->action_type=="uploaded")) - {{ $activity->userlog->fullName() }} - @else - {{ trans('general.bad_data') }} + @endif - @if (($activity->componentlog) && ($activity->asset_type=="component")) + @if (($activity->userasassetlog) && ($activity->action_type=="uploaded") && ($activity->asset_type=="user")) + {{ $activity->userasassetlog->fullName() }} + @elseif (($activity->componentlog) && ($activity->asset_type=="component")) {{ $activity->assetlog->showAssetName() }} @elseif($activity->action_type=='requested') @if ($activity->adminlog)