diff --git a/app/Http/Transformers/AssetsTransformer.php b/app/Http/Transformers/AssetsTransformer.php index 1b53d61aa8..92ba702a15 100644 --- a/app/Http/Transformers/AssetsTransformer.php +++ b/app/Http/Transformers/AssetsTransformer.php @@ -54,9 +54,9 @@ class AssetsTransformer 'id' => (int) $asset->company->id, 'name'=> e($asset->company->name) ] : null, - 'location' => ($asset->assetloc) ? [ - 'id' => (int) $asset->assetloc->id, - 'name'=> e($asset->assetloc->name) + 'location' => ($asset->assetLoc) ? [ + 'id' => (int) $asset->assetLoc->id, + 'name'=> e($asset->assetLoc->name) ] : null, 'rtd_location' => ($asset->defaultLoc) ? [ 'id' => (int) $asset->defaultLoc->id, diff --git a/app/Presenters/AssetPresenter.php b/app/Presenters/AssetPresenter.php index ba030b05cd..42d4e92b1d 100644 --- a/app/Presenters/AssetPresenter.php +++ b/app/Presenters/AssetPresenter.php @@ -112,7 +112,7 @@ class AssetPresenter extends Presenter "sortable" => true, "title" => trans('admin/hardware/table.location'), "visible" => true, - "formatter" => "locationsLinkObjFormatter" + "formatter" => "deployedLocationFormatter" ], [ "field" => "manufacturer", "searchable" => true, diff --git a/resources/views/partials/bootstrap-table.blade.php b/resources/views/partials/bootstrap-table.blade.php index 2d14246a06..fc7aca555c 100644 --- a/resources/views/partials/bootstrap-table.blade.php +++ b/resources/views/partials/bootstrap-table.blade.php @@ -346,6 +346,15 @@ $('.snipe-table').bootstrapTable({ } } + function deployedLocationFormatter(row, value) { + if ((row) && (row!=undefined)) { + return ' ' + row.name + ''; + } else if (value.rtd_location) { + return ' ' + value.rtd_location.name + ''; + } + + } + function groupsAdminLinkFormatter(value, row) { return ' ' + value + ''; }