Bläddra i källkod

fixed rm setup claim

= 3 år sedan
förälder
incheckning
38c9661da7
43 ändrade filer med 754 tillägg och 931 borttagningar
  1. 1 1
      app/Http/Controllers/GsheetController.php
  2. 0 9
      app/Http/Controllers/HomeController.php
  3. 1 1
      app/Http/Controllers/McpController.php
  4. 31 26
      app/Http/Controllers/PracticeManagementController.php
  5. 1 1
      app/Models/CareMonth.php
  6. 1 1
      app/Models/Client.php
  7. 1 1
      app/Models/Pro.php
  8. 1 1
      config/app.php
  9. 2 1
      public/css/style.css
  10. 2 2
      resources/views/app/admin/client-ccm-rm-status-table.blade.php
  11. 2 2
      resources/views/app/admin/client_ccm_rm_status_filters.blade.php
  12. 0 1
      resources/views/app/admin/patients-table-extended.blade.php
  13. 1 1
      resources/views/app/admin/patients-table.blade.php
  14. 0 4
      resources/views/app/dashboard-admin.blade.php
  15. 2 0
      resources/views/app/dashboard-mcp.blade.php
  16. 4 4
      resources/views/app/dna/patients-table.blade.php
  17. 2 2
      resources/views/app/mcp/dashboard/appointments-list.blade.php
  18. 2 7
      resources/views/app/mcp/dashboard/measurements-pending-stamping.blade.php
  19. 1 1
      resources/views/app/mcp/new_patients_awaiting_visit.blade.php
  20. 0 1
      resources/views/app/mcp/patients-table.blade.php
  21. 393 0
      resources/views/app/patient/care-month/_matrix-v2.blade.php
  22. 2 2
      resources/views/app/patient/care-month/_matrix.blade.php
  23. 153 0
      resources/views/app/patient/care-month/_vitals_graph_unified.blade.php
  24. 2 2
      resources/views/app/patient/care-month/_work_matrix.blade.php
  25. 29 201
      resources/views/app/patient/care-month/dashboard.blade.php
  26. 2 6
      resources/views/app/patient/dashboard.blade.php
  27. 37 62
      resources/views/app/patient/note/rm-setup.blade.php
  28. 0 430
      resources/views/app/patient/partials/rm-setup.blade.php
  29. 66 61
      resources/views/app/patient/rm-setup-form.blade.php
  30. 1 1
      resources/views/app/patient/segment-templates/disclaimers/edit.blade.php
  31. 1 1
      resources/views/app/patient/segment-templates/disclaimers/summary.blade.php
  32. 3 3
      resources/views/app/patient/settings.blade.php
  33. 1 1
      resources/views/app/practice-management/remote-monitoring-admin-row-markup.blade.php
  34. 0 40
      resources/views/app/practice-management/remote-monitoring-row-markup-by-pro-type.blade.php
  35. 0 8
      resources/views/app/practice-management/remote-monitoring-row-markup-for-admin.blade.php
  36. 1 1
      resources/views/app/practice-management/remote-monitoring-row-markup.blade.php
  37. 2 2
      resources/views/app/practice-management/rm-action-report.blade.php
  38. 0 17
      resources/views/app/practice-management/rpm-matrix-by-pro-type-table.blade.php
  39. 3 3
      resources/views/app/practice-management/rpm-matrix-by-pro-type.blade.php
  40. 0 3
      resources/views/app/practice-management/rpm-matrix-for-admin-table.blade.php
  41. 0 17
      resources/views/app/practice-management/rpm-matrix-for-admin.blade.php
  42. 2 2
      resources/views/layouts/patient-header.blade.php
  43. 1 1
      resources/views/layouts/template.blade.php

+ 1 - 1
app/Http/Controllers/GsheetController.php

@@ -22,7 +22,7 @@ class GsheetController extends Controller
        (mcp_pro.name_first || ' ' || mcp_pro.name_last) as mcp_pro_name,
        (rmm_pro.name_first || ' ' || rmm_pro.name_last) as rmm_pro_name,
        client.dob,
-       client.is_enrolled_in_rm,
+       care_month.is_client_enrolled_in_rm,
        client.most_recent_completed_mcp_note_date,
        client.most_recent_completed_mcp_note_id,
        mrmnote.effective_dateest::date as most_recent_completed_mcp_note_date_cm,

+ 0 - 9
app/Http/Controllers/HomeController.php

