From 482965197d513843403bd74c6cbd2965a7e729e1 Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 7 May 2024 12:07:41 +0100 Subject: [PATCH] Added users, locations to presenter, transformer Signed-off-by: snipe --- app/Http/Transformers/UsersTransformer.php | 2 ++ app/Presenters/UserPresenter.php | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/app/Http/Transformers/UsersTransformer.php b/app/Http/Transformers/UsersTransformer.php index 0ebaca2692..5befc8abb6 100644 --- a/app/Http/Transformers/UsersTransformer.php +++ b/app/Http/Transformers/UsersTransformer.php @@ -64,6 +64,8 @@ class UsersTransformer 'licenses_count' => (int) $user->licenses_count, 'accessories_count' => (int) $user->accessories_count, 'consumables_count' => (int) $user->consumables_count, + 'manages_users_count' => (int) $user->manages_users_count, + 'manages_locations_count' => (int) $user->manages_locations_count, 'company' => ($user->company) ? ['id' => (int) $user->company->id, 'name'=> e($user->company->name)] : null, 'created_by' => ($user->createdBy) ? [ 'id' => (int) $user->createdBy->id, diff --git a/app/Presenters/UserPresenter.php b/app/Presenters/UserPresenter.php index 4726205c72..600d6e5079 100644 --- a/app/Presenters/UserPresenter.php +++ b/app/Presenters/UserPresenter.php @@ -251,6 +251,24 @@ class UserPresenter extends Presenter 'title' => 'Accessories', 'visible' => true, ], + [ + 'field' => 'manages_users_count', + 'searchable' => false, + 'sortable' => true, + 'switchable' => true, + 'class' => 'css-users', + 'title' => 'Managed Users', + 'visible' => true, + ], + [ + 'field' => 'manages_locations_count', + 'searchable' => false, + 'sortable' => true, + 'switchable' => true, + 'class' => 'css-location', + 'title' => 'Managed Locations', + 'visible' => true, + ], [ 'field' => 'notes', 'searchable' => true,