浏览代码

RM action report - status filter

Vijayakrishnan 3 年之前
父节点
当前提交
9f7c33ece6

+ 17 - 0
app/Http/Controllers/PracticeManagementController.php

@@ -3679,6 +3679,23 @@ ORDER BY c.name_last, c.name_first
             }
             }
         }
         }
 
 
+        if($request->input('status')) {
+            $v = trim($request->input('status'));
+            $q = '';
+            if($v === 'ACTIVE') {
+                $q = "(client.client_engagement_status_category IS NULL OR client.client_engagement_status_category = '{$v}')";
+            }
+            else {
+                $q = "(client.client_engagement_status_category = '{$v}')";
+            }
+
+            if($q) {
+                $cmQuery = $cmQuery->whereHas('client', function($clientQuery) use ($q) {
+                    return $clientQuery->whereRaw($q);
+                });
+            }
+        }
+
         $cmQuery = $cmQuery->orderBy('start_date', 'DESC')->orderBy('client_id', 'ASC');
         $cmQuery = $cmQuery->orderBy('start_date', 'DESC')->orderBy('client_id', 'ASC');
         $rows =$cmQuery->paginate(15);
         $rows =$cmQuery->paginate(15);
 
 

+ 17 - 0
resources/views/app/practice-management/rm-action-report.blade.php

@@ -97,6 +97,23 @@
                         </div>
                         </div>
                     </div>
                     </div>
 
 
+                    <div class="sm-section">
+                        <div class="form-group m-0">
+                            <label class="font-weight-normal mb-1">Status:</label>
+                            <select name="status" class="form-control input-sm">
+                                <option value="ACTIVE">Active</option>
+                                <option {{request()->input('status') === 'INACTIVE' ? 'selected' : ''}} value="INACTIVE">Inactive</option>
+                                <option {{request()->input('status') === 'ENTRY_ERROR' ? 'selected' : ''}} value="ENTRY_ERROR">Entry Error</option>
+                                <option {{request()->input('status') === 'DUMMY' ? 'selected' : ''}} value="DUMMY">Test Chart</option>
+                                <option {{request()->input('status') === 'DECEASED' ? 'selected' : ''}} value="DECEASED">Deceased</option>
+                                <option {{request()->input('status') === 'DUPLICATE' ? 'selected' : ''}} value="DUPLICATE">Duplicate</option>
+                                <option {{request()->input('status') === 'NO_LONGER_INTERESTED' ? 'selected' : ''}} value="NO_LONGER_INTERESTED">No Longer Interested</option>
+                                <option {{request()->input('status') === 'BAD_RECORD' ? 'selected' : ''}} value="BAD_RECORD">Bad Record</option>
+                                <option {{request()->input('status') === 'NO_LONGER_ELIGIBLE' ? 'selected' : ''}} value="NO_LONGER_ELIGIBLE">No Longer Eligible</option>
+                            </select>
+                        </div>
+                    </div>
+
                     <div>
                     <div>
                         <div class="form-group m-0">
                         <div class="form-group m-0">
                             <label class="font-weight-normal mb-1">&nbsp;</label>
                             <label class="font-weight-normal mb-1">&nbsp;</label>