|
@@ -323,7 +323,8 @@ class HomeController extends Controller
|
|
->orWhere('cm_pro_id', $proID)
|
|
->orWhere('cm_pro_id', $proID)
|
|
->orWhere('rmm_pro_id', $proID)
|
|
->orWhere('rmm_pro_id', $proID)
|
|
->orWhere('rme_pro_id', $proID)
|
|
->orWhere('rme_pro_id', $proID)
|
|
- ->orWhereRaw('id IN (SELECT client_id FROM client_pro_access WHERE is_active AND pro_id = ?)', [$proID]);
|
|
|
|
|
|
+ ->orWhereRaw('id IN (SELECT client_id FROM client_pro_access WHERE is_active AND pro_id = ?)', [$proID])
|
|
|
|
+ ->orWhereRaw('id IN (SELECT client_id FROM appointment WHERE pro_id = ?)', [$proID]);
|
|
});
|
|
});
|
|
}
|
|
}
|
|
switch ($filter) {
|
|
switch ($filter) {
|
|
@@ -341,12 +342,20 @@ class HomeController extends Controller
|
|
|
|
|
|
public function patientsSuggest(Request $request)
|
|
public function patientsSuggest(Request $request)
|
|
{
|
|
{
|
|
|
|
+
|
|
|
|
+ $pro = $this->pro;
|
|
$term = $request->input('term') ? trim($request->input('term')) : '';
|
|
$term = $request->input('term') ? trim($request->input('term')) : '';
|
|
if (empty($term)) return '';
|
|
if (empty($term)) return '';
|
|
- $clients = Client::where(function ($q) use ($term) {
|
|
|
|
|
|
+ $clientQuery= Client::where(function ($q) use ($term) {
|
|
$q->where('name_first', 'ILIKE', '%' . $term . '%')
|
|
$q->where('name_first', 'ILIKE', '%' . $term . '%')
|
|
->orWhere('name_last', 'ILIKE', '%' . $term . '%');
|
|
->orWhere('name_last', 'ILIKE', '%' . $term . '%');
|
|
- })->get();
|
|
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ if($pro->pro_type != 'ADMIN'){
|
|
|
|
+ $clientQuery->whereIn('id', $pro->getMyClientIds());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $clients = $clientQuery->get();
|
|
return view('app/patient-suggest', compact('clients'));
|
|
return view('app/patient-suggest', compact('clients'));
|
|
}
|
|
}
|
|
|
|
|