From 596846a94a6c67e0378ef9e688b95d8a0c246e07 Mon Sep 17 00:00:00 2001 From: akemidx Date: Tue, 24 Jan 2023 15:29:27 -0500 Subject: [PATCH] Add VIP Checkbox --- app/Http/Controllers/Api/UsersController.php | 1 + app/Http/Controllers/Users/UsersController.php | 1 + app/Models/User.php | 4 +++- app/Presenters/UserPresenter.php | 9 +++++++++ resources/lang/en/admin/users/general.php | 2 ++ resources/views/users/edit.blade.php | 13 +++++++++++++ resources/views/users/view.blade.php | 12 +++++++++++- 7 files changed, 40 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Api/UsersController.php b/app/Http/Controllers/Api/UsersController.php index cca829c23f..8185583868 100644 --- a/app/Http/Controllers/Api/UsersController.php +++ b/app/Http/Controllers/Api/UsersController.php @@ -246,6 +246,7 @@ class UsersController extends Controller 'two_factor_optin', 'two_factor_enrolled', 'remote', + 'vipuser', 'start_date', 'end_date', ]; diff --git a/app/Http/Controllers/Users/UsersController.php b/app/Http/Controllers/Users/UsersController.php index 52d423036f..9d322ca4d9 100755 --- a/app/Http/Controllers/Users/UsersController.php +++ b/app/Http/Controllers/Users/UsersController.php @@ -271,6 +271,7 @@ class UsersController extends Controller $user->activated = $request->input('activated', 0); $user->zip = $request->input('zip', null); $user->remote = $request->input('remote', 0); + $user->vipuser = $request->input('vipuser', 0); $user->website = $request->input('website', null); $user->start_date = $request->input('start_date', null); $user->end_date = $request->input('end_date', null); diff --git a/app/Models/User.php b/app/Models/User.php index 399008430b..b51d23626f 100755 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -61,7 +61,8 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo 'remote', 'start_date', 'end_date', - 'scim_externalid' + 'scim_externalid', + 'vipuser', ]; protected $casts = [ @@ -69,6 +70,7 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo 'manager_id' => 'integer', 'location_id' => 'integer', 'company_id' => 'integer', + 'vipuser' => 'boolean', ]; diff --git a/app/Presenters/UserPresenter.php b/app/Presenters/UserPresenter.php index 8f5cfcccf5..dc41050f5b 100644 --- a/app/Presenters/UserPresenter.php +++ b/app/Presenters/UserPresenter.php @@ -85,6 +85,15 @@ class UserPresenter extends Presenter 'visible' => true, 'formatter' => 'usersLinkFormatter', ], + [ + 'field' => 'vipuser', + 'searchable' => false, + 'sortable' => true, + 'switchable' => true, + 'title' => trans('admin/users/general.vip_label'), + 'visible' => false, + 'formatter' => 'trueFalseFormatter', + ], [ 'field' => 'remote', 'searchable' => false, diff --git a/resources/lang/en/admin/users/general.php b/resources/lang/en/admin/users/general.php index daa568e8bf..241667c387 100644 --- a/resources/lang/en/admin/users/general.php +++ b/resources/lang/en/admin/users/general.php @@ -41,4 +41,6 @@ return [ 'remote' => 'Remote', 'remote_help' => 'This can be useful if you need to filter by remote users who never or rarely come into your physical locations.', 'not_remote_label' => 'This is not a remote user', + 'vip_label' => 'VIP user', + 'vip_help' => 'This can be helpful to mark important people if you would like', ]; diff --git a/resources/views/users/edit.blade.php b/resources/views/users/edit.blade.php index 93b8fb7a21..b06dcad237 100755 --- a/resources/views/users/edit.blade.php +++ b/resources/views/users/edit.blade.php @@ -362,6 +362,19 @@ @include ('partials.forms.edit.datepicker', ['translated_name' => trans('general.end_date'), 'fieldname' => 'end_date', 'item' => $user]) + +
+
+ +

{{ trans('admin/users/general.vip_help') }} +

+
+
+
diff --git a/resources/views/users/view.blade.php b/resources/views/users/view.blade.php index 5d959589e6..f12929a9d4 100755 --- a/resources/views/users/view.blade.php +++ b/resources/views/users/view.blade.php @@ -519,7 +519,17 @@
@endif - + +
+
+ {{ trans('admin/users/general.vip_label') }} +
+
+ {!! ($user->vipuser=='1') ? ' '.trans('general.yes') : ' '.trans('general.no') !!} +
+
+ +
{{ trans('admin/users/general.remote') }}