@@ -510,9 +510,6 @@ WHERE ((client.mcp_pro_id = {$performer->pro->id}) OR (client.rmm_pro_id = {$per
         );
         $keyNumbers['rmPatientsWithWhomCommNotDone'] = $count[0]->cnt;
 
-        // num measurements that need stamping
-        $keyNumbers['measurementsToBeStamped'] = $this->performer()->pro->getUnstampedMeasurementsFromCurrentMonth(true, null, null);
-
         if($performer->pro->pro_type === 'ADMIN') {
 
             // patients without coverage information
@@ -891,9 +888,6 @@ WHERE ((client.mcp_pro_id = {$performer->pro->id}) OR (client.rmm_pro_id = {$per
         );
         $keyNumbers['rmPatientsWithWhomCommNotDone'] = $count[0]->cnt;
 
-        // num measurements that need stamping
-        $keyNumbers['measurementsToBeStamped'] = $this->performer()->pro->getUnstampedMeasurementsFromCurrentMonth(true, null, null);
-
         if($performer->pro->pro_type === 'ADMIN') {
 
             // patients without coverage information
@@ -1346,9 +1340,6 @@ WHERE ((client.mcp_pro_id = {$performer->pro->id}) OR (client.rmm_pro_id = {$per
         );
         $keyNumbers['rmPatientsWithWhomCommNotDone'] = $count[0]->cnt;
 
-        // num measurements that need stamping
-        $keyNumbers['measurementsToBeStamped'] = $this->performer()->pro->getUnstampedMeasurementsFromCurrentMonth(true, null, null);
-
         if($performer->pro->pro_type === 'ADMIN') {
 
             // patients without coverage information

+ 1 - 1
app/Http/Controllers/McpController.php

@@ -465,7 +465,7 @@ FROM
     client join care_month on client.id = care_month.client_id
 WHERE
     care_month.start_date = '{$cmStartDate}'
-    AND client.is_enrolled_in_rm = 'YES'
+    AND care_month.is_client_enrolled_in_rm
     AND care_month.has_mcp_interacted_with_client_about_rm IS NOT TRUE
     AND care_month.mcp_pro_id = {$this->performer->pro->id}
     AND (client.client_engagement_status_category IS NULL OR client.client_engagement_status_category != 'DUMMY')

+ 31 - 26
app/Http/Controllers/PracticeManagementController.php

@@ -1243,7 +1243,7 @@ SELECT client.name_first, client.name_last,
        (client.name_first || ' ' || client.name_last) as client_name,
        client.uid as client_uid, 
        client.dob,
-       client.is_enrolled_in_rm,
+       care_month.is_client_enrolled_in_rm,
        client.most_recent_completed_mcp_note_date,
        client.most_recent_completed_mcp_note_id,
        mrmnote.effective_dateest::date as most_recent_completed_mcp_note_date_cm,
@@ -1311,7 +1311,7 @@ SELECT client.name_first, client.name_last,
        (client.name_first || ' ' || client.name_last) as client_name,
        client.uid as client_uid, 
        client.dob,
-       client.is_enrolled_in_rm,
+       care_month.is_client_enrolled_in_rm,
        client.most_recent_completed_mcp_note_date,
        client.most_recent_completed_mcp_note_id,
        mrmnote.effective_dateest::date as most_recent_completed_mcp_note_date_cm,
@@ -1371,7 +1371,7 @@ SELECT client.name_first, client.name_last,
        (client.name_first || ' ' || client.name_last) as client_name,
        client.uid as client_uid, 
        client.dob,
-       client.is_enrolled_in_rm,
+       care_month.is_client_enrolled_in_rm,
        client.most_recent_completed_mcp_note_date,
        client.most_recent_completed_mcp_note_id,
        mrmnote.effective_dateest::date as most_recent_completed_mcp_note_date_cm,
@@ -1431,7 +1431,7 @@ SELECT client.name_first, client.name_last,
        (client.name_first || ' ' || client.name_last) as client_name,
        client.uid as client_uid, 
        client.dob,
-       client.is_enrolled_in_rm,
+       care_month.is_client_enrolled_in_rm,
        client.most_recent_completed_mcp_note_date,
        client.most_recent_completed_mcp_note_id,
        mrmnote.effective_dateest::date as most_recent_completed_mcp_note_date_cm,
@@ -1555,10 +1555,10 @@ WHERE care_month.uid = '{$careMonthUid}' AND client.uid = '{$clientUid}'
         if(trim($request->input('f_rpm'))) {
             $v = trim($request->input('f_rpm'));
             if($v === 'yes') {
-                $conditions[] = "(client.is_enrolled_in_rm IS NOT NULL AND client.is_enrolled_in_rm = 'YES')";
+                $conditions[] = "(care_month.is_client_enrolled_in_rm IS TRUE)";
             }
             elseif($v === 'no') {
-                $conditions[] = "(client.is_enrolled_in_rm IS NULL OR client.is_enrolled_in_rm != 'YES')";
+                $conditions[] = "(care_month.is_client_enrolled_in_rm IS NOT TRUE)";
             }
         }
         if(trim($request->input('f_cell_bp'))) {
@@ -1628,10 +1628,10 @@ WHERE care_month.uid = '{$careMonthUid}' AND client.uid = '{$clientUid}'
         }
 
         if($request->input('not-enrolled')) {
-            $conditions[] = "(client.is_enrolled_in_rm != 'YES')";
+            $conditions[] = "(care_month.is_client_enrolled_in_rm IS NOT TRUE)";
         }
         else {
-            $conditions[] = "(client.is_enrolled_in_rm = 'YES')";
+            $conditions[] = "(care_month.is_client_enrolled_in_rm IS TRUE)";
         }
 
         $proTypeCondition = '';
@@ -1672,7 +1672,7 @@ SELECT client.name_first, client.name_last,
        (client.name_first || ' ' || client.name_last) as client_name,
        client.uid as client_uid, 
        client.dob,
-       client.is_enrolled_in_rm,
+       care_month.is_client_enrolled_in_rm,
        client.most_recent_completed_mcp_note_date,
        client.most_recent_completed_mcp_note_id,
        mrmnote.effective_dateest::date as most_recent_completed_mcp_note_date_cm,
@@ -1851,10 +1851,10 @@ WHERE
         if(trim($request->input('f_rpm'))) {
             $v = trim($request->input('f_rpm'));
             if($v === 'yes') {
-                $conditions[] = "(client.is_enrolled_in_rm IS NOT NULL AND client.is_enrolled_in_rm = 'YES')";
+                $conditions[] = "(care_month.is_client_enrolled_in_rm IS TRUE)";
             }
             elseif($v === 'no') {
-                $conditions[] = "(client.is_enrolled_in_rm IS NULL OR client.is_enrolled_in_rm != 'YES')";
+                $conditions[] = "(care_month.is_client_enrolled_in_rm IS NOT TRUE)";
             }
         }
         if(trim($request->input('f_cell_bp'))) {
@@ -1950,10 +1950,10 @@ WHERE
         }
 
         if($request->input('not-enrolled')) {
-            $conditions[] = "(client.is_enrolled_in_rm != 'YES')";
+            $conditions[] = "(care_month.is_client_enrolled_in_rm IS NOT TRUE)";
         }
         else {
-            $conditions[] = "(client.is_enrolled_in_rm = 'YES')";
+            $conditions[] = "(care_month.is_client_enrolled_in_rm IS TRUE)";
         }
 
         if($request->input('f_claim_closed')) {
@@ -2017,7 +2017,7 @@ SELECT client.name_first, client.name_last,
        client.uid as client_uid, 
        client.dob,
        client.age_in_years,
-       client.is_enrolled_in_rm,
+       care_month.is_client_enrolled_in_rm,
        client.most_recent_completed_mcp_note_date,
        client.most_recent_completed_mcp_note_id,
        client.cell_number,
@@ -2233,7 +2233,7 @@ WHERE
            (client.name_first || ' ' || client.name_last) as client_name,
            client.uid as client_uid, 
            client.dob,
-           client.is_enrolled_in_rm,
+           care_month.is_client_enrolled_in_rm,
            client.most_recent_completed_mcp_note_date,
            care_month.uid as care_month_uid,
            care_month.id as care_month_id,
@@ -2331,7 +2331,7 @@ SELECT client.name_first, client.name_last,
        client.uid as client_uid,
        client.chart_number, 
        client.dob,
-       client.is_enrolled_in_rm,
+       care_month.is_client_enrolled_in_rm,
        client.most_recent_completed_mcp_note_date,
        client.most_recent_completed_mcp_note_id,
        mrmnote.effective_dateest::date as most_recent_completed_mcp_note_date_cm,
@@ -2407,7 +2407,7 @@ WHERE
 SELECT count(*)
 FROM care_month join client on care_month.client_id = client.id
 WHERE
-      client.shadow_pro_id is null AND client.is_enrolled_in_rm = 'YES'
+      client.shadow_pro_id is null AND care_month.is_client_enrolled_in_rm IS TRUE
       AND EXTRACT(MONTH from care_month.start_date) = " . ($request->input('m') ?: 'EXTRACT(MONTH from now())') . "
       AND EXTRACT(YEAR from care_month.start_date) = " . ($request->input('y') ?: 'EXTRACT(YEAR from now())') . "
       " . (count($conditions) > 0 ? 'AND ' . implode(" AND ", $conditions) : '')
@@ -2421,7 +2421,7 @@ WHERE
         $conditions = [];
 
         $c_isMCP = "client.mcp_pro_id = {$performer->pro->id}";
-        $c_enrolledInRPM = "client.is_enrolled_in_rm = 'YES'";
+        $c_enrolledInRPM = "care_month.is_client_enrolled_in_rm IS TRUE";
         $c_hasDevice = "(SELECT COUNT(client_bdt_device.id) FROM client_bdt_device JOIN bdt_device bd on client_bdt_device.device_id = bd.id WHERE client_bdt_device.client_id = client.id) > 0";
         $c_lastVisitBefore90Days = "DATE_PART('day', care_month.start_date::timestamp - client.most_recent_completed_mcp_note_date::timestamp) > 90";
         $c_lastVisitWithin90Days = "DATE_PART('day', care_month.start_date::timestamp - client.most_recent_completed_mcp_note_date::timestamp) <= 90";
@@ -2475,7 +2475,7 @@ WHERE
     private function rpmConditionsAdmin($performer, $rc, $rc2) {
         $conditions = [];
 
-        $c_enrolledInRPM = "client.is_enrolled_in_rm = 'YES'";
+        $c_enrolledInRPM = "care_month.is_client_enrolled_in_rm IS TRUE";
         $c_hasDevice = "(SELECT COUNT(client_bdt_device.id) FROM client_bdt_device JOIN bdt_device bd on client_bdt_device.device_id = bd.id WHERE client_bdt_device.client_id = client.id) > 0";
         $c_lastVisitBefore90Days = "DATE_PART('day', care_month.start_date::timestamp - client.most_recent_completed_mcp_note_date::timestamp) > 90";
         $c_lastVisitWithin90Days = "DATE_PART('day', care_month.start_date::timestamp - client.most_recent_completed_mcp_note_date::timestamp) <= 90";
@@ -3771,12 +3771,12 @@ ORDER BY c.name_last, c.name_first
         $pro = $this->performer()->pro;
         if($pro->pro_type !== 'ADMIN') {
             if($pro->is_hcp){
-               $patients = $patients->where('mcp_pro_id', $this->performer()->pro->id); 
+               $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); 
+                $patients = $patients->where('default_na_pro_id', $this->performer()->pro->id);
              }
-            
+
 
         }
 
@@ -3839,8 +3839,8 @@ ORDER BY c.name_last, c.name_first
             $patients->where('is_eligible_for_rm', '=', $request->input('is_eligible_for_rm'));
         }
 
-        if($request->input('is_enrolled_in_rm')){
-            $patients->where('is_enrolled_in_rm', '=', $request->input('is_enrolled_in_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')){
@@ -3899,7 +3899,12 @@ ORDER BY c.name_last, c.name_first
             $conditions[] = "(c.is_eligible_for_rm = '" . $request->input('rm_eligible') . "')";
         }
         if($request->input('rm_enrolled')) {
-            $conditions[] = "(c.is_enrolled_in_rm = '" . $request->input('rm_enrolled') . "')";
+            if($request->input('rm_enrolled') === 'YES') {
+                $conditions[] = "(cm.is_client_enrolled_in_rm IS TRUE)";
+            }
+            else {
+                $conditions[] = "(cm.is_client_enrolled_in_rm IS NOT TRUE)";
+            }
         }
         if($request->input('rm_setup')) {
             $conditions[] = "(c.has_rm_setup_been_performed IS " . ($request->input('rm_setup') === 'YES' ? 'TRUE' : 'FALSE') . ")";
@@ -3976,7 +3981,7 @@ ORDER BY c.name_last, c.name_first
             cm.start_date,
             c.uid as client_uid,
             c.is_eligible_for_rm,
-            c.is_enrolled_in_rm,
+            cm.is_client_enrolled_in_rm,
             c.has_rm_setup_been_performed,
             (c.name_first || ' ' || c.name_last) as client_name,
             (mcp.name_first || ' ' || mcp.name_last) as mcp_name,

+ 1 - 1
app/Models/CareMonth.php

@@ -36,7 +36,7 @@ class CareMonth extends Model
     }
 
     public function entries() {
-        return $this->hasMany(CareMonthEntry::class, 'care_month_id', 'id');
+        return $this->hasMany(CareMonthEntry::class, 'care_month_id', 'id')->orderBy('effective_date', 'DESC');
     }
 
     public function bills() {

+ 1 - 1
app/Models/Client.php

@@ -314,9 +314,9 @@ class Client extends Model
     // returns the current care-month, if in fact patient is awaiting mcp rm interaction
     public function isAwaitingRMCommunicationFromMCP() {
         // if patient is enrolled in rm AND has current care month AND $careMonth->has_mcp_interacted_with_client_about_rm IS FALSE
-        if($this->is_enrolled_in_rm !== 'YES') return false;
         $careMonth = $this->currentCareMonth();
         if(!$careMonth) return false;
+        if(!$careMonth->is_client_enrolled_in_rm) return false;
         return $careMonth->has_mcp_interacted_with_client_about_rm ? false : $careMonth;
     }
 

+ 1 - 1
app/Models/Pro.php

@@ -745,7 +745,7 @@ FROM
     client join care_month on client.id = care_month.client_id
 WHERE
     care_month.start_date = '{$cmStartDate}'
-    AND client.is_enrolled_in_rm = 'YES'
+    AND care_month.is_client_enrolled_in_rm IS TRUE
     AND care_month.has_mcp_interacted_with_client_about_rm IS NOT TRUE
     AND care_month.mcp_pro_id = {$this->id}
     AND (client.client_engagement_status_category IS NULL OR client.client_engagement_status_category != 'DUMMY')

+ 1 - 1
config/app.php

@@ -65,7 +65,7 @@ return [
 
     'hrm2_url' => env('HRM2_URL'),
 
-    'asset_version' => 100,
+    'asset_version' => 101,
 
 
     'temp_dir' => env('TEMP_DIR'),

+ 2 - 1
public/css/style.css

@@ -1856,7 +1856,8 @@ button.note-templates-trigger-assessment {
 }
 .stag-chart .safe-region>text {
     fill: #888;
-    transform: translateY(-18px);
+    /*transform: translateY(-18px);*/
+    font-size: 90%;
 }
 
 .on-hover-text-reveal {

+ 2 - 2
resources/views/app/admin/client-ccm-rm-status-table.blade.php

@@ -111,8 +111,8 @@
 					@endif 
 				</td>
 				<td>
-					<div>{{$patient->is_enrolled_in_rm}}</div>
-					@if(!$patient->is_enrolled_in_rm)
+					<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>

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

@@ -160,7 +160,7 @@
 	<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">
+			<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>
@@ -214,7 +214,7 @@ $allFilterKeys = [
 	'sex',
 	'status',
 	'is_eligible_for_rm',
-	'is_enrolled_in_rm',
+	'is_enrolled_in_rm', // -- correct --
 	'has_rm_setup_been_performed',
 ];
 for ($i=0; $i < count($allFilterKeys); $i++) {

+ 0 - 1
resources/views/app/admin/patients-table-extended.blade.php

@@ -332,7 +332,6 @@
                 {{--<td><?= $patient->most_recent_cellular_bp_value_irregular ? '<i class="fa fa-heartbeat"></i>' : '' ?></td>--}}
                 {{--<td>{{ $patient->most_recent_cellular_bp_value_pulse }}</td>--}}
                 {{--<td>{{ $patient->most_recent_cellular_weight_value ? round($patient->most_recent_cellular_weight_value, 2) : '--' }}</td>--}}
-                {{-- <td>{{$patient->is_enrolled_in_rm ? 'Yes' : 'No'}}</td>--}}
                 {{--<td class="d-none text-nowrap">
                     <?php $m = $patient->lastMeasurementOfType('Wt. (lbs.)'); ?>
                     {{$m && $m->value ? round($m->value, 2) : '-'}}

+ 1 - 1
resources/views/app/admin/patients-table.blade.php

@@ -96,7 +96,7 @@
 
 				<td>{{ friendlier_date_time($patient->most_recent_cellular_weight_measurement_at, false) }}</td>
 
-				{{-- <td>{{$patient->is_enrolled_in_rm ? 'Yes' : 'No'}}</td>--}}
+
 				<td class="d-none text-nowrap">
 					<?php $m = $patient->lastMeasurementOfType('Wt. (lbs.)'); ?>
 					{{$m && $m->value ? round($m->value, 2) : '-'}}

+ 0 - 4
resources/views/app/dashboard-admin.blade.php

@@ -252,10 +252,6 @@
                         <div class="card-body p-0">
                             <table class="table mb-0 dashboard-stats-table">
                                 <tbody>
-                                <tr>
-                                    <th class="px-2 text-center">{{$pro->get_measurements_awaiting_review_count_as_mcp() ?? '-'}}</th>
-                                    <th class="pl-2 font-weight-normal">Measurements Pending Review</th>
-                                </tr>
                                 <tr>
                                     <th class="px-2 text-center">{{$pro->get_patients_without_remote_measurement_in_48_hours_count_as_mcp() ?? '-'}}</th>
                                     <th class="pl-2 font-weight-normal">Patients w/o Measurement in 48 hrs.</th>

+ 2 - 0
resources/views/app/dashboard-mcp.blade.php

@@ -429,6 +429,7 @@
                                 </div>
                             </div>
                             @endif--}}
+                            {{--
                             <div class="card mb-4">
                                 <div class="card-header pl-2">
                                     <strong>
@@ -448,6 +449,7 @@
                                     @include('app.mcp.dashboard.measurements-pending-stamping')
                                 </div>
                             </div>
+                            --}}
                             @if($pro->is_considered_for_supervising_physician)
                             <!-- ENCOUNTERS PENDING MY REVIEW -->
                             <div class="card mb-4">

+ 4 - 4
resources/views/app/dna/patients-table.blade.php

@@ -77,9 +77,9 @@
 			   <div class="">
 				   <div class="on-hover-show d-inline-block">
 					   <span>Enrolled:
-						   @if($patient->is_enrolled_in_rm === 'YES')
+						   @if($patient->is_enrolled_in_rm === 'YES') {{-- correct --}}
 							   <i class="fas fa-check-circle text-success" data-toggle="tooltip" data-placement="bottom" title="YES"></i>
-						   @elseif($patient->is_enrolled_in_rm === 'NO')
+						   @elseif($patient->is_enrolled_in_rm === 'NO') {{-- correct --}}
 							   <i
 									   class="fas fa-times-circle text-danger"
 									   tabindex="0"
@@ -87,7 +87,7 @@
 									   title="No"
 									   data-target="#enrollment-{{ $patient->uid }}"
 							   ></i>
-						   @elseif($patient->is_enrolled_in_rm === 'UNKNOWN')
+						   @elseif($patient->is_enrolled_in_rm === 'UNKNOWN') {{-- correct --}}
 							   <i
 									   tabindex="0"
 									   data-toggle="popover"
@@ -99,7 +99,7 @@
 						   @endif
 						</span>
 					   	<div id="enrollment-{{ $patient->uid }}" class="on-hover-content">
-						   	<h6 class="mt-2 font-weight-bold">{{ $patient->is_enrolled_in_rm }}</h6>
+						   	<h6 class="mt-2 font-weight-bold">{{ $patient->is_enrolled_in_rm }}</h6> {{-- correct --}}
 							<span>Is Eligible for RM: {{ $patient->is_eligible_for_rm }}</span><br>
 							<span>Why not eligible: {{ $patient->why_not_eligible_for_rm_category ?? '---' }}</span><br>
 							<span>{{ $patient->why_not_eligible_for_rm_memo }}</span>

+ 2 - 2
resources/views/app/mcp/dashboard/appointments-list.blade.php

@@ -1,5 +1,5 @@
 <div class="card overflow-hidden">
-    <div class="card-header pl-2">
+    <div class="card-header pl-2 border-bottom-0">
         <div class="font-weight-bold">
             @if(@$from)
                 Appointments for {{friendly_date($from)}}
@@ -8,7 +8,7 @@
             @endif
         </div>
     </div>
-    <div class="card-body p-0 max-height-200px overflow-auto">
+    <div class="card-body p-0 max-height-300px overflow-auto">
         @if(@$appointments && count($appointments))
             <table class="mb-0 table table-sm table-striped appointments border-top-0">
                 @foreach($appointments as $appointment)

+ 2 - 7
resources/views/app/mcp/dashboard/measurements-pending-stamping.blade.php

@@ -28,14 +28,9 @@
                     @endif
                 </td>
                 <td class="text-secondary">
-                    <a href="{{ route('practice-management.rpm_work_matrix') }}?patientUid={{$row->client->uid}}&careMonthUid={{$row->careMonth->uid}}"
+                    <a href="/mc/patients/view/{{$row->client->uid}}/care-months/view/{{$row->careMonth->uid}}"
                        native target="_blank"
-                       open-in-stag-popup
-                       update-parent
-                       update-target="#dashboard-measurements-pending-stamping"
-                       popup-style="tall overflow-visible"
-                       mc-initer="rpm-work-matrix"
-                       title="Care Month Matrix: {{date('M Y', strtotime($row->careMonth->start_date))}}">
+                       title="Care Month: {{date('M Y', strtotime($row->careMonth->start_date))}}">
                         {{ friendly_date_time_short_with_tz_from_timestamp_divide1000($row->ts, 'EASTERN') }} EST
                     </a>
                 </td>

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

@@ -48,7 +48,7 @@
                             <td>{{$row->lastMcpAppointment() ? @$row->lastMcpAppointment()->start_date : '-'}}</td>
                             <td>{{$row->nextMcpAppointment() ? @$row->nextMcpAppointment()->start_date : '-'}}</td>
                             <td>{{$row->nextMcpAppointment() ? @$row->nextMcpAppointment()->status : '-'}}</td>
-                            <td>{{$row->is_enrolled_in_rm ? 'Yes' : 'No'}}</td>
+                            <td>{{$row->currentCareMonth() && $row->currentCareMonth()->is_client_enrolled_in_rm ? 'Yes' : 'No'}}</td>
                             <td class="d-none">
                                 <?php $m = $row->lastMeasurementOfType('Wt. (lbs.)'); ?>
                                 {{$m && $m->value ? round($m->value, 2) : '-'}}

+ 0 - 1
resources/views/app/mcp/patients-table.blade.php

@@ -69,7 +69,6 @@
 
 				<td>{{ friendlier_date_time($patient->most_recent_cellular_weight_measurement_at, false) }}</td>
 
-				{{-- <td>{{$patient->is_enrolled_in_rm ? 'Yes' : 'No'}}</td>--}}
 				<td class="d-none text-nowrap">
 					<?php $m = $patient->lastMeasurementOfType('Wt. (lbs.)'); ?>
 					{{$m && $m->value ? round($m->value, 2) : '-'}}

+ 393 - 0
resources/views/app/patient/care-month/_matrix-v2.blade.php

@@ -0,0 +1,393 @@
+<?php
+
+$days = $patient->cmMeasurementsMatrix($careMonth, ($pro->pro_type === 'ADMIN' ? null : $pro));
+
+$performerRole = false;
+if ($pro->pro_type === 'ADMIN') {
+    $performerRole = 'ADMIN';
+} else if ($careMonth->mcp_pro_id === $pro->id) {
+    $performerRole = 'MCP';
+} else if ($careMonth->rme_pro_id === $pro->id || $careMonth->rmm_pro_id === $pro->id) {
+    $performerRole = 'NON-HCP';
+}
+
+$unstampedMCP = [];
+$unstampedNonHCP = [];
+foreach ($days as $k => $day) {
+    $unstampedMCP[$k] = [];
+    $unstampedNonHCP[$k] = [];
+    foreach ($days[$k] as $mIndex => $m) {
+        if(!$m->has_been_stamped_by_mcp) {
+            $unstampedMCP[$k][] = $m->measurement_uid;
+        }
+        if(!$m->has_been_stamped_by_non_hcp) {
+            $unstampedNonHCP[$k][] = $m->measurement_uid;
+        }
+    }
+}
+
+?>
+
+<div id="cm-matrix-{{$patient->id}}">
+@if(!@$onlyMatrix)
+<div class="d-flex align-items-baseline mb-3" tab-links>
+    <a class="tab-link-active" href="#" tab-link="time-entries">Time Entries</a>
+    <a class="" href="#" tab-link="bmi-summary">BMI/Weight Management Settings</a>
+    <a class="" href="#" tab-link="bp-summary">BP Management Settings</a>
+</div>
+@endif
+<div class="my-3 border p-3 cm-tab" tab-key="time-entries">
+    @if($careMonth->is_client_enrolled_in_rm)
+        <div class="d-flex align-items-center">
+            <h6 class="my-0 text-secondary font-weight-bold text-dark lh-24px">Time Entries</h6>
+            @if(!$activeRMBill)
+                <span class="mx-2 text-secondary">|</span>
+                <div moe large>
+                    <a start show class="py-0 mb-3">Add</a>
+                    <form url="/api/careMonthEntry/createForRm">
+                        <input type="hidden" name="careMonthUid" value="{{ $careMonth->uid }}">
+                        <div class="mb-2">
+                            <div class="row">
+                                <div class="col-4 pr-0">
+                                    <select class="form-control form-control-sm w-100" name="proUid" provider-search data-pro-uid="{{ @$pro->uid }}"
+                                            required>
+                                        <option value="">-- Select Pro --</option>
+                                        @foreach($pros as $iPro)
+                                            <option {{ $iPro->uid === $pro->uid ? 'selected' : '' }}
+                                                    value="{{ $iPro->uid }}">{{ $iPro->displayName() }}</option>
+                                        @endforeach
+                                    </select>
+                                </div>
+                                <div class="col-4 pr-0">
+                                    <?php
+                                    $sD = strtotime($careMonth->start_date);
+                                    $y = date('Y', $sD);
+                                    $m = date('m', $sD);
+                                    $d = date('t', $sD);
+                                    $yCurrent = date('Y');
+                                    $mCurrent = date('m');
+                                    $isToday = false;
+                                    if($y === $yCurrent && $m === $mCurrent) {
+                                        $d = date('d');
+                                        $isToday = true;
+                                    }
+                                    ?>
+                                    <input autofocus type="date" min="{{ date($y . '-' . $m . '-01') }}" max="{{ date($y . '-' . $m . '-' . $d) }}"
+                                           value="{{date('Y-m-d')}}"
+                                           class="form-control form-control-sm w-100" name="effectiveDate"
+                                           placeholder="Effective Date" required>
+                                </div>
+                                <div class="col-4">
+                                    <select name="timeInSeconds" class="form-control form-control-sm w-100 cm-time-value" required>
+                                        <option value="">-- Minutes --</option>
+                                        <option value="60">1 minute</option>
+                                        <option value="300">5 minutes</option>
+                                        <option value="600">10 minutes</option>
+                                        <option value="1200">20 minutes</option>
+                                    </select>
+                                </div>
+                            </div>
+                        </div>
+                        <div class="mb-2 border border-info p-2 mt-2 bg-light">
+                            <span><i class="fa fa-phone rotateh text-dark mr-1"></i>This time entry involved interactive communication (audio, video, or in-person) with the patient and/or caretaker.</span>
+                            <div class="d-flex border-top mt-2">
+                                <label class="mt-2 mb-0 d-inline-flex align-items-center mr-3">
+                                    <input type="radio" class="mr-2" name="didProInteractWithClientAboutRm" value="true" required>
+                                    <span>Yes</span>
+                                </label>
+                                <label class="mt-2 mb-0 d-inline-flex align-items-center">
+                                    <input type="radio" class="mr-2" name="didProInteractWithClientAboutRm" value="false" required>
+                                    <span>No</span>
+                                </label>
+                            </div>
+                        </div>
+                        <div class="mb-2">
+                            <div class="row">
+                                <div class="col-12">
+                                    <div cm-rte data-content="Reviewed/managed patient measurements" data-name="contentText"></div>
+                                </div>
+                            </div>
+                        </div>
+                        <div class="d-flex align-items-center">
+                            <button class="btn btn-sm btn-primary mr-2" submit>Save</button>
+                            <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
+                        </div>
+                    </form>
+                </div>
+            @else
+                <span class="mx-2 text-secondary">|</span>
+                <span class="text-secondary">Can't modify since a bill exists</span>
+            @endif
+        </div>
+        <table class="table table-striped table-sm table-bordered mt-2 mb-0 table-hover">
+            <thead>
+            <tr>
+                <th class="px-2 text-secondary border-bottom-0">Effective Date</th>
+                <th class="px-2 text-secondary border-bottom-0">Time</th>
+                <th class="px-2 text-secondary border-bottom-0">Created</th>
+                <th class="px-2 text-secondary border-bottom-0">Communicated</th>
+                <th class="px-2 text-secondary border-bottom-0 w-50">Comments</th>
+                <th class="px-2 text-secondary border-bottom-0 delete-column">&nbsp;</th>
+            </tr>
+            </thead>
+            <tbody>
+            @foreach($careMonth->entries as $entry)
+                @if(!$entry->is_removed && $entry->cm_or_rm === "RM")
+                    <tr>
+                        <td class="px-2">
+                            <div class="font-weight-bold">{{friendly_date_time($entry->effective_date, false)}}</div>
+                        </td>
+                        <td class="px-2">
+                            {{time_in_hrminsec($entry->time_in_seconds)}}
+                        </td>
+                        <td class="px-2">
+                            {{friendly_date_time($entry->created_at)}}
+                        </td>
+                        <td class="px-2">
+                            {{$entry->did_pro_interact_with_client_about_rm ? 'Yes' : 'No'}}
+                        </td>
+                        <td class="px-2">
+                            <div class="text-secondary in-table-markup">{!! $entry->content_text !!}</div>
+                            <!--                                        <div class="text-secondary text-sm">{{$entry->content_detail}}</div>-->
+                        </td>
+                        <td class="px-2 text-right">
+                            @if(!$activeRMBill)
+                                <div moe large class="mr-2">
+                                    <a start show class="py-0 mb-3">Edit</a>
+                                    <form url="/api/careMonthEntry/updateSimpleForRm" right>
+                                        <input type="hidden" name="uid" value="{{ $entry->uid }}">
+                                        <div class="mb-2">
+                                            <div class="row">
+                                                <div class="col-4 pr-0">
+                                                    <select class="form-control form-control-sm w-100" name="proUid" provider-search data-pro-uid="{{ @$entry->pro->uid }}"
+                                                            required>
+                                                        <option value="">-- Select Pro --</option>
+                                                        @foreach($pros as $iPro)
+                                                            <option {{ $iPro->uid === $pro->uid ? 'selected' : '' }}
+                                                                    value="{{ $iPro->uid }}">{{ $iPro->displayName() }}</option>
+                                                        @endforeach
+                                                    </select>
+                                                </div>
+                                                <div class="col-4 pr-0">
+                                                    <?php
+                                                    $sD = strtotime($careMonth->start_date);
+                                                    $y = date('Y', $sD);
+                                                    $m = date('m', $sD);
+                                                    $d = date('t', $sD);
+                                                    $yCurrent = date('Y');
+                                                    $mCurrent = date('m');
+                                                    $isToday = false;
+                                                    if($y === $yCurrent && $m === $mCurrent) {
+                                                        $d = date('d');
+                                                        $isToday = true;
+                                                    }
+                                                    ?>
+                                                    <input autofocus type="date" min="{{ date($y . '-' . $m . '-01') }}" max="{{ date($y . '-' . $m . '-' . $d) }}"
+                                                           value="{{$entry->effective_date}}"
+                                                           class="form-control form-control-sm w-100" name="effectiveDate"
+                                                           placeholder="Effective Date" required>
+                                                </div>
+                                                <div class="col-4">
+                                                    <select name="timeInSeconds" class="form-control form-control-sm w-100 cm-time-value" required>
+                                                        <option value="">-- Minutes --</option>
+                                                        <option value="60" {{$entry->time_in_seconds === 60 ? 'selected' : ''}}>1:00</option>
+                                                        <option value="75" {{$entry->time_in_seconds === 75 ? 'selected' : ''}}>1:15</option>
+                                                        <option value="300" {{$entry->time_in_seconds === 300 ? 'selected' : ''}}>5:00</option>
+                                                        <option value="600" {{$entry->time_in_seconds === 600 ? 'selected' : ''}}>10:00</option>
+                                                        <option value="1200" {{$entry->time_in_seconds === 1200 ? 'selected' : ''}}>20:00</option>
+                                                    </select>
+                                                </div>
+                                            </div>
+                                        </div>
+                                        <div class="mb-2 border border-info p-2 mt-2 bg-light text-left">
+                                            <span><i class="fa fa-phone rotateh text-dark mr-1"></i>This time entry involved interactive communication (audio, video, or in-person) with the patient and/or caretaker.</span>
+                                            <div class="d-flex border-top mt-2">
+                                                <label class="mt-2 mb-0 d-inline-flex align-items-center mr-3">
+                                                    <input type="radio" class="mr-2" name="didProInteractWithClientAboutRm" value="true" {{$entry->did_pro_interact_with_client_about_rm ? 'checked' : ''}} required>
+                                                    <span>Yes</span>
+                                                </label>
+                                                <label class="mt-2 mb-0 d-inline-flex align-items-center">
+                                                    <input type="radio" class="mr-2" name="didProInteractWithClientAboutRm" value="false" {{$entry->did_pro_interact_with_client_about_rm ? '' : 'checked' }} required>
+                                                    <span>No</span>
+                                                </label>
+                                            </div>
+                                        </div>
+                                        <div class="mb-2">
+                                            <div class="row">
+                                                <div class="col-12">
+                                                    <div cm-rte data-name="contentText">{!! $entry->content_text !!}</div>
+                                                </div>
+                                            </div>
+                                        </div>
+                                        <div class="d-flex align-items-center">
+                                            <button class="btn btn-sm btn-primary mr-2" submit>Save</button>
+                                            <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
+                                        </div>
+                                    </form>
+                                </div>
+                                <div moe relative>
+                                    <a start show class="text-danger">Delete</a>
+                                    <form url="/api/careMonthEntry/remove" right class="text-left">
+                                        <input type="hidden" name="uid" value="{{ $entry->uid }}">
+                                        <p class="small">Are you sure you want to delete this RM entry?</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>
+                            @else
+                                <span class="text-sm text-secondary">Can't modify since a bill exists</span>
+                            @endif
+                        </td>
+                    </tr>
+                @endif
+            @endforeach
+            </tbody>
+        </table>
+    @else
+        <h6 class="mb-2 text-secondary font-weight-bold text-dark lh-24px">Time Entries</h6>
+        <div class="alert alert-secondary mt-2 mb-0">
+            <b>{{ $patient->displayName() }}</b> is not enrolled in <b>RM</b> for this care month.
+            <span moe class="">
+                    <a start show class="font-weight-bold">Enroll Now</a>
+                    <form url="/api/careMonth/setIsClientEnrolledInRmToTrue">
+                        <input type="hidden" name="uid" value="{{ $careMonth->uid }}">
+                        <p class="small">Enroll this client in RM?</p>
+                        <div class="d-flex align-items-center">
+                            <button class="btn btn-sm btn-primary mr-2" submit>Yes</button>
+                            <button class="btn btn-sm btn-default mr-2 border" cancel>No</button>
+                        </div>
+                    </form>
+                </span>
+        </div>
+    @endif
+</div>
+<div class="my-3 border p-3 d-none cm-tab" tab-key="bmi-summary">
+    <div class="d-flex align-items-baseline mb-2">
+        <b>BMI/Weight Management</b>
+        <span class="mx-2 text-secondary">|</span>
+        @include('app.patient.vitals-settings.bmi-management-form')
+    </div>
+    @include('app.patient.vitals-settings.bmi-management-summary')
+</div>
+<div class="my-3 border p-3 d-none cm-tab" tab-key="bp-summary">
+    <div class="d-flex align-items-baseline mb-2">
+        <b>BP Management</b>
+        <span class="mx-2 text-secondary">|</span>
+        @include('app.patient.vitals-settings.bp-management-form')
+    </div>
+    @include('app.patient.vitals-settings.bp-management-summary')
+</div>
+</div>
+<script>
+    (function() {
+        function init() {
+
+            $('.btn-stamp')
+                .off('click')
+                .on('click', function () {
+                    let form = $(this).closest('form');
+                    if(!form[0].checkValidity()) {
+                        form[0].reportValidity();
+                        return false;
+                    }
+
+                    showMask();
+
+                    let payload = {
+                        uid: form.find('[name="uid"]').val(),
+                        memo: form.find('[name="memo"]').val(),
+                    }
+
+                    $.ajax({
+                        url: form.attr('url'),
+                        type:"POST",
+                        data: JSON.stringify(payload),
+                        contentType:"application/json; charset=utf-8",
+                        dataType:"json",
+                        success: function(_data) {
+                            if(!hasResponseError(_data)) {
+                                if(form.closest('.stag-popup').length) {
+                                    refreshDynamicStagPopup();
+                                }
+                                else {
+                                    fastReload();
+                                }
+                            }
+                        }
+                    }).then(() => {
+                        hideMask();
+                    });
+                    return false;
+                });
+
+            $('.btn-bulk-stamp')
+                .off('click')
+                .on('click', function () {
+                    let form = $(this).closest('form');
+                    if(!form[0].checkValidity()) {
+                        form[0].reportValidity();
+                        return false;
+                    }
+
+                    showMask();
+
+                    let payload = {
+                        clientUid: '{{$patient->uid}}',
+                        toStamp: form.find('.measurements-uids').val().split('|').map(_x => {
+                            return {
+                                measurementUid: _x,
+                                memo: null,
+                                detailJson: null
+                            }
+                        }),
+                        shouldAddEntry: form.find('.shouldAddEntry').prop('checked') ? 1 : 0,
+                        entryDate: form.find('[name="entryDate"]').val(),
+                        entryMemo: form.find('[name="entryMemo"]').val(),
+                        entryNumberOfSeconds: form.find('[name="entryNumberOfSeconds"]').val() ? +(form.find('[name="entryNumberOfSeconds"]').val()) : 0
+                    }
+
+                    if(form.find('[name="didProInteractWithClientAboutRm"]:checked').length) {
+                        payload.didProInteractWithClientAboutRm = (form.find('[name="didProInteractWithClientAboutRm"]:checked').val() === 'true');
+                    }
+
+                    $.ajax({
+                        url: form.attr('url'),
+                        type:"POST",
+                        data: JSON.stringify(payload),
+                        contentType:"application/json; charset=utf-8",
+                        dataType:"json",
+                        success: function(_data) {
+                            if(!hasResponseError(_data)) {
+                                if(form.closest('.stag-popup').length) {
+                                    refreshDynamicStagPopup();
+                                }
+                                else {
+                                    fastReload();
+                                }
+                            }
+                        }
+                    }).then(() => {
+                        hideMask();
+                    });
+                    return false;
+                });
+
+            $('.shouldAddEntry')
+                .off('change')
+                .on('change', function () {
+                    let form = $(this).closest('form');
+                    if(this.checked) {
+                        form.find('.if-adding-time-entry').removeClass('d-none');
+                    }
+                    else {
+                        form.find('.if-adding-time-entry').addClass('d-none');
+                    }
+                    return false;
+                })
+                .trigger('change');
+        }
+        addMCInitializer('cm-matrix-{{$patient->id}}', init, '#cm-matrix-{{$patient->id}}');
+    }).call(window);
+</script>

+ 2 - 2
resources/views/app/patient/care-month/_matrix.blade.php

@@ -204,7 +204,7 @@ foreach ($days as $k => $day) {
                                         $dayTotalMinutes += round($entry->time_in_seconds / 60);
                                     }
                                     $autoCheckEntry = false;
-                                    $autoCheckEntry = ($dayTotalMinutes < 2 && $patient->is_enrolled_in_rm);
+                                    $autoCheckEntry = ($dayTotalMinutes < 2 && $careMonth->is_client_enrolled_in_rm);
                                     ?>
                                     <div class="mb-2">
                                         <div class="mb-2">
@@ -275,7 +275,7 @@ foreach ($days as $k => $day) {
                                         $dayTotalMinutes += round($entry->time_in_seconds / 60);
                                     }
                                     $autoCheckEntry = false;
-                                    $autoCheckEntry = ($dayTotalMinutes < 2 && $patient->is_enrolled_in_rm);
+                                    $autoCheckEntry = ($dayTotalMinutes < 2 && $careMonth->is_client_enrolled_in_rm);
                                     ?>
                                     <div class="p-2 border border-info bg-light mb-2">
                                         <div class="mb-2">

+ 153 - 0
resources/views/app/patient/care-month/_vitals_graph_unified.blade.php

@@ -0,0 +1,153 @@
+
+    <link href="/c3/c3.min.css" rel="stylesheet">
+    <script src="/c3/d3.v5.min.js" charset="utf-8"></script>
+    <script src="/c3/c3.min.js"></script>
+
+    <div id="vitalsGraphComponentUnified" class="stag-chart mb-4 pt-3">
+        <div id="unified-chart">Unified Graph</div>
+    </div>
+
+    <?php
+    $dates = [];
+    $startDate = $careMonth->start_date;
+    $nextMonthFirstDay = date_format(date_add(date_create($startDate), date_interval_create_from_date_string("1 month")), 'Y-m-d');
+
+    $nextDay = $startDate;
+    while ($nextDay !== $nextMonthFirstDay) {
+        $dates[] = $nextDay;
+        $nextDay = date_format(date_add(date_create($nextDay), date_interval_create_from_date_string('1 day')), 'Y-m-d');
+    }
+
+    /** @var \App\Models\Client $patient */
+
+    // BP
+    $bpMeasurements = $patient->getNonZeroBpMeasurements->toArray();
+    $weightMeasurements = $patient->getNonZeroWeightMeasurements->toArray();
+
+    $bpData = [];
+    $weightData = [];
+
+    for ($i=0; $i<count($dates); $i++) {
+
+        $date = $dates[$i];
+
+        // bp
+        $bp = array_filter($bpMeasurements, function($_measurement) use ($date) {
+            return $_measurement['effective_date'] === $date;
+        });
+        if(count($bp)) {
+            $bp = array_values($bp);
+            $bp = $bp[count($bp) - 1];
+        }
+        else {
+            $bp = null;
+        }
+
+
+        if ($bp) {
+            $bpData[] = [
+                "date" => $date,
+                "sbp" => $bp["sbp_mm_hg"],
+                "dbp" => $bp["dbp_mm_hg"]
+            ];
+        }
+
+        // weight
+        $weight = array_filter($weightMeasurements, function($_measurement) use ($date) {
+            return $_measurement['effective_date'] === $date;
+        });
+        if(count($weight)) {
+            $weight = array_values($weight);
+            $weight = $weight[count($weight) - 1];
+            $weightData[] = [
+                "date" => $date,
+                "weight" => $weight["numeric_value"]
+            ];
+        }
+
+    }
+
+    $bpDates = [];
+    $sbpValues = [];
+    $dbpValues = [];
+    for ($i = 0; $i < count($bpData); $i++) {
+        $bpDates[] = $bpData[$i]['date'];
+        $sbpValues[] = round($bpData[$i]['sbp'], 1);
+        $dbpValues[] = round($bpData[$i]['dbp'], 1);
+    }
+
+    $weightDates = [];
+    $weightValues = [];
+    for ($i = 0; $i < count($weightData); $i++) {
+        $weightDates[] = $weightData[$i]['date'];
+        $weightValues[] = round($weightData[$i]['weight'], 1);
+    }
+
+    ?>
+
+    <script>
+        (function() {
+            function init() {
+                unifiedChart();
+            }
+            function unifiedChart() {
+
+                window.vgBPChart = c3.generate({
+                    bindto: '#unified-chart',
+                    data: {
+                        xs: {
+                            'Systolic BP' : 'x1',
+                            'Diastolic BP' : 'x1',
+                            'Weight': 'x2',
+                        },
+                        axes: {
+                            'Systolic BP' : 'y',
+                            'Diastolic BP' : 'y',
+                            'Weight': 'y2',
+                        },
+                        columns: [
+                            ['x1', <?= implode(", ", array_map(function($_x) { return "'" . $_x . "'"; }, $bpDates)) ?>],
+                            ['x2', <?= implode(", ", array_map(function($_x) { return "'" . $_x . "'"; }, $weightDates)) ?>],
+                            ['Systolic BP', <?= implode(", ", array_map(function($_x) { return "'" . $_x . "'"; }, $sbpValues)) ?>],
+                            ['Diastolic BP', <?= implode(", ", array_map(function($_x) { return "'" . $_x . "'"; }, $dbpValues)) ?>],
+                            ['Weight', <?= implode(", ", array_map(function($_x) { return "'" . $_x . "'"; }, $weightValues)) ?>]
+                        ]
+                    },
+                    axis: {
+                        x: {
+                            type: 'timeseries',
+                            tick: {
+                                format: '%Y-%m-%d',
+                                multiline: true,
+                                fit: true,
+                                rotate: -45
+                            },
+                        },
+                        y: {
+                            show: true,
+                            label: {
+                                text: 'Blood Pressure (mmHg)',
+                                position: 'outer-middle'
+                            },
+                            min: 60,
+                            max: 220
+                        },
+                        y2: {
+                            show: true,
+                            label: {
+                                text: 'Weight (lbs)',
+                                position: 'outer-middle'
+                            },
+                            min: 80,
+                            max: 280
+                        },
+                    },
+                    regions: [
+                        {axis: 'y', start: 100, end: 130, class: 'safe-region', label: 'Safe Systolic BP: 100 to 130 mmHg'},
+                        {axis: 'y', start: 60, end: 90, class: 'safe-region', label: 'Safe Diastolic BP: 60 to 90 mmHg'}
+                    ]
+                });
+            }
+            addMCInitializer('vitalsGraphUnified', init, '#vitalsGraphComponentUnified');
+        }).call(window);
+    </script>

+ 2 - 2
resources/views/app/patient/care-month/_work_matrix.blade.php

@@ -229,7 +229,7 @@ $days = $daysWithUnstamped;
                                             $dayTotalMinutes += round($entry->time_in_seconds / 60);
                                         }
                                         $autoCheckEntry = false;
-                                        $autoCheckEntry = ($dayTotalMinutes < 2 && $patient->is_enrolled_in_rm);
+                                        $autoCheckEntry = ($dayTotalMinutes < 2 && $careMonth->is_client_enrolled_in_rm);
                                         ?>
                                         <div class="mb-2">
                                             <div class="mb-2">
@@ -300,7 +300,7 @@ $days = $daysWithUnstamped;
                                             $dayTotalMinutes += round($entry->time_in_seconds / 60);
                                         }
                                         $autoCheckEntry = false;
-                                        $autoCheckEntry = ($dayTotalMinutes < 2 && $patient->is_enrolled_in_rm);
+                                        $autoCheckEntry = ($dayTotalMinutes < 2 && $careMonth->is_client_enrolled_in_rm);
                                         ?>
                                         <div class="p-2 border border-info bg-light mb-2">
                                             <div class="mb-2">

+ 29 - 201
resources/views/app/patient/care-month/dashboard.blade.php

@@ -162,8 +162,6 @@
         <hr class="m-negator mt-0">
 
         <?php
-        $entries = $careMonth->entries;
-
         $rmBills = $careMonth->getBillsOfType('RM');
         $activeRMBill = false;
         $cancelledRMBills = new \Illuminate\Support\Collection();
@@ -188,8 +186,12 @@
                         <div class="row mb-3">
                             <div class="col-9">
                                 <div class="d-flex align-items-baseline mb-3" tab-links>
-                                    <a class="tab-link-active" href="#" tab-link="measurements-calendar">Calendar</a>
-                                    <a class="" href="#" tab-link="measurements-graph">Graph</a>
+                                    <a class="tab-link-active" href="#" tab-link="measurements-graph">Graph</a>
+                                    <a class="" href="#" tab-link="measurements-calendar">Calendar</a>
+                                </div>
+
+                                <div class="cm-tab border pr-4" tab-key="measurements-graph">
+                                    @include('app.patient.care-month._vitals_graph_unified')
                                 </div>
 
                                 <div class="cm-tab" tab-key="measurements-calendar">
@@ -198,9 +200,6 @@
                                     </div>
                                 </div>
 
-                                <div class="d-none cm-tab border pr-4" tab-key="measurements-graph">
-                                    @include('app.patient.care-month._vitals_graph')
-                                </div>
                             </div>
                             <div class="col-3 px-0">
 
@@ -381,7 +380,18 @@
                                                     </div>
                                                 </form>
                                             </div>
-                                        @endif 
+                                        @endif
+                                        <div moe relative class="d-inline-block text-sm ml-2">
+                                            <a class="font-weight-normal text-danger" href="" show start>Cancel</a>
+                                            <form url="/api/bill/markCancelled" right>
+                                                <input type="hidden" name="uid" value="{{$careMonth->mcpRmGenericBill->uid}}">
+                                                <p class="text-dark font-weight-normal">Cancel this bill?</p>
+                                                <div class="mb-0">
+                                                    <button class="btn btn-primary btn-sm" submit>Cancel</button>
+                                                    <button class="btn btn-default border btn-sm" cancel>Cancel</button>
+                                                </div>
+                                            </form>
+                                        </div>
                                     </div>
                                 @endif
                                     </div>
@@ -397,7 +407,7 @@
                         </div>
                     </div>
 
-                    @include('app.patient.care-month._matrix')
+                    @include('app.patient.care-month._matrix-v2')
 
                     <table class="table table-striped table-sm table-bordered mt-2 mb-0 d-none">
                         <thead>
@@ -604,7 +614,6 @@
             </div>
         </div> --}}
 
-        <hr class="m-negator mt-4 mb-3">
         @include('app.patient.rm-setup-form')
 
         @if($pro->pro_type === 'ADMIN')
@@ -745,197 +754,13 @@
             </div>
         @endif
 
-        <hr class="m-negator mt-0 mb-3">
-
-        {{-- RM --}}
-        <div class="row">
-            <div class="col-12">
-                @if($careMonth->is_client_enrolled_in_rm)
-                    <div class="d-flex align-items-center">
-                        <h6 class="my-0 text-secondary font-weight-bold text-dark lh-24px">Time Entries</h6>
-                        @if(!$activeRMBill)
-                            <span class="mx-2 text-secondary">|</span>
-                            <span moe large>
-                                <a start show class="py-0 mb-3">Add</a>
-                                <form url="/api/careMonthEntry/createForRm">
-                                    <input type="hidden" name="careMonthUid" value="{{ $careMonth->uid }}">
-                                    <div class="mb-2">
-                                        <div class="row">
-                                            <div class="col-4 pr-0">
-                                                <select class="form-control form-control-sm w-100" name="proUid" provider-search data-pro-uid="{{ @$pro->uid }}"
-                                                        required>
-                                                    <option value="">-- Select Pro --</option>
-                                                    @foreach($pros as $iPro)
-                                                        <option {{ $iPro->uid === $pro->uid ? 'selected' : '' }}
-                                                                value="{{ $iPro->uid }}">{{ $iPro->displayName() }}</option>
-                                                    @endforeach
-                                                </select>
-                                            </div>
-                                            <div class="col-4 pr-0">
-                                                <?php
-                                                $sD = strtotime($careMonth->start_date);
-                                                $y = date('Y', $sD);
-                                                $m = date('m', $sD);
-                                                $d = date('t', $sD);
-                                                $yCurrent = date('Y');
-                                                $mCurrent = date('m');
-                                                $isToday = false;
-                                                if($y === $yCurrent && $m === $mCurrent) {
-                                                    $d = date('d');
-                                                    $isToday = true;
-                                                }
-                                                ?>
-                                                <input autofocus type="date" min="{{ date($y . '-' . $m . '-01') }}" max="{{ date($y . '-' . $m . '-' . $d) }}"
-                                                       value="{{date('Y-m-d')}}"
-                                                       class="form-control form-control-sm w-100" name="effectiveDate"
-                                                       placeholder="Effective Date" required>
-                                            </div>
-                                            <div class="col-4">
-                                                <input type="number" min="75"  class="form-control form-control-sm w-100 cm-time-value" name="timeInSeconds"
-                                                       value="" placeholder="Time (secs.)" required>
-                                            </div>
-                                        </div>
-                                    </div>
-                                    {{--<div class="mb-2">
-                                        <div class="row">
-                                            <div class="col-4 pr-0 d-flex align-items-center">
-                                                <div class="d-flex align-items-center">
-                                                    <span>Time Specific:</span>
-                                                    <input type="checkbox" name="isTimeSpecific" class="ml-1"
-                                                           onchange="enableTimeSpecificFields(this.checked, 'rm-time-value', 'rm-time-range')">
-                                                </div>
-                                            </div>
-                                            <div class="col-4 pr-0">
-                                                <input type="time" class="form-control form-control-sm rm-time-range" name="startingTime"
-                                                       value="" placeholder="Starting Time" disabled>
-                                            </div>
-                                            <div class="col-4">
-                                                <input type="time" class="form-control form-control-sm rm-time-range" name="endingTime"
-                                                       value="" placeholder="Ending Time" disabled>
-                                            </div>
-                                        </div>
-                                    </div>--}}
-                                    <div class="mb-2 border border-info p-2 mt-2 bg-light">
-                                        <span>I have had interactive communication with <b>{{$careMonth->client->displayName()}}</b>.</span>
-                                        <div class="d-flex border-top mt-2">
-                                            <label class="mt-2 mb-0 d-inline-flex align-items-center mr-3">
-                                                <input type="radio" class="mr-2" name="didProInteractWithClientAboutRm" value="true" required>
-                                                <span>Yes</span>
-                                            </label>
-                                            <label class="mt-2 mb-0 d-inline-flex align-items-center">
-                                                <input type="radio" class="mr-2" name="didProInteractWithClientAboutRm" value="false" required>
-                                                <span>No</span>
-                                            </label>
-                                        </div>
-                                    </div>
-                                                                        {{--@include('app/entry-templates/rm/default')--}}
-                                    <div class="mb-2">
-                                        <div class="row">
-                                            <div class="col-12">
-                                                <div cm-rte data-content="Reviewed/managed patient measurements" data-name="contentText"></div>
-                                            </div>
-                                        </div>
-                                    </div>
-                                    <div class="d-flex align-items-center">
-                                        <button class="btn btn-sm btn-primary mr-2" submit>Save</button>
-                                        <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
-                                    </div>
-                                </form>
-                            </span>
-                            {{--<span class="mx-2 text-secondary">|</span>
-                            <span moe>
-                                <a start show class="py-0 mb-3 text-danger">Un-Enroll</a>
-                                <form url="/api/careMonth/setIsClientEnrolledInRmToFalse">
-                                    <input type="hidden" name="uid" value="{{ $careMonth->uid }}">
-                                    <p class="small">Are you sure you want to un-enroll this client from RM?</p>
-                                    <div class="d-flex align-items-center">
-                                        <button class="btn btn-sm btn-danger mr-2" submit>Yes</button>
-                                        <button class="btn btn-sm btn-default mr-2 border" cancel>No</button>
-                                    </div>
-                                </form>
-                            </span>--}}
-                        @else
-                            <span class="mx-2 text-secondary">|</span>
-                            <span class="text-secondary">Can't modify since a bill exists</span>
-                        @endif
-                    </div>
-                    <table class="table table-striped table-sm table-bordered mt-2 mb-0">
-                        <thead>
-                        <tr>
-                            <th class="px-2 text-secondary border-bottom-0">Effective Date</th>
-                            <th class="px-2 text-secondary border-bottom-0">Time</th>
-                            <th class="px-2 text-secondary border-bottom-0">Created</th>
-                            <th class="px-2 text-secondary border-bottom-0 w-50">Details</th>
-                            <th class="px-2 text-secondary border-bottom-0 delete-column">&nbsp;</th>
-                        </tr>
-                        </thead>
-                        <tbody>
-                        @foreach($entries as $entry)
-                            @if(!$entry->is_removed && $entry->cm_or_rm === "RM")
-                                <tr>
-                                    <td class="px-2">
-                                        <div class="font-weight-bold">{{friendly_date_time($entry->effective_date, false)}}</div>
-                                    </td>
-                                    <td class="px-2">
-                                        {{time_in_hrminsec($entry->time_in_seconds)}}
-                                    </td>
-                                    <td class="px-2">
-                                        {{friendly_date_time($entry->created_at)}}
-                                    </td>
-                                    <td class="px-2">
-                                        <div class="text-secondary in-table-markup">{!! $entry->content_text !!}</div>
-<!--                                        <div class="text-secondary text-sm">{{$entry->content_detail}}</div>-->
-                                    </td>
-                                    <td class="px-2 text-center delete-column">
-                                        @if(!$activeRMBill)
-                                            <div moe relative>
-                                                <a start show><i class="on-hover-opaque fa fa-trash-alt text-danger"></i></a>
-                                                <form url="/api/careMonthEntry/remove" right>
-                                                    <input type="hidden" name="uid" value="{{ $entry->uid }}">
-                                                    <p class="small">Are you sure you want to delete this RM entry?</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>
-                                        @else
-                                            <a href="#" class="text-secondary" title="Can't modify since a bill exists"><i class="on-hover-opaque fa fa-trash-alt"></i></a>
-                                        @endif
-                                    </td>
-                                </tr>
-                            @endif
-                        @endforeach
-                        </tbody>
-                    </table>
-                @else
-                    <h6 class="mb-2 text-secondary font-weight-bold text-dark lh-24px">Time Entries</h6>
-                    <div class="alert alert-secondary mt-2 mb-0">
-                        <b>{{ $patient->displayName() }}</b> is currently not enrolled in <b>RM</b>.
-                        <span moe class="">
-                            <a start show class="font-weight-bold">Enroll Now</a>
-                            <form url="/api/careMonth/setIsClientEnrolledInRmToTrue">
-                                <input type="hidden" name="uid" value="{{ $careMonth->uid }}">
-                                <p class="small">Enroll this client in RM?</p>
-                                <div class="d-flex align-items-center">
-                                    <button class="btn btn-sm btn-primary mr-2" submit>Yes</button>
-                                    <button class="btn btn-sm btn-default mr-2 border" cancel>No</button>
-                                </div>
-                            </form>
-                        </span>
-                    </div>
-                @endif
-            </div>
-
-        </div>
-
         @if($careMonth->number_of_days_with_remote_measurements >= 16)
 
-            <hr class="m-negator mt-4 mb-0">
-
             {{-- bills --}} {{-- only admins --}}
             @if($pro->pro_type === 'ADMIN')
 
+                <hr class="m-negator my-0">
+
                 <div class="screen-only m-neg-4 mb-3">
                     @include('app.generic-bills.inline-for-cm', ['patient' => $patient, 'careMonth' => $careMonth, 'class' => 'p-3 border-bottom', 'label' => 'MCP'])
                 </div>
@@ -1368,8 +1193,6 @@
         </div>
         @endif
 
-        <hr class="m-negator my-3">
-
         {{-- generic bills --}}{{--
         <div class="row">
             @include('app.generic-bills.inline', ['patient' => $patient, 'class' => 'col-12', 'entityType' => 'CareMonth', 'entityUid' => $careMonth->id])
@@ -1393,7 +1216,7 @@
                     var editorID = Math.ceil(Math.random() * 99999), fieldName = $(this).attr('data-name');
 
                     var el = this;
-                    var existingContent = $(el).attr('data-content');
+                    var existingContent = $(el).attr('data-content') ? $(el).attr('data-content') : $(el).html();
                     var quill = new Quill(el, {
                         theme: 'snow',
                         modules: stagQuillConfig
@@ -1423,7 +1246,7 @@
                 });
 
                 // init calendar view
-                $('#caremonth-measurements-calendar-{{$calendarID}}').closest('.d-none').removeClass('d-none');
+                // $('#caremonth-measurements-calendar-{{$calendarID}}').closest('.d-none').removeClass('d-none');
                 let measurementsCalendar = new FullCalendar.Calendar($('#caremonth-measurements-calendar-{{$calendarID}}')[0], {
                     allDaySlot: false,
                     headerToolbar: false,
@@ -1453,8 +1276,13 @@
                         // self.showEditAppointmentModal();
                     }
                 });
+                measurementsCalendar.render();
 
-                window.setTimeout(() => { measurementsCalendar.render(); window.dispatchEvent(new Event('resize'));}, 10);
+                window.setTimeout(() => {
+                    // window.dispatchEvent(new Event('resize'));
+                    measurementsCalendar.updateSize();
+                    $('#caremonth-measurements-calendar-{{$calendarID}}').parent().addClass('d-none');
+                }, 10);
 
             }
 

+ 2 - 6
resources/views/app/patient/dashboard.blade.php

@@ -82,12 +82,8 @@ foreach ($pro->allShortcuts() as $shortcut) {
             </div>
             @endif
             {{-- rpm summary for current caremonth --}}
-            @if($patient->is_enrolled_in_rm === 'YES')
-            @if($patient->currentCareMonth())
-            @include('app/patient/partials/caremonth-summary', ['careMonth' => $patient->currentCareMonth()])
-            @else
-            <div class="alert alert-info">No caremonth for this month.</div>
-            @endif
+            @if($patient->currentCareMonth() && $patient->currentCareMonth()->is_client_enrolled_in_rm)
+                @include('app/patient/partials/caremonth-summary', ['careMonth' => $patient->currentCareMonth()])
             @endif
 
             {{-- appointments --}}

+ 37 - 62
resources/views/app/patient/note/rm-setup.blade.php

@@ -53,74 +53,18 @@
                     @endif
                 </div>
                 <span class="text-secondary mx-2">|</span>
-                <?php $currentCareMonth = $patient->currentCareMonth(); ?>
-                @if($currentCareMonth && $pro->id === $currentCareMonth->mcp_pro_id)
-                <?php $spoken = $currentCareMonth->has_anyone_interacted_with_client_about_rm_outside_note; ?>
-                {{--
-                <div class="d-flex align-items-center">
-                    <span class="mr-1 text-secondary">Comm. this month:</span>
-                    <span class="{{$spoken ? 'text-success' : ''}}">
-                        {{$spoken ? 'Yes' : 'No'}}
-                        @if(!$spoken)
-                            <i class="fa fa-exclamation-triangle"></i>
-                        @else
-                            <i class="fa fa-check"></i>
-                        @endif
-                    </span>
-                    @if($currentCareMonth->mcp && $pro->id === $currentCareMonth->mcp->id)
-                        <div moe relative class="ml-1">
-                            <a href="#" start show class=""><i class="fa fa-edit on-hover-opaque"></i></a>
-                            <form url="/api/careMonth/setHasAnyoneInteractedWithClientAboutRmOutsideNoteTo{{$spoken ? 'False' : 'True'}}" right>
-                                <input type="hidden" name="uid" value="{{$currentCareMonth->uid}}">
-                                <p>Set to {{$spoken ? 'No' : 'Yes'}}?</p>
-                                <div class="d-flex align-items-center">
-                                    <button class="btn btn-sm btn-primary mr-2" submit>Save</button>
-                                    <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
-                                </div>
-                            </form>
-                        </div>
-                    @endif
-                </div>
-                <span class="text-secondary mx-2 d-xlarge">|</span>--}}
-                @endif
 
                 <div class="d-flex align-items-center">
                     <span class="mr-1 text-secondary">Enrollment:</span>
-                    <span>{{ ucwords($patient->is_enrolled_in_rm ? $patient->is_enrolled_in_rm : '-') }}</span>
-                    @if($patient->is_enrolled_in_rm === 'NO' && $patient->why_not_enrolled_in_rm_category)
+                    <span>{{ ucwords($patient->is_enrolled_in_rm ? $patient->is_enrolled_in_rm : '-') }}</span> {{-- correct --}}
+                    @if($patient->is_enrolled_in_rm === 'NO' && $patient->why_not_enrolled_in_rm_category) {{-- correct --}}
                         <span class="text-sm ml-2">({{$patient->why_not_enrolled_in_rm_category}})</span>
                     @endif
-                    @if($patient->is_enrolled_in_rm === 'YES')
-                        <div moe class="ml-1">
-                            <a start show><i class="fa fa-edit on-hover-opaque"></i></a>
-                            <form url="/api/client/setIsEnrolledInRmToFalse" class="mcp-theme-1">
-                                <input type="hidden" name="uid" value="{{$patient->uid}}">
-                                <p class="mb-2">Un-enroll from RPM?</p>
-                                <div class="mb-2">
-                                    <label class="text-secondary text-sm mb-1">Reason</label>
-                                    <select name="whyNotEnrolledInRmCategory" class="form-control" required>
-                                        <option value="">-- select --</option>
-                                        <option value="Withdrawn">Withdrawn</option>
-                                        <option value="Inactive">Inactive</option>
-                                        <option value="Entry Error">Entry Error</option>
-                                        <option value="Test Chart">Test Chart</option>
-                                        <option value="Deceased">Deceased</option>
-                                        <option value="No Longer Eligible">No Longer Eligible</option>
-                                    </select>
-                                </div>
-                                <div class="mb-2">
-                                    <label class="text-secondary text-sm mb-1">Memo</label>
-                                    <textarea type="text" name="whyNotEnrolledInRmMemo" class="form-control"></textarea>
-                                </div>
-                                <div>
-                                    <button submit class="btn btn-sm btn-primary mr-1">Submit</button>
-                                    <button cancel class="btn btn-sm btn-default border">Cancel</button>
-                                </div>
-                            </form>
-                        </div>
-                    @else
+
+                    @if($patient->is_enrolled_in_rm === 'NO' || $patient->is_enrolled_in_rm === 'UNKNOWN') {{-- correct --}}
+                        <span class="ml-2 text-secondary">|</span>
                         <div moe wide class="ml-2">
-                            <a start show><i class="fa fa-edit on-hover-opaque"></i></a>
+                            <a start show>Enroll</a>
                             <form url="/api/client/setIsEnrolledInRmToTrue" class="mcp-theme-1">
                                 <input type="hidden" name="uid" value="{{$patient->uid}}">
                                 <h2>RPM Enrollment:</h2>
@@ -151,6 +95,37 @@
                             </form>
                         </div>
                     @endif
+
+                    <span class="ml-2 text-secondary">|</span>
+                    <div moe class="ml-2">
+                        <a start show>{{$patient->is_enrolled_in_rm === 'YES' ? 'Un-enroll' : ($patient->is_enrolled_in_rm === 'NO' ? 'Edit Reason' : 'Not interested/other')}}</a> {{-- correct --}}
+                        <form url="/api/client/setIsEnrolledInRmToFalse" class="mcp-theme-1">
+                            <input type="hidden" name="uid" value="{{$patient->uid}}">
+                            <p class="mb-2 text-nowrap">
+                                {{$patient->is_enrolled_in_rm === 'YES' ? 'Mark as not enrolled' : ($patient->is_enrolled_in_rm === 'NO' ? 'Edit Reason' : 'Not interested/other')}} {{-- correct --}}
+                            </p>
+                            <div class="mb-2">
+                                <label class="text-secondary text-sm mb-1">Reason</label>
+                                <select name="whyNotEnrolledInRmCategory" class="form-control" required>
+                                    <option value="">-- select --</option>
+                                    <option {{$patient->why_not_enrolled_in_rm_category === 'Withdrawn' ? 'selected' : ''}} value="Withdrawn">Withdrawn</option>
+                                    <option {{$patient->why_not_enrolled_in_rm_category === 'Inactive' ? 'selected' : ''}} value="Inactive">Inactive</option>
+                                    <option {{$patient->why_not_enrolled_in_rm_category === 'Entry Error' ? 'selected' : ''}} value="Entry Error">Entry Error</option>
+                                    <option {{$patient->why_not_enrolled_in_rm_category === 'Test Chart' ? 'selected' : ''}} value="Test Chart">Test Chart</option>
+                                    <option {{$patient->why_not_enrolled_in_rm_category === 'Deceased' ? 'selected' : ''}} value="Deceased">Deceased</option>
+                                    <option {{$patient->why_not_enrolled_in_rm_category === 'No Longer Eligible' ? 'selected' : ''}} value="No Longer Eligible">No Longer Eligible</option>
+                                </select>
+                            </div>
+                            <div class="mb-2">
+                                <label class="text-secondary text-sm mb-1">Memo</label>
+                                <textarea type="text" name="whyNotEnrolledInRmMemo" class="form-control">{{$patient->why_not_enrolled_in_rm_memo}}</textarea>
+                            </div>
+                            <div>
+                                <button submit class="btn btn-sm btn-primary mr-1">Submit</button>
+                                <button cancel class="btn btn-sm btn-default border">Cancel</button>
+                            </div>
+                        </form>
+                    </div>
                 </div>
             </div>
 

+ 0 - 430
resources/views/app/patient/partials/rm-setup.blade.php

@@ -1,430 +0,0 @@
-<div class="row">
-    <div class="col-5">
-        <div class="d-flex mb-2">
-          @if($pro->pro_type === 'ADMIN')
-              <div class="d-flex align-items-center">
-                  <div class="d-flex align-items-center">
-                    <span class="mr-2 text-secondary">Eligible for RM?</span>
-                    <span class="mr-1">{{ ucwords($patient->is_eligible_for_rm ? $patient->is_eligible_for_rm : '-') }}</span>
-                    <div moe>
-                      <a start show><i class="fa fa-edit on-hover-opaque"></i></a>
-                      <form url="/api/client/updateRmEligibility" class="mcp-theme-1">
-                        <input type="hidden" name="uid" value="{{$patient->uid}}">
-                        <div class="mb-2">
-                          <label class="text-sm mb-1 text-secondary">Is Eligible?</label>
-                          <select name="isEligibleForRm"
-                          class="form-control form-control-sm"
-                          onchange="toggleDisabledAsNeeded(this, 'NO', 'not-eligible-for-rm')">
-                          <option value="">-- Select Status --</option>
-                          <option value="YES" {{ $patient->is_eligible_for_rm === 'YES' ? 'selected' : '' }}>YES</option>
-                          <option value="NO" {{ $patient->is_eligible_for_rm === 'NO' ? 'selected' : '' }}>NO</option>
-                          <option value="UNKNOWN" {{ $patient->is_eligible_for_rm === 'UNKNOWN' ? 'selected' : '' }}>UNKNOWN</option>
-                        </select>
-                      </div>
-                      <div class="mb-2">
-                        <label class="text-sm mb-1 text-secondary">Why not eligible category</label>
-                        <input type="text" class="not-eligible-for-rm form-control form-control-sm"
-                        {{$patient->is_eligible_for_rm === 'NO' ? '' : 'disabled' }}
-                        name="whyNotEligibleForRmCategory" value="{{$patient->why_not_eligible_for_rm_category}}">
-                      </div>
-                      <div class="mb-2">
-                        <label class="text-sm mb-1 text-secondary">Why not eligible memo</label>
-                        <input type="text" class="not-eligible-for-rm form-control form-control-sm"
-                        {{$patient->is_eligible_for_rm === 'NO' ? '' : 'disabled' }}
-                        name="whyNotEligibleForRmMemo" value="{{$patient->why_not_eligible_for_rm_memo}}">
-                      </div>
-                      <div>
-                        <button submit class="btn btn-sm btn-primary mr-1">Submit</button>
-                        <button cancel class="btn btn-sm btn-default border">Cancel</button>
-                      </div>
-                    </form>
-                  </div>
-                  @if($patient->is_eligible_for_rm === 'NO')
-                  <span class="ml-1 on-hover-show d-inline-block on-hover-opaque">
-                      <i class="fa fa-info-circle"></i>
-                      <div class="on-hover-content py-2 pl-3 text-nowrap text-dark" style="left:0;right:auto;">
-                          <div>
-                              <small class="text-sm"><b>Category:</b> {{$patient->why_not_eligible_for_rm_category ?: '-'}}</small>
-                          </div>
-                          <div>
-                              <small class="text-sm"><b>Memo:</b> {{$patient->why_not_eligible_for_rm_memo ?: '-'}}</small>
-                          </div>
-                      </div>
-                  </span>
-                  @endif
-                  </div>
-              </div>
-              <span class="text-secondary mx-2">|</span>
-          @endif
-
-          <div class="d-flex align-items-center">
-              <span class="mr-1 text-secondary">Enrollment:</span>
-              <span>{{ ucwords($patient->is_enrolled_in_rm ? $patient->is_enrolled_in_rm : '-') }}</span>
-              @if($patient->is_enrolled_in_rm === 'NO' && $patient->why_not_enrolled_in_rm_category)
-                  <span class="text-sm ml-2">({{$patient->why_not_enrolled_in_rm_category}})</span>
-              @endif
-              @if($patient->is_enrolled_in_rm === 'YES')
-                  <div moe wide class="ml-2">
-                      <a start show><i class="fa fa-edit on-hover-opaque"></i></a>
-                      <form url="/api/client/setIsEnrolledInRmToFalse" class="mcp-theme-1">
-                          <input type="hidden" name="uid" value="{{$patient->uid}}">
-                          <h2 class="alert alert-warning"><i class="fa fa-warning"></i> RPM Enrollment Cancellation</h2>
-                          <div class="mb-2">
-                              <label class="text-secondary text-sm mb-1">Reason</label>
-                              <select name="whyNotEnrolledInRmCategory" class="form-control" required>
-                                  <option value="">-- select --</option>
-                                  <option value="Withdrawn">Withdrawn</option>
-                                  <option value="Inactive">Inactive</option>
-                                  <option value="Entry Error">Entry Error</option>
-                                  <option value="Test Chart">Test Chart</option>
-                                  <option value="Deceased">Deceased</option>
-                                  <option value="No Longer Eligible">No Longer Eligible</option>
-                              </select>
-                          </div>
-                          <div class="mb-2">
-                              <label class="text-secondary text-sm mb-1">Memo</label>
-                              <textarea type="text" name="whyNotEnrolledInRmMemo" class="form-control"></textarea>
-                          </div>
-                          <div>
-                              <button submit class="btn btn-sm btn-primary mr-1">Submit</button>
-                              <button cancel class="btn btn-sm btn-default border">Cancel</button>
-                          </div>
-                      </form>
-                  </div>
-              @else
-                  <div moe wide class="ml-2">
-                      <a start show><i class="fa fa-edit on-hover-opaque"></i></a>
-                      <form url="/api/client/setIsEnrolledInRmToTrue" class="mcp-theme-1">
-                          <input type="hidden" name="uid" value="{{$patient->uid}}">
-                          <h2>RPM Enrollment:</h2>
-                          <h3>Please confirm the following with patient:</h3>
-                          <p class="mb-2">I understand that:</p>
-                          <ul style="list-style:none;" class="pl-2">
-                              <li class="d-flex mb-1">
-                                  <input type="checkbox" required="true" class="mt-1 mr-2" id="x" name="x">
-                                  <label class="c-pointer" for="x">I am the only person who should be using the remote monitoring equipment as instructed. I will
-                                  not use the device for reasons other than my own personal health monitoring. I understand that
-                                  I can only participate in this program with one Medical Provider at a time.</label>
-                              </li>
-                              <li class="d-flex mb-1">
-                                  <input type="checkbox" required="true" class="mt-1 mr-2" id="y" name="y">
-                                  <label class="c-pointer" for="y">I will not tamper with the equipment. I understand that I am responsible for any fees associated
-                                  with misuse of the equipment.</label>
-                              </li>
-                              <li class="d-flex mb-1">
-                                  <input type="checkbox" required="true" class="mt-1 mr-2" id="z" name="z">
-                                  <label class="c-pointer" for="z">I understand the devices are only designed for the RPM program.</label>
-                              </li>
-                          </ul>
-
-                          <div class="mb-2">
-                              <button submit class="btn btn-sm btn-primary mr-1">Submit</button>
-                              <button cancel class="btn btn-sm btn-default border">Cancel</button>
-                          </div>
-                      </form>
-                  </div>
-              @endif
-          </div>
-        </div>
-
-        <div class="d-flex align-items-start flex-column mb-2">
-            <div>
-                <span class="mr-2 text-secondary">RM Reasons:</span>
-                @include('app.patient.partials.put-rm-reasons', ['recordType' => 'CLIENT', 'record' => $patient])
-            </div>
-            <div class="pl-3 mt-1">
-                @include('app.patient.partials.rm-reasons-display', ['recordType' => 'CLIENT', 'record' => $patient])
-            </div>
-        </div>
-
-        {{--<div class="d-flex align-items-baseline mb-3">
-            <span>RM Reasons:</span>
-            <div class="ml-3">
-                @if(!$patient->rmReasons || !count($patient->rmReasons))
-                    <span class="text-secondary">None</span>
-                @else
-                    <div>
-                        @foreach($patient->rmReasons as $reason)
-                            <div class="border-bottom pb-1 mb-1 d-flex align-items-start">
-                                <b class="width-90px">{{$reason->code}}</b>
-                                <span class="width-200px mr-3">{{$reason->description}}</span>
-                                <div moe>
-                                    <a start show>Edit</a>
-                                    <form url="/api/clientCmRmReason/updateBasic" class="mcp-theme-1">
-                                        <input type="hidden" name="uid" value="{{$reason->uid}}">
-                                        <div class="mb-2">
-                                            <label class="text-sm mb-1 text-secondary">Code *</label>
-                                            <input type="text" class="form-control form-control-sm"
-                                                   icd-autocomplete-code
-                                                   name="code" value="{{$reason->code}}" required>
-                                        </div>
-                                        <div class="mb-2">
-                                            <label class="text-sm mb-1 text-secondary">Description</label>
-                                            <input type="text" class="form-control form-control-sm"
-                                                   icd-autocomplete-description
-                                                   name="description" value="{{$reason->description}}">
-                                        </div>
-                                        <div>
-                                            <button submit class="btn btn-sm btn-primary mr-1">Submit</button>
-                                            <button cancel class="btn btn-sm btn-default border">Cancel</button>
-                                        </div>
-                                    </form>
-                                </div>
-                            </div>
-                        @endforeach
-                    </div>
-                @endif
-                <div>
-                    <div moe>
-                        <a start show>+ Add</a>
-                        <form url="/api/clientCmRmReason/create" class="mcp-theme-1">
-                            <input type="hidden" name="clientUid" value="{{$patient->uid}}">
-                            <input type="hidden" name="cmOrRm" value="RM">
-                            <div class="mb-2">
-                                <label class="text-sm mb-1 text-secondary">Code *</label>
-                                <input type="text" class="form-control form-control-sm"
-                                       icd-autocomplete-code
-                                       name="code" value="" required>
-                            </div>
-                            <div class="mb-2">
-                                <label class="text-sm mb-1 text-secondary">Description</label>
-                                <input type="text" class="form-control form-control-sm"
-                                       icd-autocomplete-description
-                                       name="description" value="">
-                            </div>
-                            <div>
-                                <button submit class="btn btn-sm btn-primary mr-1">Submit</button>
-                                <button cancel class="btn btn-sm btn-default border">Cancel</button>
-                            </div>
-                        </form>
-                    </div>
-                </div>
-            </div>
-        </div>--}}
-
-        @if($pro->pro_type === 'ADMIN')
-            <div class="d-flex align-items-center mb-2">
-                <span class="text-secondary">RME Pro:</span>
-                <span>{{ $patient->rme ? $patient->rme->displayName() : '-' }}</span>
-                <div moe class="ml-2">
-                    <a start show><i class="fa fa-edit on-hover-opaque"></i></a>
-                    <form url="/api/client/putRmePro" class="mcp-theme-1">
-                        <input type="hidden" name="uid" value="{{$patient->uid}}">
-                        <div class="mb-2">
-                            <label class="text-secondary text-sm">RME Pro</label>
-                            <select provider-search data-pro-uid="{{ @$patient->rme->uid }}" name="rmeProUid" class="form-control form-control-sm">
-                                <option value=""> --select--</option>
-                            </select>
-                        </div>
-                        <div>
-                            <button submit class="btn btn-sm btn-primary mr-1">Submit</button>
-                            <button cancel class="btn btn-sm btn-default border">Cancel</button>
-                        </div>
-                    </form>
-                </div>
-                @if($patient->rme)
-                    <div moe class="ml-2">
-                        <a start show><i class="fa fa-trash-alt text-danger on-hover-opaque"></i></a>
-                        <form url="/api/client/removeRmePro" class="mcp-theme-1">
-                            <input type="hidden" name="uid" value="{{$patient->uid}}">
-                            <p>Remove RME Pro?</p>
-                            <div>
-                                <button submit class="btn btn-sm btn-primary mr-1">Submit</button>
-                                <button cancel class="btn btn-sm btn-default border">Cancel</button>
-                            </div>
-                        </form>
-                    </div>
-                @endif
-            </div>
-            <div class="d-flex align-items-center mb-2">
-                <span class="text-secondary">RMM Pro:</span>
-                <span>{{ $patient->rmm ? $patient->rmm->displayName() : '-' }}</span>
-                <div moe class="ml-2">
-                    <a start show><i class="fa fa-edit on-hover-opaque"></i></a>
-                    <form url="/api/client/putRmmPro" class="mcp-theme-1">
-                        <input type="hidden" name="uid" value="{{$patient->uid}}">
-                        <div class="mb-2">
-                            <label class="text-secondary text-sm">RMM Pro</label>
-                            <select provider-search data-pro-uid="{{ @$patient->rmm->uid }}" name="rmmProUid" class="form-control form-control-sm">
-                                <option value=""> --select--</option>
-                            </select>
-                        </div>
-                        <div>
-                            <button submit class="btn btn-sm btn-primary mr-1">Submit</button>
-                            <button cancel class="btn btn-sm btn-default border">Cancel</button>
-                        </div>
-                    </form>
-                </div>
-                @if($patient->rmm)
-                    <div moe class="ml-2">
-                        <a start show><i class="fa fa-trash-alt text-danger on-hover-opaque"></i></a>
-                        <form url="/api/client/removeRmmPro" class="mcp-theme-1">
-                            <input type="hidden" name="uid" value="{{$patient->uid}}">
-                            <p>Remove RMM Pro?</p>
-                            <div>
-                                <button submit class="btn btn-sm btn-primary mr-1">Submit</button>
-                                <button cancel class="btn btn-sm btn-default border">Cancel</button>
-                            </div>
-                        </form>
-                    </div>
-                @endif
-            </div>
-        @endif
-        {{--<div class="border-top mt-2 pt-2">
-            @include('app.patient.partials.client_bp_weight_phone_number_status')
-        </div>--}}
-    </div>
-    <div class="col-5 border-left">
-        <?php
-        $bpDevice = null;
-        $weightScale = null;
-        if(count($patient->devices)) {
-            foreach($patient->devices as $device) {
-                if(!$bpDevice && $device->device->category === 'BP') {
-                    $bpDevice = $device;
-                }
-                elseif(!$weightScale && $device->device->category === 'WEIGHT') {
-                    $weightScale = $device;
-                }
-                if($bpDevice && $weightScale) break;
-            }
-        }
-        $bpMeasurements = [];
-        if($bpDevice) {
-            $bpMeasurements["first"] = \App\Models\Measurement
-                ::where('imei', $bpDevice->device->imei)
-                ->where('client_id', $patient->id)
-                ->where('is_cellular_zero', false)
-                ->orderBy('ts')
-                ->first();
-            $bpMeasurements["last"] = \App\Models\Measurement
-                ::where('imei', $bpDevice->device->imei)
-                ->where('client_id', $patient->id)
-                ->where('is_cellular_zero', false)
-                ->orderBy('ts', 'DESC')
-                ->first();
-        }
-        $weightMeasurements = [];
-        if($weightScale) {
-            $weightMeasurements["first"] = \App\Models\Measurement
-                ::where('imei', $weightScale->device->imei)
-                ->where('client_id', $patient->id)
-                ->where('is_cellular_zero', false)
-                ->orderBy('ts')
-                ->first();
-            $weightMeasurements["last"] = \App\Models\Measurement
-                ::where('imei', $weightScale->device->imei)
-                ->where('client_id', $patient->id)
-                ->where('is_cellular_zero', false)
-                ->orderBy('ts', 'DESC')
-                ->first();
-        }
-        $careMonth = $patient->currentCareMonth();
-        ?>
-
-        @if($bpDevice)
-            <div class="mb-2">
-                <table class="table table-sm table-bordered mb-0">
-                    <tr class="bg-light">
-                        <td class="text-secondary" style="width: 125px;">Cellular BP Device</td>
-                        <td colspan="2">Yes <i>({{$bpDevice->device->imei}})</i></td>
-                    </tr>
-                    <tr>
-                        <td class="text-secondary">Arrived</td>
-                        <td colspan="2">Yes</td>
-                    </tr>
-                    <tr>
-                        <td class="text-secondary">First Meas.</td>
-                        @if($bpMeasurements["first"])
-                        <td class="">{{ $bpMeasurements["first"]->sbp_mm_hg . '/' . $bpMeasurements["first"]->dbp_mm_hg . '' }}</td>
-                        <td class="">{{friendly_date_short(date("Y-m-d", $bpMeasurements["first"]->ts/1000))}} <i class="text-muted">- {{date_diff(date_create(date("Y-m-d", $bpMeasurements["first"]->ts/1000)), date_create('now'))->days}} <small class="text-sm">days ago</small></i></td>
-                        @else
-                            <td colspan="3">-</td>
-                        @endif
-                    </tr>
-                    <tr>
-                        <td class="text-secondary">Last Meas.</td>
-                        @if($bpMeasurements["last"])
-                            <td>{{ $bpMeasurements["last"]->sbp_mm_hg . '/' . $bpMeasurements["last"]->dbp_mm_hg . '' }}</td>
-                            <td>{{friendly_date_short(date("Y-m-d", $bpMeasurements["last"]->ts/1000))}} <i class="text-muted">- {{date_diff(date_create(date("Y-m-d", $bpMeasurements["last"]->ts/1000)), date_create('now'))->days}} <small class="text-sm">days ago</small></i></td>
-                        @else
-                           <td colspan="3">-</td>
-                        @endif
-                    </tr>
-                    {{--
-                    <tr>
-                        <td class="text-secondary">How often to measure</td>
-                        <td colspan="2">-</td>
-                    </tr>
-                    <tr>
-                        <td class="text-secondary">SMS reminders</td>
-                        <td colspan="2">-</td>
-                    </tr>
-                    --}}
-                </table>
-            </div>
-        @else
-            <div class="d-flex align-items-baseline mb-3">
-                <span class="min-width-200px">Cellular BP Device</span>
-                <b class="ml-3">No</b>
-            </div>
-        @endif
-
-        @if($weightScale)
-            <div class="mb-2">
-            <table class="table table-sm table-bordered mb-0">
-                <tr class="bg-light">
-                    <td class="text-secondary">Cellular Wt. Scale</td>
-                    <td colspan="3">Yes <i>({{$weightScale->device->imei}})</i></td>
-                </tr>
-                <tr>
-                    <td class="text-secondary">Arrived</td>
-                    <td colspan="3">Yes</td>
-                </tr>
-                <tr>
-                    <td class="text-secondary">First Meas.</td>
-                    @if($weightMeasurements["first"])
-                        <td>{{ round($weightMeasurements["first"]->value, 2) . ' lbs' }}</td>
-                        <td colspan="2">{{ friendly_date_short(date("Y-m-d", $weightMeasurements["first"]->ts/1000)) }} <i class="text-muted">- {{date_diff(date_create(date("Y-m-d", $weightMeasurements["first"]->ts/1000)), date_create('now'))->days}} <small class="text-asm">days ago</small></i></td>
-                    @else
-                        <td colspan="4"></td>
-                    @endif
-                </tr>
-                <tr>
-                        <td class="text-secondary">Last Meas.</td>
-                        @if($weightMeasurements["last"])
-                            <td>{{ round($weightMeasurements["last"]->value, 2) . ' lbs' }}</td>
-                            <td>{{ friendly_date_short(date("Y-m-d", $weightMeasurements["last"]->ts/1000)) }} <i class="text-muted">- {{date_diff(date_create(date("Y-m-d", $weightMeasurements["last"]->ts/1000)), date_create('now'))->days}} <small class="text-sm">days ago</small></i></td>
-                        @else
-                            <td colspan="4">-</td>
-                        @endif
-                    </tr>
-                    {{--
-                    <tr>
-                        <td class="text-secondary">How often to measure</td>
-                        <td colspan="3">-</td>
-                    </tr>
-                    <tr>
-                        <td class="text-secondary">SMS reminders:</td>
-                        <td colspan="3">-</td>
-                    </tr>
-                    --}}
-            </table>
-            </div>
-        @else
-            <div class="d-flex align-items-baseline mb-3">
-                <span class="min-width-200px">Cellular Weight Scale</span>
-                <b class="ml-3">No</b>
-            </div>
-        @endif
-
-        @if($careMonth && ($bpDevice || $weightScale))
-            <div class="d-flex align-items-baseline mb-1">
-                <span class="min-width-200px">Measurement days this month:</span>
-                <div class="ml-3">
-                    <b>{{$careMonth->number_of_days_with_remote_measurements}} days</b>
-                </div>
-            </div>
-        @endif
-    </div>
-</div>

+ 66 - 61
resources/views/app/patient/rm-setup-form.blade.php

@@ -1,77 +1,82 @@
-<div class="screen-only">
-    <div class="d-flex align-items-center mb-3">
-        <p class="font-weight-bold text-secondary m-0 font-size-14">RM Setup</p>
-    </div>
+@if($pro->pro_type === 'ADMIN')
 
-    <div class="mb-3 d-flex align-items-center">
-        <span class="min-width-140px">RM Setup Status:</span>
-        <div class="d-inline-flex align-items-center flex-grow-1">
-            @if($patient->has_rm_setup_been_performed)
-            <span class="text-nowrap text-success">
-                <i class="fa fa-check"></i>
-                <b>Performed</b>
-            </span>
-                @if($careMonth->was_rm_setup_performed)
-                <div moe class="ml-3">
-                    <a href="" show start>Undo</a>
-                    <form url="/api/careMonth/undoMarkRmSetupPerformed">
-                        <input type="hidden" name="uid" value="{{$careMonth->uid}}">
-                        <p>Mark RM Setup as not performed?</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>
-                </div>
-                @endif
-            @else
-            <span class="text-nowrap text-warning-mellow">
-                <i class="fa fa-times"></i>
-                <b>Not Performed</b>
-            </span>
-            <div moe class="ml-3">
-                <a href="" show start>Mark RM setup as performed?</a>
-                <form url="/api/careMonth/markRmSetupPerformed">
-                    <input type="hidden" name="uid" value="{{$careMonth->uid}}">
-                    <p>Mark RM setup as performed?</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>
-            </div>
-            @endif
+    <hr class="m-negator mt-4 mb-3">
+
+    <div class="screen-only">
+        <div class="d-flex align-items-center mb-3">
+            <p class="font-weight-bold text-secondary m-0 font-size-14">RM Setup</p>
         </div>
-    </div>
 
-    @if($pro->pro_type === 'ADMIN' && $careMonth->was_rm_setup_performed)
-    <div class="d-flex align-items-center">
-        <span class="min-width-140px">RM Setup Claim:</span>
-        <div class="d-inline-flex align-items-center flex-grow-1">
-            @if(!!$careMonth->rmSetupClaim)
-                <span class="text-nowrap text-success">
-                    <i class="fa fa-check"></i>
-                    <b>Created</b>
-                </span>
-            @else
+        <div class="mb-3 d-flex align-items-center">
+            <span class="min-width-140px">RM Setup Status:</span>
+            <div class="d-inline-flex align-items-center flex-grow-1">
+                @if($patient->has_rm_setup_been_performed)
+                    <span class="text-nowrap text-success">
+                        <i class="fa fa-check"></i>
+                        <b>Performed</b>
+                    </span>
+                    @if($careMonth->was_rm_setup_performed)
+                        <div moe class="ml-3">
+                            <a href="" show start>Undo</a>
+                            <form url="/api/careMonth/undoMarkRmSetupPerformed">
+                                <input type="hidden" name="uid" value="{{$careMonth->uid}}">
+                                <p>Mark RM Setup as not performed?</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>
+                        </div>
+                    @endif
+                @else
                 <span class="text-nowrap text-warning-mellow">
                     <i class="fa fa-times"></i>
-                    <b>Not Created</b>
+                    <b>Not Performed</b>
                 </span>
                 <div moe class="ml-3">
-                    <a href="" show start>Generate</a>
-                    <form url="/api/careMonth/generateRmSetupClaim">
+                    <a href="" show start>Mark RM setup as performed?</a>
+                    <form url="/api/careMonth/markRmSetupPerformed">
                         <input type="hidden" name="uid" value="{{$careMonth->uid}}">
-                        <p>Generate RM setup claim?</p>
+                        <p>Mark RM setup as performed?</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>
                 </div>
-            @endif
+                @endif
+            </div>
         </div>
-    </div>
-    @endif
 
-</div>
+        @if($careMonth->was_rm_setup_performed)
+            <div class="d-flex align-items-center">
+                <span class="min-width-140px">RM Setup Claim:</span>
+                <div class="d-inline-flex align-items-center flex-grow-1">
+                    @if(!!$careMonth->rmSetupClaim)
+                    <span class="text-nowrap text-success">
+                        <i class="fa fa-check"></i>
+                        <b>Created</b>
+                    </span>
+                    @else
+                    <span class="text-nowrap text-warning-mellow">
+                        <i class="fa fa-times"></i>
+                        <b>Not Created</b>
+                    </span>
+                    <div moe class="ml-3">
+                        <a href="" show start>Generate</a>
+                        <form url="/api/careMonth/generateRmSetupClaim">
+                            <input type="hidden" name="uid" value="{{$careMonth->uid}}">
+                            <p>Generate RM setup claim?</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>
+                    </div>
+                    @endif
+                </div>
+            </div>
+        @endif
+
+    </div>
+@endif

+ 1 - 1
resources/views/app/patient/segment-templates/disclaimers/edit.blade.php

@@ -77,7 +77,7 @@ if (!!@$point->data) {
             <p class="mb-2">Patient elects to participate in Chronic Care Management.</p>
         @endif
 
-        @if($note->hcp_pro_id == $patient->mcp_pro_id && $patient->is_enrolled_in_rm === 'YES')
+        @if($note->hcp_pro_id == $patient->mcp_pro_id && $patient->is_enrolled_in_rm === 'YES') {{-- correct --}}
             <p class="mb-2">Patient elects to participate in Remote Patient Monitoring.</p>
         @endif
 

+ 1 - 1
resources/views/app/patient/segment-templates/disclaimers/summary.blade.php

@@ -89,7 +89,7 @@ if (!!@$point->data) {
     <p class="mb-2">Patient elects to participate in Chronic Care Management.</p>
 @endif
 
-@if($note->hcp_pro_id == $patient->mcp_pro_id && $patient->is_enrolled_in_rm === 'YES')
+@if($note->hcp_pro_id == $patient->mcp_pro_id && $patient->is_enrolled_in_rm === 'YES') {{-- correct --}}
     <p class="mb-2">Patient elects to participate in Remote Patient Monitoring.</p>
 @endif
 

+ 3 - 3
resources/views/app/patient/settings.blade.php

@@ -605,13 +605,13 @@
 
                 <hr class="m-negator-3 my-3">
                 <div>
-                    <p>Is enrolled to RM: {{$patient->is_enrolled_in_rm}}</p>
-                    @if($patient->is_enrolled_in_rm == 'NO')
+                    <p>Is enrolled to RM: {{$patient->is_enrolled_in_rm}}</p> {{-- correct --}}
+                    @if($patient->is_enrolled_in_rm == 'NO') {{-- correct --}}
                         <p>Why Not Enrolled In RM Category:   {{$patient->why_not_enrolled_in_rm_category}}</p>
 		                <p>Why Not Enrolled In RM Memo:   {{$patient->why_not_enrolled_in_rm_memo}}</p>
                     @endif
                 </div>
-                @if($patient->is_enrolled_in_rm == 'YES')
+                @if($patient->is_enrolled_in_rm == 'YES') {{-- correct --}}
                 <div moe class="ml-2">
                     <a start show><i class="fa fa-edit"></i> Set is enrolled to RM to false</a>
                     <form url="/api/client/setIsEnrolledInRmToFalse" class="mcp-theme-1">

+ 1 - 1
resources/views/app/practice-management/remote-monitoring-admin-row-markup.blade.php

@@ -22,7 +22,7 @@
     </td>
 
     <td>{{friendly_date($iPatient->dob)}}</td>
-    <td>{!! $iPatient->is_enrolled_in_rm === 'YES' ? '<i class="fa fa-check text-success"></i>' : 'No' !!}</td>
+    <td>{!! $iPatient->is_client_enrolled_in_rm ? '<i class="fa fa-check text-success"></i>' : 'No' !!}</td>
     <td>{!! $iPatient->is_assigned_cellular_bp_device ? '<i class="fa fa-check text-success"></i>' : 'No' !!}</td>
     <td>{!! $iPatient->is_assigned_cellular_weight_scale_device ? '<i class="fa fa-check text-success"></i>' : 'No' !!}</td>
     <td>

+ 0 - 40
resources/views/app/practice-management/remote-monitoring-row-markup-by-pro-type.blade.php

@@ -18,7 +18,6 @@
     </td>
 
     <td>{{friendly_date($iPatient->dob)}}</td>
-    {{--<td>{!! $iPatient->is_enrolled_in_rm === 'YES' ? '<i class="fa fa-check text-success"></i>' : 'No' !!}</td>--}}
     <td>{!! $iPatient->is_assigned_cellular_bp_device ? '<i class="fa fa-check text-success"></i>' : 'No' !!}</td>
     <td>{!! $iPatient->is_assigned_cellular_weight_scale_device ? '<i class="fa fa-check text-success"></i>' : 'No' !!}</td>
     <td>
@@ -140,45 +139,6 @@
                 @endif--}}
             </div>
         </td>
-        @if($strategy === 'X16_DAYS_20_MINS_ON_OWN_MCP_COM_DURING_CM')
-            <td>
-                <div class="d-flex align-items-baseline">
-                    @if($mode === 'mcp')
-                        <span class="sort-data">{{$iPatient->rm_num_measurements_not_stamped_by_mcp}}</span>
-                        @if(!request()->input('not-enrolled'))
-                            @if($iPatient->rm_num_measurements_not_stamped_by_mcp)
-                                <a href="{{ route('practice-management.rpm_work_matrix') }}?patientUid={{$iPatient->client_uid}}&careMonthUid={{$iPatient->care_month_uid}}"
-                                   native target="_blank"
-                                   open-in-stag-popup
-                                   update-parent="refresh-rpm-row-{{$trIndex}}"
-                                   popup-style="tall overflow-visible"
-                                   class="ml-2 text-sm"
-                                   mc-initer="rpm-work-matrix"
-                                   title="RPM Work Matrix">
-                                    View
-                                </a>
-                            @endif
-                        @endif
-                    @elseif($mode === 'rmm')
-                        <span class="sort-data">{{$iPatient->rm_num_measurements_not_stamped_by_rmm}}</span>
-                        @if(!request()->input('not-enrolled'))
-                            @if($iPatient->rm_num_measurements_not_stamped_by_rmm)
-                                <a href="{{ route('practice-management.rpm_work_matrix') }}?patientUid={{$iPatient->client_uid}}&careMonthUid={{$iPatient->care_month_uid}}"
-                                   native target="_blank"
-                                   open-in-stag-popup
-                                   update-parent="refresh-rpm-row-{{$trIndex}}"
-                                   popup-style="tall overflow-visible"
-                                   class="ml-2 text-sm"
-                                   mc-initer="rpm-work-matrix"
-                                   title="RPM Work Matrix">
-                                    View
-                                </a>
-                            @endif
-                        @endif
-                    @endif
-                </div>
-            </td>
-        @endif
     @elseif($mode === 'rme')
         <td>
             <div class="d-flex align-items-baseline">

+ 0 - 8
resources/views/app/practice-management/remote-monitoring-row-markup-for-admin.blade.php

@@ -85,14 +85,6 @@
         </div>
     </td>
 
-    <td>
-        <span class="sort-data">{{$iPatient->rm_num_measurements_not_stamped_by_mcp}}</span>
-    </td>
-
-    <td>
-        <span class="sort-data">{{$iPatient->rm_num_measurements_not_stamped_by_rmm}}</span>
-    </td>
-
     <td>
         <div class="d-flex align-items-baseline">
             <i class="mr-1 text-sm fa {{$iPatient->rm_total_time_in_seconds_by_mcp >= 1200 ? 'fa-check text-success' : 'fa-exclamation-triangle text-danger on-hover-opaque'}}"></i>

+ 1 - 1
resources/views/app/practice-management/remote-monitoring-row-markup.blade.php

@@ -11,7 +11,7 @@
     </td>
 
     <td>{{friendly_date($iPatient->dob)}}</td>
-    <td>{!! $iPatient->is_enrolled_in_rm === 'YES' ? '<i class="fa fa-check text-success"></i>' : 'No' !!}</td>
+    <td>{!! $iPatient->is_client_enrolled_in_rm ? '<i class="fa fa-check text-success"></i>' : 'No' !!}</td>
     <td>{!! $iPatient->is_assigned_cellular_bp_device ? '<i class="fa fa-check text-success"></i>' : 'No' !!}</td>
     <td>{!! $iPatient->is_assigned_cellular_weight_scale_device ? '<i class="fa fa-check text-success"></i>' : 'No' !!}</td>
     <td>

+ 2 - 2
resources/views/app/practice-management/rm-action-report.blade.php

@@ -166,7 +166,7 @@
                         <th>@include('app.practice-management._sort_header_multi', ['route' => route("practice-management.rmActionReport"), 'label' => 'Month', 'key' => 'start_date'])</th>
                         <th>@include('app.practice-management._sort_header_multi', ['route' => route("practice-management.rmActionReport"), 'label' => 'Patient', 'key' => 'client_name'])</th>
                         <th>@include('app.practice-management._sort_header_multi', ['route' => route("practice-management.rmActionReport"), 'label' => 'RM<br>Elig.', 'key' => 'is_eligible_for_rm'])</th>
-                        <th>@include('app.practice-management._sort_header_multi', ['route' => route("practice-management.rmActionReport"), 'label' => 'RM<br>Enrol', 'key' => 'is_enrolled_in_rm'])</th>
+                        <th>@include('app.practice-management._sort_header_multi', ['route' => route("practice-management.rmActionReport"), 'label' => 'RM<br>Enrol', 'key' => 'is_client_enrolled_in_rm'])</th>
                         <th>@include('app.practice-management._sort_header_multi', ['route' => route("practice-management.rmActionReport"), 'label' => 'RM<br>Setup', 'key' => 'has_rm_setup_been_performed'])</th>
                         <th>@include('app.practice-management._sort_header_multi', ['route' => route("practice-management.rmActionReport"), 'label' => 'MCP', 'key' => 'mcp_name'])</th>
                         <th>@include('app.practice-management._sort_header_multi', ['route' => route("practice-management.rmActionReport"), 'label' => 'RMM', 'key' => 'rmm_name'])</th>
@@ -203,7 +203,7 @@
                             </a>
                         </td>
                         <td>{{ucwords(strtolower($row->is_eligible_for_rm))}}</td>
-                        <td>{{ucwords(strtolower($row->is_enrolled_in_rm))}}</td>
+                        <td>{{ucwords(strtolower($row->is_client_enrolled_in_rm))}}</td>
                         <td>{{$row->has_rm_setup_been_performed ? 'Yes' : 'No'}}</td>
                         <td>
                             {{$row->mcp_name}}

+ 0 - 17
resources/views/app/practice-management/rpm-matrix-by-pro-type-table.blade.php

@@ -20,22 +20,8 @@
         <table class="table table-sm table-striped table-hover p-0 m-0 min-width-1100px" id="table-rm-matrix">
             <thead class="bg-light">
             <tr>
-                <!--<th class="border-0 pl-2">Name</th>
-                                <th class="border-0">DOB</th>
-                                <th class="border-0">RPM?</th>
-                                <th class="border-0">Cell. BP?</th>
-                                <th class="border-0">Cell. Scale?</th>
-                                <th class="border-0">Last BP</th>
-                                <th class="border-0">Last Wt</th>
-                                <th class="border-0">Days Since Last Visit</th>
-                                <th class="border-0">Interacted?</th>
-                                <th class="border-0">#Meas. Days</th>
-                                <th class="border-0">#Unstamped</th>
-                                <th class="border-0">Billable</th>-->
-
                 <th class="border-0 pl-2">@include('app.practice-management._sort_header', ['route' => route("practice-management.rpm-matrix-" . $mode), 'label' => 'Name', 'key' => 'client_name'])</th>
                 <th class="border-0">@include('app.practice-management._sort_header', ['route' => route("practice-management.rpm-matrix-" . $mode), 'label' => 'DOB', 'key' => 'dob'])</th>
-                {{--<th class="border-0">@include('app.practice-management._sort_header', ['route' => route("practice-management.rpm-matrix-" . $mode), 'label' => 'RPM?', 'key' => 'is_enrolled_in_rm'])</th>--}}
                 <th class="border-0 text-secondary">Cell. BP?</th>
                 <th class="border-0 text-secondary">Cell. Scale?</th>
                 <th class="border-0 text-secondary">Latest BP</th>
@@ -46,9 +32,6 @@
                         <th class="border-0">@include('app.practice-management._sort_header', ['route' => route("practice-management.rpm-matrix-" . $mode), 'label' => 'Interacted?', 'key' => 'has_mcp_interacted_with_client_about_rm'])</th>
                     @endif
                     <th class="border-0">@include('app.practice-management._sort_header', ['route' => route("practice-management.rpm-matrix-" . $mode), 'label' => '#Meas. Days', 'key' => 'number_of_days_with_remote_measurements'])</th>
-                    @if($strategy === 'X16_DAYS_20_MINS_ON_OWN_MCP_COM_DURING_CM')
-                        <th class="border-0">@include('app.practice-management._sort_header', ['route' => route("practice-management.rpm-matrix-" . $mode), 'label' => '#Unstamped', 'key' => 'rm_num_measurements_not_stamped_by_mcp'])</th>
-                    @endif
                     @if($mode === 'mcp')
                         <th class="border-0">@include('app.practice-management._sort_header', ['route' => route("practice-management.rpm-matrix-" . $mode), 'label' => '#MCP Mins.', 'key' => 'rm_total_time_in_seconds_by_mcp'])</th>
                     @else

+ 3 - 3
resources/views/app/practice-management/rpm-matrix-by-pro-type.blade.php

@@ -57,7 +57,7 @@
                         $m = +$mStr;
                         $y = +$yStr;
                         ?>
-                        <a href="{{ route('practice-management.rpm_work_matrix') }}?m={{$mStr}}&y={{$yStr}}"
+                        {{--<a href="{{ route('practice-management.rpm_work_matrix') }}?m={{$mStr}}&y={{$yStr}}"
                            native target="_blank"
                            open-in-stag-popup
                            update-parent
@@ -66,8 +66,8 @@
                            mc-initer="rpm-work-matrix"
                            title="RPM Work Matrix">
                             RPM Work Matrix
-                        </a>
-                        <span class="mr-2">Strategy:</span>
+                        </a>--}}
+                        <span class="mx-3">Strategy:</span>
                         @if($mode === 'mcp')
                             {{strategy_display($pro->mcp_rpm_payment_strategy, $mode)}}
                             <?php $strategy = 'X16_DAYS_20_MINS_ON_OWN_MCP_COM_DURING_CM'; // $pro->mcp_rpm_payment_strategy; ?>

+ 0 - 3
resources/views/app/practice-management/rpm-matrix-for-admin-table.blade.php

@@ -29,7 +29,6 @@
                 <th class="border-0">@include('app.practice-management._sort_header_multi', ['route' => route("practice-management.rpm-matrix-admin"), 'label' => 'Insurance', 'key' => 'payer_name'])</th>
                 <th class="border-0">@include('app.practice-management._sort_header_multi', ['route' => route("practice-management.rpm-matrix-admin"), 'label' => 'State', 'key' => 'mailing_address_state'])</th>
                 <th class="border-0">@include('app.practice-management._sort_header_multi', ['route' => route("practice-management.rpm-matrix-admin"), 'label' => 'CM MCP', 'key' => 'mcp_name'])</th>
-                {{--<th class="border-0">@include('app.practice-management._sort_header_multi', ['route' => route("practice-management.rpm-matrix-admin"), 'label' => 'RPM?', 'key' => 'is_enrolled_in_rm'])</th>--}}
                 <th class="border-0 text-secondary">BP</th>
                 <th class="border-0 text-secondary">Scale</th>
                 <th class="border-0">@include('app.practice-management._sort_header_multi', ['route' => route("practice-management.rpm-matrix-admin"), 'label' => 'DSLM', 'key' => 'dslm'])</th>
@@ -38,8 +37,6 @@
                 <th class="border-0">@include('app.practice-management._sort_header_multi', ['route' => route("practice-management.rpm-matrix-admin"), 'label' => '<i class="text-sm fa fa-phone rotateh"></i> MCP', 'key' => 'has_mcp_interacted_with_client_about_rm'])</th>
                 <th class="border-0">@include('app.practice-management._sort_header_multi', ['route' => route("practice-management.rpm-matrix-admin"), 'label' => '<i class="text-sm fa fa-phone rotateh"></i> Any', 'key' => 'has_anyone_interacted_with_client_about_rm'])</th>
                 <th class="border-0">@include('app.practice-management._sort_header_multi', ['route' => route("practice-management.rpm-matrix-admin"), 'label' => '#Meas.<br>Days', 'key' => 'number_of_days_with_remote_measurements'])</th>
-                <th class="border-0">@include('app.practice-management._sort_header_multi', ['route' => route("practice-management.rpm-matrix-admin"), 'label' => '#MCP<br>Unst.', 'key' => 'rm_num_measurements_not_stamped_by_mcp'])</th>
-                <th class="border-0">@include('app.practice-management._sort_header_multi', ['route' => route("practice-management.rpm-matrix-admin"), 'label' => '#RMM<br>Unst.', 'key' => 'rm_num_measurements_not_stamped_by_rmm'])</th>
                 <th class="border-0">@include('app.practice-management._sort_header_multi', ['route' => route("practice-management.rpm-matrix-admin"), 'label' => '#MCP<br>Mins.', 'key' => 'rm_total_time_in_seconds_by_mcp'])</th>
                 <th class="border-0">@include('app.practice-management._sort_header_multi', ['route' => route("practice-management.rpm-matrix-admin"), 'label' => '#RMM<br>Mins.', 'key' => 'rm_total_time_in_seconds_by_rmm_pro'])</th>
                 <th class="border-0 text-secondary">MCP</th>

+ 0 - 17
resources/views/app/practice-management/rpm-matrix-for-admin.blade.php

@@ -272,23 +272,6 @@
                             </div>
                         </div>
 
-                        <div>
-                            <label class="mb-0 text-sm {{request()->input('f_unst') ? 'font-weight-bold text-info' : 'text-secondary'}}">Unstamped</label>
-                            <div class="d-flex align-items-start">
-                                <select name="f_unst_op"
-                                        class="mr-1 form-control form-control-sm min-width-unset width-40px pl-0">
-                                    <option {{request()->input('f_unst_op') === '=' ? 'selected' : ''}} value="=">&equals;</option>
-                                    <option {{request()->input('f_unst_op') === '>' ? 'selected' : ''}} value=">">&gt;</option>
-                                    <option {{request()->input('f_unst_op') === '<' ? 'selected' : ''}} value="<">&lt;</option>
-                                    <option {{request()->input('f_unst_op') === '>=' ? 'selected' : ''}} value=">=">&ge;</option>
-                                    <option {{request()->input('f_unst_op') === '<=' ? 'selected' : ''}} value="<=">&le;</option>
-                                </select>
-                                <input type="number" name="f_unst"
-                                       value="{{request()->input('f_unst')}}"
-                                       class="mr-2 form-control form-control-sm min-width-unset width-70px">
-                            </div>
-                        </div>
-
                         <div>
                             <label class="mb-0 text-sm {{request()->input('f_mcp_mins') ? 'font-weight-bold text-info' : 'text-secondary'}}">MCP Mins.</label>
                             <div class="d-flex align-items-start">

+ 2 - 2
resources/views/layouts/patient-header.blade.php

@@ -75,8 +75,8 @@ $addressParts .= implode(", ", $addressPart2);
         </span>
       </h6>
       <div class="d-flex border-left pl-2 ml-2">
-        <div class="mr-2">RPM: <b>{{ucwords(strtolower($patient->is_enrolled_in_rm))}}</b>
-          @if($patient->is_enrolled_in_rm === 'NO' && $patient->why_not_enrolled_in_rm_category)
+        <div class="mr-2">RPM: <b>{{ucwords(strtolower($patient->is_enrolled_in_rm))}}</b> {{-- correct --}}
+          @if($patient->is_enrolled_in_rm === 'NO' && $patient->why_not_enrolled_in_rm_category) {{-- correct --}}
             <span class="text-sm">({{$patient->why_not_enrolled_in_rm_category}})</span>
           @endif
         </div>

+ 1 - 1
resources/views/layouts/template.blade.php

@@ -194,7 +194,7 @@
                             <i class="mr-1 fas fa-tasks"></i> Admin
                         </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.claims-report') }}">Claims Reports</a>
+                            <a class="dropdown-item" href="{{ route('practice-management.claims-report') }}">Claims Report</a>
                             <a class="dropdown-item" href="{{ route('practice-management.coverages') }}">Coverage Center</a>
                             <a class="dropdown-item" href="{{ route('practice-management.notes-resolution-center') }}">Notes Resolution Center</a>
                             <a class="dropdown-item" href="{{ route('practice-management.notes-resolution-center-v2') }}">Notes Resolution Center V2</a>