mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-11 05:47:28 -08:00
Allow sorting on asset counts, disable delete button if the user has items checked out to them
This commit is contained in:
parent
f757da1a98
commit
22e13cd4d2
|
@ -92,7 +92,8 @@ class UsersController extends Controller
|
|||
[
|
||||
'last_name','first_name','email','jobtitle','username','employee_num',
|
||||
'assets','accessories', 'consumables','licenses','groups','activated','created_at',
|
||||
'two_factor_enrolled','two_factor_optin','last_login'
|
||||
'two_factor_enrolled','two_factor_optin','last_login', 'assets_count', 'licenses_count',
|
||||
'consumables_count', 'accessories_count'
|
||||
];
|
||||
|
||||
$sort = in_array($request->get('sort'), $allowed_columns) ? $request->get('sort') : 'first_name';
|
||||
|
|
|
@ -58,7 +58,7 @@ class UsersTransformer
|
|||
|
||||
$permissions_array['available_actions'] = [
|
||||
'update' => (Gate::allows('update', User::class) && ($user->deleted_at=='')) ? true : false,
|
||||
'delete' => (Gate::allows('delete', User::class) && ($user->deleted_at=='')) ? true : false,
|
||||
'delete' => (Gate::allows('delete', User::class) && ($user->deleted_at=='') && ($user->assets_count == 0) && ($user->licenses_count == 0) && ($user->accessories_count == 0) && ($user->consumables_count == 0)) ? true : false,
|
||||
'clone' => (Gate::allows('create', User::class) && ($user->deleted_at=='')) ,
|
||||
'restore' => (Gate::allows('create', User::class) && ($user->deleted_at!='')) ? true : false,
|
||||
];
|
||||
|
|
|
@ -115,7 +115,7 @@ class UserPresenter extends Presenter
|
|||
[
|
||||
"field" => "assets_count",
|
||||
"searchable" => false,
|
||||
"sortable" => false,
|
||||
"sortable" => true,
|
||||
"switchable" => true,
|
||||
"title" => ' <span class="hidden-md hidden-lg">Assets</span>'
|
||||
.'<span class="hidden-xs"><i class="fa fa-barcode fa-lg"></i></span>',
|
||||
|
@ -124,7 +124,7 @@ class UserPresenter extends Presenter
|
|||
[
|
||||
"field" => "licenses_count",
|
||||
"searchable" => false,
|
||||
"sortable" => false,
|
||||
"sortable" => true,
|
||||
"switchable" => true,
|
||||
"title" => ' <span class="hidden-md hidden-lg">Licenses</span>'
|
||||
.'<span class="hidden-xs"><i class="fa fa-floppy-o fa-lg"></i></span>',
|
||||
|
@ -133,7 +133,7 @@ class UserPresenter extends Presenter
|
|||
[
|
||||
"field" => "consumables_count",
|
||||
"searchable" => false,
|
||||
"sortable" => false,
|
||||
"sortable" => true,
|
||||
"switchable" => true,
|
||||
"title" => ' <span class="hidden-md hidden-lg">Consumables</span>'
|
||||
.'<span class="hidden-xs"><i class="fa fa-tint fa-lg"></i></span>',
|
||||
|
@ -142,7 +142,7 @@ class UserPresenter extends Presenter
|
|||
[
|
||||
"field" => "accessories_count",
|
||||
"searchable" => false,
|
||||
"sortable" => false,
|
||||
"sortable" => true,
|
||||
"switchable" => true,
|
||||
"title" => ' <span class="hidden-md hidden-lg">Accessories</span>'
|
||||
.'<span class="hidden-xs"><i class="fa fa-keyboard-o fa-lg"></i></span>',
|
||||
|
|
Loading…
Reference in a new issue