A free open source IT asset/license management system
Fixes #4249 - display deployed location in listing
snipec5893b444528
diff --git a/app/Http/Transformers/AssetsTransformer.php b/app/Http/Transformers/AssetsTransformer.phpindex 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.phpindex 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.phpindex 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 '<a href="{{ url('/') }}/locations/' + row.id + '"> ' + row.name + '</a>';+ } else if (value.rtd_location) {+ return '<a href="{{ url('/') }}/locations/' + value.rtd_location.id + '" data-tooltip="true" title="Default Location"> ' + value.rtd_location.name + '</a>';+ }++ }+function groupsAdminLinkFormatter(value, row) {return '<a href="{{ url('/') }}/admin/groups/' + row.id + '"> ' + value + '</a>';}