Forráskód Böngészése

RPM manager - single row refresh after actions

Vijayakrishnan 2 éve
szülő
commit
e8acff4ce5

+ 104 - 1
app/Http/Controllers/PracticeManagementController.php

@@ -2471,7 +2471,7 @@ WHERE
         }
 
         // show only if enrolled in RPM
-        $conditions[] = "(care_month.is_client_enrolled_in_rm IS TRUE)";
+        $conditions[] = "(care_month.is_client_enrolled_in_rm IS TRUE AND client.has_mcp_done_onboarding_visit = 'YES')";
 
         // m and y are mandatory
         $v = trim($request->input('m'));
@@ -2602,6 +2602,109 @@ WHERE
         return view('app.practice-management.rpm-manager.index', compact('patients', 'month', 'year','paginator', 'perPage', 'proRoles', 'viewingAs', 'cmStartDate'));
     }
 
+    public function rpmManagerRow(Request $request, $uid) {
+        $query = "
+SELECT 
+       -- display columns
+       (client.name_first || ' ' || client.name_last) as client_name,
+       client.age_in_years,
+       client.dob,
+       care_month.start_date,
+       mcpPro.name_last as mcp_last_name,
+       rmmPro.name_last as rmm_last_name,
+       rmePro.name_last as rme_last_name,
+       (mcpPro.name_first || ' ' || mcpPro.name_last) as mcp_name,
+       (rmmPro.name_first || ' ' || rmmPro.name_last) as rmm_name,
+       (rmePro.name_first || ' ' || rmePro.name_last) as rme_name,
+       care_month.days_between_most_recent_mcp_note_date_and_end_of_care_month,
+       care_month.number_of_days_with_remote_measurements,
+       care_month.number_of_days_with_remote_bp_measurements,
+       care_month.number_of_days_with_remote_weight_measurements,
+       care_month.has_cellular_weight_scale_been_ordered,
+       care_month.has_cellular_weight_scale_device,
+       care_month.most_recent_cellular_weight_value,
+       care_month.most_recent_cellular_weight_measurement_at,
+       care_month.has_cellular_bp_device,
+       care_month.has_cellular_bp_meter_been_ordered,
+       care_month.most_recent_cellular_bp_dbp_mm_hg,
+       care_month.most_recent_cellular_bp_sbp_mm_hg,
+       care_month.most_recent_cellular_bp_measurement_at,
+       care_month.entries_json,
+       care_month.has_mcp_interacted_with_client_about_rm,
+       care_month.has_anyone_interacted_with_client_about_rm,
+       care_month.has_admin_interacted_with_client_about_rm,
+       care_month.has_rmm_interacted_with_client_about_rm,
+       care_month.rm_total_time_in_seconds,
+       care_month.rm_total_time_in_seconds_by_mcp,
+       care_month.rm_total_time_in_seconds_by_rmm_pro,
+       care_month.is_billable_by_mcp,
+       care_month.is_billed_by_mcp,
+       care_month.is_billable_by_rmm,
+       care_month.is_billed_by_rmm,
+       care_month.is_billable_by_rme,
+       care_month.is_billed_by_rme,
+       care_month.is_99454_claimable,
+       care_month.is_99454_claimed,
+       care_month.is_99454_claiming_waived,
+       care_month.why_99454_not_claimable_reason,
+       care_month.why_claiming_99454_waived,
+       care_month.is_99457_claimable,
+       care_month.is_99457_claimed,
+       care_month.is_99457_claiming_waived,
+       care_month.why_99457_not_claimable_reason,
+       care_month.why_claiming_99457_waived,
+       care_month.is_99458_claimable,
+       care_month.is_99458_claimed,
+       care_month.is_99458_claiming_waived,
+       care_month.why_99458_not_claimable_reason,
+       care_month.why_claiming_99458_waived,
+       nv.raw_date as next_visit_date,
+       -- TODO vital settings
+       
+       -- functionality support columns
+       client.uid as client_uid,
+       care_month.uid as care_month_uid,
+       mcpPro.mcp_rpm_payment_strategy,
+       mcpPro.mcp_rpm_payment_amount,
+       rmmPro.rmm_payment_strategy,
+       rmmPro.rmm_payment_amount,
+       rmePro.rme_payment_strategy,
+       rmePro.rme_payment_amount,
+       care_month.entries_json,
+       care_month.measurements_json,
+       care_month.measurements_bp_json,
+       care_month.measurements_weight_json,
+       care_month.start_date as care_month_start_date
+
+FROM care_month join client on care_month.client_id = client.id 
+    left join pro mcpPro on care_month.mcp_pro_id = mcpPro.id
+    left join pro rmmPro on care_month.rmm_pro_id = rmmPro.id
+    left join pro rmePro on care_month.rme_pro_id = rmePro.id
+    left join note mrnote on client.most_recent_completed_mcp_note_id = mrnote.id
+    left join appointment nv on nv.id = mrnote.follow_up_appointment_id
+WHERE
+      care_month.uid = '{$uid}'
+";
+
+        $iPatient = DB::select($query)[0];
+
+        $index = $request->input('index');
+        $viewingAs = $request->input('viewingAs');
+        $daysRemaining = date('t') - date('j');
+
+        // m and y are mandatory
+        $v = trim($request->input('m'));
+        if(!$v) $v = date("m");
+        $month = $v;
+        $v = trim($request->input('y'));
+        if(!$v) $v = date("Y");
+        $year = $v;
+
+        $updateModel = true;
+
+        return view('app.practice-management.rpm-manager.row', compact('iPatient', 'index', 'month', 'year', 'viewingAs', 'updateModel'));
+    }
+
     public function claimsReport(Request $request) {
 
         $performer = $this->performer();

+ 19 - 341
resources/views/app/practice-management/rpm-manager/index.blade.php

@@ -227,344 +227,10 @@
                         $index = $paginator->firstItem();
                         ?>
                         @foreach ($patients as $iPatient)
-                            <tr data-client-uid="{{$iPatient->client_uid}}" data-care-month-uid="{{$iPatient->care_month_uid}}">
-                                <td class="text-right">{{$index++}}</td>
-                                <td class="border-left-0">
-                                    <a href="/mc/patients/view/{{ $iPatient->client_uid }}"
-                                       native target="_blank"
-                                       class="text-nowrap d-block max-width-170px overflow-hidden text-ellipsis"
-                                    >{{ $iPatient->client_name }}</a>
-                                </td>
-                                <td title="{{friendly_date($iPatient->dob)}}">{{$iPatient->age_in_years ?: '-'}}</span></td>
-                                @if($viewingAs === 'ADMIN')
-                                    <td class="rmgr-name-column"><div class="rmgr-name-element" title="{{$iPatient->mcp_name ?: ''}}">{{$iPatient->mcp_last_name ?: '-'}}</div></td>
-                                    <td class="rmgr-name-column"><div class="rmgr-name-element" title="{{$iPatient->rmm_name ?: ''}}">{{$iPatient->rmm_last_name ?: '-'}}</div></td>
-                                    <td class="rmgr-name-column"><div class="rmgr-name-element" title="{{$iPatient->rme_name ?: ''}}">{{$iPatient->rme_last_name ?: '-'}}</div></td>
-                                @endif
-                                <td>{{$iPatient->days_between_most_recent_mcp_note_date_and_end_of_care_month}}</td>
-
-                                <!--# Meas. Days-->
-                                <td>
-                                    <?php
-                                    $icon = '';
-                                    $label = '';
-                                    if($iPatient->number_of_days_with_remote_measurements>=16) {
-                                        $icon = '<i class="ml-1 fa fa-check text-success opacity-35"></i>';
-                                    }
-                                    else {
-                                        if(intval(date('m')) === intval(request()->input('m')) || !request()->input('m')) {
-                                            if($daysRemaining < 16 - $iPatient->number_of_days_with_remote_measurements) {
-                                                $icon = '<i class="ml-1 fas fa-ban text-secondary opacity-35"></i>';
-                                                $label = 'Not possible. Not enough days left to reach 16.';
-                                            }
-                                            elseif($daysRemaining > 16 - $iPatient->number_of_days_with_remote_measurements) {
-                                                $icon = '<i class="ml-1 fa fa-bolt text-primary"></i>';
-                                                $label = 'Possible. Ensure ' . (16 - $iPatient->number_of_days_with_remote_measurements) . ' more days with measurements before the end of the month.';
-                                            }
-                                            elseif($daysRemaining === 16 - $iPatient->number_of_days_with_remote_measurements) {
-                                                $icon = '<i class="ml-1 fa fa-exclamation-triangle text-danger"></i>';
-                                                $label = 'Possible. Ensure a measurement every day for the rest of the month.';
-                                            }
-                                        }
-                                        else {
-                                            $icon = '<i class="ml-1 fas fa-ban text-secondary opacity-35"></i>';
-                                            $label = 'Not possible. Past month.';
-                                        }
-                                    }
-                                    ?>
-                                    <div class="d-flex align-items-baseline flex-nowrap" title="{{$label}}">
-                                        <?php $iPatient->number_of_days_with_remote_measurements = $iPatient->number_of_days_with_remote_measurements ?: 0; ?>
-                                        <span>{{$iPatient->number_of_days_with_remote_measurements}}</span>
-                                        {!! $icon !!}
-                                    </div>
-                                </td>
-                                <td>{{$iPatient->number_of_days_with_remote_bp_measurements}}</td>
-                                <td>{{$iPatient->number_of_days_with_remote_weight_measurements}}</td>
-
-                                <td class="text-nowrap position-relative {{$iPatient->has_cellular_bp_device && $iPatient->most_recent_cellular_bp_sbp_mm_hg && $iPatient->most_recent_cellular_bp_dbp_mm_hg ? 'rpm-manager-bp-popover-trigger' : ''}} rpm-manager-popover-trigger" data-uid="{{$iPatient->care_month_uid}}">
-                                    @if(!$iPatient->has_cellular_bp_device)
-                                        @if($iPatient->has_cellular_bp_meter_been_ordered)
-                                            <span class="text-info">Ordered</span>
-                                        @else
-                                            <span class="text-warning-dark">Not Ordered</span>
-                                        @endif
-                                    @else
-                                        @if($iPatient->most_recent_cellular_bp_sbp_mm_hg && $iPatient->most_recent_cellular_bp_dbp_mm_hg)
-                                            <div class="text-nowrap d-flex align-items-baseline flex-nowrap">
-                                                <span class="sort-data">{{$iPatient->most_recent_cellular_bp_sbp_mm_hg}}</span>/{{$iPatient->most_recent_cellular_bp_dbp_mm_hg}}
-                                                @if($iPatient->most_recent_cellular_bp_measurement_at)
-                                                    <span class="text-sm text-secondary text-nowrap ml-1"
-                                                          title="{{friendly_date_time($iPatient->most_recent_cellular_bp_measurement_at)}}">{{friendly_date_est_compact($iPatient->most_recent_cellular_bp_measurement_at)}}</span>
-                                                @endif
-                                                <span class="mx-1 text-secondary text-sm">|</span>
-                                                <a href="#" class="btn-bp-popup"
-                                                   data-uid="{{$iPatient->care_month_uid}}">All</a>
-                                            </div>
-                                        @else
-                                            <span class="text-danger opacity-60">Not used yet</span>
-                                        @endif
-                                    @endif
-                                    @if($iPatient->has_cellular_bp_device && $iPatient->most_recent_cellular_bp_sbp_mm_hg && $iPatient->most_recent_cellular_bp_dbp_mm_hg)
-                                        <div class="position-absolute p-2 bg-white border rpm-manager-popover rpm-manager-bp-popover" id="rpm-manager-bp-popover-{{$iPatient->care_month_uid}}">
-                                            <div class="font-size-16">{{ $iPatient->client_name }} - BP Measurements</div>
-                                            <h3 class="my-2 font-size-16" id="rpm-manager-bp-caremonth-{{$iPatient->care_month_uid}}">Care Month:
-                                                <a href="/patients/view/{{ $iPatient->client_uid }}/care-months/view/{{$iPatient->care_month_uid}}"
-                                                   native target="_blank"
-                                                   open-in-stag-popup
-                                                   update-parent="refresh-rpm-row"
-                                                   popup-style="tall overflow-visible"
-                                                   mc-initer="care-month-dashboard-{{$iPatient->client_uid}}"
-                                                   title="{{$iPatient->client_name}} - {{friendly_month($iPatient->care_month_start_date)}}"
-                                                   class="font-size-16"
-                                                >{{friendly_month($iPatient->care_month_start_date)}}</a>
-                                            </h3>
-                                            <div id="rpm-manager-bp-graph-container-{{ $iPatient->care_month_uid }}" class="mt-3 mr-3">
-                                                <div id="rpm-manager-bp-graph-{{ $iPatient->care_month_uid }}"></div>
-                                            </div>
-                                            <div class="max-height-200px overflow-overlay-on-hover mt-3">
-                                                <table class="table table-condensed table-sm table-bordered m-0" id="rpm-manager-bp-matrix-{{ $iPatient->care_month_uid }}">
-                                                    <tbody></tbody>
-                                                </table>
-                                            </div>
-                                        </div>
-                                    @endif
-                                </td>
-                                <td class="text-nowrap position-relative {{$iPatient->has_cellular_weight_scale_device && $iPatient->most_recent_cellular_weight_value ? 'rpm-manager-weight-popover-trigger' : ''}} rpm-manager-popover-trigger" data-uid="{{$iPatient->care_month_uid}}">
-                                    @if(!$iPatient->has_cellular_weight_scale_device)
-                                        @if($iPatient->has_cellular_weight_scale_been_ordered)
-                                            <span class="text-info">Ordered</span>
-                                        @else
-                                            <span class="text-warning-dark">Not Ordered</span>
-                                        @endif
-                                    @else
-                                        @if($iPatient->most_recent_cellular_weight_value)
-                                            <div class="text-nowrap d-flex align-items-baseline flex-nowrap">
-                                                <span class="sort-data">{{round($iPatient->most_recent_cellular_weight_value, 1)}}</span>
-                                                @if($iPatient->most_recent_cellular_weight_measurement_at)
-                                                    <span class="text-sm text-secondary text-nowrap ml-1"
-                                                          title="{{friendly_date_time($iPatient->most_recent_cellular_weight_measurement_at)}}">{{friendly_date_est_compact($iPatient->most_recent_cellular_weight_measurement_at)}}</span>
-                                                @endif
-                                                <span class="mx-1 text-secondary text-sm">|</span>
-                                                <a href="#" class="btn-weight-popup"
-                                                   data-uid="{{$iPatient->care_month_uid}}">All</a>
-                                            </div>
-                                        @else
-                                            <span class="text-danger opacity-60">Not used yet</span>
-                                        @endif
-                                    @endif
-                                    @if($iPatient->has_cellular_weight_scale_device && $iPatient->most_recent_cellular_weight_value)
-                                        <div class="position-absolute p-2 bg-white border rpm-manager-popover rpm-manager-weight-popover" id="rpm-manager-weight-popover-{{$iPatient->care_month_uid}}">
-                                            <div class="font-size-16">{{ $iPatient->client_name }} - Weight Measurements</div>
-                                            <h3 class="my-2 font-size-16" id="rpm-manager-weight-caremonth-{{$iPatient->care_month_uid}}">Care Month:
-                                                <a href="/patients/view/{{ $iPatient->client_uid }}/care-months/view/{{$iPatient->care_month_uid}}"
-                                                   native target="_blank"
-                                                   open-in-stag-popup
-                                                   update-parent="refresh-rpm-row"
-                                                   popup-style="tall overflow-visible"
-                                                   mc-initer="care-month-dashboard-{{$iPatient->client_uid}}"
-                                                   title="{{$iPatient->client_name}} - {{friendly_month($iPatient->care_month_start_date)}}"
-                                                   class="font-size-16"
-                                                >{{friendly_month($iPatient->care_month_start_date)}}</a>
-                                            </h3>
-                                            <div id="rpm-manager-weight-graph-container-{{ $iPatient->care_month_uid }}" class="mt-3 mr-3">
-                                                <div id="rpm-manager-weight-graph-{{ $iPatient->care_month_uid }}"></div>
-                                            </div>
-                                            <div class="max-height-200px overflow-overlay-on-hover mt-3">
-                                                <table class="table table-condensed table-sm table-bordered m-0" id="rpm-manager-weight-matrix-{{ $iPatient->care_month_uid }}">
-                                                    <tbody></tbody>
-                                                </table>
-                                            </div>
-                                        </div>
-                                    @endif
-                                </td>
-
-                                @if($viewingAs !== 'RME')
-                                    <td>
-                                        @if(@$iPatient->myEntries && count($iPatient->myEntries))
-                                            <div class="d-flex align-items-baseline" title="Me: {{strip_tags($iPatient->myEntries[0]->contentText)}}">
-                                                <span class="text-info mr-1">{{round($iPatient->myEntries[0]->timeInSeconds/30)}}m</span>
-                                                <span class="flex-grow-1 max-width-200px text-ellipsis mr-1">{{strip_tags($iPatient->myEntries[0]->contentText)}}</span>
-                                                @if(gettype($iPatient->myEntries[0]->effectiveDate) === 'string')
-                                                    <span class="text-secondary text-sm">{{friendly_date_est_compact($iPatient->myEntries[0]->effectiveDate)}}</span>
-                                                @endif
-                                            </div>
-                                        @else
-                                            <span class="text-secondary">None</span>
-                                        @endif
-                                    </td>
-                                    <td>
-                                        @if(@$iPatient->otherEntries && count($iPatient->otherEntries))
-                                            <div class="d-flex align-items-baseline" title="{{$iPatient->otherEntries[0]->proNameFirst}} {{$iPatient->otherEntries[0]->proNameLast}}: {{strip_tags($iPatient->otherEntries[0]->contentText)}}">
-                                                @if($viewingAs === 'ADMIN')
-                                                    <span class="text-info mr-1">{{round($iPatient->otherEntries[0]->timeInSeconds/30)}}m</span>
-                                                @endif
-                                                <span class="flex-grow-1 max-width-200px text-ellipsis mr-1">{{strip_tags($iPatient->otherEntries[0]->contentText)}}</span>
-                                                @if(gettype($iPatient->otherEntries[0]->effectiveDate) === 'string')
-                                                    <span class="text-secondary text-sm">{{friendly_date_est_compact($iPatient->otherEntries[0]->effectiveDate)}}</span>
-                                                @endif
-                                            </div>
-                                        @else
-                                            <span class="text-secondary">None</span>
-                                        @endif
-                                    </td>
-                                @endif
-
-                                <td>
-                                    @if($viewingAs === 'ADMIN')
-                                        <div class="d-flex align-items-baseline flex-nowrap">
-                                            <div class="d-inline-flex align-items-baseline" title="MCP Interaction">
-                                                <i class="fa fa-circle text-sm opacity-35 {{$iPatient->has_mcp_interacted_with_client_about_rm ? 'text-success' : 'text-danger'}}"></i>
-                                                <span class="ml-1 mr-2">M</span>
-                                            </div>
-                                            <div class="d-inline-flex align-items-baseline" title="RMM Interaction">
-                                                <i class="fa fa-circle text-sm opacity-35 {{$iPatient->has_rmm_interacted_with_client_about_rm ? 'text-success' : 'text-danger'}}"></i>
-                                                <span class="ml-1 mr-2">R</span>
-                                            </div>
-                                            <div class="d-inline-flex align-items-baseline" title="Admin Interaction">
-                                                <i class="fa fa-circle text-sm opacity-35 {{$iPatient->has_admin_interacted_with_client_about_rm ? 'text-success' : 'text-danger'}}"></i>
-                                                <span class="ml-1 mr-2">A</span>
-                                            </div>
-                                        </div>
-                                    @elseif($viewingAs === 'MCP')
-                                        <div class="d-flex align-items-baseline flex-nowrap">
-                                            <i class="fa fa-circle text-sm opacity-35 {{$iPatient->has_mcp_interacted_with_client_about_rm ? 'text-success' : 'text-danger'}}"></i>
-                                            <span class="ml-1 mr-2">{{$iPatient->has_mcp_interacted_with_client_about_rm ? 'Yes' : 'No'}}</span>
-                                        </div>
-                                    @elseif($viewingAs === 'RMM')
-                                        <div class="d-flex align-items-baseline flex-nowrap">
-                                            <i class="fa fa-circle text-sm opacity-35 {{$iPatient->has_mcp_interacted_with_client_about_rm ? 'text-success' : 'text-danger'}}"></i>
-                                            <span class="ml-1 mr-2">{{$iPatient->has_mcp_interacted_with_client_about_rm ? 'Yes' : 'No'}}</span>
-                                        </div>
-                                    @endif
-                                </td>
-
-                                <!--Time-->
-                                @if($viewingAs !== 'RME')
-                                    @if($viewingAs === 'ADMIN' || $viewingAs === 'MCP')
-                                        <td>
-                                            <div class="d-flex align-items-baseline">
-                                                <i class="mr-1 text-sm fa fa-circle opacity-35 {{$iPatient->rm_total_time_in_seconds_by_mcp >= 1200 ? 'text-success' : 'text-danger'}}"></i>
-                                                <span class="text-nowrap">{{round($iPatient->rm_total_time_in_seconds_by_mcp / 60)}}:{{round($iPatient->rm_total_time_in_seconds_by_mcp % 60)}}</span>
-                                                <span class="sort-data d-none">{{$iPatient->rm_total_time_in_seconds_by_mcp}}</span>
-                                            </div>
-                                        </td>
-                                    @endif
-                                    @if($viewingAs === 'ADMIN' || $viewingAs === 'RMM')
-                                        <td>
-                                            <div class="d-flex align-items-baseline">
-                                                <i class="mr-1 text-sm fa fa-circle opacity-35 {{$iPatient->rm_total_time_in_seconds_by_rmm_pro >= 1200 ? 'text-success' : 'text-danger'}}"></i>
-                                                <span class="text-nowrap">{{round($iPatient->rm_total_time_in_seconds_by_rmm_pro / 60)}}:{{round($iPatient->rm_total_time_in_seconds_by_rmm_pro % 60)}}</span>
-                                                <span class="sort-data d-none">{{$iPatient->rm_total_time_in_seconds_by_rmm_pro}}</span>
-                                            </div>
-                                        </td>
-                                    @endif
-                                    @if($viewingAs === 'ADMIN')
-                                        <td>
-                                            <div class="d-flex align-items-baseline">
-                                                <i class="mr-1 text-sm fa fa-circle opacity-35 {{$iPatient->rm_total_time_in_seconds >= 1200 ? 'text-success' : 'text-danger'}}"></i>
-                                                <span class="text-nowrap">{{round($iPatient->rm_total_time_in_seconds / 60)}}:{{round($iPatient->rm_total_time_in_seconds % 60)}}</span>
-                                                <span class="sort-data d-none">{{$iPatient->rm_total_time_in_seconds}}</span>
-                                            </div>
-                                        </td>
-                                    @endif
-                                @endif
-
-                                <!--Reimb.-->
-                                @if($viewingAs === 'ADMIN' || $viewingAs === 'MCP')
-                                    <td>
-                                        @if($iPatient->is_billable_by_mcp)
-                                            @if($iPatient->is_billed_by_mcp)
-                                                <i class="mr-1 fa fa-check text-success opacity-60" title="Billed"></i>
-                                            @else
-                                                <i class="mr-1 fa fa-bolt text-primary" title="Billable"></i>
-                                            @endif
-                                        @else
-                                            <i class="mr-1 fas fa-ban text-secondary" title="Not Billable"></i>
-                                        @endif
-                                    </td>
-                                @endif
-                                @if($viewingAs === 'ADMIN' || $viewingAs === 'RMM')
-                                    <td>
-                                        @if($iPatient->is_billable_by_rmm)
-                                            @if($iPatient->is_billed_by_rmm)
-                                                <i class="mr-1 fa fa-check text-success opacity-60" title="Billed"></i>
-                                            @else
-                                                <i class="mr-1 fa fa-bolt text-primary" title="Billable"></i>
-                                            @endif
-                                        @else
-                                            <i class="mr-1 fas fa-ban text-secondary" title="Not Billable"></i>
-                                        @endif
-                                    </td>
-                                @endif
-                                @if($viewingAs === 'ADMIN' || $viewingAs === 'RME')
-                                    <td>
-                                        @if($iPatient->is_billable_by_rme)
-                                            @if($iPatient->is_billed_by_rme)
-                                                <i class="mr-1 fa fa-check text-success opacity-60" title="Billed"></i>
-                                            @else
-                                                <i class="mr-1 fa fa-bolt text-primary" title="Billable"></i>
-                                            @endif
-                                        @else
-                                            <i class="mr-1 fas fa-ban text-secondary" title="Not Billable"></i>
-                                        @endif
-                                    </td>
-                                @endif
-
-                                <!--Claim-->
-                                @if($viewingAs === 'ADMIN' && !(date('m') == $month && date('Y') == $year))
-                                    <td>
-                                        @if($iPatient->is_99454_claiming_waived)
-                                            <span title="{{$iPatient->why_claiming_99454_waived ?: ''}}">Waived</span>
-                                        @else
-                                            @if($iPatient->is_99454_claimable)
-                                                @if($iPatient->is_99454_claimed)
-                                                    <i class="mr-1 fa fa-check text-success opacity-60" title="Claimed"></i>
-                                                @else
-                                                    <i class="mr-1 fa fa-bolt text-primary" title="Claimable"></i>
-                                                @endif
-                                            @else
-                                                <i class="mr-1 fas fa-ban text-secondary" title="Not Claimable: {{$iPatient->why_99454_not_claimable_reason ?: ''}}"></i>
-                                            @endif
-                                        @endif
-                                    </td>
-                                    <td>
-                                        @if($iPatient->is_99457_claiming_waived)
-                                            <span title="{{$iPatient->why_claiming_99457_waived ?: ''}}">Waived</span>
-                                        @else
-                                            @if($iPatient->is_99457_claimable)
-                                                @if($iPatient->is_99457_claimed)
-                                                    <i class="mr-1 fa fa-check text-success opacity-60" title="Claimed"></i>
-                                                @else
-                                                    <i class="mr-1 fa fa-bolt text-primary" title="Claimable"></i>
-                                                @endif
-                                            @else
-                                                <i class="mr-1 fas fa-ban text-secondary" title="Not Claimable: {{$iPatient->why_99457_not_claimable_reason ?: ''}}"></i>
-                                            @endif
-                                        @endif
-                                    </td>
-                                    <td>
-                                        @if($iPatient->is_99458_claiming_waived)
-                                            <span title="{{$iPatient->why_claiming_99458_waived ?: ''}}">Waived</span>
-                                        @else
-                                            @if($iPatient->is_99458_claimable)
-                                                @if($iPatient->is_99458_claimed)
-                                                    <i class="mr-1 fa fa-check text-success opacity-60" title="Claimed"></i>
-                                                @else
-                                                    <i class="mr-1 fa fa-bolt text-primary" title="Claimable"></i>
-                                                @endif
-                                            @else
-                                                <i class="mr-1 fas fa-ban text-secondary" title="Not Claimable: {{$iPatient->why_99458_not_claimable_reason ?: ''}}"></i>
-                                            @endif
-                                        @endif
-                                    </td>
-                                @endif
-
-                                <td><span class="text-nowrap">{{$iPatient->next_visit_date ?: '-'}}</span></td>
-
-                                <td class="border-right-0"></td>
-
-                            </tr>
-
+                            @include('app.practice-management.rpm-manager.row', compact('iPatient', 'index', 'month', 'year', 'viewingAs'))
+                            <?php
+                            $index++;
+                            ?>
                         @endforeach
                         </tbody>
                     </table>
@@ -633,7 +299,7 @@
     <script>
         (function () {
 
-            let careMonths = {!! json_encode($careMonths) !!};
+            window.RM_careMonths = {!! json_encode($careMonths) !!};
 
             function reInitMoes() {
                 $('[moe][initialized]').removeAttr('initialized');
@@ -737,6 +403,18 @@
                         return false;
                     });
 
+                parent
+                    .off('click', '.rpm-manager-popover-trigger')
+                    .on('click', '.rpm-manager-popover-trigger', function() {
+                        openDynamicStagPopup('/patients/view/' + $(this).attr('data-client-uid') + '/care-months/view/' + $(this).attr('data-uid'),
+                            'care-month-dashboard-' + $(this).attr('data-client-uid'),
+                            $(this).attr('data-cm-title'),
+                            'refresh-' + $(this).attr('data-uid'),
+                            'tall overflow-visible'
+                        );
+                        return false;
+                    });
+
                 parent
                     .off('click', '.btn-my-entries-popup')
                     .on('click', '.btn-my-entries-popup', function() {
@@ -757,7 +435,7 @@
             }
 
             function prepareMeasurementsPopover(_careMonthUid, _type) {
-                let careMonth = careMonths[_careMonthUid],
+                let careMonth = RM_careMonths[_careMonthUid],
                     measurements = careMonth['measurements_' + _type + '_json'];
                 if(!measurements) measurements = [];
 
@@ -959,7 +637,7 @@
             }
 
             function prepareEntriesPopup(_careMonthUid, _type) {
-                let careMonth = careMonths[_careMonthUid],
+                let careMonth = RM_careMonths[_careMonthUid],
                     entries = careMonth[_type + 'Entries'];
 
                 // misc

+ 395 - 0
resources/views/app/practice-management/rpm-manager/row.blade.php

@@ -0,0 +1,395 @@
+<tr data-client-uid="{{$iPatient->client_uid}}" data-care-month-uid="{{$iPatient->care_month_uid}}">
+    <td class="text-right">
+        @if(@$updateModel)
+            <?php
+            if(!!$iPatient->entries_json) {
+                $iPatient->entries_json = json_decode($iPatient->entries_json);
+                $myEntries = [];
+                $otherEntries = [];
+                for ($i = 0; $i < count($iPatient->entries_json); $i++) {
+                    if($iPatient->entries_json[$i]->proUid === $pro->uid) {
+                        $myEntries[] = $iPatient->entries_json[$i];
+                    }
+                    else {
+                        $otherEntries[] = $iPatient->entries_json[$i];
+                    }
+                }
+                $iPatient->myEntries = $myEntries;
+                $iPatient->otherEntries = $otherEntries;
+            }
+            if(!!$iPatient->measurements_json) {
+                $iPatient->measurements_json = json_decode($iPatient->measurements_json);
+            }
+            if(!!$iPatient->measurements_bp_json) {
+                $iPatient->measurements_bp_json = json_decode($iPatient->measurements_bp_json);
+                for ($i = 0; $i < count($iPatient->measurements_bp_json); $i++) {
+                    $timestampInSec = floor($iPatient->measurements_bp_json[$i]->ts / 1000);
+                    $iPatient->measurements_bp_json[$i]->date_display = friendly_date_time_short_with_tz_from_timestamp($timestampInSec, 'EASTERN', '-', 'm/d/y');
+                    $iPatient->measurements_bp_json[$i]->date_standard = friendly_date_time_short_with_tz_from_timestamp($timestampInSec, 'EASTERN', '-', 'Y-m-d');
+                    $iPatient->measurements_bp_json[$i]->time_display = friendly_date_time_short_with_tz_from_timestamp($timestampInSec, 'EASTERN', '-', 'h:i A') . ' EST';
+                }
+            }
+            if(!!$iPatient->measurements_weight_json) {
+                $iPatient->measurements_weight_json = json_decode($iPatient->measurements_weight_json);
+                for ($i = 0; $i < count($iPatient->measurements_weight_json); $i++) {
+                    $timestampInSec = floor($iPatient->measurements_weight_json[$i]->ts / 1000);
+                    $iPatient->measurements_weight_json[$i]->date_display = friendly_date_time_short_with_tz_from_timestamp($timestampInSec, 'EASTERN', '-', 'm/d/y');
+                    $iPatient->measurements_weight_json[$i]->date_standard = friendly_date_time_short_with_tz_from_timestamp($timestampInSec, 'EASTERN', '-', 'Y-m-d');
+                    $iPatient->measurements_weight_json[$i]->time_display = friendly_date_time_short_with_tz_from_timestamp($timestampInSec, 'EASTERN', '-', 'h:i A') . ' EST';
+                    $iPatient->measurements_weight_json[$i]->numericValue = round($iPatient->measurements_weight_json[$i]->numericValue, 1);
+                }
+            }
+            $iPatient->month_display = friendly_month($iPatient->care_month_start_date);
+            ?>
+            <script>
+                window.RM_careMonths['{{$iPatient->care_month_uid}}'] = {!! json_encode($iPatient) !!};
+            </script>
+        @else
+        {{-- hook for single row refresh --}}
+        <script>
+            addMCHook('refresh-{{$iPatient->care_month_uid}}', function() {
+                console.log('I should refresh CM: {{$iPatient->care_month_uid}}');
+                $.get('/practice-management/rpm-manager-row/{{$iPatient->care_month_uid}}', {
+                    index: {{$index}},
+                    viewingAs: '{{$viewingAs}}',
+                    m: '{{request()->input('m')}}',
+                    y: '{{request()->input('y')}}',
+                }, _data => {
+                    $('tr[data-care-month-uid="{{$iPatient->care_month_uid}}"]').replaceWith(_data);
+                })
+            });
+        </script>
+        @endif
+        {{$index}}
+    </td>
+    <td class="border-left-0">
+        <a href="/mc/patients/view/{{ $iPatient->client_uid }}"
+           native target="_blank"
+           class="text-nowrap d-block max-width-170px overflow-hidden text-ellipsis"
+        >{{ $iPatient->client_name }}</a>
+    </td>
+    <td title="{{friendly_date($iPatient->dob)}}">{{$iPatient->age_in_years ?: '-'}}</span></td>
+    @if($viewingAs === 'ADMIN')
+        <td class="rmgr-name-column"><div class="rmgr-name-element" title="{{$iPatient->mcp_name ?: ''}}">{{$iPatient->mcp_last_name ?: '-'}}</div></td>
+        <td class="rmgr-name-column"><div class="rmgr-name-element" title="{{$iPatient->rmm_name ?: ''}}">{{$iPatient->rmm_last_name ?: '-'}}</div></td>
+        <td class="rmgr-name-column"><div class="rmgr-name-element" title="{{$iPatient->rme_name ?: ''}}">{{$iPatient->rme_last_name ?: '-'}}</div></td>
+    @endif
+    <td>{{$iPatient->days_between_most_recent_mcp_note_date_and_end_of_care_month}}</td>
+
+    <!--# Meas. Days-->
+    <td>
+        <?php
+        $icon = '';
+        $label = '';
+        if($iPatient->number_of_days_with_remote_measurements>=16) {
+            $icon = '<i class="ml-1 fa fa-check text-success opacity-35"></i>';
+        }
+        else {
+            if(intval(date('m')) === intval(request()->input('m')) || !request()->input('m')) {
+                if($daysRemaining < 16 - $iPatient->number_of_days_with_remote_measurements) {
+                    $icon = '<i class="ml-1 fas fa-ban text-secondary opacity-35"></i>';
+                    $label = 'Not possible. Not enough days left to reach 16.';
+                }
+                elseif($daysRemaining > 16 - $iPatient->number_of_days_with_remote_measurements) {
+                    $icon = '<i class="ml-1 fa fa-bolt text-primary"></i>';
+                    $label = 'Possible. Ensure ' . (16 - $iPatient->number_of_days_with_remote_measurements) . ' more days with measurements before the end of the month.';
+                }
+                elseif($daysRemaining === 16 - $iPatient->number_of_days_with_remote_measurements) {
+                    $icon = '<i class="ml-1 fa fa-exclamation-triangle text-danger"></i>';
+                    $label = 'Possible. Ensure a measurement every day for the rest of the month.';
+                }
+            }
+            else {
+                $icon = '<i class="ml-1 fas fa-ban text-secondary opacity-35"></i>';
+                $label = 'Not possible. Past month.';
+            }
+        }
+        ?>
+        <div class="d-flex align-items-baseline flex-nowrap" title="{{$label}}">
+            <?php $iPatient->number_of_days_with_remote_measurements = $iPatient->number_of_days_with_remote_measurements ?: 0; ?>
+            <span>{{$iPatient->number_of_days_with_remote_measurements}}</span>
+            {!! $icon !!}
+        </div>
+    </td>
+    <td>{{$iPatient->number_of_days_with_remote_bp_measurements}}</td>
+    <td>{{$iPatient->number_of_days_with_remote_weight_measurements}}</td>
+
+    <td class="text-nowrap position-relative {{$iPatient->has_cellular_bp_device && $iPatient->most_recent_cellular_bp_sbp_mm_hg && $iPatient->most_recent_cellular_bp_dbp_mm_hg ? 'rpm-manager-bp-popover-trigger' : ''}} rpm-manager-popover-trigger"
+        data-uid="{{$iPatient->care_month_uid}}" data-client-uid="{{$iPatient->client_uid}}" data-cm-title="{{$iPatient->client_name}} - {{friendly_month($iPatient->care_month_start_date)}}">
+        @if(!$iPatient->has_cellular_bp_device)
+            @if($iPatient->has_cellular_bp_meter_been_ordered)
+                <span class="text-info">Ordered</span>
+            @else
+                <span class="text-warning-dark">Not Ordered</span>
+            @endif
+        @else
+            @if($iPatient->most_recent_cellular_bp_sbp_mm_hg && $iPatient->most_recent_cellular_bp_dbp_mm_hg)
+                <div class="text-nowrap d-flex align-items-baseline flex-nowrap">
+                    <span class="sort-data">{{$iPatient->most_recent_cellular_bp_sbp_mm_hg}}</span>/{{$iPatient->most_recent_cellular_bp_dbp_mm_hg}}
+                    @if($iPatient->most_recent_cellular_bp_measurement_at)
+                        <span class="text-sm text-secondary text-nowrap ml-1"
+                              title="{{friendly_date_time($iPatient->most_recent_cellular_bp_measurement_at)}}">{{friendly_date_est_compact($iPatient->most_recent_cellular_bp_measurement_at)}}</span>
+                    @endif
+                </div>
+            @else
+                <span class="text-danger opacity-60">Not used yet</span>
+            @endif
+        @endif
+        @if($iPatient->has_cellular_bp_device && $iPatient->most_recent_cellular_bp_sbp_mm_hg && $iPatient->most_recent_cellular_bp_dbp_mm_hg)
+            <div class="position-absolute p-2 bg-white border rpm-manager-popover rpm-manager-bp-popover" id="rpm-manager-bp-popover-{{$iPatient->care_month_uid}}">
+                <div class="font-size-16">{{ $iPatient->client_name }} - BP Measurements</div>
+                <h3 class="my-2 font-size-16" id="rpm-manager-bp-caremonth-{{$iPatient->care_month_uid}}">Care Month:
+                    <a href="/patients/view/{{ $iPatient->client_uid }}/care-months/view/{{$iPatient->care_month_uid}}"
+                       native target="_blank"
+                       open-in-stag-popup
+                       update-parent="'refresh-{{$iPatient->care_month_uid}}"
+                       popup-style="tall overflow-visible"
+                       mc-initer="care-month-dashboard-{{$iPatient->client_uid}}"
+                       title="{{$iPatient->client_name}} - {{friendly_month($iPatient->care_month_start_date)}}"
+                       class="font-size-16"
+                    >{{friendly_month($iPatient->care_month_start_date)}}</a>
+                </h3>
+                <div id="rpm-manager-bp-graph-container-{{ $iPatient->care_month_uid }}" class="mt-3 mr-3">
+                    <div id="rpm-manager-bp-graph-{{ $iPatient->care_month_uid }}"></div>
+                </div>
+                <div class="max-height-200px overflow-overlay-on-hover mt-3">
+                    <table class="table table-condensed table-sm table-bordered m-0" id="rpm-manager-bp-matrix-{{ $iPatient->care_month_uid }}">
+                        <tbody></tbody>
+                    </table>
+                </div>
+            </div>
+        @endif
+    </td>
+    <td class="text-nowrap position-relative {{$iPatient->has_cellular_weight_scale_device && $iPatient->most_recent_cellular_weight_value ? 'rpm-manager-weight-popover-trigger' : ''}} rpm-manager-popover-trigger"
+        data-uid="{{$iPatient->care_month_uid}}" data-client-uid="{{$iPatient->client_uid}}" data-cm-title="{{$iPatient->client_name}} - {{friendly_month($iPatient->care_month_start_date)}}">
+        @if(!$iPatient->has_cellular_weight_scale_device)
+            @if($iPatient->has_cellular_weight_scale_been_ordered)
+                <span class="text-info">Ordered</span>
+            @else
+                <span class="text-warning-dark">Not Ordered</span>
+            @endif
+        @else
+            @if($iPatient->most_recent_cellular_weight_value)
+                <div class="text-nowrap d-flex align-items-baseline flex-nowrap">
+                    <span class="sort-data">{{round($iPatient->most_recent_cellular_weight_value, 1)}}</span>
+                    @if($iPatient->most_recent_cellular_weight_measurement_at)
+                        <span class="text-sm text-secondary text-nowrap ml-1"
+                              title="{{friendly_date_time($iPatient->most_recent_cellular_weight_measurement_at)}}">{{friendly_date_est_compact($iPatient->most_recent_cellular_weight_measurement_at)}}</span>
+                    @endif
+                </div>
+            @else
+                <span class="text-danger opacity-60">Not used yet</span>
+            @endif
+        @endif
+        @if($iPatient->has_cellular_weight_scale_device && $iPatient->most_recent_cellular_weight_value)
+            <div class="position-absolute p-2 bg-white border rpm-manager-popover rpm-manager-weight-popover" id="rpm-manager-weight-popover-{{$iPatient->care_month_uid}}">
+                <div class="font-size-16">{{ $iPatient->client_name }} - Weight Measurements</div>
+                <h3 class="my-2 font-size-16" id="rpm-manager-weight-caremonth-{{$iPatient->care_month_uid}}">Care Month:
+                    <a href="/patients/view/{{ $iPatient->client_uid }}/care-months/view/{{$iPatient->care_month_uid}}"
+                       native target="_blank"
+                       open-in-stag-popup
+                       update-parent="refresh-rpm-row"
+                       popup-style="tall overflow-visible"
+                       mc-initer="care-month-dashboard-{{$iPatient->client_uid}}"
+                       title="{{$iPatient->client_name}} - {{friendly_month($iPatient->care_month_start_date)}}"
+                       class="font-size-16"
+                    >{{friendly_month($iPatient->care_month_start_date)}}</a>
+                </h3>
+                <div id="rpm-manager-weight-graph-container-{{ $iPatient->care_month_uid }}" class="mt-3 mr-3">
+                    <div id="rpm-manager-weight-graph-{{ $iPatient->care_month_uid }}"></div>
+                </div>
+                <div class="max-height-200px overflow-overlay-on-hover mt-3">
+                    <table class="table table-condensed table-sm table-bordered m-0" id="rpm-manager-weight-matrix-{{ $iPatient->care_month_uid }}">
+                        <tbody></tbody>
+                    </table>
+                </div>
+            </div>
+        @endif
+    </td>
+
+    @if($viewingAs !== 'RME')
+        <td>
+            @if(@$iPatient->myEntries && count($iPatient->myEntries))
+                <div class="d-flex align-items-baseline" title="Me: {{strip_tags($iPatient->myEntries[0]->contentText)}}">
+                    <span class="text-info mr-1">{{round($iPatient->myEntries[0]->timeInSeconds/30)}}m</span>
+                    <span class="flex-grow-1 max-width-200px text-ellipsis mr-1">{{strip_tags($iPatient->myEntries[0]->contentText)}}</span>
+                    @if(gettype($iPatient->myEntries[0]->effectiveDate) === 'string')
+                        <span class="text-secondary text-sm">{{friendly_date_est_compact($iPatient->myEntries[0]->effectiveDate)}}</span>
+                    @endif
+                </div>
+            @else
+                <span class="text-secondary">None</span>
+            @endif
+        </td>
+        <td>
+            @if(@$iPatient->otherEntries && count($iPatient->otherEntries))
+                <div class="d-flex align-items-baseline" title="{{$iPatient->otherEntries[0]->proNameFirst}} {{$iPatient->otherEntries[0]->proNameLast}}: {{strip_tags($iPatient->otherEntries[0]->contentText)}}">
+                    @if($viewingAs === 'ADMIN')
+                        <span class="text-info mr-1">{{round($iPatient->otherEntries[0]->timeInSeconds/30)}}m</span>
+                    @endif
+                    <span class="flex-grow-1 max-width-200px text-ellipsis mr-1">{{strip_tags($iPatient->otherEntries[0]->contentText)}}</span>
+                    @if(gettype($iPatient->otherEntries[0]->effectiveDate) === 'string')
+                        <span class="text-secondary text-sm">{{friendly_date_est_compact($iPatient->otherEntries[0]->effectiveDate)}}</span>
+                    @endif
+                </div>
+            @else
+                <span class="text-secondary">None</span>
+            @endif
+        </td>
+    @endif
+
+    <td>
+        @if($viewingAs === 'ADMIN')
+            <div class="d-flex align-items-baseline flex-nowrap">
+                <div class="d-inline-flex align-items-baseline" title="MCP Interaction">
+                    <i class="fa fa-circle text-sm opacity-35 {{$iPatient->has_mcp_interacted_with_client_about_rm ? 'text-success' : 'text-danger'}}"></i>
+                    <span class="ml-1 mr-2">M</span>
+                </div>
+                <div class="d-inline-flex align-items-baseline" title="RMM Interaction">
+                    <i class="fa fa-circle text-sm opacity-35 {{$iPatient->has_rmm_interacted_with_client_about_rm ? 'text-success' : 'text-danger'}}"></i>
+                    <span class="ml-1 mr-2">R</span>
+                </div>
+                <div class="d-inline-flex align-items-baseline" title="Admin Interaction">
+                    <i class="fa fa-circle text-sm opacity-35 {{$iPatient->has_admin_interacted_with_client_about_rm ? 'text-success' : 'text-danger'}}"></i>
+                    <span class="ml-1 mr-2">A</span>
+                </div>
+            </div>
+        @elseif($viewingAs === 'MCP')
+            <div class="d-flex align-items-baseline flex-nowrap">
+                <i class="fa fa-circle text-sm opacity-35 {{$iPatient->has_mcp_interacted_with_client_about_rm ? 'text-success' : 'text-danger'}}"></i>
+                <span class="ml-1 mr-2">{{$iPatient->has_mcp_interacted_with_client_about_rm ? 'Yes' : 'No'}}</span>
+            </div>
+        @elseif($viewingAs === 'RMM')
+            <div class="d-flex align-items-baseline flex-nowrap">
+                <i class="fa fa-circle text-sm opacity-35 {{$iPatient->has_mcp_interacted_with_client_about_rm ? 'text-success' : 'text-danger'}}"></i>
+                <span class="ml-1 mr-2">{{$iPatient->has_mcp_interacted_with_client_about_rm ? 'Yes' : 'No'}}</span>
+            </div>
+        @endif
+    </td>
+
+    <!--Time-->
+    @if($viewingAs !== 'RME')
+        @if($viewingAs === 'ADMIN' || $viewingAs === 'MCP')
+            <td>
+                <div class="d-flex align-items-baseline">
+                    <i class="mr-1 text-sm fa fa-circle opacity-35 {{$iPatient->rm_total_time_in_seconds_by_mcp >= 1200 ? 'text-success' : 'text-danger'}}"></i>
+                    <span class="text-nowrap">{{round($iPatient->rm_total_time_in_seconds_by_mcp / 60)}}:{{round($iPatient->rm_total_time_in_seconds_by_mcp % 60)}}</span>
+                    <span class="sort-data d-none">{{$iPatient->rm_total_time_in_seconds_by_mcp}}</span>
+                </div>
+            </td>
+        @endif
+        @if($viewingAs === 'ADMIN' || $viewingAs === 'RMM')
+            <td>
+                <div class="d-flex align-items-baseline">
+                    <i class="mr-1 text-sm fa fa-circle opacity-35 {{$iPatient->rm_total_time_in_seconds_by_rmm_pro >= 1200 ? 'text-success' : 'text-danger'}}"></i>
+                    <span class="text-nowrap">{{round($iPatient->rm_total_time_in_seconds_by_rmm_pro / 60)}}:{{round($iPatient->rm_total_time_in_seconds_by_rmm_pro % 60)}}</span>
+                    <span class="sort-data d-none">{{$iPatient->rm_total_time_in_seconds_by_rmm_pro}}</span>
+                </div>
+            </td>
+        @endif
+        @if($viewingAs === 'ADMIN')
+            <td>
+                <div class="d-flex align-items-baseline">
+                    <i class="mr-1 text-sm fa fa-circle opacity-35 {{$iPatient->rm_total_time_in_seconds >= 1200 ? 'text-success' : 'text-danger'}}"></i>
+                    <span class="text-nowrap">{{round($iPatient->rm_total_time_in_seconds / 60)}}:{{round($iPatient->rm_total_time_in_seconds % 60)}}</span>
+                    <span class="sort-data d-none">{{$iPatient->rm_total_time_in_seconds}}</span>
+                </div>
+            </td>
+        @endif
+    @endif
+
+    <!--Reimb.-->
+    @if($viewingAs === 'ADMIN' || $viewingAs === 'MCP')
+        <td>
+            @if($iPatient->is_billable_by_mcp)
+                @if($iPatient->is_billed_by_mcp)
+                    <i class="mr-1 fa fa-check text-success opacity-60" title="Billed"></i>
+                @else
+                    <i class="mr-1 fa fa-bolt text-primary" title="Billable"></i>
+                @endif
+            @else
+                <i class="mr-1 fas fa-ban text-secondary" title="Not Billable"></i>
+            @endif
+        </td>
+    @endif
+    @if($viewingAs === 'ADMIN' || $viewingAs === 'RMM')
+        <td>
+            @if($iPatient->is_billable_by_rmm)
+                @if($iPatient->is_billed_by_rmm)
+                    <i class="mr-1 fa fa-check text-success opacity-60" title="Billed"></i>
+                @else
+                    <i class="mr-1 fa fa-bolt text-primary" title="Billable"></i>
+                @endif
+            @else
+                <i class="mr-1 fas fa-ban text-secondary" title="Not Billable"></i>
+            @endif
+        </td>
+    @endif
+    @if($viewingAs === 'ADMIN' || $viewingAs === 'RME')
+        <td>
+            @if($iPatient->is_billable_by_rme)
+                @if($iPatient->is_billed_by_rme)
+                    <i class="mr-1 fa fa-check text-success opacity-60" title="Billed"></i>
+                @else
+                    <i class="mr-1 fa fa-bolt text-primary" title="Billable"></i>
+                @endif
+            @else
+                <i class="mr-1 fas fa-ban text-secondary" title="Not Billable"></i>
+            @endif
+        </td>
+    @endif
+
+    <!--Claim-->
+    @if($viewingAs === 'ADMIN' && !(date('m') == $month && date('Y') == $year))
+        <td>
+            @if($iPatient->is_99454_claiming_waived)
+                <span title="{{$iPatient->why_claiming_99454_waived ?: ''}}">Waived</span>
+            @else
+                @if($iPatient->is_99454_claimable)
+                    @if($iPatient->is_99454_claimed)
+                        <i class="mr-1 fa fa-check text-success opacity-60" title="Claimed"></i>
+                    @else
+                        <i class="mr-1 fa fa-bolt text-primary" title="Claimable"></i>
+                    @endif
+                @else
+                    <i class="mr-1 fas fa-ban text-secondary" title="Not Claimable: {{$iPatient->why_99454_not_claimable_reason ?: ''}}"></i>
+                @endif
+            @endif
+        </td>
+        <td>
+            @if($iPatient->is_99457_claiming_waived)
+                <span title="{{$iPatient->why_claiming_99457_waived ?: ''}}">Waived</span>
+            @else
+                @if($iPatient->is_99457_claimable)
+                    @if($iPatient->is_99457_claimed)
+                        <i class="mr-1 fa fa-check text-success opacity-60" title="Claimed"></i>
+                    @else
+                        <i class="mr-1 fa fa-bolt text-primary" title="Claimable"></i>
+                    @endif
+                @else
+                    <i class="mr-1 fas fa-ban text-secondary" title="Not Claimable: {{$iPatient->why_99457_not_claimable_reason ?: ''}}"></i>
+                @endif
+            @endif
+        </td>
+        <td>
+            @if($iPatient->is_99458_claiming_waived)
+                <span title="{{$iPatient->why_claiming_99458_waived ?: ''}}">Waived</span>
+            @else
+                @if($iPatient->is_99458_claimable)
+                    @if($iPatient->is_99458_claimed)
+                        <i class="mr-1 fa fa-check text-success opacity-60" title="Claimed"></i>
+                    @else
+                        <i class="mr-1 fa fa-bolt text-primary" title="Claimable"></i>
+                    @endif
+                @else
+                    <i class="mr-1 fas fa-ban text-secondary" title="Not Claimable: {{$iPatient->why_99458_not_claimable_reason ?: ''}}"></i>
+                @endif
+            @endif
+        </td>
+    @endif
+
+    <td><span class="text-nowrap">{{$iPatient->next_visit_date ?: '-'}}</span></td>
+
+    <td class="border-right-0"></td>
+
+</tr>

+ 1 - 0
routes/web.php

@@ -383,6 +383,7 @@ Route::middleware('pro.auth')->group(function () {
 
             // rpm manager (new)
             Route::get('rpm-manager', 'PracticeManagementController@rpmManager')->name('rpm-manager');
+            Route::get('rpm-manager-row/{uid}', 'PracticeManagementController@rpmManagerRow')->name('rpm-manager-row');
 
             Route::get('claims-report', 'PracticeManagementController@claimsReport')->name('claims-report');