Bläddra i källkod

RPM matrix mcp/rmm/rme UI updates

Vijayakrishnan 3 år sedan
förälder
incheckning
6864e6db3d

+ 40 - 0
app/Http/Controllers/PracticeManagementController.php

@@ -1407,6 +1407,39 @@ WHERE care_month.uid = '{$careMonthUid}' AND client.uid = '{$clientUid}'
             }
         }
 
+        // default sort
+        if(!$request->input('sort_by')) {
+            if($mode === 'mcp') {
+                $orderBy = "ORDER BY care_month.number_of_days_with_remote_measurements DESC NULLS LAST, care_month.rm_total_time_in_seconds_by_mcp DESC NULLS LAST";
+            }
+            elseif ($mode === 'rmm') {
+                $orderBy = "ORDER BY care_month.number_of_days_with_remote_measurements DESC NULLS LAST, care_month.rm_total_time_in_seconds_by_rmm_pro DESC NULLS LAST";
+            }
+            else {
+                $orderBy = "ORDER BY care_month.number_of_days_with_remote_measurements DESC NULLS LAST";
+            }
+        }
+        else {
+            $sortBy = $request->input('sort_by');
+            $sortDir = $request->input('sort_dir');
+            if($sortBy && $sortDir) {
+                if(!in_array($sortBy, ['number_of_days_with_remote_measurements', 'rm_total_time_in_seconds_by_mcp', 'rm_total_time_in_seconds_by_rmm_pro'])) {
+                    if($mode === 'mcp') {
+                        $orderBy = "ORDER BY $sortBy $sortDir NULLS LAST, care_month.number_of_days_with_remote_measurements DESC NULLS LAST, care_month.rm_total_time_in_seconds_by_mcp DESC NULLS LAST";
+                    }
+                    elseif ($mode === 'rmm') {
+                        $orderBy = "ORDER BY $sortBy $sortDir NULLS LAST, care_month.number_of_days_with_remote_measurements DESC NULLS LAST, care_month.rm_total_time_in_seconds_by_rmm_pro DESC NULLS LAST";
+                    }
+                    else {
+                        $orderBy = "ORDER BY $sortBy $sortDir NULLS LAST, care_month.number_of_days_with_remote_measurements DESC NULLS LAST";
+                    }
+                }
+                else {
+                    $orderBy = "ORDER BY $sortBy $sortDir NULLS LAST";
+                }
+            }
+        }
+
         // filters from the UI
         if(trim($request->input('f_name'))) {
             $v = trim($request->input('f_name'));
@@ -1492,6 +1525,13 @@ WHERE care_month.uid = '{$careMonthUid}' AND client.uid = '{$clientUid}'
             $conditions[] = "(care_month.{$field} {$o} {$v})";
         }
 
+        if($request->input('not-enrolled')) {
+            $conditions[] = "(client.is_enrolled_in_rm != 'YES')";
+        }
+        else {
+            $conditions[] = "(client.is_enrolled_in_rm = 'YES')";
+        }
+
         $proTypeCondition = '';
         $genericBillIdColumns = '';
         $genericBillJoinClause = '';

+ 14 - 7
resources/views/app/practice-management/_sort_header.blade.php

@@ -1,7 +1,14 @@
-<a href="{{ $route }}?{{queryLineExcept(['sort_by', 'sort_dir'])}}&sort_by={{$key}}&sort_dir={{request()->input('sort_by') === $key && request()->input('sort_dir') === 'ASC' ? 'DESC' : 'ASC'}}" class="ml-1 text-decoration-none">
-    <b class="{{request()->input('sort_by') === $key ? 'text-primary' : 'text-secondary'}}">{{$label}}</b>
-    <span class="ml-2 d-inline-flex align-items-baseline">
-        <i class="text-sm fa fa-chevron-up {{request()->input('sort_by') === $key && request()->input('sort_dir') === 'DESC' ? '' : 'on-hover-opaque text-secondary'}}"></i>
-        <i class="ml-1 text-sm fa fa-chevron-down {{request()->input('sort_by') === $key && request()->input('sort_dir') === 'ASC' ? '' : 'on-hover-opaque text-secondary'}}"></i>
-    </span>
-</a>
+<div class="d-flex align-items-baseline flex-wrap">
+    <a href="{{ $route }}?{{queryLineExcept(['sort_by', 'sort_dir'])}}&sort_by={{$key}}&sort_dir={{request()->input('sort_by') === $key && request()->input('sort_dir') === 'ASC' ? 'DESC' : 'ASC'}}" class="text-decoration-none">
+        <b class="{{request()->input('sort_by') === $key ? 'text-primary' : 'text-secondary'}}">{{$label}}</b>
+        <span class="ml-1 d-inline-flex align-items-baseline">
+            <i class="text-sm fa fa-chevron-up {{request()->input('sort_by') === $key && request()->input('sort_dir') === 'DESC' ? '' : 'on-hover-opaque text-secondary'}}"></i>
+            <i class="ml-1 text-sm fa fa-chevron-down {{request()->input('sort_by') === $key && request()->input('sort_dir') === 'ASC' ? '' : 'on-hover-opaque text-secondary'}}"></i>
+        </span>
+    </a>
+    @if(request()->input('sort_by') === $key)
+        <a href="{{ $route }}?{{queryLineExcept(['sort_by', 'sort_dir'])}}" class="text-sm on-hover-opaque text-secondary ml-1">
+            <i class="fa fa-times"></i>
+        </a>
+    @endif
+</div>

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

