mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-11 22:07:29 -08:00
Link user table counts to section in user show
This commit is contained in:
parent
d2df83cf2f
commit
3a8f825de5
|
@ -223,6 +223,7 @@ class UserPresenter extends Presenter
|
||||||
'class' => 'css-barcode',
|
'class' => 'css-barcode',
|
||||||
'title' => trans('general.assets'),
|
'title' => trans('general.assets'),
|
||||||
'visible' => true,
|
'visible' => true,
|
||||||
|
'formatter' => 'linkNumberToUserAssetsFormatter',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'field' => 'licenses_count',
|
'field' => 'licenses_count',
|
||||||
|
@ -232,6 +233,7 @@ class UserPresenter extends Presenter
|
||||||
'class' => 'css-license',
|
'class' => 'css-license',
|
||||||
'title' => trans('general.licenses'),
|
'title' => trans('general.licenses'),
|
||||||
'visible' => true,
|
'visible' => true,
|
||||||
|
'formatter' => 'linkNumberToUserLicensesFormatter',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'field' => 'consumables_count',
|
'field' => 'consumables_count',
|
||||||
|
@ -241,6 +243,7 @@ class UserPresenter extends Presenter
|
||||||
'class' => 'css-consumable',
|
'class' => 'css-consumable',
|
||||||
'title' => trans('general.consumables'),
|
'title' => trans('general.consumables'),
|
||||||
'visible' => true,
|
'visible' => true,
|
||||||
|
'formatter' => 'linkNumberToUserConsumablesFormatter',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'field' => 'accessories_count',
|
'field' => 'accessories_count',
|
||||||
|
@ -250,6 +253,7 @@ class UserPresenter extends Presenter
|
||||||
'class' => 'css-accessory',
|
'class' => 'css-accessory',
|
||||||
'title' => trans('general.accessories'),
|
'title' => trans('general.accessories'),
|
||||||
'visible' => true,
|
'visible' => true,
|
||||||
|
'formatter' => 'linkNumberToUserAccessoriesFormatter',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'field' => 'manages_users_count',
|
'field' => 'manages_users_count',
|
||||||
|
@ -259,6 +263,7 @@ class UserPresenter extends Presenter
|
||||||
'class' => 'css-users',
|
'class' => 'css-users',
|
||||||
'title' => trans('admin/users/table.managed_users'),
|
'title' => trans('admin/users/table.managed_users'),
|
||||||
'visible' => true,
|
'visible' => true,
|
||||||
|
'formatter' => 'linkNumberToUserManagedUsersFormatter',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'field' => 'manages_locations_count',
|
'field' => 'manages_locations_count',
|
||||||
|
@ -268,6 +273,7 @@ class UserPresenter extends Presenter
|
||||||
'class' => 'css-location',
|
'class' => 'css-location',
|
||||||
'title' => trans('admin/users/table.managed_locations'),
|
'title' => trans('admin/users/table.managed_locations'),
|
||||||
'visible' => true,
|
'visible' => true,
|
||||||
|
'formatter' => 'linkNumberToUserManagedLocationsFormatter',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'field' => 'notes',
|
'field' => 'notes',
|
||||||
|
|
|
@ -804,6 +804,38 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function linkToUserSectionBasedOnCount (count, id, section) {
|
||||||
|
if (count) {
|
||||||
|
return '<a href="{{ config('app.url') }}/users/' + id + '#' + section +'">' + count + '</a>';
|
||||||
|
}
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
function linkNumberToUserAssetsFormatter(value, row) {
|
||||||
|
return linkToUserSectionBasedOnCount(value, row.id, 'asset');
|
||||||
|
}
|
||||||
|
|
||||||
|
function linkNumberToUserLicensesFormatter(value, row) {
|
||||||
|
return linkToUserSectionBasedOnCount(value, row.id, 'licenses');
|
||||||
|
}
|
||||||
|
|
||||||
|
function linkNumberToUserConsumablesFormatter(value, row) {
|
||||||
|
return linkToUserSectionBasedOnCount(value, row.id, 'consumables');
|
||||||
|
}
|
||||||
|
|
||||||
|
function linkNumberToUserAccessoriesFormatter(value, row) {
|
||||||
|
return linkToUserSectionBasedOnCount(value, row.id, 'accessories');
|
||||||
|
}
|
||||||
|
|
||||||
|
function linkNumberToUserManagedUsersFormatter(value, row) {
|
||||||
|
return linkToUserSectionBasedOnCount(value, row.id, 'managed-users');
|
||||||
|
}
|
||||||
|
|
||||||
|
function linkNumberToUserManagedLocationsFormatter(value, row) {
|
||||||
|
return linkToUserSectionBasedOnCount(value, row.id, 'managed-locations');
|
||||||
|
}
|
||||||
|
|
||||||
function labelPerPageFormatter(value, row, index, field) {
|
function labelPerPageFormatter(value, row, index, field) {
|
||||||
if (row) {
|
if (row) {
|
||||||
if (!row.hasOwnProperty('sheet_info')) { return 1; }
|
if (!row.hasOwnProperty('sheet_info')) { return 1; }
|
||||||
|
@ -937,4 +969,4 @@
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@endpush
|
@endpush
|
||||||
|
|
Loading…
Reference in a new issue