Ver Fonte

fixed filter

= há 3 anos atrás
pai
commit
8050842cc2

+ 12 - 11
app/Http/Controllers/AdminController.php

@@ -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');

+ 2 - 0
resources/views/app/admin/patients-table-extended.blade.php

@@ -14,6 +14,7 @@
                 <th class="border-0">MCP</th>
                 <th class="border-0">NA</th>
                 <th class="border-0">Initiative</th>
+                <th class="border-9">Status</th>
                 <th class="border-0">Source</th>
             @endif
             <th class="border-0">Mailing Address State</th>
@@ -61,6 +62,7 @@
                     <td>{{@$patient->mcp ? $patient->mcp->displayName() : '--'}}</td>
                     <td>{{@$patient->defaultNaPro ? $patient->defaultNaPro->displayName() : '--'}}</td>
                     <td>{{$patient->initiative}}</td>
+                    <td>{{$patient->client_engagement_status_category == 'DUMMY'? 'Test Record': $patient->client_engagement_status_category}}</td>
                     <td>{{$patient->source}}</td>
                 @endif
                 <td>{{$patient->mailing_address_state}}</td>

+ 8 - 3
resources/views/app/admin/patients_filters.blade.php

@@ -166,9 +166,14 @@
 			<label>Status:</label>
 			<select name="status" class="form-control input-sm" v-model="filters.status">
 				<option value="">All</option>
-				<option value="ACTIVE">Active</option>
-				<option value="AWAITING_VISIT">Awaiting Visit</option>
-				<option value="INACTIVE">Inactive</option>
+ 				<option value="ACTIVE">Active</option>
+ 				<option value="DUMMY">Test Record</option>
+ 				<option value="NO_LONGER_INTERESTED">No Longer Interested</option>
+ 				<option value="INACTIVE">Inactive</option>
+ 				<option value="ENTRY_ERROR">Entry Error</option>
+ 				<option value="DUPLICATE">Duplicate</option>
+ 				<option value="DECEASED">Deceased</option>
+ 				<option value="BAD_RECORD">Bad Record</option>
 			</select>
 		</div>
 	</div>