@@ -1,3 +1,10 @@
+@if($mode === 'mcp')
+    <?php $strategy = 'X16_DAYS_20_MINS_ON_OWN_MCP_COM_DURING_CM'; // $pro->mcp_rpm_payment_strategy; ?>
+@elseif($mode === 'rmm')
+    <?php $strategy = 'X16_DAYS_20_MINS_ON_OWN_MCP_COM_DURING_CM'; // $pro->rmm_payment_strategy; ?>
+@elseif($mode === 'rmm')
+    <?php $strategy = 'X16_DAYS'; // $pro->rme_payment_strategy; ?>
+@endif
 <tr data-client-uid="{{$iPatient->client_uid}}" data-care-month-uid="{{$iPatient->care_month_uid}}">
     <td class="pl-2">
         <a href="/patients/view/{{ $iPatient->client_uid }}/care-months/view/{{$iPatient->care_month_uid}}" class="text-nowrap"
@@ -11,7 +18,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_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>
@@ -46,59 +53,61 @@
                 <div class="d-flex align-items-baseline">
                     <i class="mr-1 text-sm fa {{$iPatient->has_mcp_interacted_with_client_about_rm ? 'fa-check text-success' : 'fa-exclamation-triangle text-danger on-hover-opaque'}}"></i>
                     <span class="sort-data">{{$iPatient->has_mcp_interacted_with_client_about_rm ? 'Yes' : 'No'}}</span>
-                    @if($mode === 'mcp')
-                        <div moe large relative class="ml-2">
-                            <a start show class="py-0 mb-3 text-sm">Entry</a>
-                            <form url="/api/careMonthEntry/createForRm" right hook="refresh-rpm-row-{{$trIndex}}">
-                                <input type="hidden" name="careMonthUid" value="{{ $iPatient->care_month_uid }}">
-                                <input type="hidden" name="proUid" value="{{ $pro->uid }}">
-                                <div class="mb-2">
-                                    <div class="row">
-                                        <div class="col-6 pr-0">
-                                            <?php
-                                            $sD = strtotime($rcmStartDate);
-                                            $y = date('Y', $sD);
-                                            $m0 = date('m', $sD);
-                                            $d = date('t', $sD);
-                                            $defaultED = $sD >= strtotime(date('Y-m-d')) ? date('Y-m-d') : $rcmStartDate;
-                                            ?>
-                                            <label class="text-sm text-secondary mb-1">Effective Date</label>
-                                            <input autofocus type="date" min="{{ date($y . '-' . $m0 . '-01') }}" max="{{ date($y . '-' . $m0 . '-' . $d) }}"
-                                                   value="{{$defaultED}}"
-                                                   class="form-control form-control-sm w-100" name="effectiveDate"
-                                                   placeholder="Effective Date" required>
+                    @if(!request()->input('not-enrolled'))
+                        @if($mode === 'mcp')
+                            <div moe large relative class="ml-2">
+                                <a start show class="py-0 mb-3 text-sm">Entry</a>
+                                <form url="/api/careMonthEntry/createForRm" right hook="refresh-rpm-row-{{$trIndex}}">
+                                    <input type="hidden" name="careMonthUid" value="{{ $iPatient->care_month_uid }}">
+                                    <input type="hidden" name="proUid" value="{{ $pro->uid }}">
+                                    <div class="mb-2">
+                                        <div class="row">
+                                            <div class="col-6 pr-0">
+                                                <?php
+                                                $sD = strtotime($rcmStartDate);
+                                                $y = date('Y', $sD);
+                                                $m0 = date('m', $sD);
+                                                $d = date('t', $sD);
+                                                $defaultED = $sD >= strtotime(date('Y-m-d')) ? date('Y-m-d') : $rcmStartDate;
+                                                ?>
+                                                <label class="text-sm text-secondary mb-1">Effective Date</label>
+                                                <input autofocus type="date" min="{{ date($y . '-' . $m0 . '-01') }}" max="{{ date($y . '-' . $m0 . '-' . $d) }}"
+                                                       value="{{$defaultED}}"
+                                                       class="form-control form-control-sm w-100" name="effectiveDate"
+                                                       placeholder="Effective Date" required>
+                                            </div>
+                                            <div class="col-6">
+                                                <label class="text-sm text-secondary mb-1">Seconds</label>
+                                                <input type="number" min="75" max="300" class="form-control form-control-sm w-100 cm-time-value" name="timeInSeconds"
+                                                       value="75" placeholder="Time (secs.)" required>
+                                            </div>
                                         </div>
