Forráskód Böngészése

Notes resolution center - filters

Vijayakrishnan 3 éve
szülő
commit
17413155fa

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

@@ -3312,9 +3312,24 @@ ORDER BY c.name_last, c.name_first
             c.latest_eligible_refresh_at::DATE >= '2022-01-01' AND
             c.mpb_remaining = 0
             ";
+        $filters = [];
+        if($request->input('f')) {
+            $filters[] =  "(n.detail_json IS NOT NULL AND ((n.detail_json)::json->'farah_decision')::text = '\"" . $request->input('f') . "\"')";
+        }
+        if($request->input('s')) {
+            $filters[] =  "(n.detail_json IS NOT NULL AND ((n.detail_json)::json->'shawn_decision')::text = '\"" . $request->input('s') . "\"')";
+        }
+        if(count($filters)) {
+            $filters = 'AND ' . implode(' AND ',  $filters);
+        }
+        else {
+            $filters = '';
+        }
+        // $filters = '';
         $orderBy = "ORDER BY c.chart_number ASC, n.effective_dateest ASC";
 
-        $countQuery = "SELECT count(*) {$from} {$where}";
+        $countQuery = "SELECT count(*) {$from} {$where} {$filters}";
+        // dd($countQuery);
         $countResult = DB::select($countQuery);
         $total = $countResult[0]->count;
 
@@ -3322,7 +3337,7 @@ ORDER BY c.name_last, c.name_first
         $perPage = $request->input('per_page') ?: 20;
         $offset = ($page - 1) * $perPage;
 
-        $dataQuery = "SELECT {$columns} {$from} {$where} {$orderBy} OFFSET {$offset} LIMIT {$perPage}";
+        $dataQuery = "SELECT {$columns} {$from} {$where} {$filters} {$orderBy} OFFSET {$offset} LIMIT {$perPage}";
         $rows = DB::select($dataQuery);
 
         $paginator = new LengthAwarePaginator($rows, $total, $request->input('per_page') ?: 20, $request->input('page') ?: 1);

+ 16 - 0
resources/views/app/practice-management/notes-resolution-center.blade.php

@@ -6,6 +6,22 @@
 
         <div class="d-flex align-items-baseline">
             <h6 class="font-size-16 font-weight-bold text-secondary mb-3">Notes Resolution Center</h6>
+            <form class="ml-5 d-inline-flex align-items-center" action="{{route('practice-management.notes-resolution-center')}}" method="GET">
+                <span class="">Farah:</span>
+                <select name="f" class="form-control form-control-sm min-width-unset max-width-110px ml-2"
+                        onchange="fastLoad('{{route('practice-management.notes-resolution-center')}}?' + $(this).closest('form').serialize()); return false;">
+                    <option value="">Any</option>
+                    <option {{ request()->input('f') === 'green' ? 'selected' : '' }} value="green">Green</option>
+                    <option {{ request()->input('f') === 'red' ? 'selected' : '' }} value="red">Red</option>
+                </select>
+                <span class=" ml-3">Shawn:</span>
+                <select name="s" class="form-control form-control-sm min-width-unset max-width-110px ml-2"
+                        onchange="fastLoad('{{route('practice-management.notes-resolution-center')}}?' + $(this).closest('form').serialize()); return false;">
+                    <option value="">Any</option>
+                    <option {{ request()->input('s') === 'green' ? 'selected' : '' }} value="green">Green</option>
+                    <option {{ request()->input('s') === 'red' ? 'selected' : '' }} value="red">Red</option>
+                </select>
+            </form>
         </div>
 
         <table class="table table-sm table-bordered table-striped">