فهرست منبع

Merge branch 'b' into cleanup

Samson Mutunga 1 سال پیش
والد
کامیت
59c47494e1
58فایلهای تغییر یافته به همراه2615 افزوده شده و 34 حذف شده
  1. 4 1
      app/Http/Controllers/HomeController.php
  2. 249 0
      app/Http/Controllers/RdController.php
  3. 1 1
      resources/views/app/admin/bdt_devices_filters.blade.php
  4. 1 1
      resources/views/app/admin/client_ccm_rm_status_filters.blade.php
  5. 1 1
      resources/views/app/admin/management-stats/filters.blade.php
  6. 1 1
      resources/views/app/admin/part_b_patients_filters.blade.php
  7. 1 1
      resources/views/app/admin/patients_filters.blade.php
  8. 1 1
      resources/views/app/admin/patients_missing_defsult_settings_filters.blade.php
  9. 1 1
      resources/views/app/admin/points/filters.blade.php
  10. 1 1
      resources/views/app/ca/patients_filters.blade.php
  11. 1 1
      resources/views/app/dna/appointments_filters.blade.php
  12. 1 1
      resources/views/app/dna/care_months_filters.blade.php
  13. 1 1
      resources/views/app/dna/encounters_filters.blade.php
  14. 1 1
      resources/views/app/dna/my_bills_filters.blade.php
  15. 1 1
      resources/views/app/dna/patients_filters.blade.php
  16. 1 1
      resources/views/app/mcp/appointments_filters.blade.php
  17. 1 1
      resources/views/app/mcp/bills_filters.blade.php
  18. 1 1
      resources/views/app/mcp/client_messages_filters.blade.php
  19. 1 1
      resources/views/app/mcp/clients_bdt_devices_filters.blade.php
  20. 1 1
      resources/views/app/mcp/erx_and_orders_filters.blade.php
  21. 1 1
      resources/views/app/mcp/memos_filters.blade.php
  22. 1 1
      resources/views/app/mcp/notes_filters.blade.php
  23. 1 1
      resources/views/app/mcp/patients-accounts-invites-filters.blade.php
  24. 1 1
      resources/views/app/mcp/patients_filters.blade.php
  25. 1 1
      resources/views/app/mcp/reports_filters.blade.php
  26. 1 1
      resources/views/app/mcp/supply_orders_filters.blade.php
  27. 1 1
      resources/views/app/practice-management/billing-report.blade.php
  28. 1 1
      resources/views/app/practice-management/client-pro-changes-filters.blade.php
  29. 1 1
      resources/views/app/practice-management/clients_bdt_devices_filters.blade.php
  30. 1 1
      resources/views/app/practice-management/memos_filters.blade.php
  31. 1 1
      resources/views/app/practice-management/notes_filters.blade.php
  32. 1 1
      resources/views/app/practice-management/patients-accounts-invites-filters.blade.php
  33. 69 0
      resources/views/app/rd/appointments.blade.php
  34. 111 0
      resources/views/app/rd/appointments_filters.blade.php
  35. 59 0
      resources/views/app/rd/bills.blade.php
  36. 107 0
      resources/views/app/rd/bills_filters.blade.php
  37. 160 0
      resources/views/app/rd/client-ccm-rm-status-table.blade.php
  38. 22 0
      resources/views/app/rd/client-ccm-rm-status.blade.php
  39. 254 0
      resources/views/app/rd/client_ccm_rm_status_filters.blade.php
  40. 58 0
      resources/views/app/rd/client_messages.blade.php
  41. 119 0
      resources/views/app/rd/client_messages_filters.blade.php
  42. 86 0
      resources/views/app/rd/clients_bdt_devices.blade.php
  43. 107 0
      resources/views/app/rd/clients_bdt_devices_filters.blade.php
  44. 89 0
      resources/views/app/rd/erx_and_orders.blade.php
  45. 110 0
      resources/views/app/rd/erx_and_orders_filters.blade.php
  46. 97 0
      resources/views/app/rd/memos.blade.php
  47. 110 0
      resources/views/app/rd/memos_filters.blade.php
  48. 86 0
      resources/views/app/rd/notes.blade.php
  49. 107 0
      resources/views/app/rd/notes_filters.blade.php
  50. 88 0
      resources/views/app/rd/patients-accounts-invites.blade.php
  51. 1 1
      resources/views/app/rd/patients_filters.blade.php
  52. 73 0
      resources/views/app/rd/reports.blade.php
  53. 107 0
      resources/views/app/rd/reports_filters.blade.php
  54. 81 0
      resources/views/app/rd/rpm-matrix.blade.php
  55. 71 0
      resources/views/app/rd/supply_orders.blade.php
  56. 119 0
      resources/views/app/rd/supply_orders_filters.blade.php
  57. 27 2
      resources/views/layouts/template.blade.php
  58. 14 0
      routes/web.php

+ 4 - 1
app/Http/Controllers/HomeController.php

@@ -31,6 +31,7 @@ use Illuminate\Support\Facades\Cookie;
 use Illuminate\Support\Facades\DB;
 use Illuminate\Support\Facades\Http;
 use App\Models\OutgoingEmailTemplate;
+use Illuminate\Support\Facades\Route;
 
 class HomeController extends Controller
 {
@@ -2065,9 +2066,11 @@ WHERE measurement.label NOT IN ('SBP', 'DBP')
                     $redirUrlParts[1] = 'a';
                 }
                 $goTo = implode('/', $redirUrlParts);
+                $route = app('router')->getRoutes()->match(app('request')->create($goTo))->getName();
+                return redirect()->to(route($route));
             }
 
-            return redirect($goTo ?: route('dashboard'));
+            return redirect(route('dashboard'));
 
         } catch (\Exception $e) {
             return redirect(route('dashboard'));

+ 249 - 0
app/Http/Controllers/RdController.php

@@ -2,9 +2,19 @@
 
 namespace App\Http\Controllers;
 
+use App\Models\AccountInvite;
+use App\Models\Appointment;
+use App\Models\Bill;
 use App\Models\Client;
+use App\Models\ClientBDTDevice;
+use App\Models\ClientMemo;
 use App\Models\ClientProAccess;
 use App\Models\ClientReviewRequest;
+use App\Models\ClientSMS;
+use App\Models\Erx;
+use App\Models\IncomingReport;
+use App\Models\Note;
+use App\Models\SupplyOrder;
 use Illuminate\Http\Request;
 class RdController extends Controller
 {
@@ -135,4 +145,243 @@ class RdController extends Controller
         $records = $pro->supplyOrdersPendingHcpApprovalRecordsAsRd();
         return view('app.rd.dashboard.supply_orders_pending_hcp_approval', compact('records'));
     }
+
+    public function appointments(Request $request)
+    {
+        $pro = $this->performer->pro;
+        $filters = $request->all();
+        $appointments = Appointment::whereHas('client',function($qry)use($pro){
+            return $qry->where('rd_pro_id', $pro->id);
+        });
+        $this->filterMultiQuery($request, $appointments, 'raw_date', 'date_category', 'date_value_1', 'date_value_2');
+        $this->filterSimpleQuery($request, $appointments, 'status', 'status');
+        $appointments = $appointments->orderBy('end_time', 'DESC')->paginate(20);
+        return view('app.rd.appointments', compact('appointments', 'filters'));
+    }
+    public function clientCcmRmStatus(Request $request){
+        $pro = $this->performer()->pro;
+        $filters = $request->all();
+        $patients = Client::whereNull('shadow_pro_id')->where('rd_pro_id', $pro->id);
+        
+        if($pro->pro_type !== 'ADMIN') {
+            if($pro->is_hcp){
+               $patients = $patients->where('mcp_pro_id', $this->performer()->pro->id);
+            }
+            if($pro->is_considered_for_dna){
+                $patients = $patients->where('default_na_pro_id', $this->performer()->pro->id);
+             }
+
+
+        }
+
+        $this->filterMultiQuery($request, $patients, 'age_in_years', 'age_category', 'age_value_1', 'age_value_2', false);
+        $this->filterSimpleQuery($request, $patients, 'sex', 'sex');
+        $this->filterMultiQuery($request, $patients, 'usual_bmi', 'bmi_category', 'bmi_value_1', 'bmi_value_2');
+        $this->filterMultiQuery($request, $patients, 'most_recent_weight_at', 'last_weighed_in_category', 'last_weighed_in_value_1', 'last_weighed_in_value_2');
+        $this->filterMultiQuery($request, $patients, 'most_recent_bp_at', 'last_bp_category', 'last_bp_value_1', 'last_bp_value_2');
+
+        switch($request->input('status')) {
+            case 'ACTIVE':
+                $patients->where('is_active', true)->where('has_mcp_done_onboarding_visit', true);
+                break;
+            case 'AWAITING_VISIT':
+                $patients->where('is_active', true)->where('has_mcp_done_onboarding_visit', false);
+                break;
+            case 'INACTIVE':
+                $patients->where('is_active', '<>', true);
+                break;
+        }
+
+
+        if($request->input('is_eligible_for_cm')){
+            $patients->where('is_eligible_for_cm', '=', $request->input('is_eligible_for_cm'));
+        }
+
+        if($request->input('is_enrolled_in_cm')){
+            $patients->where('is_enrolled_in_cm', '=', $request->input('is_enrolled_in_cm'));
+        }
+
+        if($request->input('has_cm_setup_been_performed')){
+            $patients->where('has_cm_setup_been_performed', '=', $request->input('has_cm_setup_been_performed')=='YES'? true : false);
+        }
+
+        if($request->input('is_eligible_for_rm')){
+            $patients->where('is_eligible_for_rm', '=', $request->input('is_eligible_for_rm'));
+        }
+
+        if($request->input('is_enrolled_in_rm')){  /*-- correct --*/
+            $patients->where('is_enrolled_in_rm', '=', $request->input('is_enrolled_in_rm')); /*-- correct --*/
+        }
+
+        if($request->input('has_rm_setup_been_performed')){
+            $patients->where('has_rm_setup_been_performed', '=', $request->input('has_rm_setup_been_performed') =='YES'? true : false);
+        }
+
+        $patients = $patients->orderBy('created_at', 'DESC')->paginate(20);
+        return view('app.rd.client-ccm-rm-status', compact('patients', 'filters'));
+    }
+    public function rpmMatrix(Request $request)
+    {
+        $proID = $this->performer()->pro->id;
+        $isAdmin = $this->performer()->pro->pro_type == 'ADMIN';
+        $query = Client::whereNull('shadow_pro_id');
+        $query->where('rd_pro_id', '=', $proID);
+        $clients = $query->orderByRaw('most_recent_cellular_measurement_at desc nulls last')
+            ->paginate(50);
+        return view ('app.rd.rpm-matrix', compact('clients'));
+    }
+
+    public function notes(Request $request)
+    {
+        $pro = $this->performer->pro;
+        $filters = $request->all();
+        $notes = Note::query();
+        $notes = $notes->whereHas('client', function($qry)use($pro){
+            return $qry->where('rd_pro_id', $pro->id);
+        });
+        $this->filterMultiQuery($request, $notes, 'effective_time', 'date_category', 'date_value_1', 'date_value_2');
+        $this->filterSimpleQuery($request, $notes, 'new_or_fu_or_na', 'new_or_fu_or_na');
+        $notes = $notes->orderBy('created_at', 'DESC')->paginate(20);
+
+
+        return view('app.rd.notes', compact('notes','filters'));
+    }
+
+    public function memos(Request $request){
+        $filters = $request->all();
+
+        $memos = ClientMemo::select('client_memo.*')
+        ->join('client', 'client.id', '=', 'client_memo.client_id')
+        ->where('client.rd_pro_id', $this->performer->pro->id);
+
+        $this->filterMultiQuery($request, $memos, 'client_memo.created_at', 'date_category', 'date_value_1', 'date_value_2');
+        $this->filterSimpleQuery($request, $memos, 'category', 'category');
+        $memos = $memos->orderBy('created_at', 'DESC')->paginate(20);
+
+        return view('app.rd.memos', compact('memos', 'filters'));
+    }
+
+    public function bills(Request $request)
+    {
+        $pro = $this->performer->pro;
+        $filters = $request->all();
+        $bills = Bill::whereHas('client', function($qry)use($pro){
+            return $qry->where('rd_pro_id', $pro->id);
+        });
+        $this->filterMultiQuery($request, $bills, 'created_at', 'date_category', 'date_value_1', 'date_value_2');
+        $status = $request->get('status');
+        if($status){
+            if($status == 'CANCELLED') $bills = $bills->where('is_cancelled', true);
+            if($status == 'NOT_CANCELLED') $bills = $bills->where('is_cancelled', false);
+        }
+        $bills = $bills->orderBy('created_at', 'DESC')->paginate(20);
+        return view('app.rd.bills', compact('bills', 'filters'));
+    }
+
+    public function erxAndOrders(Request $request)
+    {
+        $pro = $this->performer->pro;
+        $filters = $request->all();
+        $erxAndOrders = Erx::query();
+        $erxAndOrders = $erxAndOrders->whereHas('client', function($qry)use($pro){
+            return $qry->where('rd_pro_id', $pro->id);
+        });
+        $this->filterMultiQuery($request, $erxAndOrders, 'created_at', 'date_category', 'date_value_1', 'date_value_2');
+        $this->filterSimpleQuery($request, $erxAndOrders, 'pro_declared_status', 'status');
+
+        $erxAndOrders = $erxAndOrders->orderBy('created_at', 'DESC')->paginate(20);
+        return view('app.rd.erx_and_orders', compact('erxAndOrders', 'filters'));
+    }
+
+    public function reports(Request $request)
+    {
+        $pro = $this->performer->pro;
+        $filters = $request->all();
+        $reports = IncomingReport::whereHas('client',function($qry)use($pro){
+            return $qry->where('rd_pro_id', $pro->id);
+        });
+        $this->filterMultiQuery($request, $reports, 'report_date', 'date_category', 'date_value_1', 'date_value_2');
+        $status = $request->get('status');
+        if($status){
+            if($status == 'SIGNED') $reports = $reports->where('has_hcp_pro_signed', true);
+            if($status == 'NOT_SIGNED') $reports = $reports->where('has_hcp_pro_signed', false);
+        }
+
+        $reports = $reports->orderBy('created_at', 'DESC')->paginate(20);
+        return view('app.rd.reports', compact('reports', 'filters'));
+    }
+
+    public function supplyOrders(Request $request)
+    {
+        $pro = $this->performer->pro;
+        $filters = $request->all();
+        $supplyOrders = SupplyOrder::select('supply_order.*')->whereHas('client',function($qry)use($pro){
+            return $qry->where('rd_pro_id', $pro->id);
+        });
+        $this->filterMultiQuery($request, $supplyOrders, 'created_at', 'date_category', 'date_value_1', 'date_value_2');
+        $status = $request->get('status');
+        if($status){
+            if($status == 'CLEARED_FOR_SHIPMENT'){
+                $supplyOrders = $supplyOrders->where('is_cleared_for_shipment', true);
+            }elseif($status == 'NOT_CLEARED_FOR_SHIPMENT'){
+                $supplyOrders = $supplyOrders->where('is_cleared_for_shipment', false);
+            }elseif($status == 'CANCELLED'){
+                $supplyOrders = $supplyOrders->where('is_cancelled', true);
+            }else{
+             $supplyOrders = $supplyOrders->join('shipment', 'shipment.id', '=', 'supply_order.shipment_id')->where('shipment.status', $status);
+            }
+
+        }
+        $supplyOrders = $supplyOrders->orderBy('created_at', 'DESC')->paginate(20);
+        return view('app.rd.supply_orders', compact('supplyOrders', 'filters'));
+    }
+
+    public function clientMessages(Request $request)
+    {
+        $filters = $request->all();
+
+        $clientMessages = ClientSMS::select('client_sms.*')
+        ->join('client', 'client.id', '=', 'client_sms.client_id')
+        ->where('client.rd_pro_id', $this->performer->pro->id);
+
+        $this->filterMultiQuery($request, $clientMessages, 'client_sms.created_at', 'date_category', 'date_value_1', 'date_value_2');
+        $this->filterSimpleQuery($request, $clientMessages, 'sms_status', 'sms_status');
+
+        $clientMessages = $clientMessages->orderBy('client_sms.created_at', 'DESC');
+        $clientMessages = $clientMessages->paginate(20);
+        return view('app.rd.client_messages', compact('clientMessages', 'filters'));
+    }
+
+    public function patientsAccountsInvites(Request $request){
+        $filters = $request->all();
+
+        $accountInvites = AccountInvite::select('account_invite.*')
+                            ->join('client', 'client.id', '=', 'account_invite.for_client_id');
+        $accountInvites = $accountInvites->where('client.rd_pro_id', $this->performer->pro->id);
+
+        $this->filterMultiQuery($request, $accountInvites, 'account_invite.created_at', 'date_category', 'date_value_1', 'date_value_2');
+        $this->filterSimpleQuery($request, $accountInvites, 'account_invite.status', 'status');
+
+        $accountInvites = $accountInvites->orderBy('created_at', 'DESC')->paginate(20);
+
+        return view('app.rd.patients-accounts-invites', compact('accountInvites', 'filters'));
+    }
+
+    public function clientsBdtDevices(Request $request){
+        $filters = $request->all();
+
+        $devices = ClientBDTDevice::select('client_bdt_device.*')
+        ->join('client', 'client.id', '=', 'client_bdt_device.client_id')
+        ->where('client.rd_pro_id', $this->performer->pro->id);
+
+        $this->filterMultiQuery($request, $devices, 'client_bdt_device.created_at', 'date_category', 'date_value_1', 'date_value_2');
+        $status = $request->get('status');
+        if($status){
+            if($status === 'ACTIVE') $devices = $devices->where('client_bdt_device.is_active', true);
+            if($status === 'DEACTIVATED') $devices = $devices->where('client_bdt_device.is_active', false);
+        }
+        $devices = $devices->orderBy('created_at', 'DESC')->paginate(20);
+
+        return view('app.rd.clients_bdt_devices', compact('devices', 'filters'));
+    }
 }