-                                        <div class="col-6">
-                                            <label class="text-sm text-secondary mb-1">Seconds</label>
-                                            <input type="number" min="75" max="300" class="form-control form-control-sm w-100 cm-time-value" name="timeInSeconds"
-                                                   value="75" placeholder="Time (secs.)" required>
+                                    </div>
+                                    <div class="mb-2 border border-info p-2 mt-2 bg-light">
+                                        <span>I have had interactive communication with <b>{{$iPatient->client_name}}</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>
-                                </div>
-                                <div class="mb-2 border border-info p-2 mt-2 bg-light">
-                                    <span>I have had interactive communication with <b>{{$iPatient->client_name}}</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 class="mb-2">
+                                        <label class="text-sm text-secondary mb-1">Memo</label>
+                                        <textarea class="form-control form-control-sm w-100" name="contentText"
+                                                  required>Interacted with the patient</textarea>
                                     </div>
-                                </div>
-                                <div class="mb-2">
-                                    <label class="text-sm text-secondary mb-1">Memo</label>
-                                    <textarea class="form-control form-control-sm w-100" name="contentText"
-                                              required>Interacted with the patient</textarea>
-                                </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 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
                     @endif
                 </div>
             </td>
@@ -107,26 +116,28 @@
             <div class="d-flex align-items-baseline">
                 <i class="mr-1 text-sm fa {{$iPatient->number_of_days_with_remote_measurements >= 16 ? 'fa-check text-success' : 'fa-exclamation-triangle text-danger on-hover-opaque'}}"></i>
                 <span class="sort-data">{{$iPatient->number_of_days_with_remote_measurements ?: 0}}</span>
-                @if($iPatient->number_of_days_with_remote_measurements < 16)
-                    <div moe relative class="ml-2">
-                        <a href="#" start show class="text-sm">SMS</a>
-                        <form url="/api/clientSms/createOutgoing" right="" class="mcp-theme-1" noreload="" style="display: none;">
-                            <input type="hidden" name="uid" value="{{ $iPatient->client_uid }}">
-                            <div class="mb-2">
-                                <label for="" class="text-sm text-secondary mb-1">Cell Number</label>
-                                <input type="text" class="form-control form-control-sm" name="cellNumber" value="{{$iPatient->cell_number}}">
-                            </div>
-                            <div class="mb-2">
-                                <label for="" class="text-sm text-secondary mb-1">Message</label>
-                                <textarea rows="5" class="form-control form-control-sm" name="message">Hi! This is {{$pro->displayName(true)}}, from Cardio 1st. Please check your blood pressure.</textarea>
-                            </div>
-                            <div class="d-flex align-items-center">
-                                <button class="btn btn-sm btn-primary mr-2" submit="">Send</button>
-                                <button class="btn btn-sm btn-default mr-2 border" cancel="">Cancel</button>
-                            </div>
-                        </form>
-                    </div>
-                @endif
+                {{--@if(!request()->input('not-enrolled'))
+                    @if($iPatient->number_of_days_with_remote_measurements < 16)
+                        <div moe relative class="ml-2">
+                            <a href="#" start show class="text-sm">SMS</a>
+                            <form url="/api/clientSms/createOutgoing" right="" class="mcp-theme-1" noreload="" style="display: none;">
+                                <input type="hidden" name="uid" value="{{ $iPatient->client_uid }}">
+                                <div class="mb-2">
+                                    <label for="" class="text-sm text-secondary mb-1">Cell Number</label>
+                                    <input type="text" class="form-control form-control-sm" name="cellNumber" value="{{$iPatient->cell_number}}">
+                                </div>
+                                <div class="mb-2">
+                                    <label for="" class="text-sm text-secondary mb-1">Message</label>
+                                    <textarea rows="5" class="form-control form-control-sm" name="message">Hi! This is {{$pro->displayName(true)}}, from Cardio 1st. Please check your blood pressure.</textarea>
+                                </div>
+                                <div class="d-flex align-items-center">
+                                    <button class="btn btn-sm btn-primary mr-2" submit="">Send</button>
+                                    <button class="btn btn-sm btn-default mr-2 border" cancel="">Cancel</button>
+                                </div>
+                            </form>
+                        </div>
+                    @endif
+                @endif--}}
             </div>
         </td>
         @if($strategy === 'X16_DAYS_20_MINS_ON_OWN_MCP_COM_DURING_CM')
