|
@@ -6,6 +6,7 @@ use App\Models\Appointment;
|
|
|
use App\Models\BDTDevice;
|
|
|
use App\Models\CareMonth;
|
|
|
use App\Models\Client;
|
|
|
+use App\Models\ClientBDTDevice;
|
|
|
use App\Models\ClientInfoLine;
|
|
|
use App\Models\Facility;
|
|
|
use App\Models\NoteTemplate;
|
|
@@ -21,6 +22,10 @@ class PatientController extends Controller
|
|
|
$mcpPros = Pro::where('is_enrolled_as_mcp', true)->get();
|
|
|
$facilities = Facility::where('is_active', true)->get();
|
|
|
$devices = BDTDevice::where('is_active', true)->orderBy('imei', 'asc')->get();
|
|
|
+ $devices = $devices->filter(function ($record) {
|
|
|
+ $matching = ClientBDTDevice::where('device_id', $record->id)->get();
|
|
|
+ return count($matching) === 0;
|
|
|
+ });
|
|
|
$dxInfoLines = ClientInfoLine::where('client_id', $patient->id)
|
|
|
->where('category', 'dx')
|
|
|
->where('is_removed', false)
|
|
@@ -82,6 +87,10 @@ class PatientController extends Controller
|
|
|
public function devices(Request $request, Client $patient )
|
|
|
{
|
|
|
$devices = BDTDevice::where('is_active', true)->get();
|
|
|
+ $devices = $devices->filter(function ($record) {
|
|
|
+ $matching = ClientBDTDevice::where('device_id', $record->id)->get();
|
|
|
+ return count($matching) === 0;
|
|
|
+ });
|
|
|
return view('app.patient.devices', compact('patient', 'devices'));
|
|
|
}
|
|
|
|