|
@@ -28,9 +28,10 @@ use Illuminate\Support\Facades\DB;
|
|
|
use Illuminate\Support\Facades\File;
|
|
|
use App\Models\Bill;
|
|
|
use App\Models\ClientSMS;
|
|
|
-
|
|
|
+use App\Models\Point;
|
|
|
use Illuminate\Support\Facades\Http;
|
|
|
use PDF;
|
|
|
+use Illuminate\Support\Facades\Schema;
|
|
|
|
|
|
class AdminController extends Controller
|
|
|
{
|
|
@@ -712,4 +713,34 @@ class AdminController extends Controller
|
|
|
return view('app.admin.patients_missing_default_settings', compact('patients', 'filters'));
|
|
|
}
|
|
|
|
|
|
+ public function points(Request $request){
|
|
|
+ $filters = $request->all();
|
|
|
+ $points = Point::query();
|
|
|
+ $points = $points->where('is_removed','!=', true);
|
|
|
+
|
|
|
+ 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();
|
|
|
+ if ($mcp) {
|
|
|
+ $points = $points->where('created_by_pro_id', $mcp->id);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ $points = $points->paginate(30);
|
|
|
+
|
|
|
+ $_point = new Point;
|
|
|
+ $tableName = $_point->getTable();
|
|
|
+ $columns = Schema::getColumnListing($tableName);
|
|
|
+ return view('app.admin.points.index', compact('points', 'filters', 'columns'));
|
|
|
+ }
|
|
|
+
|
|
|
}
|