@@ -134,31 +145,35 @@
                 <div class="d-flex align-items-baseline">
                     @if($mode === 'mcp')
                         <span class="sort-data">{{$iPatient->rm_num_measurements_not_stamped_by_mcp}}</span>
-                        @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>
+                        @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($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>
+                        @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>
@@ -169,25 +184,27 @@
             <div class="d-flex align-items-baseline">
                 <i class="mr-1 text-sm fa {{$iPatient->number_of_days_with_remote_measurements >= 16 ? 'fa-check text-success' : 'fa-exclamation-triangle text-danger on-hover-opaque'}}"></i>
                 <span class="sort-data">{{$iPatient->number_of_days_with_remote_measurements ?: 0}}</span>
-                @if($iPatient->number_of_days_with_remote_measurements < 16)
-                    <div moe relative class="ml-2">
-                        <a href="#" start show class="text-sm">SMS</a>
-                        <form url="/api/clientSms/createOutgoing" right="" class="mcp-theme-1" noreload="" style="display: none;">
-                            <input type="hidden" name="uid" value="{{ $iPatient->client_uid }}">
-                            <div class="mb-2">
-                                <label for="" class="text-sm text-secondary mb-1">Cell Number</label>
-                                <input type="text" class="form-control form-control-sm" name="cellNumber" value="{{$iPatient->cell_number}}">
-                            </div>
-                            <div class="mb-2">
-                                <label for="" class="text-sm text-secondary mb-1">Message</label>
-                                <textarea rows="5" class="form-control form-control-sm" name="message">Hi! This is {{$pro->displayName(true)}}, from Cardio 1st. Please check your blood pressure.</textarea>
-                            </div>
-                            <div class="d-flex align-items-center">
-                                <button class="btn btn-sm btn-primary mr-2" submit="">Send</button>
-                                <button class="btn btn-sm btn-default mr-2 border" cancel="">Cancel</button>
-                            </div>
-                        </form>
-                    </div>
+                @if(!request()->input('not-enrolled'))
+                    @if($iPatient->number_of_days_with_remote_measurements < 16)
+                        <div moe relative class="ml-2">
+                            <a href="#" start show class="text-sm">SMS</a>
+                            <form url="/api/clientSms/createOutgoing" right="" class="mcp-theme-1" noreload="" style="display: none;">
+                                <input type="hidden" name="uid" value="{{ $iPatient->client_uid }}">
+                                <div class="mb-2">
+                                    <label for="" class="text-sm text-secondary mb-1">Cell Number</label>
+                                    <input type="text" class="form-control form-control-sm" name="cellNumber" value="{{$iPatient->cell_number}}">
+                                </div>
+                                <div class="mb-2">
+                                    <label for="" class="text-sm text-secondary mb-1">Message</label>
+                                    <textarea rows="5" class="form-control form-control-sm" name="message">Hi! This is {{$pro->displayName(true)}}, from Cardio 1st. Please check your blood pressure.</textarea>
+                                </div>
+                                <div class="d-flex align-items-center">
+                                    <button class="btn btn-sm btn-primary mr-2" submit="">Send</button>
+                                    <button class="btn btn-sm btn-default mr-2 border" cancel="">Cancel</button>
+                                </div>
+                            </form>
+                        </div>
+                    @endif
                 @endif
             </div>
         </td>
@@ -213,76 +230,103 @@
             </div>
         @endif
     </td>
+    @if(!request()->input('not-enrolled'))
     <td>
         @if($mode === 'mcp')
-            @if($iPatient->mcp_rm_generic_bill_id)
+            @if($lastVisitWithin90Days && $iPatient->has_mcp_interacted_with_client_about_rm && $iPatient->number_of_days_with_remote_measurements >= 16 && $iPatient->rm_total_time_in_seconds_by_mcp >= 1200)
                 <span class="text-success font-weight-bold">
                     <i class="fa fa-check"></i>
-                    Yes
                 </span>
-                (${{friendly_money($iPatient->mcp_rm_generic_bill_expected_payment_amount)}})
-                @if($iPatient->mcp_rm_generic_bill_signed)
-                    <div moe relative
-                         class="d-inline-block {{ $iPatient->mcp_rm_generic_bill_generic_pro_id !== $pro->id ? 'moe-disabled' : '' }}"
-                         title="{{ $iPatient->mcp_rm_generic_bill_generic_pro_id !== $pro->id ? 'Only the bill\'s pro can sign' : '' }}">
-                        <a class="font-weight-bold" href="" show start>Sign</a>
-                        <form url="/api/bill/signAsGenericPro" right>
-                            <input type="hidden" name="uid" value="{{$iPatient->mcp_rm_generic_bill_uid}}">
-                            <p>Sign this bill?</p>
+                @if($iPatient->mcp_rm_generic_bill_uid)
+                    ${{friendly_money($iPatient->mcp_rm_generic_bill_expected_payment_amount)}}
+                    @if($iPatient->mcp_rm_generic_bill_signed)
+                        <div moe relative
+                             class="d-inline-block {{ $iPatient->mcp_rm_generic_bill_generic_pro_id !== $pro->id ? 'moe-disabled' : '' }}"
+                             title="{{ $iPatient->mcp_rm_generic_bill_generic_pro_id !== $pro->id ? 'Only the bill\'s pro can sign' : '' }}">
+                            <a class="font-weight-bold" href="" show start>Sign</a>
+                            <form url="/api/bill/signAsGenericPro" right>
+                                <input type="hidden" name="uid" value="{{$iPatient->mcp_rm_generic_bill_uid}}">
+                                <p>Sign this bill?</p>
+                                <div class="mb-0">
+                                    <button class="btn btn-success btn-sm" submit>Sign</button>
+                                    <button class="btn btn-default border btn-sm" cancel>Cancel</button>
+                                </div>
+                            </form>
+                        </div>
+                    @else
+                        <span class="text-success">Signed</span>
+                    @endif
+                @else
+                    <div moe relative class="d-inline-block">
+                        <a class="font-weight-bold" href="" show start>Bill</a>
+                        <form url="/api/careMonth/generateRmGenericBillForMcpAndAutoSign" right>
+                            <input type="hidden" name="uid" value="{{$iPatient->care_month_uid}}">
+                            <p>Bill for this care month and sign it?</p>
                             <div class="mb-0">
-                                <button class="btn btn-success btn-sm" submit>Sign</button>
+                                <button class="btn btn-success btn-sm" submit>Bill &amp; Sign</button>
                                 <button class="btn btn-default border btn-sm" cancel>Cancel</button>
                             </div>
                         </form>
                     </div>
-                @else
-                    <span class="text-success">Signed</span>
                 @endif
             @else
                 <span class="text-danger font-weight-normal">
-                    Not yet
+                    No
                 </span>
             @endif
         @elseif($mode === 'rmm')
-            @if($iPatient->rmm_rm_generic_bill_id)
+            @if($lastVisitWithin90Days && $iPatient->has_mcp_interacted_with_client_about_rm && $iPatient->number_of_days_with_remote_measurements >= 16 && $iPatient->rm_total_time_in_seconds_by_rmm_pro >= 1200)
                 <span class="text-success font-weight-bold">
                     <i class="fa fa-check"></i>
-                    Yes
                 </span>
-                (${{friendly_money($iPatient->rmm_rm_generic_bill_expected_payment_amount)}})
-                @if($iPatient->rmm_rm_generic_bill_signed)
-                    <div moe relative
-                         class="d-inline-block {{ $iPatient->rmm_rm_generic_bill_generic_pro_id !== $pro->id ? 'moe-disabled' : '' }}"
-                         title="{{ $iPatient->rmm_rm_generic_bill_generic_pro_id !== $pro->id ? 'Only the bill\'s pro can sign' : '' }}">
-                        <a class="font-weight-bold" href="" show start>Sign</a>
-                        <form url="/api/bill/signAsGenericPro" right>
-                            <input type="hidden" name="uid" value="{{$iPatient->rmm_rm_generic_bill_uid}}">
-                            <p>Sign this bill?</p>
+                @if($iPatient->rmm_rm_generic_bill_uid)
+                    ${{friendly_money($iPatient->rmm_rm_generic_bill_expected_payment_amount)}}
+                    @if($iPatient->rmm_rm_generic_bill_signed)
+                        <div moe relative
+                             class="d-inline-block {{ $iPatient->rmm_rm_generic_bill_generic_pro_id !== $pro->id ? 'moe-disabled' : '' }}"
+                             title="{{ $iPatient->rmm_rm_generic_bill_generic_pro_id !== $pro->id ? 'Only the bill\'s pro can sign' : '' }}">
+                            <a class="font-weight-bold" href="" show start>Sign</a>
+                            <form url="/api/bill/signAsGenericPro" right>
+                                <input type="hidden" name="uid" value="{{$iPatient->rmm_rm_generic_bill_uid}}">
+                                <p>Sign this bill?</p>
+                                <div class="mb-0">
+                                    <button class="btn btn-success btn-sm" submit>Sign</button>
+                                    <button class="btn btn-default border btn-sm" cancel>Cancel</button>
+                                </div>
+                            </form>
+                        </div>
+                    @else
+                        <span class="text-success">Signed</span>
+                    @endif
+                @else
+                    <div moe relative class="d-inline-block">
+                        <a class="font-weight-bold" href="" show start>Bill</a>
+                        <form url="/api/careMonth/generateRmGenericBillForRmmAndAutoSign" right>
+                            <input type="hidden" name="uid" value="{{$iPatient->care_month_uid}}">
+                            <p>Bill for this care month and sign it?</p>
                             <div class="mb-0">
-                                <button class="btn btn-success btn-sm" submit>Sign</button>
+                                <button class="btn btn-success btn-sm" submit>Bill &amp; Sign</button>
                                 <button class="btn btn-default border btn-sm" cancel>Cancel</button>
                             </div>
                         </form>
                     </div>
-                @else
-                    <span class="text-success">Signed</span>
                 @endif
             @else
                 <span class="text-danger font-weight-normal">
-                    Not yet
+                    No
                 </span>
             @endif
         @elseif($mode === 'rme')
             @if($lastVisitWithin90Days && $iPatient->number_of_days_with_remote_measurements >= 16)
                 <span class="text-success font-weight-bold">
                     <i class="fa fa-check"></i>
-                    Yes
                 </span>
             @else
                 <span class="text-danger font-weight-normal">
-                    Not yet
+                    No
                 </span>
             @endif
         @endif
     </td>
+    @endif
 </tr>

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

@@ -0,0 +1,98 @@
+<div class="d-flex align-items-stretch m-0 h-100">
+    {{--<div class="overflow-auto border-right h-100 rpm-matrix-left-column">
+        @include('app.stat-tree.summary', ['slug' => 'rm-tree-' . $mode, 'showForPro' => $pro, 'noDropVisualize' => true, 'stParams' => ['start_date' => $rcmStartDate]])
+    </div>--}}
+    <div class="flex-grow-1 px-0 overflow-auto h-100 rpm-matrix-right-column">
+        <?php $trIndex = 0; ?>
+        @if(!request()->input('not-enrolled'))
+            @foreach ($patients as $iPatient)
+                <script>
+                    addMCHook(
+                        'refresh-rpm-row-{{$trIndex}}',
+                        function () {
+                            refreshRpmRow({{$trIndex}});
+                        }
+                    );
+                </script>
+                <?php $trIndex++; ?>
+            @endforeach
+        @endif
+        <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 {{$strategy === 'X16_DAYS_20_MINS_ON_OWN_MCP_COM_DURING_CM' ? '' : 'd-nonex'}}">#RPM Mins.</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>
+                <th class="border-0 text-secondary">Latest Wt</th>
+                <th class="border-0">@include('app.practice-management._sort_header', ['route' => route("practice-management.rpm-matrix-" . $mode), 'label' => 'Days Since Last Visit', 'key' => 'most_recent_completed_mcp_note_date'])</th>
+                @if($mode === 'mcp' || $mode === 'rmm')
+                    @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' => '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
+                        <th class="border-0">@include('app.practice-management._sort_header', ['route' => route("practice-management.rpm-matrix-" . $mode), 'label' => '#RMM Mins.', 'key' => 'rm_total_time_in_seconds_by_rmm_pro'])</th>
+                    @endif
+                @elseif($mode === 'rme')
+                    <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>
+                    <th class="border-0">@include('app.practice-management._sort_header', ['route' => route("practice-management.rpm-matrix-" . $mode), 'label' => '#RME Mins.', 'key' => 'rm_total_time_in_seconds_by_rme_pro'])</th>
+                @endif
+                @if(!request()->input('not-enrolled'))
+                    {{--
+                    @if(!request()->input('f_billable') || request()->input('f_billable') === 'all')
+                        @if($mode === 'mcp')
+                            <th class="border-0">@include('app.practice-management._sort_header', ['route' => route("practice-management.rpm-matrix-" . $mode), 'label' => 'Billable', 'key' => 'mcp_rm_generic_bill_id'])</th>
+                        @elseif($mode === 'rmm')
+                            <th class="border-0">@include('app.practice-management._sort_header', ['route' => route("practice-management.rpm-matrix-" . $mode), 'label' => 'Billable', 'key' => 'rmm_rm_generic_bill_id'])</th>
+                        @endif
+                    @else
+                        <th class="border-0 text-secondary">Billable</th>
+                    @endif
+                    --}}
+                    <th class="border-0 text-secondary">Billable</th>
+                @endif
+            </tr>
+            </thead>
+            <tbody>
+            <?php $trIndex = 0; ?>
+            @foreach ($patients as $iPatient)
+                <?php
+
+                $daysDiff = -1;
+                if ($iPatient->most_recent_completed_mcp_note_date) {
+                    $careMonthLastDay = date_add(date_create($rcmStartDate), date_interval_create_from_date_string("1 month"));
+                    $careMonthLastDay = date_sub($careMonthLastDay, date_interval_create_from_date_string("1 day"));
+                    $daysDiff = date_diff($careMonthLastDay, date_create($iPatient->most_recent_completed_mcp_note_date))->days;
+                }
+                $lastVisitWithin90Days = ($daysDiff !== -1 && $daysDiff <= 90);
+
+                ?>
+                @include('app.practice-management.remote-monitoring-row-markup-by-pro-type')
+                <?php $trIndex++; ?>
+            @endforeach
+            </tbody>
+        </table>
+    </div>
+</div>

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

@@ -36,12 +36,12 @@
             padding: 0.5rem;
         }
     </style>
