Przeglądaj źródła

fixed filter on patient

= 3 lat temu
rodzic
commit
da1b2a90b0

+ 18 - 1
app/Http/Controllers/McpController.php

@@ -39,7 +39,13 @@ class McpController extends Controller
     public function patients(Request $request)
     {
         $filters = $request->all();
-        $patients = Client::whereNull('shadow_pro_id')->where('mcp_pro_id', $this->performer->pro->id);
+        $patients = Client::whereNull('shadow_pro_id');
+        
+        //TODO: implement in admin controller 
+        if($this->performer->pro->pro_type != 'ADMIN'){
+            $patients->where('mcp_pro_id', $this->performer->pro->id);
+        }
+        
 
         // filters
         /*
@@ -93,6 +99,17 @@ class McpController extends Controller
                 break;
         }
 
+        $initiative = $request->input('initiative');
+        if($initiative){
+            $wildCardedInitiative = '%'.$initiative.'%';
+            $patients->where('initiative', 'ilike', $wildCardedInitiative);
+        }
+
+        $include_test_records = $request->input('include_test_records');
+        if(!$include_test_records){
+            $patients->where('client_engagement_status_category', '<>', 'DUMMY');
+        }
+
         $patients = $patients->orderBy('created_at', 'DESC')->paginate(50);
         return view('app.mcp.patients', compact('patients', 'filters'));
     }

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

@@ -29,6 +29,7 @@
 
 				@if($pro->pro_type == 'ADMIN')
 				<th class="border-0">MCP</th>
+				<th class="border-0">Initiative</th>
 				@endif
 			</tr>
 		</thead>
@@ -93,6 +94,7 @@
 				<td>{{$patient->getMcpAssignedOn()}}</td>
 				@if($pro->pro_type == 'ADMIN')
 				<td>{{$patient->mcp->display_name ?? '--'}}</td>
+				<td>{{$patient->initiative}}</td>
 				@endif
 			</tr>
 			@endforeach

+ 24 - 0
resources/views/app/mcp/patients_filters.blade.php

@@ -143,6 +143,28 @@
 		</div>
 	</div>
 
+	@if($performer->pro->pro_type == 'ADMIN')
+	<div class="sm-section">
+		<div class="form-group">
+			<label>Initiative:</label>
+			<input type="text" name="initiative" class="form-control input-sm" v-model="filters.initiative">
+		</div>
+	</div>
+	@endif
+
+	@if($performer->pro->pro_type == 'ADMIN')
+	<div class="sm-section">
+		<div class="form-group">
+			<div class="checkbox mt-4 pt-2">
+				<label>
+					<input type="checkbox" name="include_test_records"  v-model="filters.include_test_records">
+					Include Test Records
+				</label>
+			</div>
+		</div>
+	</div>
+	@endif
+
 	<!-- LAST WEIGHED-IN -->
 	<!-- <div class="col-md-2 d-none">
 		<div class="form-group">
@@ -222,6 +244,8 @@ $allFilterKeys = [
 	'next_appointment_value_1',
 	'sex',
 	'status',
+	'initiative',
+	'include_test_records',
 ];
 for ($i=0; $i < count($allFilterKeys); $i++) {
 	if (!isset($loadedFilters[$allFilterKeys[$i]]) || !$loadedFilters[$allFilterKeys[$i]]) {