Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added links on user table to tabs on show user page #15001

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions app/Presenters/UserPresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ public static function dataTableLayout()
'class' => 'css-barcode',
'title' => trans('general.assets'),
'visible' => true,
'formatter' => 'linkNumberToUserAssetsFormatter',
],
[
'field' => 'licenses_count',
Expand All @@ -232,6 +233,7 @@ public static function dataTableLayout()
'class' => 'css-license',
'title' => trans('general.licenses'),
'visible' => true,
'formatter' => 'linkNumberToUserLicensesFormatter',
],
[
'field' => 'consumables_count',
Expand All @@ -241,6 +243,7 @@ public static function dataTableLayout()
'class' => 'css-consumable',
'title' => trans('general.consumables'),
'visible' => true,
'formatter' => 'linkNumberToUserConsumablesFormatter',
],
[
'field' => 'accessories_count',
Expand All @@ -250,6 +253,7 @@ public static function dataTableLayout()
'class' => 'css-accessory',
'title' => trans('general.accessories'),
'visible' => true,
'formatter' => 'linkNumberToUserAccessoriesFormatter',
],
[
'field' => 'manages_users_count',
Expand All @@ -259,6 +263,7 @@ public static function dataTableLayout()
'class' => 'css-users',
'title' => trans('admin/users/table.managed_users'),
'visible' => true,
'formatter' => 'linkNumberToUserManagedUsersFormatter',
],
[
'field' => 'manages_locations_count',
Expand All @@ -268,6 +273,7 @@ public static function dataTableLayout()
'class' => 'css-location',
'title' => trans('admin/users/table.managed_locations'),
'visible' => true,
'formatter' => 'linkNumberToUserManagedLocationsFormatter',
],
[
'field' => 'notes',
Expand Down
34 changes: 33 additions & 1 deletion resources/views/partials/bootstrap-table.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,38 @@ function fileUploadNameFormatter(value) {
}
}

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) {
if (row) {
if (!row.hasOwnProperty('sheet_info')) { return 1; }
Expand Down Expand Up @@ -937,4 +969,4 @@ function numberWithCommas(value) {

</script>

@endpush
@endpush
Loading