-    <div class="p-3 mcp-theme-1 body-height" id="practice-remote-monitoring" v-cloak>
+    <div class="p-3 mcp-theme-1" id="practice-remote-monitoring" v-cloak>
 
         <div class="card h-100">
 
             <div class="card-header px-2 py-2 d-flex align-items-baseline">
-                <form class="d-block w-100" action="" method="GET">
+                <form class="d-block w-100" action="" method="GET" id="rpm-matrix-filter">
 
                     <div class="d-flex align-items-end">
                         <span class="mr-4">
@@ -70,17 +70,15 @@
                         <span class="mr-2">Strategy:</span>
                         @if($mode === 'mcp')
                             {{strategy_display($pro->mcp_rpm_payment_strategy, $mode)}}
-                            <?php $strategy = $pro->mcp_rpm_payment_strategy; ?>
+                            <?php $strategy = 'X16_DAYS_20_MINS_ON_OWN_MCP_COM_DURING_CM'; // $pro->mcp_rpm_payment_strategy; ?>
                         @elseif($mode === 'rmm')
                             {{strategy_display($pro->rme_payment_strategy, $mode)}}
-                            <?php $strategy = $pro->rmm_payment_strategy; ?>
+                            <?php $strategy = 'X16_DAYS_20_MINS_ON_OWN_MCP_COM_DURING_CM'; // $pro->rmm_payment_strategy; ?>
                         @elseif($mode === 'rmm')
                             {{strategy_display($pro->rmm_payment_strategy, $mode)}}
