|
@@ -730,20 +730,18 @@ class AdminController extends Controller
|
|
|
return view('app.admin.patients_missing_default_settings', compact('patients', 'filters'));
|
|
|
}
|
|
|
|
|
|
- public function points(Request $request){
|
|
|
+ public function points(Request $request)
|
|
|
+ {
|
|
|
$filters = $request->all();
|
|
|
$points = Point::query();
|
|
|
- $points = $points->where('is_removed','!=', true);
|
|
|
+ $points = $points->where('is_removed', '!=', true)
|
|
|
+ ->where('category', '!=', 'REVIEW')
|
|
|
+ ->where('category', '!=', 'PLAN');
|
|
|
+
|
|
|
+ $categories = [];
|
|
|
+ $names = [];
|
|
|
+
|
|
|
|
|
|
- if ($request->input('name')) {
|
|
|
- $name = trim($request->input('name'));
|
|
|
- if ($name) {
|
|
|
- $points = $points->whereHas('client', function ($q) use ($name) {
|
|
|
- $q->where('name_first', 'ILIKE', '%' . $name . '%')
|
|
|
- ->orWhere('name_last', 'ILIKE', '%' . $name . '%');
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
if ($request->input('mcp')) {
|
|
|
$mcp = Pro::where('uid', trim($request->input('mcp')))->first();
|
|
@@ -752,12 +750,32 @@ class AdminController extends Controller
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ if ($request->input('intentions')) {
|
|
|
+ $points = $points->whereIn('intention', $request->input('intentions'));
|
|
|
+ $implodedIntentions = join("','", $request->input('intentions'));
|
|
|
+ $categories = DB::select("SELECT category, COUNT(category) as count FROM point WHERE intention in ('" . $implodedIntentions . "') GROUP BY category ORDER BY category ASC");
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($request->input('categories')) {
|
|
|
+ $points = $points->whereIn('category', $request->input('categories'));
|
|
|
+ $implodedCategories = join("','", $request->input('categories'));
|
|
|
+ $names = DB::select("select (data::json)->>'name' as name, count(id) as count from point where category in ('".$implodedCategories."') group by 1 order by 1 asc");
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($request->input('names')){
|
|
|
+ $implodedNames = join("','", $request->input('names'));
|
|
|
+ $points = $points->whereRaw("(data::json)->>'name' in ('".$implodedNames."')");
|
|
|
+ }
|
|
|
+
|
|
|
$points = $points->paginate(30);
|
|
|
|
|
|
$_point = new Point;
|
|
|
$tableName = $_point->getTable();
|
|
|
$columns = Schema::getColumnListing($tableName);
|
|
|
- return view('app.admin.points.index', compact('points', 'filters', 'columns'));
|
|
|
+
|
|
|
+ $intentions = DB::select("SELECT intention, COUNT(intention) as count FROM point WHERE intention is not null GROUP BY intention ORDER BY intention ASC");
|
|
|
+
|
|
|
+ return view('app.admin.points.index', compact('points', 'filters', 'columns', 'intentions', 'categories', 'names'));
|
|
|
}
|
|
|
|
|
|
public function messages(Request $request)
|