diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php index 48ebccd6b4..3309923c50 100755 --- a/app/controllers/AccountController.php +++ b/app/controllers/AccountController.php @@ -85,7 +85,11 @@ class AccountController extends \BaseController { Session::put("show_trash:{$entityType}", $visible == 'true'); - return Redirect::to("{$entityType}s"); + if ($entityType == 'user') { + return Redirect::to('company/'.ACCOUNT_ADVANCED_SETTINGS.'/'.ACCOUNT_USER_MANAGEMENT); + } else { + return Redirect::to("{$entityType}s"); + } } public function getSearchData() diff --git a/app/controllers/UserController.php b/app/controllers/UserController.php index 79d8a5d1a5..ec6b701c29 100755 --- a/app/controllers/UserController.php +++ b/app/controllers/UserController.php @@ -31,26 +31,43 @@ class UserController extends BaseController public function getDatatable() { $query = DB::table('users') - ->where('users.account_id', '=', Auth::user()->account_id) - ->where('users.deleted_at', '=', null) - ->where('users.public_id', '>', 0) - ->select('users.public_id', 'users.first_name', 'users.last_name', 'users.email', 'users.confirmed', 'users.public_id'); + ->where('users.account_id', '=', Auth::user()->account_id); + + if (!Session::get('show_trash:user')) { + $query->where('users.deleted_at', '=', null); + } + + $query->where('users.public_id', '>', 0) + ->select('users.public_id', 'users.first_name', 'users.last_name', 'users.email', 'users.confirmed', 'users.public_id', 'users.deleted_at'); return Datatable::query($query) ->addColumn('first_name', function ($model) { return link_to('users/'.$model->public_id.'/edit', $model->first_name.' '.$model->last_name); }) ->addColumn('email', function ($model) { return $model->email; }) - ->addColumn('confirmed', function ($model) { return $model->confirmed ? trans('texts.active') : trans('texts.pending'); }) + ->addColumn('confirmed', function ($model) { return $model->deleted_at ? trans('texts.deleted') : ($model->confirmed ? trans('texts.active') : trans('texts.pending')); }) ->addColumn('dropdown', function ($model) { - return '