-                            <?php $strategy = $pro->rme_payment_strategy; ?>
+                            <?php $strategy = 'X16_DAYS'; // $pro->rme_payment_strategy; ?>
                         @endif
 
-                        <?php $strategy = 'X16_DAYS_20_MINS_ON_OWN_MCP_COM_DURING_CM'; ?>
-
                         <div class="ml-auto d-inline-flex flex-nowrap align-items-baseline">
                             <span class="mr-2">Month</span>
                             <select class="form-control form-control-sm min-width-unset width-100px mr-3" name="m"
@@ -108,8 +106,9 @@
                         </div>
                     </div>
 
-                    <div class="d-flex align-items-start mt-2 pt-1 border-top">
+                    <div class="d-none align-items-start mt-2 pt-1 border-top">
 
+                        {{--
                         <div>
                             <label class="mb-0 text-sm {{request()->input('f_name') ? 'text-info' : 'text-secondary'}}">Name</label>
                             <input type="text"
@@ -248,105 +247,33 @@
                                 <button class="btn-reset btn btn-sm btn-default bg-white text-secondary border"><i class="fa fa-times"></i></button>
                             </div>
                         </div>
+                        --}}
                     </div>
 
+                    <input type="hidden" name="not-enrolled" value="{{request()->input('not-enrolled')}}">
+
                 </form>
             </div>
 
             <?php $rc = request()->input('rc') ? request()->input('rc') : 1; ?>
 
             <div class="card-body p-0">
