|
@@ -158,16 +158,17 @@ class AdminController extends Controller
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- switch($request->input('status')) {
|
|
|
- case 'ACTIVE':
|
|
|
- $patients->where('is_active', true)->where('has_mcp_done_onboarding_visit', true);
|
|
|
- break;
|
|
|
- case 'AWAITING_VISIT':
|
|
|
- $patients->where('is_active', true)->where('has_mcp_done_onboarding_visit', false);
|
|
|
- break;
|
|
|
- case 'INACTIVE':
|
|
|
- $patients->where('is_active', '<>', true);
|
|
|
- break;
|
|
|
+ $status = $request->input('status');
|
|
|
+ if($status){
|
|
|
+ if($status == 'ACTIVE'){
|
|
|
+ $patients->where('is_active', true)->where(function($q) use ($status){
|
|
|
+ return $q->where('client_engagement_status_category', $status)
|
|
|
+ ->orWhereNull('client_engagement_status_category');
|
|
|
+ });
|
|
|
+ }else {
|
|
|
+ $patients->where('client_engagement_status_category', $status);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
$initiative = $request->input('initiative');
|
|
@@ -177,7 +178,7 @@ class AdminController extends Controller
|
|
|
}
|
|
|
|
|
|
$include_test_records = $request->input('include_test_records');
|
|
|
- if(!$include_test_records){
|
|
|
+ if(!$include_test_records && $status != 'DUMMY'){
|
|
|
$patients = $patients->where(function ($q) {
|
|
|
$q->whereNull('client_engagement_status_category')
|
|
|
->orWhere('client_engagement_status_category', '<>', 'DUMMY');
|