+ 1 - 1
resources/views/app/admin/bdt_devices_filters.blade.php

@@ -74,7 +74,7 @@
 </form>
 
 <?php
-$loadedFilters = $filters;
+$loadedFilters = @$filters;
 $allFilterKeys = [
 	'imei',
 	'mcp',

+ 1 - 1
resources/views/app/admin/client_ccm_rm_status_filters.blade.php

@@ -192,7 +192,7 @@
 </form>
 
 <?php
-$loadedFilters = $filters;
+$loadedFilters = @$filters;
 $allFilterKeys = [
 	'name',
 	'age_category',

+ 1 - 1
resources/views/app/admin/management-stats/filters.blade.php

@@ -50,7 +50,7 @@
 </form>
 
 <?php
-$loadedFilters = $filters;
+$loadedFilters = @$filters;
 $allFilterKeys = [
 	'start_date',
 	'end_date',

+ 1 - 1
resources/views/app/admin/part_b_patients_filters.blade.php

@@ -210,7 +210,7 @@
 </form>
 
 <?php
-$loadedFilters = $filters;
+$loadedFilters = @$filters;
 $allFilterKeys = [
 	'name',
 	

+ 1 - 1
resources/views/app/admin/patients_filters.blade.php

@@ -522,7 +522,7 @@ use App\Models\Company;
 </form>
 
 <?php
-$loadedFilters = $filters;
+$loadedFilters = @$filters;
 $allFilterKeys = [
 	'name',
 	'age_category',

+ 1 - 1
resources/views/app/admin/patients_missing_defsult_settings_filters.blade.php

@@ -114,7 +114,7 @@
 </form>
 
 <?php
-$loadedFilters = $filters;
+$loadedFilters = @$filters;
 $allFilterKeys = [
 	'name',
 	'status',

+ 1 - 1
resources/views/app/admin/points/filters.blade.php

@@ -52,7 +52,7 @@
 </form>
 
 <?php
-$loadedFilters = $filters;
+$loadedFilters = @$filters;
 $allFilterKeys = [
     'name',
 ];

+ 1 - 1
resources/views/app/ca/patients_filters.blade.php

@@ -220,7 +220,7 @@
 </form>
 
 <?php
-$loadedFilters = $filters;
+$loadedFilters = @$filters;
 $allFilterKeys = [
 	'name',
 	'age_category',

+ 1 - 1
resources/views/app/dna/appointments_filters.blade.php

@@ -67,7 +67,7 @@
 </form>
 
 <?php
-$loadedFilters = $filters;
+$loadedFilters = @$filters;
 $allFilterKeys = [
 	'date_category',
 	'date_value_1',

+ 1 - 1
resources/views/app/dna/care_months_filters.blade.php

@@ -67,7 +67,7 @@
 </form>
 
 <?php
-$loadedFilters = $filters;
+$loadedFilters = @$filters;
 $allFilterKeys = [
 	'date_category',
 	'date_value_1',

+ 1 - 1
resources/views/app/dna/encounters_filters.blade.php

@@ -64,7 +64,7 @@
 	</div>
 </form>
 <?php
-$loadedFilters = $filters;
+$loadedFilters = @$filters;
 $allFilterKeys = [
 	'date_category',
 	'date_value_1',

+ 1 - 1
resources/views/app/dna/my_bills_filters.blade.php

@@ -88,7 +88,7 @@
 </form>
 
 <?php
-$loadedFilters = $filters;
+$loadedFilters = @$filters;
 $allFilterKeys = [
 	'date_category',
 	'date_value_1',

+ 1 - 1
resources/views/app/dna/patients_filters.blade.php

@@ -220,7 +220,7 @@
 </form>
 
 <?php
-$loadedFilters = $filters;
+$loadedFilters = @$filters;
 $allFilterKeys = [
 	'name',
 	'age_category',

+ 1 - 1
resources/views/app/mcp/appointments_filters.blade.php

@@ -67,7 +67,7 @@
 </form>
 
 <?php
-$loadedFilters = $filters;
+$loadedFilters = @$filters;
 $allFilterKeys = [
 	'date_category',
 	'date_value_1',

+ 1 - 1
resources/views/app/mcp/bills_filters.blade.php

@@ -64,7 +64,7 @@
 	</div>
 </form>
 <?php
-$loadedFilters = $filters;
+$loadedFilters = @$filters;
 $allFilterKeys = [
 	'date_category',
 	'date_value_1',

+ 1 - 1
resources/views/app/mcp/client_messages_filters.blade.php

@@ -75,7 +75,7 @@
 </form>
 
 <?php
-$loadedFilters = $filters;
+$loadedFilters = @$filters;
 $allFilterKeys = [
 	'date_category',
 	'date_value_1',

+ 1 - 1
resources/views/app/mcp/clients_bdt_devices_filters.blade.php

@@ -64,7 +64,7 @@
 	</div>
 </form>
 <?php
-$loadedFilters = $filters;
+$loadedFilters = @$filters;
 $allFilterKeys = [
 	'date_category',
 	'date_value_1',

+ 1 - 1
resources/views/app/mcp/erx_and_orders_filters.blade.php

@@ -67,7 +67,7 @@
 	</div>
 </form>
 <?php
-$loadedFilters = $filters;
+$loadedFilters = @$filters;
 $allFilterKeys = [
 	'date_category',
 	'date_value_1',

+ 1 - 1
resources/views/app/mcp/memos_filters.blade.php

@@ -69,7 +69,7 @@
 	</div>
 </form>
 <?php
-$loadedFilters = $filters;
+$loadedFilters = @$filters;
 $allFilterKeys = [
 	'date_category',
 	'date_value_1',

+ 1 - 1
resources/views/app/mcp/notes_filters.blade.php

@@ -64,7 +64,7 @@
 	</div>
 </form>
 <?php
-$loadedFilters = $filters;
+$loadedFilters = @$filters;
 $allFilterKeys = [
 	'date_category',
 	'date_value_1',

+ 1 - 1
resources/views/app/mcp/patients-accounts-invites-filters.blade.php

@@ -66,7 +66,7 @@
 	</div>
 </form>
 <?php
-$loadedFilters = $filters;
+$loadedFilters = @$filters;
 $allFilterKeys = [
 	'date_category',
 	'date_value_1',

+ 1 - 1
resources/views/app/mcp/patients_filters.blade.php

@@ -275,7 +275,7 @@
 </form>
 
 <?php
-$loadedFilters = $filters;
+$loadedFilters = @$filters;
 $allFilterKeys = [
 	'name',
 	'age_category',

+ 1 - 1
resources/views/app/mcp/reports_filters.blade.php

@@ -64,7 +64,7 @@
 	</div>
 </form>
 <?php
-$loadedFilters = $filters;
+$loadedFilters = @$filters;
 $allFilterKeys = [
 	'date_category',
 	'date_value_1',

+ 1 - 1
resources/views/app/mcp/supply_orders_filters.blade.php

@@ -76,7 +76,7 @@
 	</div>
 </form>
 <?php
-$loadedFilters = $filters;
+$loadedFilters = @$filters;
 $allFilterKeys = [
 	'date_category',
 	'date_value_1',

+ 1 - 1
resources/views/app/practice-management/billing-report.blade.php

@@ -161,7 +161,7 @@
 
 </div>
     <?php
-$loadedFilters = $filters;
+$loadedFilters = @$filters;
 $allFilterKeys = [
 	'no_claims',
 	'zero_deductible',

+ 1 - 1
resources/views/app/practice-management/client-pro-changes-filters.blade.php

@@ -85,7 +85,7 @@
 	</div>
 </form>
 <?php
-$loadedFilters = $filters;
+$loadedFilters = @$filters;
 $allFilterKeys = [
 	'date_category',
 	'date_value_1',

+ 1 - 1
resources/views/app/practice-management/clients_bdt_devices_filters.blade.php

@@ -85,7 +85,7 @@
 	</div>
 </form>
 <?php
-$loadedFilters = $filters;
+$loadedFilters = @$filters;
 $allFilterKeys = [
 	'date_category',
 	'date_value_1',

+ 1 - 1
resources/views/app/practice-management/memos_filters.blade.php

@@ -69,7 +69,7 @@
 	</div>
 </form>
 <?php
-$loadedFilters = $filters;
+$loadedFilters = @$filters;
 $allFilterKeys = [
 	'date_category',
 	'date_value_1',

+ 1 - 1
resources/views/app/practice-management/notes_filters.blade.php

@@ -129,7 +129,7 @@
 	</div>
 </form>
 <?php
-$loadedFilters = $filters;
+$loadedFilters = @$filters;
 $allFilterKeys = [
 	'created_at_category',
 	'created_at_value_1',

+ 1 - 1
resources/views/app/practice-management/patients-accounts-invites-filters.blade.php

@@ -66,7 +66,7 @@
 	</div>
 </form>
 <?php
-$loadedFilters = $filters;
+$loadedFilters = @$filters;
 $allFilterKeys = [
 	'date_category',
 	'date_value_1',

+ 69 - 0
resources/views/app/rd/appointments.blade.php

@@ -0,0 +1,69 @@
+@extends ('layouts/template')
+
+@section('content')
+<div class="p-3 mcp-theme-1" id="patients-list">
+    <div class="card">
+
+        <div class="card-header px-3 py-2 d-flex align-items-center">
+            <strong class="mr-4">
+                <i class="fas fa-calendar-alt"></i>
+                Appointments
+            </strong>
+        </div>
+
+        <div class="card-body p-0">
+            <div class="p-3">
+                @include('app.rd.appointments_filters')
+            </div>
+            <table class="table table-sm table-striped p-0 m-0">
+                <thead class="bg-light border-top">
+                    <tr>
+                        <th class="border-0">Date & Time</th>
+                        <th class="border-0">Patient</th>
+                        <th class="border-0">Title</th>
+                        <th class="border-0">Description</th>
+                        <th class="border-0">Status</th>
+                        <th class="border-0">Confirmation</th>
+                    </tr>
+                </thead>
+                <tbody>
+                    @foreach($appointments as $appointment)
+                    <tr>
+                        <td>
+                            <a href="/patients/view/{{$appointment->client->uid}}/calendar/{{$appointment->uid}}">
+                                {{friendly_date($appointment->raw_date) . ' ' . friendly_time($appointment->raw_start_time)}}                            
+                            </a>
+                        </td>
+                        <td>{{ $appointment->client->displayName() }}</pre>
+                        </td>
+                        <td>{{ $appointment->title }}</td>
+                        <td>{{ $appointment->description }}</td>
+                        <td>
+                            {{ $appointment->status }}
+                            @if($appointment->status_memo)
+                            <hr>
+                            {{$appointment->status_memo}}
+                            @endif
+                        </td>
+                        <td>
+                            @include('app.patient.partials.appointment-confirmation',['patient' => $appointment->client])
+                        </td>
+                    </tr>
+                    @endforeach
+
+                    @if(count($appointments) === 0)
+                    <tr>
+                        <td colspan="6">No records found!</td>
+                    </tr>
+                    @endif
+                </tbody>
+            </table>
+            @if($appointments->hasPages())
+            <div class="ml-2 mt-2">
+                {{ $appointments->appends(request()->input())->links() }}
+            </div>
+            @endif
+        </div>
+    </div>
+</div>
+@endsection

+ 111 - 0
resources/views/app/rd/appointments_filters.blade.php

@@ -0,0 +1,111 @@
+<style>
+	#mcp-appointments-filters label {
+		font-weight: bold;
+	}
+
+	#mcp-appointments-filters .mw-100px {
+		min-width: 100px;
+	}
+	.filter-container{
+		display: flex;
+		align-items: flex-start;
+		flex-wrap: wrap;
+	}
+	.filter-container >div {
+		width: 165px;
+	}
+	.filter-container >div:not(:last-child) {
+		margin-right: 15px;
+	}
+</style>
+<form id="mcp-appointments-filters" method="GET" action="{{ route('rd.appointments') }}" class="filter-container" v-cloak>
+	   <!-- DATE -->
+	<div class="">
+		<div class="form-group">
+			<label>Date:</label>
+			<select name="date_category" class="form-control input-sm" v-model="filters.date_category">
+				<option value="">All</option>
+				<option value="EXACTLY">Exactly</option>
+				<option value="LESS_THAN">Less Than</option>
+				<option value="GREATER_THAN">Greater Than</option>
+				<option value="BETWEEN">Between</option>
+				<option value="NOT_BETWEEN">Not Between</option>
+			</select>
+			<div v-show="filters.date_category" class="mt-2">
+				<div>
+					<input  name="date_value_1" v-model="filters.date_value_1" type="date" class="form-control input-sm"/>
+				</div>
+				<div v-show="filters.date_category === 'BETWEEN' || filters.date_category === 'NOT_BETWEEN'" class="mt-2">
+					<input name="date_value_2" v-model="filters.date_value_2" type="date" class="form-control input-sm"/>
+				</div>
+			</div>
+		</div>
+	</div>
+	<!-- STATUS -->
+	<div class="">
+		<div class="form-group">
+			<label>Status:</label>
+			<select name="status" class="form-control input-sm" v-model="filters.status">
+				<option value="">All</option>
+				<option value="PENDING">PENDING</option>
+				<option value="CONFIRMED">CONFIRMED</option>
+				<option value="CANCELLED">CANCELLED</option>
+				<option value="COMPLETED">COMPLETED</option>
+			</select>
+		</div>
+	</div>
+
+	<div class="">
+		<div class="form-group">
+			<label>&nbsp;</label>
+			<div class="d-flex">
+				<button type="submit" v-on:click.prevent="doSubmit()" class="btn btn-primary btn-sm mr-2"><i class="fas fa-filter"></i> Filter</button>
+				<a href="#" v-on:click.prevent="fastLoad('{{route('rd.appointments')}}')" class="btn btn-link btn-sm text-danger">Clear Filters</a>
+			</div>
+		</div>
+	</div>
+</form>
+
+<?php
+$loadedFilters = @$filters;
+$allFilterKeys = [
+	'date_category',
+	'date_value_1',
+	'date_value_2',
+	'status'
+];
+for ($i=0; $i < count($allFilterKeys); $i++) {
+	if (!isset($loadedFilters[$allFilterKeys[$i]]) || !$loadedFilters[$allFilterKeys[$i]]) {
+		$loadedFilters[$allFilterKeys[$i]] = '';
+	}
+}
+?>
+
+<script>
+	(function() {
+		function init() {
+			window.apapp = new Vue({
+				el: '#mcp-appointments-filters',
+				delimiters: ['@{{', '}}'],
+				data: {
+					filters: <?= json_encode($loadedFilters) ?>
+				},
+				methods: {
+					doSubmit: function() {
+						fastLoad('{{ route("rd.appointments") }}?' + $('#mcp-appointments-filters').serialize());
+						return false;
+					},
+					init: function() {
+
+					}
+				},
+				mounted: function() {
+					this.init();
+				},
+			});
+
+
+		}
+		addMCInitializer('mcp-appointments-filters', init, '#mcp-appointments-filters');
+	})();
+</script>

+ 59 - 0
resources/views/app/rd/bills.blade.php

@@ -0,0 +1,59 @@
+@extends ('layouts/template')
+
+@section('content')
+<div class="p-3 mcp-theme-1" id="patients-list">
+    <div class="card">
+
+        <div class="card-header px-2 py-1 d-flex align-items-center">
+            <strong class="mr-4">
+                <i class="fas fa-file-invoice-dollar"></i>
+                Bills
+            </strong>
+        </div>
+
+        <div class="card-body p-0">
+            <div class="p-3">
+                @include('app.rd.bills_filters')
+            </div>
+            <table class="table table-sm table-striped border-top p-0 m-0">
+                <thead class="bg-light">
+                    <tr>
+                        <th class="border-0">Date</th>
+                        <th class="border-0">Patient</th>
+                        <th class="border-0">Service</th>
+                        <th class="border-0">Amount</th>
+                        <th class="border-0">Is Cancelled</th>
+                    </tr>
+                </thead>
+                <tbody>
+                    @foreach($bills as $bill)
+                    <tr>
+                        <td>{{ friendly_date_time($bill->effective_date, false) }}</td>
+                        <td>
+                            <a target="_blank" native href="{{route('patients.view.dashboard', $bill->client)}}">
+                                {{$bill->client->displayName()}}
+                            </a>
+                        </td>
+                        <td>{{ $bill->code }}</td>
+                        <td>{{ $bill->hcp_expected_payment_amount ? '$'.$bill->hcp_expected_payment_amount : '' }}</td>
+                        <td>{{ $bill->is_cancelled ? 'YES':'NO' }}</td>
+                    </tr>
+                    @endforeach
+
+                    @if(count($bills) === 0)
+                    <tr>
+                        <td colspan="5">No records found!</td>
+                    </tr>
+                    @endif
+                </tbody>
+
+            </table>
+
+        </div>
+    </div>
+    <div class="mt-3">
+        {{ $bills->appends(request()->input())->links() }}
+    </div>
+
+</div>
+@endsection

+ 107 - 0
resources/views/app/rd/bills_filters.blade.php

@@ -0,0 +1,107 @@
+<style>
+	#mcp-bills-filters label {
+		font-weight: bold;
+	}
+
+	#mcp-bills-filters .mw-100px {
+		min-width: 100px;
+	}
+	.filter-container {
+		display: flex;
+		align-items: flex-start;
+		flex-wrap: wrap;
+	}
+	.filter-container >div {
+		width: 165px;
+	}
+	.filter-container >div:not(:last-child) {
+		margin-right: 15px;
+	}
+</style>
+<form id="mcp-bills-filters" method="GET" action="{{ route('rd.bills') }}" class="filter-container" v-cloak>
+	<!-- DATE	 -->
+	<div>
+		<div class="form-group">
+			<label>Date:</label>
+			<select name="date_category" class="form-control input-sm" v-model="filters.date_category">
+				<option value="">All</option>
+				<option value="EXACTLY">Exactly</option>
+				<option value="LESS_THAN">Less Than</option>
+				<option value="GREATER_THAN">Greater Than</option>
+				<option value="BETWEEN">Between</option>
+				<option value="NOT_BETWEEN">Not Between</option>
+			</select>
+			<div v-show="filters.date_category" class="mt-2">
+				<div>
+					<input name="date_value_1" v-model="filters.date_value_1" type="date" class="form-control input-sm"/>
+				</div>
+				<div v-show="filters.date_category === 'BETWEEN' || filters.date_category === 'NOT_BETWEEN'" class="mt-2">
+					<input name="date_value_2" v-model="filters.date_value_2" type="date" class="form-control input-sm"/>
+				</div>
+			</div>
+		</div>
+	</div>
+	<!-- STATUS -->
+	<div>
+		<div class="form-group">
+			<label>Status:</label>
+			<select name="status" class="form-control input-sm" v-model="filters.status">
+				<option value="">All</option>
+				<option value="CANCELLED">Cancelled</option>
+				<option value="NOT_CANCELLED">Not Cancelled</option>
+			</select>
+		</div>
+	</div>
+
+	<div>
+		<div class="form-group">
+			<label>&nbsp;</label>
+			<div class="d-flex">
+				<button type="submit" v-on:click.prevent="doSubmit()" class="btn btn-primary btn-sm mr-2"><i class="fas fa-filter"></i> Filter</button>
+				<a href="#" v-on:click.prevent="fastLoad('{{route('rd.bills')}}')" class="btn btn-link btn-sm text-danger">Clear Filters</a>
+			</div>
+		</div>
+	</div>
+</form>
+<?php
+$loadedFilters = @$filters;
+$allFilterKeys = [
+	'date_category',
+	'date_value_1',
+	'date_value_2',
+	'status'
+];
+for ($i = 0; $i < count($allFilterKeys); $i++) {
+	if (!isset($loadedFilters[$allFilterKeys[$i]]) || !$loadedFilters[$allFilterKeys[$i]]) {
+		$loadedFilters[$allFilterKeys[$i]] = '';
+	}
+}
+?>
+<script>
+	(function() {
+		function init() {
+			window.apapp = new Vue({
+				el: '#mcp-bills-filters',
+				delimiters: ['@{{', '}}'],
+				data: {
+					filters: <?= json_encode($loadedFilters) ?>
+				},
+				methods: {
+					doSubmit: function() {
+						fastLoad('{{ route("rd.bills") }}?' + $('#mcp-bills-filters').serialize());
+						return false;
+					},
+					init: function() {
+
+					}
+				},
+				mounted: function() {
+					this.init();
+				},
+			});
+
+
+		}
+		addMCInitializer('mcp-bills-filters', init, '#mcp-bills-filters');
+	})();
+</script>

+ 160 - 0
resources/views/app/rd/client-ccm-rm-status-table.blade.php

@@ -0,0 +1,160 @@
+	<div class="table-responsive">
+	<table class="table table-striped p-0 m-0 table-sm border-top border-bottom text-nowrap">
+		<thead class="bg-light">
+			<tr>
+				<th class="border-0">#</th>
+				<th class="border-0">Name</th>
+				<th class="border-0">DOB</th>
+				@if($pro->pro_type == 'ADMIN')
+				<th class="border-0">Age</th>
+				<th class="border-0">Sex</th>
+				<th class="border-0">BMI</th>
+				@endif
+				<th class="border-0">Insurance</th>
+				@if($pro->pro_type == 'ADMIN')
+					<th class="border-0">MCP</th>
+				@endif
+				<th class="border-0"># Visits</th>
+				<th class="border-0">Last Visit</th>
+				<th class="border-0">Next Appt.</th>
+				<th class="border-0">Status</th>
+
+				@if($pro->pro_type !== 'ADMIN')
+					<th class="border-0">Cellular BP</th>
+					<th class="border-0">Last BP</th>
+					<th class="border-0">Cellular Scale</th>
+					<th class="border-0">Last Weight</th>
+				@endif
+
+				<th class="border-0">Eligible For RM</th>
+				<th class="border-0">Enrolled In RM</th>
+				<th class="border-0">RM Setup</th>
+
+				@if($pro->pro_type !== 'ADMIN')
+					<th class="border-0"># Meas. days this mt.</th>
+					<th class="border-0">Spoken to this mt.?</th>
+				@endif
+
+			</tr>
+		</thead>
+		<tbody>
+			@foreach($patients as $patient)
+			<tr>
+				<td>
+					<a native target="_blank" href="{{route('patients.view.dashboard', $patient)}}">
+						{{$patient->chart_number}}
+					</a>
+				</td>
+				<td>{{$patient->displayName()}}</td>
+				<td>{{ friendly_date_time($patient->dob, false) }}</td>
+				@if($pro->pro_type == 'ADMIN')
+				<td>{{ $patient->age_in_years ?  $patient->age_in_years : '-' }}</td>
+				<td>{{ $patient->sex }}</td>
+				<td>
+					<div class="d-none d-dflex flex-column">
+						@if($patient->usual_bmi_min && $patient->usual_bmi_max)
+						<small class="text-muted">BMI (Usual): <b>{{ $patient->usual_bmi_min }}</b> {{ $patient->usual_bmi_min_category }} to <b>{{ $patient->usual_bmi_max }}</b> {{ $patient->usual_bmi_max_category }}</small>
+						@endif
+						@if($patient->ideal_bmi)
+						<small class="text-muted">BMI (Ideal) <b>{{ $patient->ideal_bmi }}</b> {{ $patient->ideal_bmi_category }}</small>
+						@endif
+					</div>
+				</td>
+				@endif
+				<td>
+					@include('app.patient.coverage_column_renderer', ['patient'=>$patient])
+				</td>
+				@if($pro->pro_type == 'ADMIN')
+					<td>{{$patient->mcp->display_name ?? '--'}}</td>
+				@endif
+				<td>
+					{{count($patient->activeNotes)}}
+				</td>
+				<td>
+					{{ friendly_date($patient->most_recent_completed_mcp_note_date) }}
+					{{-- {{$patient->lastMcpAppointment ? friendly_date_time($patient->lastMcpAppointment->raw_date.' '.$patient->lastMcpAppointment->raw_start_time) : '-'}}--}}
+				</td>
+				<td>{{$patient->nextMcpAppointment ? friendly_date_time($patient->nextMcpAppointment->raw_date.' '.$patient->nextMcpAppointment->raw_start_time) : '-'}}</td>
+				<td>{{$patient->nextMcpAppointment ? $patient->nextMcpAppointment->status : '-'}}</td>
+
+				@if($pro->pro_type !== 'ADMIN')
+				<td>
+					<?php $bpDevice = $patient->firstCellularBPDevice(); ?>
+					{{!!$bpDevice ? 'Yes' : 'No'}}
+				</td>
+				<td>
+					@if(!!$bpDevice && $patient->most_recent_cellular_bp_dbp_mm_hg && $patient->most_recent_cellular_bp_sbp_mm_hg)
+						{{ $patient->most_recent_cellular_bp_sbp_mm_hg }} / {{ $patient->most_recent_cellular_bp_dbp_mm_hg }}
+					@else
+						-
+					@endif
+				</td>
+				<td>
+					<?php $weightDevice = $patient->firstCellularWeightDevice(); ?>
+					{{!!$weightDevice ? 'Yes' : 'No'}}
+				</td>
+				<td>
+					@if(!!$weightDevice && $patient->most_recent_cellular_weight_value)
+						{{ round($patient->most_recent_cellular_weight_value, 1) }}
+					@else
+						-
+					@endif
+				</td>
+				@endif
+
+				<td>
+					<div>{{$patient->is_eligible_for_rm}}</div>
+					@if(!$patient->is_eligible_for_rm)
+						<div>
+							@if($patient->why_not_eligible_for_rm_category)[{{$patient->why_not_eligible_for_rm_category}}] @endif {{$patient->why_not_eligible_for_rm_memo}}
+						</div>
+					@endif 
+				</td>
+				<td>
+					<div>{{$patient->is_enrolled_in_rm}}</div> {{-- correct --}}
+					@if(!$patient->is_enrolled_in_rm) {{-- correct --}}
+						<div>
+							@if($patient->why_not_enrolled_in_rm_category)[{{$patient->why_not_enrolled_in_rm_category}}] @endif {{$patient->why_not_enrolled_in_rm_memo}}
+						</div>
+					@endif 
+				</td>
+				<td>
+					{{$patient->has_rm_setup_been_performed  ? 'YES': 'NO'}}
+					@if($patient->has_rm_setup_been_performed && $patient->rmSetupCareMonth)
+						<a href="{{route('patients.view.care-months.view.dashboard', ['patient' => $patient, 'careMonth' => $patient->rmSetupCareMonth])}}">RM Setup Care Month</a>
+					@endif
+				</td>
+
+				@if($pro->pro_type !== 'ADMIN')
+					<?php $currentCareMonth = $patient->currentCareMonth(); ?>
+					<td>
+						@if(!!$currentCareMonth && !is_null($currentCareMonth->number_of_days_with_remote_measurements))
+							{{$currentCareMonth->number_of_days_with_remote_measurements}}
+						@else
+							0
+						@endif
+					</td>
+					<td>
+						@if(!!$currentCareMonth)
+							{{$currentCareMonth->has_anyone_interacted_with_client_about_rm_outside_note ? 'Yes' : 'No'}}
+						@else
+							No
+						@endif
+					</td>
+				@endif
+
+			</tr>
+			@endforeach
+
+			@if(count($patients) === 0)
+			<tr>
+				<td colspan="24">No records found!</td>
+			</tr>
+			@endif
+		</tbody>
+
+	</table>
+</div>
+<div class="p-3">
+	{{$patients->withQueryString()->links()}}
+</div>

+ 22 - 0
resources/views/app/rd/client-ccm-rm-status.blade.php

@@ -0,0 +1,22 @@
+@extends ('layouts/template')
+
+@section('content')
+<div class="p-3 mcp-theme-1" id="patients-list">
+    <div class="card">
+
+        <div class="card-header px-3 py-2 d-flex align-items-center">
+            <strong class="mr-4">
+                <i class="fas fa-user"></i>
+                Client RM Status
+            </strong>
+        </div>
+
+        <div class="card-body p-0">
+            <div class="p-3">
+                @include('app.rd.client_ccm_rm_status_filters')
+            </div>
+            @include('app.rd.client-ccm-rm-status-table')
+        </div>
+    </div>
+</div>
+@endsection

+ 254 - 0
resources/views/app/rd/client_ccm_rm_status_filters.blade.php

@@ -0,0 +1,254 @@
+<style>
+	#client-ccm-rm-status-filters label {
+		font-weight: bold;
+	}
+
+	#client-ccm-rm-status-filters .mw-100px {
+		min-width: 100px;
+	}
+	.filter-container{
+		display: flex;
+		align-items: flex-start;
+		flex-wrap: wrap;
+	}
+	.filter-container >div {
+		width: 165px;
+	}
+	.filter-container >div:not(:last-child) {
+		margin-right: 15px;
+	}
+	.sm-section {
+		width: 125px !important;
+	}
+</style>
+<form id="client-ccm-rm-status-filters" method="GET" action="{{ route('mcp.patients') }}" class="filter-container" v-cloak>
+	<div class="sm-section">
+		<div class="form-group">
+			<label>Name:</label>
+			<input name="name" class="form-control input-sm" v-model="filters.name">
+		</div>
+	</div>
+	@if($pro->pro_type == 'ADMIN')
+	<!-- AGE	 -->
+	<div class="sm-section">
+		<div class="form-group">
+			<label>Age:</label>
+			<select name="age_category" class="form-control input-sm" v-model="filters.age_category">
+				<option value="">All</option>
+				<option value="EXACTLY">Exactly</option>
+				<option value="LESS_THAN">Less Than</option>
+				<option value="GREATER_THAN">Greater Than</option>
+				<option value="BETWEEN">Between</option>
+				<option value="NOT_BETWEEN">Not Between</option>
+			</select>
+			<div v-show="filters.age_category" class="mt-2">
+				<div>
+					<input  name="age_value_1" v-model="filters.age_value_1" type="number" class="form-control input-sm" :placeholder="(filters.age_category === 'BETWEEN' || filters.age_category === 'NOT_BETWEEN') ? 'From' : 'Age'" />
+				</div>
+				<div v-show="filters.age_category === 'BETWEEN' || filters.age_category === 'NOT_BETWEEN'" class="mt-2">
+					<input name="age_value_2" v-model="filters.age_value_2" type="number" class="form-control input-sm" placeholder="To" />
+				</div>
+			</div>
+		</div>
+	</div>
+	<!-- SEX -->
+	<div class="sm-section">
+		<div class="form-group">
+			<label>Sex:</label>
+			<select name="sex" class="form-control input-sm" v-model="filters.sex">
+				<option value="">All</option>
+				<option value="M">Male</option>
+				<option value="F">Female</option>
+			</select>
+		</div>
+	</div>
+	<!-- BMI -->
+	<div class="sm-section">
+		<div class="form-group">
+			<label>BMI:</label>
+			<select name="bmi_category" class="form-control input-sm" v-model="filters.bmi_category">
+				<option value="">All</option>
+				<option value="EXACTLY">Exactly</option>
+				<option value="LESS_THAN">Less Than</option>
+				<option value="GREATER_THAN">Greater Than</option>
+				<option value="BETWEEN">Between</option>
+				<option value="NOT_BETWEEN">Not Between</option>
+			</select>
+			<div v-show="filters.bmi_category" class="mt-2">
+				<div>
+					<input  name="bmi_value_1" v-model="filters.bmi_value_1" type="number" class="form-control input-sm" :placeholder="(filters.bmi_category === 'BETWEEN' || filters.bmi_category === 'NOT_BETWEEN') ? 'From' : 'BMI'" />
+				</div>
+				<div v-show="filters.bmi_category === 'BETWEEN' || filters.bmi_category === 'NOT_BETWEEN'" class="mt-2">
+					<input name="bmi_value_2" v-model="filters.bmi_value_2" type="number" class="form-control input-sm" placeholder="To" />
+				</div>
+			</div>
+		</div>
+	</div>
+	@endif
+
+	<!-- LAST VISIT -->
+	<div class="sm-section">
+		<div class="form-group">
+			<label>Last Visit:</label>
+			<select name="last_visit_category" class="form-control input-sm" v-model="filters.last_visit_category">
+				<option value="">All</option>
+				<option value="EXACTLY">Exactly</option>
+				<option value="LESS_THAN">Less Than</option>
+				<option value="GREATER_THAN">Greater Than</option>
+				<option value="BETWEEN">Between</option>
+				<option value="NOT_BETWEEN">Not Between</option>
+			</select>
+			<div v-show="filters.last_visit_category" class="mt-2">
+				<div>
+					<input  name="last_visit_value_1" v-model="filters.last_visit_value_1" type="number" class="form-control input-sm" :placeholder="(filters.last_visit_category === 'BETWEEN' || filters.last_visit_category === 'NOT_BETWEEN') ? 'From' : 'Last Visit'" />
+				</div>
+				<div v-show="filters.last_visit_category === 'BETWEEN' || filters.last_visit_category === 'NOT_BETWEEN'" class="mt-2">
+					<input name="last_visit_value_2" v-model="filters.last_visit_value_2" type="number" class="form-control input-sm" placeholder="To" />
+				</div>
+			</div>
+		</div>
+	</div>
+
+	<!-- NEXT APPOINTMENT -->
+	<div>
+		<div class="form-group">
+			<label>Next Appointment:</label>
+			<select name="next_appointment_category" class="form-control input-sm" v-model="filters.next_appointment_category">
+				<option value="">All</option>
+				<option value="EXACTLY">Exactly</option>
+				<option value="LESS_THAN">Less Than</option>
+				<option value="GREATER_THAN">Greater Than</option>
+				<option value="BETWEEN">Between</option>
+				<option value="NOT_BETWEEN">Not Between</option>
+			</select>
+			<div v-show="filters.next_appointment_category" class="mt-2">
+				<div>
+					<input  name="next_appointment_value_1" v-model="filters.next_appointment_value_1" type="number" class="form-control input-sm" :placeholder="(filters.next_appointment_category === 'BETWEEN' || filters.next_appointment_category === 'NOT_BETWEEN') ? 'From' : 'Next Appt.'" />
+				</div>
+				<div v-show="filters.next_appointment_category === 'BETWEEN' || filters.next_appointment_category === 'NOT_BETWEEN'" class="mt-2">
+					<input name="next_appointment_value_2" v-model="filters.next_appointment_value_2" type="number" class="form-control input-sm" placeholder="To" />
+				</div>
+			</div>
+		</div>
+	</div>
+
+	<!-- STATUS -->
+	<div class="sm-section">
+		<div class="form-group">
+			<label>Status:</label>
+			<select name="status" class="form-control input-sm" v-model="filters.status">
+				<option value="">All</option>
+				<option value="ACTIVE">Active</option>
+				<option value="AWAITING_VISIT">Awaiting Visit</option>
+				<option value="INACTIVE">Inactive</option>
+			</select>
+		</div>
+	</div>
+
+	<div class="sm-section">
+		<div class="form-group">
+			<label>Eligible For RM:</label>
+			<select name="is_eligible_for_rm" class="form-control input-sm" v-model="filters.is_eligible_for_rm">
+				<option value="">All</option>
+				<option value="YES">Yes</option>
+				<option value="NO">No</option>
+				<option value="UNKNOWN">Uknown</option>
+			</select>
+		</div>
+	</div>
+
+	<div class="sm-section">
+		<div class="form-group">
+			<label>Enrolled In RM:</label>
+			<select name="is_enrolled_in_rm" class="form-control input-sm" v-model="filters.is_enrolled_in_rm"> {{-- correct --}}
+				<option value="">All</option>
+				<option value="YES">Yes</option>
+				<option value="NO">No</option>
+				<option value="UNKNOWN">Uknown</option>
+			</select>
+		</div>
+	</div>
+
+	<div class="sm-section">
+		<div class="form-group">
+			<label>RM Setup:</label>
+			<select name="has_rm_setup_been_performed" class="form-control input-sm" v-model="filters.has_rm_setup_been_performed">
+				<option value="">All</option>
+				<option value="YES">Yes</option>
+				<option value="NO">No</option>
+			</select>
+		</div>
+	</div>
+
+	<div>
+		<div class="form-group">
+			<label>&nbsp;</label>
+			<div class=" d-flex">
+				<button type="button" v-on:click.prevent="doSubmit()" class="btn btn-primary btn-sm mr-2"><i class="fas fa-filter"></i> Filter</button>
+				<a href="#" v-on:click.prevent="fastLoad('{{route('mcp.patients')}}')" class="btn btn-link btn-sm text-secondary">Clear Filters</a>
+			</div>
+		</div>
+	</div>
+</form>
+
+<?php
+$loadedFilters = @$filters;
+$allFilterKeys = [
+	'name',
+	'age_category',
+	'age_value_1',
+	'age_value_2',
+	'bmi_category',
+	'bmi_value_1',
+	'bmi_value_2',
+	'last_bp_category',
+	'last_bp_value_1',
+	'last_bp_value_2',
+	'last_visit_category',
+	'last_visit_value_1',
+	'last_visit_value_2',
+	'last_weighed_in_category',
+	'last_weighed_in_value_1',
+	'next_appointment_category',
+	'next_appointment_value_1',
+	'sex',
+	'status',
+	'is_eligible_for_rm',
+	'is_enrolled_in_rm', // -- correct --
+	'has_rm_setup_been_performed',
+];
+for ($i=0; $i < count($allFilterKeys); $i++) {
+	if (!isset($loadedFilters[$allFilterKeys[$i]]) || !$loadedFilters[$allFilterKeys[$i]]) {
+		$loadedFilters[$allFilterKeys[$i]] = '';
+	}
+}
+?>
+<script>
+	(function() {
+		function init() {
+			new Vue({
+				el: '#client-ccm-rm-status-filters',
+				delimiters: ['@{{', '}}'],
+				data: {
+					filters: <?= json_encode($loadedFilters) ?>
+				},
+				methods: {
+					init: function() {
+
+					},
+					doSubmit: function() {
+						fastLoad('{{  route('practice-management.client-ccm-rm-status') }}?' + $('#client-ccm-rm-status-filters').serialize());
+						return false;
+					}
+				},
+				mounted: function() {
+					console.log(this.filters);
+					this.init();
+				},
+			});
+
+
+		}
+		addMCInitializer('client-ccm-rm-status-filters', init, '#client-ccm-rm-status-filters');
+	})();
+</script>

+ 58 - 0
resources/views/app/rd/client_messages.blade.php

@@ -0,0 +1,58 @@
+@extends ('layouts/template')
+
+@section('content')
+<div class="p-3 mcp-theme-1" id="patients-list">
+    <div class="card">
+
+        <div class="card-header px-2 py-1 d-flex align-items-center">
+            <strong class="mr-4">
+                <i class="far fa-comments"></i>
+                Client Messages
+            </strong>
+        </div>
+
+        <div class="card-body p-0">
+            <div class="p-3">
+                @include('app.rd.client_messages_filters')
+            </div>
+            <table class="table table-sm table-striped border-top p-0 m-0">
+                <thead class="bg-light">
+                    <tr>
+                        <th class="border-0">Date</th>
+                        <th class="border-0">Folder</th>
+                        <th class="border-0">To</th>
+                        <th class="border-0">From</th>
+                        <th class="border-0">Client</th>
+                        <th class="border-0">Message</th>
+                        <th class="border-0">Status</th>
+                    </tr>
+                </thead>
+                <tbody>
+                    @foreach($clientMessages as $clientMessage)
+                    <tr>
+                        <td>{{ friendlier_date_time($clientMessage->created_at) }}</td>
+                        <td>{{ $clientMessage->incoming_or_outgoing }}</td>
+                        <td>{{$clientMessage->to_number}}</td>
+                        <td>{{$clientMessage->from_number}}</td>
+                        <td>{{ $clientMessage->client->displayName() }}</td>
+                        <td style="width:300px;"><?= nl2br($clientMessage->body) ?></td>
+                        <td>{{ $clientMessage->sms_status }} </td>
+                    </tr>
+                    @endforeach
+
+                    @if(count($clientMessages) === 0)
+                    <tr>
+                        <td colspan="7">No records found!</td>
+                    </tr>
+                    @endif
+                </tbody>
+
+            </table>
+
+        </div>
+    </div>
+    <div class="mt-3">
+        {{ $clientMessages->appends(request()->input())->links() }}
+    </div>
+</div>
+@endsection

+ 119 - 0
resources/views/app/rd/client_messages_filters.blade.php

@@ -0,0 +1,119 @@
+<style>
+	#mcp-client-messages-filters label {
+		font-weight: bold;
+	}
+
+	#mcp-client-messages-filters .mw-100px {
+		min-width: 100px;
+	}
+	.filter-container {
+		display: flex;
+		align-items: flex-start;
+		flex-wrap: wrap;
+	}
+	.filter-container >div {
+		width: 165px;
+	}
+	.filter-container >div:not(:last-child) {
+		margin-right: 15px;
+	}
+</style>
+<form id="mcp-client-messages-filters" method="GET" action="{{ route('rd.client_messages') }}" class="filter-container" v-cloak>
+	<!-- DATE	 -->
+	<div>
+		<div class="form-group">
+			<label>Date:</label>
+			<select name="date_category" class="form-control input-sm" v-model="filters.date_category">
+				<option value="">All</option>
+				<option value="EXACTLY">Exactly</option>
+				<option value="LESS_THAN">Less Than</option>
+				<option value="GREATER_THAN">Greater Than</option>
+				<option value="BETWEEN">Between</option>
+				<option value="NOT_BETWEEN">Not Between</option>
+			</select>
+			<div v-show="filters.date_category" class="mt-2">
+				<div>
+					<input  name="date_value_1" v-model="filters.date_value_1" type="date" class="form-control input-sm"/>
+				</div>
+				<div v-show="filters.date_category === 'BETWEEN' || filters.date_category === 'NOT_BETWEEN'" class="mt-2">
+					<input name="date_value_2" v-model="filters.date_value_2" type="date" class="form-control input-sm"/>
+				</div>
+			</div>
+		</div>
+	</div>
+	<!-- TO OR FROM ME -->
+	<!-- <div>
+		<div class="form-group">
+			<label>To or From Me:</label>
+			<select name="to_or_from_me" class="form-control input-sm" v-model="filters.to_or_from_me">
+				<option value="ALL">All</option>
+				<option value="TO_ME">To me</option>
+				<option value="FROM_ME">From Me</option>
+			</select>
+		</div>
+	</div> -->
+	<!-- STATUS -->
+	<div>
+		<div class="form-group">
+			<label>Status:</label>
+			<select name="sms_status" class="form-control input-sm" v-model="filters.sms_status">
+				<option value="">All</option>
+				<option value="received">Received</option>
+			</select>
+		</div>
+	</div>
+
+	<div>
+		<div class="form-group">
+			<label>&nbsp;</label>
+			<div class="d-flex">
+				<button type="submit" v-on:click.prevent="doSubmit()" class="btn btn-primary btn-sm mr-2"><i class="fas fa-filter"></i> Filter</button>
+				<a v-on:click.prevent="fastLoad('{{route('rd.client_messages')}}')" href="#" class="btn btn-link btn-sm text-danger">Clear Filters</a>
+			</div>
+		</div>
+	</div>
+</form>
+
+<?php
+$loadedFilters = @$filters;
+$allFilterKeys = [
+	'date_category',
+	'date_value_1',
+	'date_value_2',
+	'sms_status'
+];
+for ($i=0; $i < count($allFilterKeys); $i++) {
+	if (!isset($loadedFilters[$allFilterKeys[$i]]) || !$loadedFilters[$allFilterKeys[$i]]) {
+		$loadedFilters[$allFilterKeys[$i]] = '';
+	}
+}
+?>
+
+<script>
+	(function() {
+		function init() {
+			window.apapp = new Vue({
+				el: '#mcp-client-messages-filters',
+				delimiters: ['@{{', '}}'],
+				data: {
+					filters: <?= json_encode($loadedFilters) ?>
+				},
+				methods: {
+					doSubmit: function() {
+						fastLoad('{{ route("rd.client_messages") }}?' + $('#mcp-client-messages-filters').serialize());
+						return false;
+					},
+					init: function() {
+
+					}
+				},
+				mounted: function() {
+					this.init();
+				},
+			});
+
+
+		}
+		addMCInitializer('mcp-client-messages-filters', init, '#mcp-client-messages-filters');
+	})();
+</script>

+ 86 - 0
resources/views/app/rd/clients_bdt_devices.blade.php

@@ -0,0 +1,86 @@
+@extends ('layouts/template')
+
+@section('content')
+<div class="p-3 mcp-theme-1" id="patients-list">
+    <div class="card">
+
+        <div class="card-header px-2 py-1 d-flex align-items-center">
+            <strong class="mr-4">
+                <i class="fas fa-weight"></i>
+                Clients BDT Devices
+            </strong>
+        </div>
+
+        <div class="card-body p-0">
+            <div class="p-3">
+                @include('app.rd.clients_bdt_devices_filters')
+            </div>
+            <table class="table table-sm table-striped border-top p-0 m-0">
+                <thead class="bg-light">
+                    <tr>
+                        <th class="border-0">IMEI</th>
+                        <th class="border-0">Client</th>
+                        <th class="border-0">Created</th>
+                        <th class="border-0">Category</th>
+                        <th class="border-0">Last Measurement</th>
+                        <th class="border-0">Status</th>
+                    </tr>
+                </thead>
+                <tbody>
+                    @foreach($devices as $device)
+                    <tr>
+                        <td>
+                            <pre class="m-0">{{ $device->device->imei }}</pre>
+                        </td>
+                        <td>
+                            <a target="_blank" native href="{{route('patients.view.dashboard', $device->client)}}">
+                                {{$device->client->displayName()}}
+                            </a>
+                        </td>
+                        <td class="text-nowrap">{{ friendly_date_time($device->device->created_at) }}</td>
+                        <td>{{ $device->device->category }}</td>
+                        <td class="d-flex align-items-center">
+                            <?php $lastMeasurement = $device->lastDeviceMeasurement(); ?>
+                            @if($lastMeasurement)
+                            @if($lastMeasurement->is_cellular_zero)
+                            <i class="font-size-11 fa fa-rss"></i>
+                            @elseif($lastMeasurement->label === 'BP')
+                            {{ $lastMeasurement->sbp_mm_hg }} / {{ $lastMeasurement->dbp_mm_hg }}
+                            @elseif($lastMeasurement->label === 'Wt. (lbs.)')
+                            {{ round($lastMeasurement->numeric_value, 2) }} lbs
+                            @else
+                            {{ $lastMeasurement->value }}
+                            @endif
+                            <div class="ml-2">
+                                <i class="far fa-calendar-check"></i> <span class="text-secondary">{{ friendly_date_time($lastMeasurement->created_at) }}</span>
+                            </div>
+                            @else
+                            <small class="text-muted">-</small>
+                            @endif
+                        </td>
+                        <td>
+                            @if($device->is_active)
+                            <span class="text-success">Active</span>
+                            @else
+                            <span class="text-danger">Deactivated</span>
+                            @endif
+                        </td>
+                    </tr>
+                    @endforeach
+
+                    @if(count($devices) === 0)
+                    <tr>
+                        <td colspan="6">No records found!</td>
+                    </tr>
+                    @endif
+                </tbody>
+
+            </table>
+
+        </div>
+    </div>
+    <div class="mt-3">
+        {{ $devices->appends(request()->input())->links() }}
+    </div>
+</div>
+@endsection

+ 107 - 0
resources/views/app/rd/clients_bdt_devices_filters.blade.php

@@ -0,0 +1,107 @@
+<style>
+	#mcp-clients-bdt-devices-filters label {
+		font-weight: bold;
+	}
+
+	#mcp-clients-bdt-devices-filters .mw-100px {
+		min-width: 100px;
+	}
+	.filter-container {
+		display: flex;
+		align-items: flex-start;
+		flex-wrap: wrap;
+	}
+	.filter-container >div {
+		width: 165px;
+	}
+	.filter-container >div:not(:last-child) {
+		margin-right: 15px;
+	}
+</style>
+<form id="mcp-clients-bdt-devices-filters" method="GET" action="{{ route('rd.clients_bdt_devices') }}" class="filter-container" v-cloak>
+	<!-- DATE	 -->
+	<div>
+		<div class="form-group">
+			<label>Date:</label>
+			<select name="date_category" class="form-control input-sm" v-model="filters.date_category">
+				<option value="">All</option>
+				<option value="EXACTLY">Exactly</option>
+				<option value="LESS_THAN">Less Than</option>
+				<option value="GREATER_THAN">Greater Than</option>
+				<option value="BETWEEN">Between</option>
+				<option value="NOT_BETWEEN">Not Between</option>
+			</select>
+			<div v-show="filters.date_category" class="mt-2">
+				<div>
+					<input name="date_value_1" v-model="filters.date_value_1" type="date" class="form-control input-sm"/>
+				</div>
+				<div v-show="filters.date_category === 'BETWEEN' || filters.date_category === 'NOT_BETWEEN'" class="mt-2">
+					<input name="date_value_2" v-model="filters.date_value_2" type="date" class="form-control input-sm"/>
+				</div>
+			</div>
+		</div>
+	</div>
+	<!-- STATUS -->
+	<div>
+		<div class="form-group">
+			<label>Status:</label>
+			<select name="status" class="form-control input-sm" v-model="filters.status">
+				<option value="">All</option>
+				<option value="ACTIVE">active</option>
+				<option value="DEACTIVATED">Deactivated</option>
+			</select>
+		</div>
+	</div>
+
+	<div>
+		<div class="form-group">
+			<label>&nbsp;</label>
+			<div class="d-flex">
+				<button type="submit" v-on:click.prevent="doSubmit()" class="btn btn-primary btn-sm mr-2"><i class="fas fa-filter"></i> Filter</button>
+				<a href="#" v-on:click.prevent="fastLoad('{{route('rd.clients_bdt_devices')}}')" class="btn btn-link btn-sm text-danger">Clear Filters</a>
+			</div>
+		</div>
+	</div>
+</form>
+<?php
+$loadedFilters = @$filters;
+$allFilterKeys = [
+	'date_category',
+	'date_value_1',
+	'date_value_2',
+	'status'
+];
+for ($i = 0; $i < count($allFilterKeys); $i++) {
+	if (!isset($loadedFilters[$allFilterKeys[$i]]) || !$loadedFilters[$allFilterKeys[$i]]) {
+		$loadedFilters[$allFilterKeys[$i]] = '';
+	}
+}
+?>
+<script>
+	(function() {
+		function init() {
+			window.apapp = new Vue({
+				el: '#mcp-clients-bdt-devices-filters',
+				delimiters: ['@{{', '}}'],
+				data: {
+					filters: <?= json_encode($loadedFilters) ?>
+				},
+				methods: {
+					doSubmit: function() {
+						fastLoad('{{ route("rd.clients_bdt_devices") }}?' + $('#mcp-clients-bdt-devices-filters').serialize());
+						return false;
+					},
+					init: function() {
+
+					}
+				},
+				mounted: function() {
+					this.init();
+				},
+			});
+
+
+		}
+		addMCInitializer('mcp-clients-bdt-devices-filters', init, '#mcp-clients-bdt-devices-filters');
+	})();
+</script>

+ 89 - 0
resources/views/app/rd/erx_and_orders.blade.php

@@ -0,0 +1,89 @@
+@extends ('layouts/template')
+
+@section('content')
+<div class="p-3 mcp-theme-1" id="patients-list">
+    <div class="card">
+
+        <div class="card-header px-2 py-1 d-flex align-items-center">
+            <strong class="mr-4">
+                <i class="fas fa-file-prescription"></i>
+                ERx & Orders
+            </strong>
+        </div>
+
+        <div class="card-body p-0">
+            <div class="p-3">
+                @include('app.rd.erx_and_orders_filters')
+            </div>
+            <table class="table table-sm table-striped border-top p-0 m-0">
+                <thead class="bg-light">
+                    <tr>
+                        <th class="border-0">Date</th>
+                        <th class="border-0">Patient</th>
+                        <th class="border-0">Category</th>
+                        <th class="border-0">Content</th>
+                        <th class="border-0">Status</th>
+                    </tr>
+                </thead>
+                <tbody>
+                    @foreach($erxAndOrders as $row)
+                    <tr>
+                        <td>{{ friendly_date_time($row->created_at) }}</td>
+                        <td>
+                            <a target="_blank" native href="{{route('patients.view.dashboard', $row->client)}}">
+                                {{$row->client->displayName()}}
+                            </a>
+                        </td>
+                        <td>{{ ucwords($row->erx_category) }}</td>
+                        <td>
+                            <?php $parsed = @$row->clinical_detail_json ? json_decode($row->clinical_detail_json) : false; ?>
+                            @if($row->erx_category === 'DRUG')
+                            <?php
+                            $drugs = ($parsed && @$parsed->items) ? $parsed->items : [];
+                            ?>
+                            @foreach($drugs as $drug)
+                            <div class="d-flex align-items-baseline mb-1">
+                                <b class="mr-2">{{$drug->medication ?? '-'}}</b>
+                                <span class="text-secondary mr-1">{{$drug->frequency ?? ''}}</span>
+                            </div>
+                            @endforeach
+                            @elseif($row->erx_category === 'LAB' || $row->erx_category === 'IMAGING')
+                            <?php
+                            $tests = ($parsed && @$parsed->tests) ? $parsed->tests : [];
+                            ?>
+                            @foreach($tests as $test)
+                            <div class="d-flex align-items-baseline mb-1">
+                                <b class="mr-2">{{$test ?? '-'}}</b>
+                            </div>
+                            @endforeach
+                            @elseif($row->erx_category === 'REFERRAL')
+                            <b class="mr-2">{{@$parsed->to ?? '-'}}</b>
+                            <span class="text-secondary mr-1">{{@$parsed->memo ?? '-'}}</span>
+                            @elseif($row->erx_category === 'SUPPLY')
+                            <b class="mr-2">{{@$parsed->item ?? '-'}}</b>
+                            <span class="text-secondary mr-1">{{@$parsed->quantity ?? '-'}}</span>
+                            @elseif($row->erx_category === 'OTHER')
+                            <b class="mr-2">{{@$parsed->title ?? '-'}}</b>
+                            <span class="text-secondary mr-1">{{@$parsed->memo ?? '-'}}</span>
+                            @endif
+                        </td>
+                        <td>{{ $row->pro_declared_status ?: '-' }}</td>
+                    </tr>
+                    @endforeach
+
+                    @if(count($erxAndOrders) === 0)
+                    <tr>
+                        <td colspan="5">No records found!</td>
+                    </tr>
+                    @endif
+                </tbody>
+
+            </table>
+
+        </div>
+    </div>
+    <div class="mt-3">
+        {{ $erxAndOrders->appends(request()->input())->links() }}
+    </div>
+</div>
+@endsection

+ 110 - 0
resources/views/app/rd/erx_and_orders_filters.blade.php

@@ -0,0 +1,110 @@
+<style>
+	#mcp-erx-and-orders-filters label {
+		font-weight: bold;
+	}
+
+	#mcp-erx-and-orders-filters .mw-100px {
+		min-width: 100px;
+	}
+	.filter-container {
+		display: flex;
+		align-items: flex-start;
+		flex-wrap: wrap;
+	}
+	.filter-container >div {
+		width: 165px;
+	}
+	.filter-container >div:not(:last-child) {
+		margin-right: 15px;
+	}
+</style>
+<form id="mcp-erx-and-orders-filters" method="GET" action="{{ route('rd.erx_and_orders') }}" class="filter-container" v-cloak>
+	<!-- DATE	 -->
+	<div>
+		<div class="form-group">
+			<label>Date:</label>
+			<select name="date_category" class="form-control input-sm" v-model="filters.date_category">
+				<option value="">All</option>
+				<option value="EXACTLY">Exactly</option>
+				<option value="LESS_THAN">Less Than</option>
+				<option value="GREATER_THAN">Greater Than</option>
+				<option value="BETWEEN">Between</option>
+				<option value="NOT_BETWEEN">Not Between</option>
+			</select>
+			<div v-show="filters.date_category" class="mt-2">
+				<div>
+					<input  name="date_value_1" v-model="filters.date_value_1" type="date" class="form-control input-sm"/>
+				</div>
+				<div v-show="filters.date_category === 'BETWEEN' || filters.date_category === 'NOT_BETWEEN'" class="mt-2">
+					<input name="date_value_2" v-model="filters.date_value_2" type="date" class="form-control input-sm"/>
+				</div>
+			</div>
+		</div>
+	</div>
+	<!-- STATUS -->
+	<div>
+		<div class="form-group">
+			<label>Status:</label>
+			<select name="status" class="form-control input-sm" v-model="filters.status">
+				<option value="">All</option>
+				<option value="CREATED">CREATED</option>
+				<option value="SENT">SENT</option>
+				<option value="RECEIVED_BY_CLIENT">RECEIVED BY CLIENT</option>
+				<option value="RECEIPT_CONFIRMED_BY_FACILITY">RECEIPT CONFIRMED BY FACILITY</option>
+				<option value="CANCELLED">CANCELLED</option>
+			</select>
+		</div>
+	</div>
+
+	<div>
+		<div class="form-group">
+			<label>&nbsp;</label>
+			<div class="d-flex">
+				<button type="submit" v-on:click.prevent="doSubmit()" class="btn btn-primary btn-sm mr-2"><i class="fas fa-filter"></i> Filter</button>
+				<a href="#" v-on:click.prevent="fastLoad('{{route('rd.erx_and_orders')}}')" class="btn btn-link btn-sm text-danger">Clear Filters</a>
+			</div>
+		</div>
+	</div>
+</form>
+<?php
+$loadedFilters = @$filters;
+$allFilterKeys = [
+	'date_category',
+	'date_value_1',
+	'date_value_2',
+	'status'
+];
+for ($i=0; $i < count($allFilterKeys); $i++) {
+	if (!isset($loadedFilters[$allFilterKeys[$i]]) || !$loadedFilters[$allFilterKeys[$i]]) {
+		$loadedFilters[$allFilterKeys[$i]] = '';
+	}
+}
+?>
+<script>
+	(function() {
+		function init() {
+			window.apapp = new Vue({
+				el: '#mcp-erx-and-orders-filters',
+				delimiters: ['@{{', '}}'],
+				data: {
+					filters: <?= json_encode($loadedFilters) ?>
+				},
+				methods: {
+					doSubmit: function() {
+						fastLoad('{{ route("rd.erx_and_orders") }}?' + $('#mcp-erx-and-orders-filters').serialize());
+						return false;
+					},
+					init: function() {
+
+					}
+				},
+				mounted: function() {
+					this.init();
+				},
+			});
+
+
+		}
+		addMCInitializer('mcp-erx-and-orders-filters', init, '#mcp-erx-and-orders-filters');
+	})();
+</script>

+ 97 - 0
resources/views/app/rd/memos.blade.php

@@ -0,0 +1,97 @@
+@extends ('layouts/template')
+
+@section('content')
+<div class="p-3 mcp-theme-1" id="patients-list">
+    <div class="card">
+
+        <div class="card-header px-2 py-1 d-flex align-items-center">
+            <strong class="mr-4">
+                <i class="fas fa-notes-medical"></i>
+                Memos
+            </strong>
+        </div>
+
+        <div class="card-body p-0">
+            <div class="p-3">
+                @include('app.rd.memos_filters')
+            </div>
+            <table class="table table-sm table-striped border-top p-0 m-0">
+                <thead class="bg-light">
+                    <tr>
+                        <th class="border-0">Category</th>
+                        <th class="border-0">Patient</th>
+                        <th class="border-0 w-25">Summary</th>
+                        <th class="border-0">Created</th>
+                        <th class="border-0 delete-column">&nbsp;</th>
+                    </tr>
+                </thead>
+                <tbody>
+                    @foreach($memos as $memo)
+                    <tr>
+                        <td>{{ $memo->category }}</td>
+                        <td>
+                            <a target="_blank" native href="{{route('patients.view.dashboard', $memo->client)}}">
+                                {{$memo->client->displayName()}}
+                            </a>
+                        </td>
+                        <td>
+                            <pre class="m-0 break-spaces">{{ $memo->content }}</pre>
+                        </td>
+                        <td>{{ friendly_date_time($memo->created_at) }}</td>
+                        <td class="text-center delete-column">
+                            <div moe wide relative class="mr-2">
+                                <a class="on-hover-opaque" start show title="Edit">
+                                    <i class="font-size-11 fa fa-edit"></i>
+                                </a>
+                                <form url="/api/clientMemo/update" right>
+                                    <input type="hidden" name="uid" value="{{ $memo->uid }}">
+                                    <div class="mb-2">
+                                        <select class="form-control form-control-sm" name="category" required>
+                                            <option value="">-- select --</option>
+                                            <option {{ $memo->category === "Incoming Call" ? "selected" : "" }} value="Incoming Call">Incoming Call</option>
+                                            <option {{ $memo->category === "Outgoing Call" ? "selected" : "" }} value="Outgoing Call">Outgoing Call</option>
+                                            <option {{ $memo->category === "Call Unspecified" ? "selected" : "" }} value="Call Unspecified">Call Unspecified</option>
+                                            <option {{ $memo->category === "Other" ? "selected" : "" }} value="Other">Other</option>
+                                        </select>
+                                    </div>
+                                    <div class="mb-2">
+                                        <textarea class="form-control form-control-sm" name="content" rows="5" placeholder="Content"><?= $memo->content ?></textarea>
+                                    </div>
+                                    <div class="d-flex align-items-center">
+                                        <button class="btn btn-sm btn-primary mr-2" type="button" submit>Save</button>
+                                        <button class="btn btn-sm btn-default mr-2 border" type="button" cancel>Cancel</button>
+                                    </div>
+                                </form>
+                            </div>
+                            <div moe relative>
+                                <a start show class="on-hover-opaque"><i class="fa fa-trash-alt text-danger"></i></a>
+                                <form url="/api/clientMemo/cancel" right>
+                                    <input type="hidden" name="uid" value="{{ $memo->uid }}">
+                                    <p class="small">Are you sure you want to cancel this memo?</p>
+                                    <div class="d-flex align-items-center">
+                                        <button class="btn btn-sm btn-danger mr-2" submit>Delete</button>
+                                        <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
+                                    </div>
+                                </form>
+                            </div>
+                        </td>
+                    </tr>
+                    @endforeach
+
+                    @if(count($memos) === 0)
+                    <tr>
+                        <td colspan="5">No records found!</td>
+                    </tr>
+                    @endif
+                </tbody>
+
+            </table>
+
+        </div>
+    </div>
+    <div class="mt-3">
+        {{ $memos->appends(request()->input())->links() }}
+    </div>
+
+</div>
+@endsection

+ 110 - 0
resources/views/app/rd/memos_filters.blade.php

@@ -0,0 +1,110 @@
+<style>
+	#mcp-memos-filters label {
+		font-weight: bold;
+	}
+
+	#mcp-memos-filters .mw-100px {
+		min-width: 100px;
+	}
+
+	.filter-container {
+		display: flex;
+		align-items: flex-start;
+		flex-wrap: wrap;
+	}
+
+	.filter-container>div {
+		width: 165px;
+	}
+
+	.filter-container>div:not(:last-child) {
+		margin-right: 15px;
+	}
+</style>
+<form id="mcp-memos-filters" method="GET" action="{{ route('rd.memos') }}" class="filter-container" v-cloak>
+	<!-- DATE	 -->
+	<div>
+		<div class="form-group">
+			<label>Date:</label>
+			<select name="date_category" class="form-control input-sm" v-model="filters.date_category">
+				<option value="">All</option>
+				<option value="EXACTLY">Exactly</option>
+				<option value="LESS_THAN">Less Than</option>
+				<option value="GREATER_THAN">Greater Than</option>
+				<option value="BETWEEN">Between</option>
+				<option value="NOT_BETWEEN">Not Between</option>
+			</select>
+			<div v-show="filters.date_category" class="mt-2">
+				<div>
+					<input name="date_value_1" v-model="filters.date_value_1" type="date" class="form-control input-sm" />
+				</div>
+				<div v-show="filters.date_category === 'BETWEEN' || filters.date_category === 'NOT_BETWEEN'" class="mt-2">
+					<input name="date_value_2" v-model="filters.date_value_2" type="date" class="form-control input-sm" />
+				</div>
+			</div>
+		</div>
+	</div>
+	<!-- STATUS -->
+	<div>
+		<div class="form-group">
+			<label>Category:</label>
+			<select name="category" class="form-control input-sm" v-model="filters.category">
+				<option value="">All</option>
+				<option value="Incoming Call">Incoming Call</option>
+				<option value="Outgoing Call">Outgoing Call</option>
+				<option value="Call Unspecified">Call Unspecified</option>
+				<option value="Other">Other</option>
+			</select>
+		</div>
+	</div>
+
+	<div>
+		<div class="form-group">
+			<label>&nbsp;</label>
+			<div class="d-flex">
+				<button type="submit" v-on:click.prevent="doSubmit()" class="btn btn-primary btn-sm mr-2"><i class="fas fa-filter"></i> Filter</button>
+				<a href="#" v-on:click.prevent="fastLoad('{{route('rd.memos')}}')" class="btn btn-link btn-sm text-danger">Clear Filters</a>
+			</div>
+		</div>
+	</div>
+</form>
+<?php
+$loadedFilters = @$filters;
+$allFilterKeys = [
+	'date_category',
+	'date_value_1',
+	'date_value_2',
+	'category'
+];
+for ($i = 0; $i < count($allFilterKeys); $i++) {
+	if (!isset($loadedFilters[$allFilterKeys[$i]]) || !$loadedFilters[$allFilterKeys[$i]]) {
+		$loadedFilters[$allFilterKeys[$i]] = '';
+	}
+}
+?>
+<script>
+	(function() {
+		function init() {
+			window.apapp = new Vue({
+				el: '#mcp-memos-filters',
+				delimiters: ['@{{', '}}'],
+				data: {
+					filters: <?= json_encode($loadedFilters) ?>
+				},
+				methods: {
+					doSubmit: function() {
+						fastLoad('{{ route("rd.memos") }}?' + $('#mcp-memos-filters').serialize());
+						return false;
+					},
+					init: function() {
+
+					}
+				},
+				mounted: function() {
+					this.init();
+				},
+			});
+		}
+		addMCInitializer('mcp-memos-filters', init, '#mcp-memos-filters');
+	})();
+</script>

+ 86 - 0
resources/views/app/rd/notes.blade.php

@@ -0,0 +1,86 @@
+@extends ('layouts/template')
+
+@section('content')
+<div class="p-3 mcp-theme-1" id="patients-list">
+    <div class="card">
+
+        <div class="card-header px-2 py-1 d-flex align-items-center">
+            <strong class="mr-4">
+                <i class="fas fa-notes-medical"></i>
+                Notes
+            </strong>
+        </div>
+
+        <div class="card-body p-0">
+            <div class="p-3">
+                @include('app.rd.notes_filters')
+            </div>
+            <table class="table table-sm table-striped border-top p-0 m-0">
+                <thead class="bg-light">
+                    <tr>
+                        <th class="border-0">Effective Date</th>
+                        <th class="border-0">Patient</th>
+                        <th class="border-0">New Patient / FU</th>
+
+                        <th class="border-0">HCP</th>
+
+                        <th class="border-0">HCP Signed</th>
+                        <th class="border-0">&nbsp;</th>
+                    </tr>
+                </thead>
+                <tbody>
+                    @foreach ($notes as $note)
+                    <tr class="{{ $note->is_cancelled ? 'cancelled-item always-clickable' : '' }}">
+                        <td>
+                            <a href="/patients/view/{{ $note->client->uid }}/notes/view/{{ $note->uid }}" class="font-weight-bold">
+                                {{ friendly_date_time($note->effective_dateest, false) }}
+                            </a>
+                            @if(!!$note->visitTemplate)
+                            <span class="text-info font-weight-bold">*</span>
+                            @endif
+                            <span class="ml-1">{{ $note->is_cancelled ? '[cancelled]' : '' }}</span>
+                        </td>
+                        <td>
+                            {{ $note->client->displayName() }}
+                        </td>
+
+                        <td>
+                            {{ $note->new_or_fu_or_na === 'NEW' ? 'New Patient' : $note->new_or_fu_or_na }}
+                        </td>
+
+                        <td>
+                            {{$note->hcpPro ? $note->hcpPro->name_display: '-'}}
+                        </td>
+
+                        <td>
+                            {!! $note->hcpPro && $note->is_signed_by_hcp ? '<b class="text-success">Yes</b>' : 'No' !!}
+                        </td>
+                        <td>
+                            <div class="position-relative c-pointer text-center stag-tooltip">
+                                <i class="fa fa-info-circle"></i>
+                                <div class="position-absolute bg-white border rounded p-2 stag-tooltip-content">
+                                    <div class="text-nowrap small text-left pb-1">Created on <b>{{ friendly_date_time($note->created_at, true) }}</b></div>
+                                    <div class="text-nowrap small text-left">Created by <b>{{ $note->createdSession && $note->createdSession->pro ? $note->createdSession->pro->displayName() : '-'}}</b></div>
+                                </div>
+                            </div>
+                        </td>
+                    </tr>
+                    @endforeach
+
+                    @if(count($notes) === 0)
+                    <tr>
+                        <td colspan="6">No records found!</td>
+                    </tr>
+                    @endif
+                </tbody>
+
+            </table>
+
+        </div>
+    </div>
+    <div class="mt-3">
+        {{ $notes->appends(request()->input())->links() }}
+    </div>
+
+</div>
+@endsection

+ 107 - 0
resources/views/app/rd/notes_filters.blade.php

@@ -0,0 +1,107 @@
+<style>
+	#mcp-notes-filters label {
+		font-weight: bold;
+	}
+
+	#mcp-notes-filters .mw-100px {
+		min-width: 100px;
+	}
+	.filter-container{
+		display: flex;
+		align-items: flex-start;
+		flex-wrap: wrap;
+	}
+	.filter-container >div {
+		width: 165px;
+	}
+	.filter-container >div:not(:last-child) {
+		margin-right: 15px;
+	}
+</style>
+<form id="mcp-notes-filters" method="GET" action="{{ route('rd.notes') }}" class="filter-container" v-cloak>
+	<!-- DATE	 -->
+	<div>
+		<div class="form-group">
+			<label>Date:</label>
+			<select name="date_category" class="form-control input-sm" v-model="filters.date_category">
+				<option value="">All</option>
+				<option value="EXACTLY">Exactly</option>
+				<option value="LESS_THAN">Less Than</option>
+				<option value="GREATER_THAN">Greater Than</option>
+				<option value="BETWEEN">Between</option>
+				<option value="NOT_BETWEEN">Not Between</option>
+			</select>
+			<div v-show="filters.date_category" class="filter-child-container mt-2">
+				<div>
+					<input  name="date_value_1" v-model="filters.date_value_1" type="date" class="form-control input-sm"/>
+				</div>
+				<div v-show="filters.date_category === 'BETWEEN' || filters.date_category === 'NOT_BETWEEN'" class="mt-2">
+					<input name="date_value_2" v-model="filters.date_value_2" type="date" class="form-control input-sm"/>
+				</div>
+			</div>
+		</div>
+	</div>
+	<!-- STATUS -->
+	<div>
+		<div class="form-group">
+			<label>New/FU:</label>
+			<select name="new_or_fu_or_na" class="form-control input-sm" v-model="filters.new_or_fu_or_na">
+				<option value="">All</option>
+				<option value="NEW">New</option>
+				<option value="FU">FU</option>
+			</select>
+		</div>
+	</div>
+
+	<div>
+		<div class="form-group">
+			<label>&nbsp;</label>
+			<div class="d-flex">
+				<button type="submit"  v-on:click.prevent="doSubmit()" class="btn btn-primary btn-sm mr-2"><i class="fas fa-filter"></i> Filter</button>
+				<a href="#" v-on:click.prevent="fastLoad('{{route('rd.notes')}}')" class="btn btn-link btn-sm text-danger">Clear Filters</a>
+			</div>
+		</div>
+	</div>
+</form>
+<?php
+$loadedFilters = @$filters;
+$allFilterKeys = [
+	'date_category',
+	'date_value_1',
+	'date_value_2',
+	'new_or_fu_or_na'
+];
+for ($i=0; $i < count($allFilterKeys); $i++) {
+	if (!isset($loadedFilters[$allFilterKeys[$i]]) || !$loadedFilters[$allFilterKeys[$i]]) {
+		$loadedFilters[$allFilterKeys[$i]] = '';
+	}
+}
+?>
+
+<script>
+	(function() {
+		function init() {
+			window.apapp = new Vue({
+				el: '#mcp-notes-filters',
+				delimiters: ['@{{', '}}'],
+				data: {
+					filters: <?= json_encode($loadedFilters) ?>
+				},
+				methods: {
+					doSubmit: function() {
+						fastLoad('{{ route("rd.notes") }}?' + $('#mcp-notes-filters').serialize());
+						return false;
+					},
+					init: function() {
+
+					}
+				},
+				mounted: function() {
+					this.init();
+				},
+			});
+
+		}
+		addMCInitializer('mcp-notes-filters', init, '#mcp-notes-filters');
+	})();
+</script>

+ 88 - 0
resources/views/app/rd/patients-accounts-invites.blade.php

@@ -0,0 +1,88 @@
+@extends ('layouts/template')
+
+@section('content')
+
+<div class="p-3 mcp-theme-1">
+    <div class="card">
+
+        <div class="card-header px-2 py-1 d-flex align-items-center">
+            <strong class="mr-4">
+                <i class="fas fa-user"></i>
+                Accounts Invites ({{ $accountInvites->total() }})
+            </strong>
+        </div>
+        <div class="card-body p-0">
+            <table class="table table-sm table-striped border-top p-0 m-0">
+                <thead class="bg-light">
+                    <tr>
+                        <th class="border-0">Created At</th>
+                        <th class="border-0">Client</th>
+                        <th class="border-0">Name</th>
+                        <th class="border-0">Email</th>
+                        <th class="border-0">Cell Number</th>
+                        <th class="border-0">Status</th>
+                        <th class="border-0">&nbsp;</th>
+                    </tr>
+                </thead>
+                <tbody>
+                    @foreach($accountInvites as $accountInvite)
+                    <tr>
+                        <td>
+                            {{ friendlier_date_time($accountInvite->created_at) }}
+                            @if($accountInvite->status === 'CANCELLED')
+                            <span class="text-sm text-secondary">(CANCELLED)</span>
+                            @endif
+                        </td>
+                        <td>{{ $accountInvite->client->displayName() }}</td>
+                        <td>{{ $accountInvite->first_name }} {{ $accountInvite->last_name }}</pre>
+                        </td>
+                        <td>{{ $accountInvite->to_email_address }}</td>
+                        <td>{{ $accountInvite->cell_number }}</td>
+                        <td>{{ $accountInvite->status }} <span class="text-sm text-secondary">(Updated: {{friendlier_date_time($accountInvite->status_updated_at)}})</span>
+                            @if($accountInvite->status_memo)
+                            <div class="py-1 font-italic text-secondary text-sm">{{$accountInvite->status_memo}}</div>
+                            @endif
+                        </td>
+                        <td>
+                            <div class="d-flex">
+                                @if($accountInvite->status === 'PENDING')
+                                <span moe class="ml-1" relative>
+                                    <a class="" href="" show start>Cancel</a>
+                                    <form url="/api/accountInvite/markAsCancelled" right>
+                                        <input type="hidden" name="uid" value="{{$accountInvite->uid}}">
+                                        <p>Cancel this invite?</p>
+                                        <div class="mb-0">
+                                            <button class="btn btn-primary btn-sm" submit>Submit</button>
+                                            <button class="btn btn-default border btn-sm" cancel>Cancel</button>
+                                        </div>
+                                    </form>
+                                </span>
+                                @endif
+                                @if($accountInvite->status == 'CANCELLED')
+                                <span moe class="ml-1" relative>
+                                    <a class="" href="" show start>Undo Cancel</a>
+                                    <form url="/api/accountInvite/undoMarkAsCancelled" right>
+                                        <input type="hidden" name="uid" value="{{$accountInvite->uid}}">
+                                        <p>Un-cancel this invite?</p>
+                                        <div class="mb-0">
+                                            <button class="btn btn-primary btn-sm" submit>Submit</button>
+                                            <button class="btn btn-default border btn-sm" cancel>Cancel</button>
+                                        </div>
+                                    </form>
+                                </span>
+                                @endif
+                            </div>
+                        </td>
+                    </tr>
+                    @endforeach
+                </tbody>
+            </table>
+
+        </div>
+    </div>
+    <div class="mt-3">
+        {{ $accountInvites->appends(request()->input())->links() }}
+    </div>
+</div>
+
+@endsection

+ 1 - 1
resources/views/app/rd/patients_filters.blade.php

@@ -220,7 +220,7 @@
 </form>
 
 <?php
-$loadedFilters = $filters;
+$loadedFilters = @$filters;
 $allFilterKeys = [
 	'name',
 	'age_category',

+ 73 - 0
resources/views/app/rd/reports.blade.php

@@ -0,0 +1,73 @@
+@extends ('layouts/template')
+
+@section('content')
+<div class="p-3 mcp-theme-1" id="patients-list">
+    <div class="card">
+
+        <div class="card-header px-2 py-1 d-flex align-items-center">
+            <strong class="mr-4">
+                <i class="fas fa-file-invoice-dollar"></i>
+                Reports Pending Signature
+            </strong>
+        </div>
+
+        <div class="card-body p-0">
+            <div class="p-3">
+                @include('app.rd.reports_filters')
+            </div>
+            <table class="table table-sm table-striped border-top p-0 m-0">
+                <thead class="bg-light">
+                    <tr>
+                        <th class="border-0">Patient</th>
+                        <th class="border-0">Title</th>
+                        <th class="border-0">Category</th>
+                        <th class="border-0">Report Date</th>
+                        <th class="border-0">Sign</th>
+                    </tr>
+                </thead>
+                <tbody>
+                    @foreach($reports as $report)
+                    <tr class="{{$report->is_entry_error ? 'entry-error' : ''}}">
+                        <td class="border-bottom-0">{{$report->client->displayName()}}</td>
+                        <td>
+                            <a native target="_blank" href="{{route('patients.view.incoming-reports', ['patient' => $report->client, 'currentReport' => $report])}}" class="{{@$currentReport->uid === $report->uid ? 'font-weight-bold' : ''}}">
+                                {{ $report->title ? $report->title : '(not set)' }}
+                            </a>
+                        </td>
+                        <td>{{ $report->category }}{{ $report->subcategory ? ' / ' . $report->subcategory : '' }}</td>
+                        <td>{{ friendly_date_time($report->report_date, false) }}</td>
+                        <td>
+                            @if(!$report->has_hcp_pro_signed)
+                            -
+                            @else
+                            <div class="text-success mb-1">
+                                <i class="fa fa-check"></i>
+                                Signed
+                            </div>
+                            @if($report->hcp)
+                            <div class="text-secondary">
+                                <div class="text-sm font-weight-bold">{{$report->hcp->displayName()}}</div>
+                                <div class="text-sm">{{friendlier_date_time($report->hcp_pro_signed_at)}}</div>
+                            </div>
+                            @endif
+                            @endif
+                        </td>
+                    </tr>
+                    @endforeach
+
+                    @if(count($reports) === 0)
+                    <tr>
+                        <td colspan="5">No records found!</td>
+                    </tr>
+                    @endif
+                </tbody>
+
+            </table>
+
+        </div>
+    </div>
+    <div class="mt-3">
+        {{ $reports->appends(request()->input())->links() }}
+    </div>
+</div>
+@endsection

+ 107 - 0
resources/views/app/rd/reports_filters.blade.php

@@ -0,0 +1,107 @@
+<style>
+	#mcp-reports-filters label {
+		font-weight: bold;
+	}
+
+	#mcp-reports-filters .mw-100px {
+		min-width: 100px;
+	}
+	.filter-container{
+		display: flex;
+		align-items: flex-start;
+		flex-wrap: wrap;
+	}
+	.filter-container >div {
+		width: 165px;
+	}
+	.filter-container >div:not(:last-child) {
+		margin-right: 15px;
+	}
+</style>
+<form id="mcp-reports-filters" method="GET" action="{{ route('rd.reports') }}" class="filter-container" v-cloak>
+	<!-- DATE	 -->
+	<div>
+		<div class="form-group">
+			<label>Date:</label>
+			<select name="date_category" class="form-control input-sm" v-model="filters.date_category">
+				<option value="">All</option>
+				<option value="EXACTLY">Exactly</option>
+				<option value="LESS_THAN">Less Than</option>
+				<option value="GREATER_THAN">Greater Than</option>
+				<option value="BETWEEN">Between</option>
+				<option value="NOT_BETWEEN">Not Between</option>
+			</select>
+			<div v-show="filters.date_category" class="mt-2">
+				<div>
+					<input name="date_value_1" v-model="filters.date_value_1" type="date" class="form-control input-sm"/>
+				</div>
+				<div v-show="filters.date_category === 'BETWEEN' || filters.date_category === 'NOT_BETWEEN'" class="mt-2">
+					<input name="date_value_2" v-model="filters.date_value_2" type="date" class="form-control input-sm"/>
+				</div>
+			</div>
+		</div>
+	</div>
+	<!-- STATUS -->
+	<div>
+		<div class="form-group">
+			<label>Status:</label>
+			<select name="status" class="form-control input-sm" v-model="filters.status">
+				<option value="">All</option>
+				<option value="SIGNED">Signed</option>
+				<option value="NOT_SIGNED">Not Signed</option>
+			</select>
+		</div>
+	</div>
+
+	<div>
+		<div class="form-group">
+			<label>&nbsp;</label>
+			<div class="d-flex">
+				<button type="submit" v-on:click.prevent="doSubmit()" class="btn btn-primary btn-sm mr-2"><i class="fas fa-filter"></i> Filter</button>
+				<a href="#" v-on:click.prevent="fastLoad('{{route('rd.reports')}}')" class="btn btn-link btn-sm text-danger">Clear Filters</a>
+			</div>
+		</div>
+	</div>
+</form>
+<?php
+$loadedFilters = @$filters;
+$allFilterKeys = [
+	'date_category',
+	'date_value_1',
+	'date_value_2',
+	'status'
+];
+for ($i = 0; $i < count($allFilterKeys); $i++) {
+	if (!isset($loadedFilters[$allFilterKeys[$i]]) || !$loadedFilters[$allFilterKeys[$i]]) {
+		$loadedFilters[$allFilterKeys[$i]] = '';
+	}
+}
+?>
+<script>
+	(function() {
+		function init() {
+			window.apapp = new Vue({
+				el: '#mcp-reports-filters',
+				delimiters: ['@{{', '}}'],
+				data: {
+					filters: <?= json_encode($loadedFilters) ?>
+				},
+				methods: {
+					doSubmit: function() {
+						fastLoad('{{ route("rd.reports") }}?' + $('#mcp-reports-filters').serialize());
+						return false;
+					},
+					init: function() {
+
+					}
+				},
+				mounted: function() {
+					this.init();
+				},
+			});
+
+
+		}
+		addMCInitializer('mcp-reports-filters', init, '#mcp-reports-filters');
+	})();
+</script>

+ 81 - 0
resources/views/app/rd/rpm-matrix.blade.php

@@ -0,0 +1,81 @@
+@extends ('layouts/template')
+
+@section('content')
+    <style>
+        td, th {
+            text-align: center !important;
+        }
+    </style>
+    <div class="p-3 mcp-theme-1">
+        <div class="card border-left-0 border-right-0 border-bottom-0">
+            <div class="card-header border-left border-right border-bottom-0 py-1 px-2 d-flex align-items-center">
+                <strong class="mr-4">
+                    <i class="fas fa-chart-bar"></i>
+                    RPM Matrix
+                </strong>
+            </div>
+
+            <div class="card-body p-0">
+                <table class="table table-bordered table-sm table-striped p-0 m-0">
+                    <thead class="bg-light">
+                        <tr>
+                            <th class="border-0">Chart #</th>
+                            <th class="border-0">Name</th>
+                            <th class="border-0">DOB</th>
+                            @if($pro->pro_type == 'ADMIN')
+                            <th class="border-0">MCP</th>
+                            @endif
+                            <th class="border-0">BP</th>
+                            <th class="border-0"> <i class="fa fa-heartbeat"></i> </th>
+                            <th class="border-0">Pulse</th>
+                            <th class="border-0">BP/Pulse Timestamp</th>
+                            <th class="border-0">BP <i class="fa fa-car-battery"></i></th>
+                            <th class="border-0">BP <i class="fa fa-broadcast-tower"></i></th>
+                            <th class="border-0">Weight</th>
+                            <th class="border-0">Weight Timestamp</th>
+                            <th class="border-0">Scale <i class="fa fa-battery"></i></th>
+                            <th class="border-0">Scale <i class="fa fa-broadcast-tower"></i></th>
+                        </tr>
+                    </thead>
+                    <tbody>
+                        @foreach($clients as $client)
+                            <tr>
+                                <td>
+                                    <a native target="_blank" href="{{route('patients.view.dashboard', $client)}}">
+                                        {{$client->chart_number}}
+                                    </a>
+                                </td>
+                                <td>
+                                    <a native target="_blank" href="{{route('patients.view.dashboard', $client)}}">
+                                        {{$client->name_last}}, {{$client->name_first}}
+                                    </a>
+                                </td>
+                                <td>{{ $client->dob }}</td>
+                                @if($pro->pro_type == 'ADMIN')
+                                <td>{{ $client->mcp->name_display ?? '--' }}</td>
+                                @endif
+                                <td>
+                                    @if($client->most_recent_cellular_bp_measurement_at)
+                                        {{ $client->most_recent_cellular_bp_sbp_mm_hg }} / {{ $client->most_recent_cellular_bp_dbp_mm_hg }}
+                                    @endif
+                                </td>
+                                <td><?= $client->most_recent_cellular_bp_value_irregular ? '<i class="fa fa-heartbeat"></i>' : '' ?></td>
+                                <td>{{ $client->most_recent_cellular_bp_value_pulse }}</td>
+                                <td>{{ friendlier_date_time($client->most_recent_cellular_bp_measurement_at) }}</td>
+                                <td>{{ $client->most_recent_cellular_bp_battery_voltage }}</td>
+                                <td>{{ $client->most_recent_cellular_bp_signal_strength }}</td>
+                                <td>{{ $client->most_recent_cellular_weight_value ? round($client->most_recent_cellular_weight_value, 2) : '--' }}</td>
+                                <td>{{ friendlier_date_time($client->most_recent_cellular_weight_measurement_at) }}</td>
+                                <td>{{ $client->most_recent_cellular_weight_battery_voltage }}</td>
+                                <td>{{ $client->most_recent_cellular_weight_signal_strength }}</td>
+                            </tr>
+                        @endforeach
+                    </tbody>
+                </table>
+            </div>
+        </div>
+        <div class="mt-2">
+            {{$clients->links()}}
+        </div>
+    </div>
+@endsection

+ 71 - 0
resources/views/app/rd/supply_orders.blade.php

@@ -0,0 +1,71 @@
+@extends ('layouts/template')
+
+@section('content')
+<div class="p-3 mcp-theme-1" id="patients-list">
+    <div class="card">
+
+        <div class="card-header px-2 py-1 d-flex align-items-center">
+            <strong class="mr-4">
+                <i class="fas fa-file-invoice-dollar"></i>
+                Supply Orders
+            </strong>
+        </div>
+
+        <div class="card-body p-0">
+            <div class="p-3">
+                @include('app.rd.supply_orders_filters')
+            </div>
+            <table class="table table-sm table-striped border-top p-0 m-0">
+                <thead class="bg-light">
+                    <tr>
+                        <th class="border-0">Date</th>
+                        <th class="border-0">Patient</th>
+                        <th class="border-0">Product</th>
+                        <th class="border-0">Memo</th>
+                        <th class="border-0">Is Cancelled</th>
+                        <th class="border-0">Shipment</th>
+                    </tr>
+                </thead>
+                <tbody>
+                    @foreach($supplyOrders as $supplyOrder)
+                    <tr>
+                        <td>{{ friendlier_date_time($supplyOrder->created_at)}}</td>
+                        <td>{{ $supplyOrder->client->displayName() }} -</td>
+                        <td>{{ $supplyOrder->product->title }}</td>
+                        <td style="width: 300px;">{{ $supplyOrder->reason }}</td>
+                        <td>{{ $supplyOrder->is_cancelled ? 'Yes' : 'No' }}</td>
+                        <td class="px-2">
+                            @if($supplyOrder->shipment_id)
+                            <i class="fa fa-building"></i>
+                            {{$supplyOrder->shipment->status ? $supplyOrder->shipment->status : 'CREATED'}}
+                            @elseif($supplyOrder->is_cleared_for_shipment)
+                            <span class="text-info">
+                                <i class="fa fa-user-nurse"></i>
+                                Cleared for shipment
+                            </span>
+                            @else
+                            <span class="text-warning-mellow">
+                                <i class="fa fa-user-nurse"></i>
+                                Not cleared for shipment
+                            </span>
+                            @endif
+                        </td>
+                    </tr>
+                    @endforeach
+
+                    @if(count($supplyOrders) === 0)
+                    <tr>
+                        <td colspan="6">No records found!</td>
+                    </tr>
+                    @endif
+                </tbody>
+
+            </table>
+
+        </div>
+    </div>
+    <div class="mt-3">
+        {{ $supplyOrders->appends(request()->input())->links() }}
+    </div>
+</div>
+@endsection

+ 119 - 0
resources/views/app/rd/supply_orders_filters.blade.php

@@ -0,0 +1,119 @@
+<style>
+	#mcp-supply-orders-filters label {
+		font-weight: bold;
+	}
+
+	#mcp-supply-orders-filters .mw-100px {
+		min-width: 100px;
+	}
+	.filter-container {
+		display: flex;
+		align-items: flex-start;
+	}
+	.filter-container >div {
+		width: 165px;
+	}
+	.filter-container >div:not(:last-child) {
+		margin-right: 15px;
+	}
+</style>
+<form id="mcp-supply-orders-filters" method="GET" action="{{ route('rd.supply_orders') }}" class="filter-container" v-cloak>
+	<!-- DATE	 -->
+	<div>
+		<div class="form-group">
+			<label>Date:</label>
+			<select name="date_category" class="form-control input-sm" v-model="filters.date_category">
+				<option value="">All</option>
+				<option value="EXACTLY">Exactly</option>
+				<option value="LESS_THAN">Less Than</option>
+				<option value="GREATER_THAN">Greater Than</option>
+				<option value="BETWEEN">Between</option>
+				<option value="NOT_BETWEEN">Not Between</option>
+			</select>
+			<div v-show="filters.date_category" class="filter-child-container mt-2">
+				<div>
+					<input  name="date_value_1" v-model="filters.date_value_1" type="date" class="form-control input-sm"/>
+				</div>
+				<div v-show="filters.date_category === 'BETWEEN' || filters.date_category === 'NOT_BETWEEN'" class="mt-2">
+					<input name="date_value_2" v-model="filters.date_value_2" type="date" class="form-control input-sm"/>
+				</div>
+			</div>
+		</div>
+	</div>
+	<!-- STATUS -->
+	<div>
+		<div class="form-group">
+			<label>Status:</label>
+			<select name="status" class="form-control input-sm" v-model="filters.status">
+				<option value="">All</option>
+				<option value="CREATED">NEW</option>
+				<option value="CLEARED_FOR_SHIPMENT">CLEARED FOR SHIPMENT</option>
+				<option value="NOT_CLEARED_FOR_SHIPMENT">NOT CLEARED FOR SHIPMENT</option>
+				<option value="SHIPPED">SHIPPED</option>
+				<option value="DELIVERED">DELIVERED</option>
+				<option value="RETURNED_TO_SENDER">RETURNED TO SENDER</option>
+				<option value="CANCELLED">CANCELLED</option>
+				<option value="PRINTED">PRINTED</option>
+				<option value="BEING_PICKED">BEING PICKED</option>
+				<option value="PICKED">PICKED</option>
+				<option value="BEING_SCANNED">BEING SCANNED</option>
+				<option value="SCANNED">SCANNED</option>
+				<option value="BEING_FULFILLED">BEING FULFILLED</option>
+				<option value="FULFILLED">FULFILLED</option>
+				<option value="DISPATCHED">DISPATCHED</option>
+			</select>
+		</div>
+	</div>
+
+	<div>
+		<div class="form-group">
+			<label>&nbsp;</label>
+			<div class="d-flex">
+				<button type="submit" v-on:click.prevent="doSubmit()" class="btn btn-primary btn-sm mr-2"><i class="fas fa-filter"></i> Filter</button>
+				<a href="#" v-on:click.prevent="fastLoad('{{route('rd.supply_orders')}}')" class="btn btn-link btn-sm text-danger">Clear Filters</a>
+			</div>
+		</div>
+	</div>
+</form>
+<?php
+$loadedFilters = @$filters;
+$allFilterKeys = [
+	'date_category',
+	'date_value_1',
+	'date_value_2',
+	'status'
+];
+for ($i=0; $i < count($allFilterKeys); $i++) {
+	if (!isset($loadedFilters[$allFilterKeys[$i]]) || !$loadedFilters[$allFilterKeys[$i]]) {
+		$loadedFilters[$allFilterKeys[$i]] = '';
+	}
+}
+?>
+<script>
+	(function() {
+		function init() {
+			window.apapp = new Vue({
+				el: '#mcp-supply-orders-filters',
+				delimiters: ['@{{', '}}'],
+				data: {
+					filters: <?= json_encode($loadedFilters) ?>
+				},
+				methods: {
+					doSubmit: function() {
+						fastLoad('{{ route("rd.supply_orders") }}?' + $('#mcp-supply-orders-filters').serialize());
+						return false;
+					},
+					init: function() {
+
+					}
+				},
+				mounted: function() {
+					this.init();
+				},
+			});
+
+
+		}
+		addMCInitializer('mcp-supply-orders-filters', init, '#mcp-supply-orders-filters');
+	})();
+</script>

+ 27 - 2
resources/views/layouts/template.blade.php

@@ -129,6 +129,7 @@
                     <li class="nav-item"><a class="nav-link" href="{{ route('dna.patients') }}"><i class="mr-1 fas fa-user"></i> Patients</a> </li>
                  @elseif($pro->is_considered_for_rd_assignment)
                     <li class="nav-item"><a class="nav-link" href="{{ route('rd.dashboard') }}"><i class="mr-1 fas fa-home"></i> Home</a> </li>
+                    <li class="nav-item"><a class="nav-link" href="{{ route('rd.appointments') }}"><i class="mr-1 fas fa-calendar-alt"></i> Appointments</a> </li>
                     <li class="nav-item"><a class="nav-link" href="{{ route('rd.patients') }}"><i class="mr-1 fas fa-user"></i> Patients</a> </li>
                  @else
                     <li class="nav-item"><a class="nav-link" href="{{ route('ps.dashboard') }}"><i class="mr-1 fas fa-home"></i> Home</a> </li>
@@ -146,17 +147,41 @@
                     </a>
                     <div class="dropdown-menu mcp-theme-1 no-overflow-menu p-0" aria-labelledby="practice-management">
                         <a class="dropdown-item" href="{{ route('practice-management.proAvailability') }}">My Availability</a>
-                        <a class="dropdown-item" href="{{ route('practice-management.rpm-manager') }}">RPM Manager</a>
+                        @if($pro->pro_type == 'ADMIN')
+                            <a class="dropdown-item" href="{{ route('practice-management.rpm-manager') }}">RPM Manager</a>
+                        @endif
                         @if($pro->is_enrolled_as_mcp)
+                            <a class="dropdown-item" href="{{ route('practice-management.rpm-manager') }}">RPM Manager</a>
                         	<a class="dropdown-item" href="{{ route('practice-management.rpm-matrix-mcp') }}">RPM (MCP)</a>
                         @endif
                         @if($pro->is_considered_for_rmm)
+                            <a class="dropdown-item" href="{{ route('practice-management.rpm-manager') }}">RPM Manager</a>
                         	<a class="dropdown-item" href="{{ route('practice-management.rpm-matrix-rmm') }}">RPM (RMM)</a>
                         @endif
                         @if($pro->is_considered_for_rme)
+                            <a class="dropdown-item" href="{{ route('practice-management.rpm-manager') }}">RPM Manager</a>
                         	<a class="dropdown-item" href="{{ route('practice-management.rpm-matrix-rme') }}">RPM (RME)</a>
                         @endif
-                        @if( $pro->pro_type== 'ADMIN' || $pro->is_enrolled_as_mcp || $pro->is_considered_for_rmm || $pro->is_considered_for_rme || $pro->is_considered_for_dna)
+                         @if($pro->is_considered_for_rd_assignment)
+                        	<a class="dropdown-item" href="{{ route('practice-management.rpm-matrix-rme') }}">RPM (RD)</a>
+                            <a class="dropdown-item" href="{{ route('rd.client-ccm-rm-status') }}">Client RM Status</a>
+                            <a class="dropdown-item" href="{{ route('practice-management.myTickets') }}">My Tickets</a>
+                            <a class="dropdown-item" href="{{ route('practice-management.myTextShortcuts') }}">My Text Shortcuts</a>
+                            <a class="dropdown-item" href="{{ route('practice-management.myFavorites') }}">My Favorites</a>
+                            <a class="dropdown-item" href="{{ route('practice-management.my-flyers') }}">My Flyers</a>
+                            <a class="dropdown-item" href="{{ route('practice-management.financialTransactions') }}">Financial Transactions</a>
+                            <a class="dropdown-item" href="{{ route('practice-management.proCalendar') }}">Calendar</a>
+                            <a class="dropdown-item" href="{{ route('rd.rpmMatrix') }}">RPM Matrix</a>
+                            <a class="dropdown-item" href="{{ route('rd.notes') }}">Notes</a>
+                            <a class="dropdown-item" href="{{ route('rd.memos') }}">Memos</a>
+                            <a class="dropdown-item" href="{{ route('rd.bills') }}">Bills</a>
+                            <a class="dropdown-item" href="{{ route('rd.erx_and_orders') }}">ERx & Orders</a>
+                            <a class="dropdown-item" href="{{ route('rd.reports') }}">Reports</a>
+                            <a class="dropdown-item" href="{{ route('rd.supply_orders') }}">Supply Orders</a>
+                            <a class="dropdown-item" href="{{ route('rd.client_messages') }}">Client Messages</a>
+                            <a class="dropdown-item" href="{{ route('rd.patients_accounts_invites') }}">Patients Accounts Invites</a>
+                            <a class="dropdown-item" href="{{ route('rd.clients_bdt_devices') }}">Clients BDT Devices</a>
+                        @elseif( $pro->pro_type== 'ADMIN' || $pro->is_enrolled_as_mcp || $pro->is_considered_for_rmm || $pro->is_considered_for_rme || $pro->is_considered_for_dna)
                             <a class="dropdown-item" href="{{ route('practice-management.client-ccm-rm-status') }}">Client RM Status</a>
                             <a class="dropdown-item" href="{{ route('practice-management.myTickets') }}">My Tickets</a>
                             <a class="dropdown-item" href="{{ route('practice-management.myTextShortcuts') }}">My Text Shortcuts</a>

+ 14 - 0
routes/web.php

@@ -229,6 +229,20 @@ Route::middleware('pro.auth')->group(function () {
         Route::get('reports_pending_ack', [RdController::class, 'reportsPendingAck'])->name('reports_pending_ack');
         Route::get('supply_orders_pending_my_ack', [RdController::class, 'supplyOrdersPendingMyAck'])->name('supply_orders_pending_my_ack');
         Route::get('supply_orders_pending_hcp_approval', [RdController::class, 'supplyOrdersPendingHcpApproval'])->name('supply_orders_pending_hcp_approval');
+        Route::get('appointments', [RdController::class, 'appointments'])->name('appointments');
+        Route::get('client-ccm-rm-status', [RdController::class, 'clientCcmRmStatus'])->name('client-ccm-rm-status');
+        Route::get('rpm-matrix', [RdController::class, 'rpmMatrix'])->name('rpmMatrix');
+        Route::get('notes', [RdController::class, 'notes'])->name('notes');
+        Route::get('memos', [RdController::class, 'memos'])->name('memos');
+        Route::get('bills', [RdController::class, 'bills'])->name('bills');
+        Route::get('erx_and_orders', [RdController::class, 'erxAndOrders'])->name('erx_and_orders');
+        Route::get('reports', [RdController::class, 'reports'])->name('reports');
+        Route::get('supply_orders', [RdController::class, 'supplyOrders'])->name('supply_orders');
+        Route::get('client_messages', [RdController::class, 'clientMessages'])->name('client_messages');
+        Route::get('patients_accounts_invites', [RdController::class, 'patientsAccountsInvites'])->name('patients_accounts_invites');
+        Route::get('clients_bdt_devices', [RdController::class, 'clientsBdtDevices'])->name('clients_bdt_devices');
+        
+        
 
     });