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