Bug-fix-patch4
# handling exception in while adding language # Implemented Yajra in users list table # custom filter and veiw option in users list table
This commit is contained in:
@@ -122,6 +122,7 @@ class LanguageController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function postForm()
|
public function postForm()
|
||||||
{
|
{
|
||||||
|
try {
|
||||||
// getting all of the post data
|
// getting all of the post data
|
||||||
$file = [
|
$file = [
|
||||||
'File' => Input::file('File'),
|
'File' => Input::file('File'),
|
||||||
@@ -196,6 +197,10 @@ class LanguageController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
Session::flash('fails', $e->getMessage());
|
||||||
|
Redirect::back()->withInput();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -41,6 +41,7 @@ use Illuminate\Http\Request;
|
|||||||
use Input;
|
use Input;
|
||||||
use Lang;
|
use Lang;
|
||||||
use Redirect;
|
use Redirect;
|
||||||
|
use Datatables;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UserController
|
* UserController
|
||||||
@@ -85,7 +86,6 @@ class UserController extends Controller
|
|||||||
Lang::get('lang.email'),
|
Lang::get('lang.email'),
|
||||||
Lang::get('lang.phone'),
|
Lang::get('lang.phone'),
|
||||||
Lang::get('lang.status'),
|
Lang::get('lang.status'),
|
||||||
Lang::get('lang.ban'),
|
|
||||||
Lang::get('lang.last_login'),
|
Lang::get('lang.last_login'),
|
||||||
Lang::get('lang.role'),
|
Lang::get('lang.role'),
|
||||||
Lang::get('lang.action')) // these are the column headings to be shown
|
Lang::get('lang.action')) // these are the column headings to be shown
|
||||||
@@ -116,21 +116,42 @@ class UserController extends Controller
|
|||||||
public function user_list(Request $request)
|
public function user_list(Request $request)
|
||||||
{
|
{
|
||||||
$type = $request->input('profiletype');
|
$type = $request->input('profiletype');
|
||||||
|
$search = $request->input('searchTerm');
|
||||||
|
|
||||||
if ($type == 'active') {
|
if ($type === 'agents') {
|
||||||
$users = User::where('role', '!=', 'admin')->where('is_delete', '=', 0)->get();
|
$users = User::where('role', '=', 'agent')->where('is_delete', '=', 0);
|
||||||
|
} elseif ($type === 'users') {
|
||||||
|
$users = User::where('role', '=', 'user')->where('is_delete', '=', 0);
|
||||||
|
} elseif ($type === 'active') {
|
||||||
|
$users = User::where('role', '!=', 'admin')->where('active', '=', 1);
|
||||||
|
} elseif ($type === 'inactive') {
|
||||||
|
$users = User::where('role', '!=', 'admin')->where('active', '=', 0);
|
||||||
|
} elseif ($type === 'deleted') {
|
||||||
|
$users = User::where('role', '!=', 'admin')->where('is_delete', '=', 1);
|
||||||
|
} elseif ($type === 'banned') {
|
||||||
|
$users = User::where('role', '!=', 'admin')->where('ban', '=', 1);
|
||||||
} else {
|
} else {
|
||||||
$users = User::where('role', '!=', 'admin')->where('is_delete', '=', 1)->get();
|
$users = User::where('role', '!=', 'admin')->where('is_delete', '=', 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$users = $users->select('user_name', 'email', 'mobile', 'active', 'updated_at', 'role', 'id', 'last_name', 'country_code', 'phone_number');
|
||||||
|
|
||||||
|
if ($search !== '') {
|
||||||
|
$users = $users->where(function($query) use ($search){
|
||||||
|
$query->where('user_name', 'LIKE', '%'.$search.'%');
|
||||||
|
$query->orWhere('email', 'LIKE', '%'.$search.'%');
|
||||||
|
$query->orWhere('first_name', 'LIKE', '%'.$search.'%');
|
||||||
|
$query->orWhere('last_name', 'LIKE', '%'.$search.'%');
|
||||||
|
$query->orWhere('mobile', 'LIKE', '%'.$search.'%');
|
||||||
|
$query->orWhere('updated_at', 'LIKE', '%'.$search.'%');
|
||||||
|
$query->orWhere('country_code', 'LIKE', '%'.$search.'%');
|
||||||
|
});
|
||||||
|
}
|
||||||
// displaying list of users with chumper datatables
|
// displaying list of users with chumper datatables
|
||||||
// return \Datatable::collection(User::where('role', "!=", "admin")->get())
|
// return \Datatable::collection(User::where('role', "!=", "admin")->get())
|
||||||
return \Datatable::collection($users)
|
return \Datatables::of($users)
|
||||||
/* searchable column username and email */
|
|
||||||
->searchColumns('user_name', 'email', 'phone')
|
|
||||||
/* order column username and email */
|
|
||||||
->orderColumns('user_name', 'email')
|
|
||||||
/* column username */
|
/* column username */
|
||||||
|
->removeColumn('id', 'last_name', 'country_code', 'phone_number')
|
||||||
->addColumn('user_name', function ($model) {
|
->addColumn('user_name', function ($model) {
|
||||||
if ($model->first_name) {
|
if ($model->first_name) {
|
||||||
$string = strip_tags($model->first_name.' '.$model->last_name);
|
$string = strip_tags($model->first_name.' '.$model->last_name);
|
||||||
@@ -153,7 +174,7 @@ class UserController extends Controller
|
|||||||
return $email;
|
return $email;
|
||||||
})
|
})
|
||||||
/* column phone */
|
/* column phone */
|
||||||
->addColumn('phone', function ($model) {
|
->addColumn('mobile', function ($model) {
|
||||||
$phone = '';
|
$phone = '';
|
||||||
if ($model->phone_number) {
|
if ($model->phone_number) {
|
||||||
$phone = $model->ext.' '.$model->phone_number;
|
$phone = $model->ext.' '.$model->phone_number;
|
||||||
@@ -167,7 +188,7 @@ class UserController extends Controller
|
|||||||
return $phone;
|
return $phone;
|
||||||
})
|
})
|
||||||
/* column account status */
|
/* column account status */
|
||||||
->addColumn('status', function ($model) {
|
->addColumn('active', function ($model) {
|
||||||
$status = $model->active;
|
$status = $model->active;
|
||||||
if ($status == 1) {
|
if ($status == 1) {
|
||||||
$stat = '<button class="btn btn-success btn-xs">Active</button>';
|
$stat = '<button class="btn btn-success btn-xs">Active</button>';
|
||||||
@@ -177,19 +198,8 @@ class UserController extends Controller
|
|||||||
|
|
||||||
return $stat;
|
return $stat;
|
||||||
})
|
})
|
||||||
/* column ban status */
|
|
||||||
->addColumn('ban', function ($model) {
|
|
||||||
$status = $model->ban;
|
|
||||||
if ($status == 1) {
|
|
||||||
$stat = '<button class="btn btn-danger btn-xs">Banned</button>';
|
|
||||||
} else {
|
|
||||||
$stat = '<button class="btn btn-success btn-xs">Not Banned</button>';
|
|
||||||
}
|
|
||||||
|
|
||||||
return $stat;
|
|
||||||
})
|
|
||||||
/* column last login date */
|
/* column last login date */
|
||||||
->addColumn('lastlogin', function ($model) {
|
->addColumn('updated_at', function ($model) {
|
||||||
$t = $model->updated_at;
|
$t = $model->updated_at;
|
||||||
|
|
||||||
return TicketController::usertimezone($t);
|
return TicketController::usertimezone($t);
|
||||||
|
@@ -1148,5 +1148,12 @@ return [
|
|||||||
|
|
||||||
//update 18-12-2016
|
//update 18-12-2016
|
||||||
'account-created-contact-admin-as-we-were-not-able-to-send-opt' => 'Your account has been created successfully. Please contact admin for account activation as we were not able to send you an OPT code.',
|
'account-created-contact-admin-as-we-were-not-able-to-send-opt' => 'Your account has been created successfully. Please contact admin for account activation as we were not able to send you an OPT code.',
|
||||||
|
//update 19-12-2016
|
||||||
|
'only-agents' => 'Agent users',
|
||||||
|
'only-users' => 'Clients users',
|
||||||
|
'banned-users' => 'Banned users',
|
||||||
|
'inactive-users' => 'Inactive users',
|
||||||
|
'all-users' => 'All users',
|
||||||
|
'search' => 'Search...',
|
||||||
|
|
||||||
];
|
];
|
||||||
|
@@ -1585,5 +1585,11 @@ return [
|
|||||||
|
|
||||||
//update 18-12-2016
|
//update 18-12-2016
|
||||||
'account-created-contact-admin-as-we-were-not-able-to-send-opt' => 'Your account has been created successfully. Please contact admin for account activation as we were not able to send you an OPT code.',
|
'account-created-contact-admin-as-we-were-not-able-to-send-opt' => 'Your account has been created successfully. Please contact admin for account activation as we were not able to send you an OPT code.',
|
||||||
|
//update 19-12-2016
|
||||||
|
'only-agents' => 'Agent users',
|
||||||
|
'only-users' => 'Clients users',
|
||||||
|
'banned-users' => 'Banned users',
|
||||||
|
'inactive-users' => 'Inactive users',
|
||||||
|
'all-users' => 'All users',
|
||||||
|
'search' => 'Search...',
|
||||||
];
|
];
|
||||||
|
@@ -1556,5 +1556,12 @@ return [
|
|||||||
|
|
||||||
//update 18-12-2016
|
//update 18-12-2016
|
||||||
'account-created-contact-admin-as-we-were-not-able-to-send-opt' => 'Your account has been created successfully. Please contact admin for account activation as we were not able to send you an OPT code.',
|
'account-created-contact-admin-as-we-were-not-able-to-send-opt' => 'Your account has been created successfully. Please contact admin for account activation as we were not able to send you an OPT code.',
|
||||||
|
//update 19-12-2016
|
||||||
|
'only-agents' => 'Agent users',
|
||||||
|
'only-users' => 'Clients users',
|
||||||
|
'banned-users' => 'Banned users',
|
||||||
|
'inactive-users' => 'Inactive users',
|
||||||
|
'all-users' => 'All users',
|
||||||
|
'search' => 'Search...',
|
||||||
|
|
||||||
];
|
];
|
||||||
|
@@ -1108,4 +1108,11 @@ return [
|
|||||||
|
|
||||||
//update 18-12-2016
|
//update 18-12-2016
|
||||||
'account-created-contact-admin-as-we-were-not-able-to-send-opt' => 'Your account has been created successfully. Please contact admin for account activation as we were not able to send you an OPT code.',
|
'account-created-contact-admin-as-we-were-not-able-to-send-opt' => 'Your account has been created successfully. Please contact admin for account activation as we were not able to send you an OPT code.',
|
||||||
|
//update 19-12-2016
|
||||||
|
'only-agents' => 'Agent users',
|
||||||
|
'only-users' => 'Clients users',
|
||||||
|
'banned-users' => 'Banned users',
|
||||||
|
'inactive-users' => 'Inactive users',
|
||||||
|
'all-users' => 'All users',
|
||||||
|
'search' => 'Search...',
|
||||||
];
|
];
|
||||||
|
@@ -1602,4 +1602,11 @@ return [
|
|||||||
//update 18-12-2016
|
//update 18-12-2016
|
||||||
'account-created-contact-admin-as-we-were-not-able-to-send-opt' => 'Your account has been created successfully. Please contact admin for account activation as we were not able to send you an OPT code.',
|
'account-created-contact-admin-as-we-were-not-able-to-send-opt' => 'Your account has been created successfully. Please contact admin for account activation as we were not able to send you an OPT code.',
|
||||||
|
|
||||||
|
//update 19-12-2016
|
||||||
|
'only-agents' => 'Agent users',
|
||||||
|
'only-users' => 'Clients users',
|
||||||
|
'banned-users' => 'Banned users',
|
||||||
|
'inactive-users' => 'Inactive users',
|
||||||
|
'all-users' => 'All users',
|
||||||
|
'search' => 'Search...',
|
||||||
];
|
];
|
||||||
|
@@ -1547,4 +1547,12 @@ return [
|
|||||||
//update 18-12-2016
|
//update 18-12-2016
|
||||||
'account-created-contact-admin-as-we-were-not-able-to-send-opt' => 'Your account has been created successfully. Please contact admin for account activation as we were not able to send you an OPT code.',
|
'account-created-contact-admin-as-we-were-not-able-to-send-opt' => 'Your account has been created successfully. Please contact admin for account activation as we were not able to send you an OPT code.',
|
||||||
|
|
||||||
|
//update 19-12-2016
|
||||||
|
'only-agents' => 'Agent users',
|
||||||
|
'only-users' => 'Clients users',
|
||||||
|
'banned-users' => 'Banned users',
|
||||||
|
'inactive-users' => 'Inactive users',
|
||||||
|
'all-users' => 'All users',
|
||||||
|
'search' => 'Search...',
|
||||||
|
|
||||||
];
|
];
|
||||||
|
@@ -1055,4 +1055,12 @@ return [
|
|||||||
|
|
||||||
//update 18-12-2016
|
//update 18-12-2016
|
||||||
'account-created-contact-admin-as-we-were-not-able-to-send-opt' => 'Your account has been created successfully. Please contact admin for account activation as we were not able to send you an OPT code.',
|
'account-created-contact-admin-as-we-were-not-able-to-send-opt' => 'Your account has been created successfully. Please contact admin for account activation as we were not able to send you an OPT code.',
|
||||||
|
|
||||||
|
//update 19-12-2016
|
||||||
|
'only-agents' => 'Agent users',
|
||||||
|
'only-users' => 'Clients users',
|
||||||
|
'banned-users' => 'Banned users',
|
||||||
|
'inactive-users' => 'Inactive users',
|
||||||
|
'all-users' => 'All users',
|
||||||
|
'search' => 'Search...',
|
||||||
];
|
];
|
||||||
|
@@ -34,20 +34,32 @@ class="active"
|
|||||||
|
|
||||||
<div class="box-header with-border">
|
<div class="box-header with-border">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
<div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<h3 class="box-title ">{{Lang::get('lang.user')}}</h3>
|
<h3 class="box-title ">{{Lang::get('lang.user')}}</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<div class="col-md-3">
|
<div class="col-md-5">
|
||||||
|
<div class="box-tools" style="width: 235px">
|
||||||
|
<div class="has-feedback">
|
||||||
|
<input type="text" class="form-control input-sm" id="search-text" name="search" placeholder="{{Lang::get('lang.search')}}">
|
||||||
|
<span class="fa fa-search form-control-feedback"></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-9">
|
</div><!-- /.box-tools -->
|
||||||
|
</div>
|
||||||
|
<div class="col-md-7">
|
||||||
<div class="pull-right">
|
<div class="pull-right">
|
||||||
<div id="labels-div" class="btn-group">
|
<div id="labels-div" class="btn-group">
|
||||||
<button type="button" class="btn btn-sm btn-default dropdown-toggle" data-toggle="dropdown" id="labels-button"><i class="fa fa-eye" style="color:teal;"> </i>{{Lang::get('lang.view-option')}}<span class="caret"></span>
|
<button type="button" class="btn btn-sm btn-default dropdown-toggle" data-toggle="dropdown" id="labels-button"><i class="fa fa-eye" style="color:teal;"> </i>{{Lang::get('lang.view-option')}}<span class="caret"></span>
|
||||||
</button>
|
</button>
|
||||||
<ul class="dropdown-menu pull-right" role="menu">
|
<ul class="dropdown-menu role="menu">
|
||||||
<li><a href="#" class="active">{{Lang::get('lang.active-users')}}</a></li>
|
<li class="active"><a href="#" class="all">{{Lang::get('lang.all-users')}}</a></li>
|
||||||
<li><a href="#" class="inactive">{{Lang::get('lang.deleted-users')}}</a></li>
|
<li><a href="#" class="agents">{{Lang::get('lang.only-agents')}}</a></li>
|
||||||
|
<li><a href="#" class="users">{{Lang::get('lang.only-users')}}</a></li>
|
||||||
|
<li><a href="#" class="active-users">{{Lang::get('lang.active-users')}}</a></li>
|
||||||
|
<li><a href="#" class="inactive">{{Lang::get('lang.inactive-users')}}</a></li>
|
||||||
|
<li><a href="#" class="deleted">{{Lang::get('lang.deleted-users')}}</a></li>
|
||||||
|
<li><a href="#" class="banned">{{Lang::get('lang.banned-users')}}</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<a href="{{url('user-export')}}" class="btn btn-default btn-sm ">Export</a>
|
<a href="{{url('user-export')}}" class="btn btn-default btn-sm ">Export</a>
|
||||||
|
@@ -7,8 +7,9 @@ foreach($segments as $seg){
|
|||||||
?>
|
?>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
jQuery(document).ready(function () {
|
jQuery(document).ready(function () {
|
||||||
var show = 'active';
|
var show = 'all';
|
||||||
oTable = myFunction(show);
|
var searchTerm = '';
|
||||||
|
oTable = myFunction(show, searchTerm);
|
||||||
|
|
||||||
$("select[name=type_of_profile]").change(function () {
|
$("select[name=type_of_profile]").change(function () {
|
||||||
//alert($('select[name=type_of_profile]').val());
|
//alert($('select[name=type_of_profile]').val());
|
||||||
@@ -19,29 +20,73 @@ foreach($segments as $seg){
|
|||||||
function myFunction(show)
|
function myFunction(show)
|
||||||
{
|
{
|
||||||
return jQuery('#chumper').dataTable({
|
return jQuery('#chumper').dataTable({
|
||||||
|
"sDom": "<'row'<'col-xs-6'l><'col-xs-6'>r>"+
|
||||||
|
"t"+
|
||||||
|
"<'row'<'col-xs-6'i><'col-xs-6'p>>",
|
||||||
"sPaginationType": "full_numbers",
|
"sPaginationType": "full_numbers",
|
||||||
"bProcessing": true,
|
"bProcessing": true,
|
||||||
|
"bServerSide": true,
|
||||||
"ajax": {
|
"ajax": {
|
||||||
url: "{{url('user-list')}}",
|
url: "{{url('user-list')}}",
|
||||||
data: function (d) {
|
data: function (d) {
|
||||||
d.profiletype = show;
|
d.profiletype = show;
|
||||||
|
d.searchTerm = searchTerm;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$('.active').on('click', function(){
|
$('.all').on('click', function(){
|
||||||
|
show = 'all';
|
||||||
|
$("#chumper").dataTable().fnDestroy();
|
||||||
|
myFunction(show, searchTerm);
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.active-users').on('click', function(){
|
||||||
show = 'active';
|
show = 'active';
|
||||||
$("#chumper").dataTable().fnDestroy();
|
$("#chumper").dataTable().fnDestroy();
|
||||||
myFunction(show);
|
myFunction(show, searchTerm);
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.inactive').on('click', function(){
|
$('.inactive').on('click', function(){
|
||||||
show = 'inactive';
|
show = 'inactive';
|
||||||
$("#chumper").dataTable().fnDestroy();
|
$("#chumper").dataTable().fnDestroy();
|
||||||
myFunction(show);
|
myFunction(show, searchTerm);
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('.agents').on('click', function(){
|
||||||
|
show = 'agents';
|
||||||
|
$("#chumper").dataTable().fnDestroy();
|
||||||
|
myFunction(show, searchTerm);
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.users').on('click', function(){
|
||||||
|
show = 'users';
|
||||||
|
$("#chumper").dataTable().fnDestroy();
|
||||||
|
myFunction(show, searchTerm);
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.banned').on('click', function(){
|
||||||
|
show = 'banned';
|
||||||
|
$("#chumper").dataTable().fnDestroy();
|
||||||
|
myFunction(show, searchTerm);
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.deleted').on('click', function(){
|
||||||
|
show = 'deleted';
|
||||||
|
$("#chumper").dataTable().fnDestroy();
|
||||||
|
myFunction(show, searchTerm);
|
||||||
|
});
|
||||||
|
|
||||||
|
document.getElementById('search-text').onkeypress = function(e){
|
||||||
|
if (!e) e = window.event;
|
||||||
|
var keyCode = e.keyCode || e.which;
|
||||||
|
if (keyCode == '13'){
|
||||||
|
searchTerm = $('input[name=search]').val();
|
||||||
|
$("#chumper").dataTable().fnDestroy();
|
||||||
|
myFunction(show, searchTerm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
</script>
|
</script>
|
Reference in New Issue
Block a user