mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-23 12:44:12 -08:00
Fixed deleted users/restore users view
This commit is contained in:
parent
472658b2fe
commit
47909b93f7
|
@ -52,6 +52,12 @@ class UsersController extends Controller
|
|||
$users = $users->TextSearch($request->input('search'));
|
||||
}
|
||||
|
||||
|
||||
if (($request->has('deleted')) && ($request->input('deleted')=='true')) {
|
||||
$users = $users->GetDeleted();
|
||||
}
|
||||
|
||||
|
||||
if ($request->has('company_id')) {
|
||||
$users = $users->where('company_id', '=', $request->input('company_id'));
|
||||
}
|
||||
|
|
|
@ -56,9 +56,10 @@ class UsersTransformer
|
|||
];
|
||||
|
||||
$permissions_array['available_actions'] = [
|
||||
'update' => Gate::allows('update', User::class) ? true : false,
|
||||
'delete' => Gate::allows('delete', User::class) ? true : false,
|
||||
'clone' => Gate::allows('create', User::class) ? true : false,
|
||||
'update' => (Gate::allows('update', User::class) && ($user->deleted_at=='')) ? true : false,
|
||||
'delete' => (Gate::allows('delete', User::class) && ($user->deleted_at=='')) ? true : false,
|
||||
'clone' => (Gate::allows('create', User::class) && ($user->deleted_at=='')) ,
|
||||
'restore' => (Gate::allows('create', User::class) && ($user->deleted_at!='')) ? true : false,
|
||||
];
|
||||
|
||||
$array += $permissions_array;
|
||||
|
|
|
@ -167,6 +167,10 @@ $('.snipe-table').bootstrapTable({
|
|||
+ ' data-title="{{ trans('general.delete') }}" onClick="return false;">'
|
||||
+ '<i class="fa fa-trash"></i></a></nobr>';
|
||||
}
|
||||
|
||||
if ((row.available_actions) && (row.available_actions.restore === true)) {
|
||||
actions += '<a href="{{ url('/') }}/' + destination + '/' + row.id + '/restore" class="btn btn-sm btn-warning" data-tooltip="true" title="Restore"><i class="fa fa-retweet"></i></a> ';
|
||||
}
|
||||
return actions;
|
||||
|
||||
};
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
class="table table-striped snipe-table"
|
||||
id="table"
|
||||
data-url="{{ route('api.users.index',
|
||||
array(''=>e(Input::get('status')),'company_id'=>e(Input::get('company_id')))) }}"
|
||||
array('deleted'=> (Input::get('status')=='deleted') ? 'true' : 'false','company_id'=>e(Input::get('company_id')))) }}"
|
||||
data-cookie="true"
|
||||
data-click-to-select="true"
|
||||
data-cookie-id-table="userTableDisplay-{{ config('version.hash_version') }}">
|
||||
|
|
Loading…
Reference in a new issue