Fixes #4249 - display deployed location in listing

This commit is contained in:
snipe 2017-10-19 01:30:40 -07:00
parent b90933bb8b
commit c5893b4445
3 changed files with 13 additions and 4 deletions

View file

@ -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,

View file

@ -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,

View file

@ -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>';
}