added logic for updating user profile plus other bug fixes
This commit is contained in:
@@ -39,36 +39,61 @@ class ClientsController extends Controller
|
||||
// dd('foo bar');
|
||||
return view('client.index-inactive', $data);
|
||||
}
|
||||
public function indexBak(){
|
||||
$client_arr = new Models\Client;
|
||||
$client_arr = $client_arr->with('auth_user_info','country_info', 'created_by_info')->orderBy('name', 'ASC')->paginate(10);
|
||||
$data = [
|
||||
'page_title' => 'Clients',
|
||||
'current_user' => session('current_user')
|
||||
];
|
||||
return view('client.index-rawjs', $data);
|
||||
}
|
||||
public function getClientJson(Request $request){
|
||||
|
||||
// $this->log_query();
|
||||
$client_arr = \DB::table('clients')
|
||||
->join('auth_users AS aumngr', 'aumngr.id', '=', 'clients.auth_user_id')
|
||||
->join('auth_users AS aumodify', 'aumodify.id', '=', 'clients.last_modified_by')
|
||||
->join('flags AS flags', 'flags.country', '=', 'clients.country')
|
||||
->select('clients.id', 'clients.name', 'clients.status','clients.progress_indicator_score', 'clients.country', 'aumngr.name As accountMgr', 'aumodify.name AS modifiedBy', 'flags.url AS theflag')
|
||||
->whereRaw("status NOT IN ('inactive', 'Cancelled')")
|
||||
->orderBy('name', 'ASC')
|
||||
->get();
|
||||
// ->paginate(15);
|
||||
|
||||
if($request->has('keyword')){
|
||||
$keyword = $request->keyword;
|
||||
$client_arr = \DB::table('clients')
|
||||
->join('auth_users AS aumngr', 'aumngr.id', '=', 'clients.auth_user_id')
|
||||
->join('auth_users AS aumodify', 'aumodify.id', '=', 'clients.last_modified_by')
|
||||
->join('flags AS flags', 'flags.country', '=', 'clients.country')
|
||||
->select('clients.id','clients.name', 'clients.status', 'clients.progress_indicator_score','clients.country', 'aumngr.name As accountMgr', 'aumodify.name AS modifiedBy', 'flags.url AS theflag')
|
||||
->whereRaw("clients.name like '%$keyword%' or clients.status like '%$keyword%' OR clients.country like '%$keyword%' OR aumngr.name like '%$keyword%' OR aumodify.name like '%$keyword%' OR clients.progress_indicator_score like '%$keyword%'")
|
||||
->orderBy('name', 'ASC')
|
||||
->get();
|
||||
if (strpos('inactive', $keyword) !== false ) {
|
||||
// dump('foo bars');
|
||||
$client_arr = \DB::table('clients')
|
||||
->join('auth_users AS aumngr', 'aumngr.id', '=', 'clients.auth_user_id')
|
||||
->join('auth_users AS aumodify', 'aumodify.id', '=', 'clients.last_modified_by')
|
||||
->join('flags AS flags', 'flags.country', '=', 'clients.country')
|
||||
->select('clients.id','clients.name', 'clients.status', 'clients.progress_indicator_score','clients.country', 'aumngr.name As accountMgr', 'aumodify.name AS modifiedBy', 'flags.url AS theflag')
|
||||
// ->whereRaw("status IN ('Live', 'Prospective')")
|
||||
->whereRaw("status NOT IN ('inactive', 'Cancelled')")
|
||||
->whereRaw("clients.name LIKE '%$keyword%' OR clients.country LIKE '%$keyword%' OR aumngr.name like '%$keyword%' OR aumodify.name LIKE '%$keyword%'")
|
||||
->orderBy('name', 'ASC')
|
||||
->get();
|
||||
// foreach ($client_arr as $value) {
|
||||
// // code...
|
||||
// dd($value);
|
||||
// }
|
||||
dump($client_arr->contains('status', 'inactive'));
|
||||
}
|
||||
elseif (strpos('Cancelled', $keyword) !== false ) {
|
||||
$client_arr = \DB::table('clients')
|
||||
->join('auth_users AS aumngr', 'aumngr.id', '=', 'clients.auth_user_id')
|
||||
->join('auth_users AS aumodify', 'aumodify.id', '=', 'clients.last_modified_by')
|
||||
->join('flags AS flags', 'flags.country', '=', 'clients.country')
|
||||
->select('clients.id','clients.name', 'clients.status', 'clients.progress_indicator_score','clients.country', 'aumngr.name As accountMgr', 'aumodify.name AS modifiedBy', 'flags.url AS theflag')
|
||||
// ->whereRaw("status IN ('Live', 'Prospective')")
|
||||
->whereRaw("status NOT IN ('inactive', 'Cancelled')")
|
||||
->whereRaw("clients.name LIKE '%$keyword%' OR clients.country LIKE '%$keyword%' OR aumngr.name LIKE '%$keyword%' OR aumodify.name LIKE '%$keyword%'")
|
||||
->orderBy('name', 'ASC')
|
||||
->get();
|
||||
}else{
|
||||
$client_arr = \DB::table('clients')
|
||||
->join('auth_users AS aumngr', 'aumngr.id', '=', 'clients.auth_user_id')
|
||||
->join('auth_users AS aumodify', 'aumodify.id', '=', 'clients.last_modified_by')
|
||||
->join('flags AS flags', 'flags.country', '=', 'clients.country')
|
||||
->select('clients.id','clients.name', 'clients.status', 'clients.progress_indicator_score','clients.country', 'aumngr.name As accountMgr', 'aumodify.name AS modifiedBy', 'flags.url AS theflag')
|
||||
->whereRaw("status IN ('Live', 'Prospective')")
|
||||
->whereRaw("clients.name LIKE '%$keyword%' OR clients.status LIKE '%$keyword%' OR clients.country LIKE '%$keyword%' OR aumngr.name LIKE '%$keyword%' OR aumodify.name LIKE '%$keyword%'")
|
||||
->orderBy('name', 'ASC')
|
||||
->get();
|
||||
}
|
||||
|
||||
// ->paginate(15);
|
||||
}
|
||||
|
||||
@@ -82,7 +107,7 @@ class ClientsController extends Controller
|
||||
->join('auth_users AS aumngr', 'aumngr.id', '=', 'clients.auth_user_id')
|
||||
->join('auth_users AS aumodify', 'aumodify.id', '=', 'clients.last_modified_by')
|
||||
->select('clients.id', 'clients.name', 'clients.status', 'clients.country', 'aumngr.name As accountMgr', 'aumodify.name AS modifiedBy')
|
||||
|
||||
->whereRaw("status <> 'Inactive'")
|
||||
->paginate(10);
|
||||
|
||||
if($request->has('keyword')){
|
||||
@@ -91,7 +116,8 @@ class ClientsController extends Controller
|
||||
->join('auth_users AS aumngr', 'aumngr.id', '=', 'clients.auth_user_id')
|
||||
->join('auth_users AS aumodify', 'aumodify.id', '=', 'clients.last_modified_by')
|
||||
->select('clients.id','clients.name', 'clients.status', 'clients.country', 'aumngr.name As accountMgr', 'aumodify.name AS modifiedBy')
|
||||
->whereRaw("clients.name like '%$keyword%' or clients.status like '%$keyword%' OR clients.country like '%$keyword%' OR aumngr.name like '%$keyword%' OR aumodify.name like '%$keyword%'")
|
||||
->whereRaw("status <> 'Inactive'")
|
||||
->whereRaw("clients.name like '%$keyword%' OR clients.status like '%$keyword%' OR clients.country like '%$keyword%' OR aumngr.name like '%$keyword%' OR aumodify.name like '%$keyword%'")
|
||||
->paginate(10);
|
||||
}
|
||||
return response()->json($client_arr);
|
||||
@@ -104,7 +130,7 @@ class ClientsController extends Controller
|
||||
->join('auth_users AS aumodify', 'aumodify.id', '=', 'clients.last_modified_by')
|
||||
->join('flags AS flags', 'flags.country', '=', 'clients.country')
|
||||
->select('clients.id', 'clients.name', 'clients.status','clients.progress_indicator_score', 'clients.country', 'aumngr.name As accountMgr', 'aumodify.name AS modifiedBy', 'flags.url AS theflag')
|
||||
->whereRaw("status = 'inactive'")
|
||||
->whereRaw("status IN ('inactive', 'Cancelled')")
|
||||
->orderBy('name', 'ASC')
|
||||
->get();
|
||||
// ->paginate(15);
|
||||
@@ -116,8 +142,8 @@ class ClientsController extends Controller
|
||||
->join('auth_users AS aumodify', 'aumodify.id', '=', 'clients.last_modified_by')
|
||||
->join('flags AS flags', 'flags.country', '=', 'clients.country')
|
||||
->select('clients.id','clients.name', 'clients.status', 'clients.progress_indicator_score','clients.country', 'aumngr.name As accountMgr', 'aumodify.name AS modifiedBy', 'flags.url AS theflag')
|
||||
->whereRaw("status = 'inactive'")
|
||||
->whereRaw("clients.name like '%$keyword%' or clients.status like '%$keyword%' OR clients.country like '%$keyword%' OR aumngr.name like '%$keyword%' OR aumodify.name like '%$keyword%' OR clients.progress_indicator_score like '%$keyword%'")
|
||||
->whereRaw("status IN ('inactive', 'Cancelled')")
|
||||
->whereRaw("clients.name LIKE '%$keyword%' OR clients.status LIKE '%$keyword%' OR clients.country LIKE '%$keyword%' OR aumngr.name LIKE '%$keyword%' OR aumodify.name LIKE '%$keyword%' OR clients.progress_indicator_score LIKE '%$keyword%'")
|
||||
->orderBy('name', 'ASC')
|
||||
->get();
|
||||
// ->paginate(15);
|
||||
@@ -130,7 +156,7 @@ class ClientsController extends Controller
|
||||
->join('auth_users AS aumngr', 'aumngr.id', '=', 'clients.auth_user_id')
|
||||
->join('auth_users AS aumodify', 'aumodify.id', '=', 'clients.last_modified_by')
|
||||
->select('clients.id', 'clients.name', 'clients.status', 'clients.country', 'aumngr.name As accountMgr', 'aumodify.name AS modifiedBy')
|
||||
->whereRaw("status = 'inactive'")
|
||||
->whereRaw("status = 'Inactive'")
|
||||
->paginate(10);
|
||||
|
||||
if($request->has('keyword')){
|
||||
@@ -140,7 +166,7 @@ class ClientsController extends Controller
|
||||
->join('auth_users AS aumodify', 'aumodify.id', '=', 'clients.last_modified_by')
|
||||
->select('clients.id','clients.name', 'clients.status', 'clients.country', 'aumngr.name As accountMgr', 'aumodify.name AS modifiedBy')
|
||||
// ->where('status', 'inactive')
|
||||
->whereRaw("status = 'inactive'")
|
||||
->whereRaw("status = 'Inactive'")
|
||||
->whereRaw("clients.name like '%$keyword%' or clients.status like '%$keyword%' OR clients.country like '%$keyword%' OR aumngr.name like '%$keyword%' OR aumodify.name like '%$keyword%'")
|
||||
->paginate(10);
|
||||
}
|
||||
@@ -159,7 +185,7 @@ class ClientsController extends Controller
|
||||
$service_type = Models\Service::pluck('name', 'name');
|
||||
$payment_type = ['Prepaid' => 'Prepaid', 'Postpaid' => 'Postpaid']; //Models\PaymentType::pluck('name', 'id');
|
||||
$auth_users = Models\SystemUser::pluck('name', 'id');
|
||||
$status = ['Live' => 'Live', 'inactive' => 'Inactive', 'Prospective' => 'Prospective', 'Cancelled' => 'Cancelled'];
|
||||
$status = ['Live' => 'Live', 'Inactive' => 'Inactive', 'Prospective' => 'Prospective', 'Cancelled' => 'Cancelled'];
|
||||
$currency = Models\Currency::pluck('name','name');
|
||||
$company_types = ['Aggregator/Supplier' => 'Aggregator/Supplier', 'Enterprise' => 'Enterprise', 'Hybrid' => 'Hybrid'];
|
||||
$industries = Models\Industry::orderBy('name', 'ASC')->pluck('name', 'name');
|
||||
|
||||
Reference in New Issue
Block a user