-                <div class="d-flex align-items-stretch m-0 h-100">
-                    <div class="overflow-auto border-right h-100 rpm-matrix-left-column">
-                        @include('app.stat-tree.summary', ['slug' => 'rm-tree-' . $mode, 'showForPro' => $pro, 'noDropVisualize' => true, 'stParams' => ['start_date' => $rcmStartDate]])
-                    </div>
-                    <div class="flex-grow-1 px-0 overflow-auto h-100 rpm-matrix-right-column">
-                        <?php $trIndex = 0; ?>
-                        @foreach ($patients as $iPatient)
-                            <script>
-                                addMCHook(
-                                    'refresh-rpm-row-{{$trIndex}}',
-                                    function () {
-                                        refreshRpmRow({{$trIndex}});
-                                    }
-                                );
-                            </script>
-                            <?php $trIndex++; ?>
-                        @endforeach
-                        <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 {{$strategy === 'X16_DAYS_20_MINS_ON_OWN_MCP_COM_DURING_CM' ? '' : 'd-nonex'}}">#RPM Mins.</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>
-                                <th class="border-0 text-secondary">Latest Wt</th>
-                                <th class="border-0">@include('app.practice-management._sort_header', ['route' => route("practice-management.rpm-matrix-" . $mode), 'label' => 'Days Since Last Visit', 'key' => 'most_recent_completed_mcp_note_date'])</th>
-                                @if($mode === 'mcp' || $mode === 'rmm')
-                                    @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' => '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
-                                        <th class="border-0">@include('app.practice-management._sort_header', ['route' => route("practice-management.rpm-matrix-" . $mode), 'label' => '#RMM Mins.', 'key' => 'rm_total_time_in_seconds_by_rmm_pro'])</th>
-                                    @endif
-                                @elseif($mode === 'rme')
-                                    <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>
-                                    <th class="border-0">@include('app.practice-management._sort_header', ['route' => route("practice-management.rpm-matrix-" . $mode), 'label' => '#RME Mins.', 'key' => 'rm_total_time_in_seconds_by_rme_pro'])</th>
-                                @endif
-                                @if(!request()->input('f_billable') || request()->input('f_billable') === 'all')
-                                    @if($mode === 'mcp')
-                                        <th class="border-0">@include('app.practice-management._sort_header', ['route' => route("practice-management.rpm-matrix-" . $mode), 'label' => 'Billable', 'key' => 'mcp_rm_generic_bill_id'])</th>
-                                    @elseif($mode === 'rmm')
-                                        <th class="border-0">@include('app.practice-management._sort_header', ['route' => route("practice-management.rpm-matrix-" . $mode), 'label' => 'Billable', 'key' => 'rmm_rm_generic_bill_id'])</th>
-                                    @endif
-                                @else
-                                    <th class="border-0 text-secondary">Billable</th>
-                                @endif
-                            </tr>
-                            </thead>
-                            <tbody>
-                            <?php $trIndex = 0; ?>
-                            @foreach ($patients as $iPatient)
-                                <?php
-
-                                $daysDiff = -1;
-                                if ($iPatient->most_recent_completed_mcp_note_date) {
-                                    $careMonthLastDay = date_add(date_create($rcmStartDate), date_interval_create_from_date_string("1 month"));
-                                    $careMonthLastDay = date_sub($careMonthLastDay, date_interval_create_from_date_string("1 day"));
-                                    $daysDiff = date_diff($careMonthLastDay, date_create($iPatient->most_recent_completed_mcp_note_date))->days;
-                                }
-                                $lastVisitWithin90Days = ($daysDiff !== -1 && $daysDiff <= 90);
-
-                                ?>
-                                @include('app.practice-management.remote-monitoring-row-markup-by-pro-type')
-                                <?php $trIndex++; ?>
-                            @endforeach
-                            </tbody>
-                        </table>
+                <div>
+                    <div class="d-flex align-items-baseline p-2 border-bottom" tab-links="">
+                        <a class="{{ !request()->input('not-enrolled') ? 'tab-link-active' : '' }} text-dark c-pointer"
+                           onclick="$('[name=not-enrolled]').val(''); return fastLoad('{{route('practice-management.rpm-matrix-' . $mode)}}?' + $('#rpm-matrix-filter').serialize());"
+                           tab-link="rpm">Enrolled in RPM</a>
+                        <a class="{{ request()->input('not-enrolled') ? 'tab-link-active' : '' }} text-dark c-pointer"
+                           onclick="$('[name=not-enrolled]').val('1'); return fastLoad('{{route('practice-management.rpm-matrix-' . $mode)}}?' + $('#rpm-matrix-filter').serialize());"
+                           tab-link="no-rpm">Not Enrolled in RPM</a>
                     </div>
                 </div>
+                <div class="cm-tab {{!request()->input('not-enrolled') ? '' : 'd-none'}}" tab-key="rpm">
+                    @include('app.practice-management.rpm-matrix-by-pro-type-table')
+                </div>
+                <div class="cm-tab {{request()->input('not-enrolled') ? '' : 'd-none'}}" tab-key="no-rpm">
+                    @include('app.practice-management.rpm-matrix-by-pro-type-table')
+                </div>
             </div>
         </div>
     </div>