Sfoglia il codice sorgente

Merge branch 'master' of rav.triplestart.com:jmudaka/stagfe2

= 2 anni fa
parent
commit
af5a499a19

+ 91 - 5
app/Http/Controllers/PracticeManagementController.php

@@ -2474,6 +2474,20 @@ WHERE
             }
         }
 
+        if($request->input('mins')) {
+            switch ($request->input('mins')) {
+                case '<20':
+                    $conditions[] = "(care_month.rm_total_time_in_seconds < 1200)";
+                    break;
+                case '20-40':
+                    $conditions[] = "(care_month.rm_total_time_in_seconds >= 1200 AND care_month.rm_total_time_in_seconds < 2400)";
+                    break;
+                case '40+':
+                    $conditions[] = "(care_month.rm_total_time_in_seconds >= 2400)";
+                    break;
+            }
+        }
+
         // show only if enrolled in RPM
         $conditions[] = "(care_month.is_client_enrolled_in_rm IS TRUE AND client.has_mcp_done_onboarding_visit = 'YES')";
 
@@ -2512,9 +2526,19 @@ WHERE
         $total = $countResult[0]->count;
 
         $orderBy = "care_month.start_date DESC, care_month.number_of_days_with_remote_measurements DESC NULLS LAST, care_month.rm_total_time_in_seconds_by_mcp DESC NULLS LAST, care_month.rm_total_time_in_seconds_by_rmm_pro DESC NULLS LAST";
-        $defaultPageSize = 25;
+        if($request->session()->get('rpmManagerPageSize')) {
+            $defaultPageSize = intval($request->session()->get('rpmManagerPageSize'));
+        }
+        else {
+            $defaultPageSize = 25;
+        }
         $page = $request->input('page') ?: 1;
-        $perPage = $request->input('per_page') ?: $defaultPageSize;
+        $perPage = $defaultPageSize;
+        if($request->input('per_page')) { // user input takes precedence
+            $perPage = intval($request->input('per_page'));
+            $request->session()->put('rpmManagerPageSize', $perPage);
+        }
+
         $offset = ($page - 1) * $perPage;
 
         // main query
@@ -2531,6 +2555,7 @@ SELECT
        (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,
+       DATE_PART('day', NOW() - client.most_recent_cellular_measurement_at) as dslm,
        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,
@@ -2573,7 +2598,8 @@ SELECT
        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,
+       -- nv.raw_date as next_visit_date,
+       (SELECT MIN(appt.raw_date) FROM appointment appt WHERE appt.client_id = client.id AND appt.raw_date > NOW()::DATE) as next_visit_date,
        -- TODO vital settings
        
        -- functionality support columns
@@ -2617,7 +2643,65 @@ WHERE
         $paginator = new LengthAwarePaginator($patients, $total, $request->input('per_page') ?: $defaultPageSize, $request->input('page') ?: 1);
         $paginator->setPath(route('practice-management.rpm-manager'));
 
-        return view('app.practice-management.rpm-manager.index', compact('patients', 'month', 'year', 'paginator', 'perPage', 'proRoles', 'viewingAs', 'cmStartDate', 'cmEndDate'));
+        $mins = $request->input('mins');
+
+        // counts
+        $stats = [];
+        $stats['totalPatients'] = $paginator->total();
+        $commonStatSQL = "
+SELECT COUNT(*)
+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
+    left join bill mcpBill on care_month.mcp_rm_generic_bill_id = mcpBill.id AND mcpBill.is_cancelled IS NOT TRUE
+    left join bill rmmBill on care_month.rmm_rm_generic_bill_id = rmmBill.id AND rmmBill.is_cancelled IS NOT TRUE
+    left join bill rmeBill on care_month.rme_rm_generic_bill_id = rmeBill.id AND rmeBill.is_cancelled IS NOT TRUE
+WHERE
+        ";
+
+        $stats['withMeasOn'] = 'N/A';
+        $v = $request->input('wmo') ?: date('Y-m-d');
+        $statQuery = "$commonStatSQL
+(SELECT COUNT(mstat.id) FROM measurement mstat WHERE mstat.care_month_id = care_month.id AND mstat.created_at::date = '$v' AND mstat.is_cellular_zero IS FALSE) > 0 AND
+  " . (count($conditions) > 0 ? implode(" AND ", $conditions) : '1') . "      
+";
+        $statResult = DB::select($statQuery);
+        $stats['withMeasOn'] = $statResult[0]->count;
+
+        $stats['noMeasOn'] = 'N/A';
+        $v = $request->input('nmo') ?: date('Y-m-d');
+        $statQuery = "$commonStatSQL
+(SELECT COUNT(mstat.id) FROM measurement mstat WHERE mstat.care_month_id = care_month.id AND mstat.created_at::date = '$v' AND mstat.is_cellular_zero IS FALSE) = 0 AND
+  " . (count($conditions) > 0 ? implode(" AND ", $conditions) : '1') . "      
+";
+        $statResult = DB::select($statQuery);
+        $stats['noMeasOn'] = $statResult[0]->count;
+
+        $statQuery = "$commonStatSQL
+    care_month.number_of_days_with_remote_measurements >= 16 AND
+      " . (count($conditions) > 0 ? implode(" AND ", $conditions) : '1') . "      
+";
+        $statResult = DB::select($statQuery);
+        $stats['gt16MD'] = $statResult[0]->count;
+
+        $statQuery = "$commonStatSQL
+    care_month.rm_total_time_in_seconds >= 1200 AND care_month.rm_total_time_in_seconds < 2400 AND
+      " . (count($conditions) > 0 ? implode(" AND ", $conditions) : '1') . "      
+";
+        $statResult = DB::select($statQuery);
+        $stats['gt20M'] = $statResult[0]->count;
+
+        $statQuery = "$commonStatSQL
+    care_month.rm_total_time_in_seconds >= 2400 AND
+      " . (count($conditions) > 0 ? implode(" AND ", $conditions) : '1') . "      
+";
+        $statResult = DB::select($statQuery);
+        $stats['gt40M'] = $statResult[0]->count;
+
+        return view('app.practice-management.rpm-manager.index', compact('patients', 'month', 'year', 'paginator', 'perPage', 'proRoles', 'viewingAs', 'cmStartDate', 'cmEndDate', 'mins', 'stats'));
     }
 
     public function rpmManagerRow(Request $request, $uid) {
@@ -2634,6 +2718,7 @@ SELECT
        (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,
+       DATE_PART('day', NOW() - client.most_recent_cellular_measurement_at) as dslm,
        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,
@@ -2676,7 +2761,8 @@ SELECT
        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,
+       -- nv.raw_date as next_visit_date,
+       (SELECT MIN(appt.raw_date) FROM appointment appt WHERE appt.client_id = client.id AND appt.raw_date > NOW()::DATE) as next_visit_date,
        -- TODO vital settings
        
        -- functionality support columns

+ 2 - 3
app/Models/Pro.php

@@ -702,10 +702,9 @@ FROM care_month join client on care_month.client_id = client.id join note mrnote
      )
 WHERE
       care_month.mcp_pro_id = {$this->id}
-      AND EXTRACT(MONTH from care_month.start_date) = EXTRACT(MONTH from now())
-      AND EXTRACT(YEAR from care_month.start_date) = EXTRACT(YEAR from now())
+      AND bill.created_at::date >= NOW()::date - interval '60 days'
       AND care_month.mcp_rm_generic_bill_id IS NOT NULL
-      AND bill.is_signed_by_generic_pro = TRUE
+      AND bill.is_signed_by_generic_pro IS NOT TRUE
 ";
 
         // dd($query);

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

@@ -105,6 +105,9 @@ foreach ($days as $k => $day) {
             <thead>
             <tr>
                 <th class="px-2 text-secondary border-bottom-0 width-100px">Date</th>
+                @if($pro->pro_type === 'ADMIN')
+                    <th class="px-2 text-secondary border-bottom-0">Pro</th>
+                @endif
                 <th class="px-2 text-secondary border-bottom-0 w-100">Comments</th>
             </tr>
             </thead>
@@ -115,6 +118,11 @@ foreach ($days as $k => $day) {
                         <td class="px-2">
                             <div class="font-weight-bold">{{friendly_date_time($entry->effective_date, false)}}</div>
                         </td>
+                        @if($pro->pro_type === 'ADMIN')
+                            <td class="px-2 text-nowrap">
+                                {{$entry->pro->displayName()}}
+                            </td>
+                        @endif
                         <td class="px-2">
                             <div class="text-secondary in-table-markup">{!! $entry->content_text !!}</div>
                         </td>

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

@@ -327,9 +327,9 @@ foreach ($days as $k => $day) {
                     @foreach($m->entries as $entry)
                         <div class="border px-2 py-1 mb-1 bg-white">
                             <div class="d-flex align-items-baseline flex-nowrap">
-                                <b class="">{{round($entry->time_in_seconds / 60)}}m {{round($entry->time_in_seconds % 60)}}s</b>
+                                <b class="mr-2">{{round($entry->time_in_seconds / 60)}}m {{round($entry->time_in_seconds % 60)}}s</b>
                                 @if($entry->pro_id === $pro->id)
-                                    <div class="ml-2 mr-3" moe>
+                                    <div class="ml-2 mr-2" moe>
                                         <a href="#" start show><i class="fa fa-edit"></i></a>
                                         <form url="/api/careMonthEntry/updateTiming">
                                             <input type="hidden" name="uid" value="{{$entry->uid}}">

+ 229 - 52
resources/views/app/practice-management/rpm-manager/index.blade.php

@@ -116,7 +116,32 @@
             border-left-width: 0 !important;
         }
     </style>
-
+    <style>
+        #rpm-admin-stats-graph .stat-bg-total-light {
+            background-color: #fbe7ce;
+        }
+        #rpm-admin-stats-graph .stat-bg-total-dark {
+            background-color: #f6b26b;
+        }
+        #rpm-admin-stats-graph .stat-bg-recd-light {
+            background-color: #d8ead2;
+        }
+        #rpm-admin-stats-graph .stat-bg-recd-dark {
+            background-color: #69a751;
+        }
+        #rpm-admin-stats-graph .stat-bg-not-recd-light {
+            background-color: #f3cdcc;
+        }
+        #rpm-admin-stats-graph .stat-bg-not-recd-dark {
+            background-color: #e06665;
+        }
+        #rpm-admin-stats-graph .stat-bg-crit-light {
+            background-color: #dbd3eb;
+        }
+        #rpm-admin-stats-graph .stat-bg-crit-dark {
+            background-color: #aa98d5;
+        }
+    </style>
     <div class="p-3 mcp-theme-1" id="practice-rpm-manager">
 
         <div class="card h-100">
@@ -127,12 +152,12 @@
 
             <div class="card-body p-0">
                 <div class="d-flex align-items-baseline p-2 border-bottom">
-                    <div class="d-inline-flex align-items-center">
-                        <form action="">
+                    <form action="" class="flex-grow-1">
+                        <div class="d-flex align-items-center">
                             <div class="mr-2 d-inline-flex align-items-center">
                                 <label class="mb-0 mr-1">Month</label>
                                 <select name="m" class="form-control form-control-sm min-width-unset pl-0 font-weight-bold"
-                                    onchange="fastLoad('{{route('practice-management.rpm-manager')}}?' + $(this).closest('form').serialize())">
+                                        onchange="fastLoad('{{route('practice-management.rpm-manager')}}?' + $(this).closest('form').serialize())">
                                     <option value="">All</option>
                                     <option value="01" {{$month && intval($month) === 1 ? 'selected' : ''}}>Jan</option>
                                     <option value="02" {{$month && intval($month) === 2 ? 'selected' : ''}}>Feb</option>
@@ -151,7 +176,7 @@
                             <div class="mr-2 d-inline-flex align-items-center">
                                 <label class="mb-0 mr-1">Year</label>
                                 <select name="y" class="form-control form-control-sm min-width-unset pl-0 font-weight-bold"
-                                    onchange="fastLoad('{{route('practice-management.rpm-manager')}}?' + $(this).closest('form').serialize())">
+                                        onchange="fastLoad('{{route('practice-management.rpm-manager')}}?' + $(this).closest('form').serialize())">
                                     <option value="">All</option>
                                     <option value="2020" {{$year && intval($year) === 2020 ? 'selected' : ''}}>2020</option>
                                     <option value="2021" {{$year && intval($year) === 2021 ? 'selected' : ''}}>2021</option>
@@ -162,7 +187,7 @@
                                 <div class="mr-2 d-inline-flex align-items-center">
                                     <label class="mb-0 mr-1 text-nowrap">View As</label>
                                     <select name="viewingAs" class="form-control form-control-sm min-width-unset pl-0 font-weight-bold"
-                                        onchange="fastLoad('{{route('practice-management.rpm-manager')}}?' + $(this).closest('form').serialize())">
+                                            onchange="fastLoad('{{route('practice-management.rpm-manager')}}?' + $(this).closest('form').serialize())">
                                         @foreach($proRoles as $proRole)
                                             <option value="{{$proRole}}" {{$viewingAs === $proRole ? 'selected' : ''}}>{{$proRole}}</option>
                                         @endforeach
@@ -182,28 +207,101 @@
                                     </div>
                                 </div>
                             @endif
-                            <div class="mr-3 d-inline-flex align-items-center">
+                            {{--
+                            <div class="mr-2 d-inline-flex align-items-center">
                                 <label class="mb-0 mr-1 text-nowrap">Date</label>
                                 <input name="specificDate" class="form-control form-control-sm min-width-unset pl-1 font-weight-bold"
                                        value="{{$specificDate}}"
                                        type="date" min="{{$cmStartDate}}" max="{{$cmEndDate}}"
                                        onchange="fastLoad('{{route('practice-management.rpm-manager')}}?' + $(this).closest('form').serialize())">
                             </div>
+                            --}}
+                            <div class="mr-2 d-inline-flex align-items-center">
+                                <label class="mb-0 mr-1 text-nowrap">Mins.</label>
+                                <select name="mins" class="form-control form-control-sm min-width-unset pl-0 font-weight-bold"
+                                        onchange="fastLoad('{{route('practice-management.rpm-manager')}}?' + $(this).closest('form').serialize())">
+                                    <option value="" {{!$mins ? 'selected' : ''}}>All</option>
+                                    <option value="<20" {{$mins === '<20' ? 'selected' : ''}}>Less than 20</option>
+                                    <option value="20-40" {{$mins === '20-40' ? 'selected' : ''}}>Betw. 20 &amp; 40</option>
+                                    <option value="40+" {{$mins === '40+' ? 'selected' : ''}}>40 or more</option>
+                                </select>
+                            </div>
                             <a href="#" onclick="return fastLoad('{{route('practice-management.rpm-manager')}}')">Clear</a>
-                        </form>
-                    </div>
-                    @if($paginator->total())
-                        <div class="d-inline-flex align-items-baseline ml-auto mb-0-pagination">
-                            <div class="mr-2"><b>{{$paginator->firstItem()}}</b> to <b>{{$paginator->lastItem()}}</b> (page {{$paginator->currentPage()}}) of <b>{{$paginator->total()}}</b></div>
-                            {!! $paginator->onEachSide(1)->withQueryString()->links() !!}
-                            <select class="form-control form-control-sm min-width-unset width-140px px-2 ml-2" onchange="fastLoad('{{ route('practice-management.rpm-manager') }}?{{queryLineExcept(['per_page', 'page'])}}&per_page=' + this.value)">
-                                <option {{$perPage == 25 ? 'selected' : ''}} value="25">25/page</option>
-                                <option {{$perPage == 50 ? 'selected' : ''}} value="50">50/page</option>
-                                <option {{$perPage == 75 ? 'selected' : ''}} value="75">75/page</option>
-                                <option {{$perPage == 100 ? 'selected' : ''}} value="100">100/page</option>
-                            </select>
+                            @if($paginator->total())
+                                <div class="d-inline-flex align-items-baseline ml-auto mb-0-pagination">
+                                    <div class="mr-2"><b>{{$paginator->firstItem()}}</b> to <b>{{$paginator->lastItem()}}</b> (page {{$paginator->currentPage()}}) of <b>{{$paginator->total()}}</b></div>
+                                    {!! $paginator->onEachSide(1)->withQueryString()->links() !!}
+                                    <select class="form-control form-control-sm min-width-unset width-140px px-2 ml-2" onchange="fastLoad('{{ route('practice-management.rpm-manager') }}?{{queryLineExcept(['per_page', 'page'])}}&per_page=' + this.value)">
+                                        <option {{$perPage == 25 ? 'selected' : ''}} value="25">25/page</option>
+                                        <option {{$perPage == 50 ? 'selected' : ''}} value="50">50/page</option>
+                                        <option {{$perPage == 75 ? 'selected' : ''}} value="75">75/page</option>
+                                        <option {{$perPage == 100 ? 'selected' : ''}} value="100">100/page</option>
+                                    </select>
+                                </div>
+                            @endif
                         </div>
-                    @endif
+                        <div id="rpm-admin-stats-graph" class="w-100">
+
+                            <div class="mt-2 pt-2 border-top w-100">
+                                <div class="d-flex align-items-stretch justify-content-center">
+                                    <div class="width-140px mr-3 stat-bg-total-light d-inline-flex flex-column">
+                                        <div class="flex-grow-1 py-1 d-flex align-items-end"><span class="w-100 text-center">Total Patients</span></div>
+                                        <div class="font-size-16 font-weight-bold stat-bg-total-dark w-100 py-1 text-center">
+                                            {{$stats['totalPatients']}}
+                                        </div>
+                                    </div>
+                                    <div class="width-140px mr-3 stat-bg-recd-light d-inline-flex flex-column">
+                                        <div class="flex-grow-1 py-1 d-flex align-items-end">
+                                            <span class="w-100 text-center">With Meas. On:</span>
+                                        </div>
+                                        <div style="padding: 0 1px">
+                                            <input type="date" name="wmo" class="border-0 py-0 px-1 w-100 rounded-0 text-center"
+                                                   onchange="$('[name=nmo]').val(this.value); fastLoad('{{route('practice-management.rpm-manager')}}?' + $(this).closest('form').serialize());"
+                                                   value="{{request()->input('wmo') ?: date('Y-m-d')}}">
+                                        </div>
+                                        <div class="font-size-16 font-weight-bold stat-bg-recd-dark w-100 py-1 text-center">
+                                            {{$stats['withMeasOn']}}
+                                        </div>
+                                    </div>
+                                    <div class="width-140px mr-3 stat-bg-not-recd-light d-inline-flex flex-column">
+                                        <div class="flex-grow-1 py-1 d-flex align-items-end"><span class="w-100 text-center">No Meas. On:</span></div>
+                                        <div style="padding: 0 1px">
+                                            <input type="date" name="nmo" class="border-0 py-0 px-1 w-100 rounded-0 text-center"
+                                                   onchange="$('[name=wmo]').val(this.value); fastLoad('{{route('practice-management.rpm-manager')}}?' + $(this).closest('form').serialize());"
+                                                   value="{{request()->input('wmo') ?: date('Y-m-d')}}">
+                                        </div>
+                                        <div class="font-size-16 font-weight-bold stat-bg-not-recd-dark w-100 py-1 text-center">
+                                            {{$stats['noMeasOn']}}
+                                        </div>
+                                    </div>
+                                    <div class="width-140px mr-3 stat-bg-crit-light d-inline-flex flex-column">
+                                        <div class="flex-grow-1 py-1 d-flex align-items-end"><span class="w-100 text-center">With >= 16 Meas. days</span></div>
+                                        <div class="font-size-16 font-weight-bold stat-bg-crit-dark w-100 py-1 text-center">
+                                            {{$stats['gt16MD']}}
+                                        </div>
+                                    </div>
+                                    <div class="width-140px mr-3 stat-bg-crit-light d-inline-flex flex-column">
+                                        <div class="flex-grow-1 py-1 d-flex align-items-end"><span class="w-100 text-center">With >= 20m Interaction</span></div>
+                                        <div class="font-size-16 font-weight-bold stat-bg-crit-dark w-100 py-1 text-center">
+                                            {{$stats['gt20M']}}
+                                        </div>
+                                    </div>
+                                    <div class="width-140px mr-3 stat-bg-crit-light d-inline-flex flex-column">
+                                        <div class="flex-grow-1 py-1 d-flex align-items-end"><span class="w-100 text-center">With >= 40m Interaction</span></div>
+                                        <div class="font-size-16 font-weight-bold stat-bg-crit-dark w-100 py-1 text-center">
+                                            {{$stats['gt40M']}}
+                                        </div>
+                                    </div>
+                                </div>
+                                @if(date('m') == $month && date('Y') == $year)
+                                    <div class="mt-2 font-size-14 text-center">
+                                        Days left in the month ({{friendly_month(date('Y-m-d'))}}):
+                                        <b class="font-size-14">{{date('t') - date('j')}}</b>
+                                    </div>
+                                @endif
+                            </div>
+                        </div>
+                    </form>
                 </div>
                 <div class="rpm-manager-table-container">
                     <table class="table table-sm table-bordered table-striped table-hover p-0 mb-4 min-width-1100px border-0" id="table-pm-manager-matrix">
@@ -221,6 +319,10 @@
                             <th class="border-top-0 border-bottom-0 rmgr-name-column"></th>
                         @endif
                         <th class="border-top-0 border-bottom-0"></th>
+                        @if(date('m') == $month && date('Y') == $year) {{-- dslm --}}
+                            <th class="border-top-0 border-bottom-0"></th>
+                        @endif
+                        <th class="border-top-0 border-bottom-0"></th>
                         <th class="border-top-0 border-bottom-0 bg-aliceblue text-nowrap" colspan="3"># Meas. Days</th>
                         <th class="border-top-0 border-bottom-0 text-nowrap" colspan="2">
                             @if($specificDate)
@@ -246,7 +348,6 @@
                         @if($viewingAs === 'ADMIN' && !(date('m') == $month && date('Y') == $year))
                             <th class="border-top-0 border-bottom-0 bg-aliceblue v-sep-before" colspan="3">Claim</th>
                         @endif
-                        <th class="border-top-0 border-bottom-0"></th>
                         <th class="border-top-0 border-bottom-0 border-right-0 w-25"></th>
                     </tr>
                     <tr>
@@ -261,6 +362,10 @@
                             <th class="border-bottom-0 border-top">RMM</th>
                             <th class="border-bottom-0 border-top">RME</th>
                         @endif
+                        <th class="border-bottom-0 border-top">NV</th>
+                        @if(date('m') == $month && date('Y') == $year)
+                            <th class="border-bottom-0 border-top">DSLM</th>
+                        @endif
                         <th class="border-bottom-0 border-top">DSLV</th>
 
                         <!--# Meas. Days-->
@@ -276,7 +381,8 @@
                             <th class="border-bottom-0 border-top">Others</th>
                         @endif
 
-                        <th class="border-bottom-0 border-top">
+                        <th class="border-bottom-0 border-top text-nowrap">
+                            <i class="fa fa-phone rotateh text-sm opacity-60"></i>
                             @if($viewingAs === 'ADMIN')
                                 Inter.
                             @else
@@ -315,7 +421,6 @@
                             <th class="border-bottom-0 border-top">8</th>
                         @endif
 
-                        <th class="border-bottom-0 border-top">NV</th>
                         <th class="border-bottom-0 border-top border-right-0"></th>
                     </tr>
                     </thead>
@@ -347,7 +452,19 @@
             }
 
             let popoverVisible = false,
-                popoverShowTimer = false;
+                wtPopoverVisibleForCM = false,
+                bpPopoverVisibleForCM = false,
+                wtPopoverShowTimer = false,
+                bpPopoverShowTimer = false,
+                wtPopoverHideTimer = false,
+                bpPopoverHideTimer = false;
+
+            function hideAllPopovers() {
+                $('.rpm-manager-popover').removeClass('show');
+                popoverVisible = false;
+                bpPopoverVisibleForCM = false;
+                wtPopoverVisibleForCM = false;
+            }
 
             function init() {
                 let parent = $('#practice-rpm-manager');
@@ -395,44 +512,99 @@
                 parent
                     .off('mouseenter', '.rpm-manager-weight-popover-trigger')
                     .on('mouseenter', '.rpm-manager-weight-popover-trigger', function() {
-                        if(popoverVisible) return false;
-                        if(popoverShowTimer) {
-                            clearTimeout(popoverShowTimer);
-                            popoverShowTimer = false;
+
+                        let cmUID = $(this).closest('tr').attr('data-care-month-uid');
+
+                        // if WT GP already visible for this care month, STOP
+                        if(wtPopoverVisibleForCM === cmUID) {
+                            console.log('Wt GP already visible for CM');
+                            return false;
                         }
-                        popoverShowTimer = setTimeout(() => {
+                        else {
+                            hideAllPopovers();
+                        }
+
+                        // cancel any existing timers
+                        if(wtPopoverShowTimer) { clearTimeout(wtPopoverShowTimer); wtPopoverShowTimer = false; }
+                        if(bpPopoverShowTimer) { clearTimeout(bpPopoverShowTimer); bpPopoverShowTimer = false; }
+
+                        wtPopoverShowTimer = setTimeout(() => {
                             $('.rpm-manager-popover').removeClass('show');
                             $('#rpm-manager-weight-popover-' + $(this).attr('data-uid')).addClass('show');
                             prepareMeasurementsPopover($(this).attr('data-uid'), 'weight');
                             popoverVisible = true;
+                            wtPopoverVisibleForCM = cmUID;
+                            bpPopoverVisibleForCM = false;
                         }, 500);
+
                         return false;
                     });
 
                 parent
                     .off('mouseenter', '.rpm-manager-bp-popover-trigger')
                     .on('mouseenter', '.rpm-manager-bp-popover-trigger', function() {
-                        if(popoverVisible) return false;
-                        if(popoverShowTimer) {
-                            clearTimeout(popoverShowTimer);
-                            popoverShowTimer = false;
+
+                        let cmUID = $(this).closest('tr').attr('data-care-month-uid');
+
+                        // if WT GP already visible for this care month, STOP
+                        if(bpPopoverVisibleForCM === cmUID) {
+                            console.log('BP GP already visible for CM');
+                            return false;
                         }
-                        popoverShowTimer = setTimeout(() => {
+                        else {
+                            // hide any currently displays popups immediately
+                            hideAllPopovers();
+                        }
+
+                        // cancel any existing timers
+                        if(bpPopoverShowTimer) { clearTimeout(bpPopoverShowTimer); bpPopoverShowTimer = false; }
+                        if(wtPopoverShowTimer) { clearTimeout(wtPopoverShowTimer); wtPopoverShowTimer = false; }
+
+                        bpPopoverShowTimer = setTimeout(() => {
                             $('.rpm-manager-popover').removeClass('show');
                             $('#rpm-manager-bp-popover-' + $(this).attr('data-uid')).addClass('show');
                             prepareMeasurementsPopover($(this).attr('data-uid'), 'bp');
                             popoverVisible = true;
+                            bpPopoverVisibleForCM = cmUID;
+                            wtPopoverVisibleForCM = false;
                         }, 500);
+
                         return false;
+
                     });
 
                 parent
-                    .off('mouseleave', '.rpm-manager-popover-trigger')
-                    .on('mouseleave', '.rpm-manager-popover-trigger', function() {
-                        if(popoverVisible) return false;
-                        if(popoverShowTimer) {
-                            clearTimeout(popoverShowTimer);
-                            popoverShowTimer = false;
+                    .off('mouseleave', '.rpm-manager-weight-popover-trigger')
+                    .on('mouseleave', '.rpm-manager-weight-popover-trigger', function() {
+                        if(wtPopoverVisibleForCM) {
+                            if(wtPopoverHideTimer) { clearTimeout(wtPopoverHideTimer); wtPopoverHideTimer = false; }
+                            wtPopoverHideTimer = setTimeout(() => {
+                                $('#rpm-manager-weight-popover-' + $(this).attr('data-uid')).removeClass('show');
+                                popoverVisible = false;
+                                wtPopoverVisibleForCM = false;
+                            }, 750);
+                        }
+                        else if(wtPopoverShowTimer) {
+                            clearTimeout(wtPopoverShowTimer);
+                            wtPopoverShowTimer = false;
+                        }
+                        return false;
+                    });
+
+                parent
+                    .off('mouseleave', '.rpm-manager-bp-popover-trigger')
+                    .on('mouseleave', '.rpm-manager-bp-popover-trigger', function() {
+                        if(bpPopoverVisibleForCM) {
+                            if(bpPopoverHideTimer) { clearTimeout(bpPopoverHideTimer); bpPopoverHideTimer = false; }
+                            bpPopoverHideTimer = setTimeout(() => {
+                                $('#rpm-manager-bp-popover-' + $(this).attr('data-uid')).removeClass('show');
+                                popoverVisible = false;
+                                bpPopoverVisibleForCM = false;
+                            }, 750);
+                        }
+                        else if(bpPopoverShowTimer) {
+                            clearTimeout(bpPopoverShowTimer);
+                            bpPopoverShowTimer = false;
                         }
                         return false;
                     });
@@ -441,12 +613,11 @@
                     .off('mousedown.discard-popover')
                     .on('mousedown.discard-popover', function(_e) {
                         if(!($(_e.target).closest('.rpm-manager-popover').length) && $('.rpm-manager-popover.show').length) {
-                            $('.rpm-manager-popover').removeClass('show');
-                            popoverVisible = false;
-                            if(popoverShowTimer) {
-                                clearTimeout(popoverShowTimer);
-                                popoverShowTimer = false;
-                            }
+                            setTimeout(() => {
+                                hideAllPopovers();
+                                if(bpPopoverShowTimer) { clearTimeout(bpPopoverShowTimer); bpPopoverShowTimer = false; }
+                                if(wtPopoverShowTimer) { clearTimeout(wtPopoverShowTimer); wtPopoverShowTimer = false; }
+                            }, 100);
                             return false;
                         }
                     });
@@ -455,12 +626,11 @@
                     .off('keydown.discard-bp-popover')
                     .on('keydown.discard-bp-popover', function(_e) {
                         if(_e.which === 27) {
-                            $('.rpm-manager-popover').removeClass('show');
-                            popoverVisible = false;
-                            if(popoverShowTimer) {
-                                clearTimeout(popoverShowTimer);
-                                popoverShowTimer = false;
-                            }
+                            setTimeout(() => {
+                                hideAllPopovers();
+                                if(bpPopoverShowTimer) { clearTimeout(bpPopoverShowTimer); bpPopoverShowTimer = false; }
+                                if(wtPopoverShowTimer) { clearTimeout(wtPopoverShowTimer); wtPopoverShowTimer = false; }
+                            }, 100);
                             return false;
                         }
                     });
@@ -486,6 +656,13 @@
                 parent
                     .off('click', '.rpm-manager-popover-trigger')
                     .on('click', '.rpm-manager-popover-trigger', function() {
+                        if(popoverVisible) {
+                            $('.rpm-manager-popover').removeClass('show');
+                            popoverVisible = false;
+                            bpPopoverVisibleForCM = false;
+                            wtPopoverVisibleForCM = false;
+                            return false;
+                        }
                         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'),

+ 190 - 156
resources/views/app/practice-management/rpm-manager/row.blade.php

@@ -95,42 +95,48 @@
         </td>
     @endif
     @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>
+        <td class="rmgr-name-column" title="{{$iPatient->mcp_name ?: ''}}"><div class="rmgr-name-element">{{$iPatient->mcp_last_name ?: '-'}}</div></td>
+        <td class="rmgr-name-column" title="{{$iPatient->rmm_name ?: ''}}"><div class="rmgr-name-element">{{$iPatient->rmm_last_name ?: '-'}}</div></td>
+        <td class="rmgr-name-column" title="{{$iPatient->rme_name ?: ''}}"><div class="rmgr-name-element">{{$iPatient->rme_last_name ?: '-'}}</div></td>
     @endif
-    <td>{{$iPatient->days_between_most_recent_mcp_note_date_and_end_of_care_month}}</td>
+    <td><span class="text-nowrap">{{$iPatient->next_visit_date ? friendly_date($iPatient->next_visit_date) : '-'}}</span></td>
+    @if(date('m') == $month && date('Y') == $year)
+        <td>{{$iPatient->dslm ?: '-'}}</td>
+    @endif
+    <td class="{{+$iPatient->days_between_most_recent_mcp_note_date_and_end_of_care_month > 120 ? 'text-danger opacity-60' : ''}}"
+        title="{{+$iPatient->days_between_most_recent_mcp_note_date_and_end_of_care_month > 120 ? 'Days between most recent visit before end of care month is > 120. Not billable.' : ''}}"
+        >{{$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 {
+    <?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. Past month.';
+                $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}}">
+    }
+    ?>
+    <td title="{{$label}}">
+        <div class="d-flex align-items-baseline flex-nowrap">
             <?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 !!}
@@ -139,6 +145,7 @@
     <td>{{$iPatient->number_of_days_with_remote_bp_measurements}}</td>
     <td>{{$iPatient->number_of_days_with_remote_weight_measurements}}</td>
 
+    <!-- latest weight/bp -->
     <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)
@@ -268,6 +275,7 @@
         @endif
     </td>
 
+    <!-- entries -->
     @if($viewingAs !== 'RME')
         <td>
             @if(@$iPatient->myEntries && count($iPatient->myEntries))
@@ -333,15 +341,24 @@
         </td>
     @endif
 
+    <!-- interaction -->
     <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>
+                    @if($iPatient->mcp_name)
+                        <i class="fa fa-circle text-sm opacity-35 {{$iPatient->has_mcp_interacted_with_client_about_rm ? 'text-success' : 'text-danger'}}"></i>
+                    @else
+                        -
+                    @endif
                     <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>
+                    @if($iPatient->rmm_name)
+                        <i class="fa fa-circle text-sm opacity-35 {{$iPatient->has_rmm_interacted_with_client_about_rm ? 'text-success' : 'text-danger'}}"></i>
+                    @else
+                        -
+                    @endif
                     <span class="ml-1 mr-2">R</span>
                 </div>
                 <div class="d-inline-flex align-items-baseline" title="Admin Interaction">
@@ -368,99 +385,109 @@
         @if($viewingAs === 'ADMIN' || $viewingAs === 'MCP')
             <?php $minsBilled = round($iPatient->rm_total_time_in_seconds_by_mcp / 60); ?>
             <td>
-                <div class="d-flex align-items-baseline flex-nowrap">
-                    <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>
-                    @if(date('m') == $month && date('Y') == $year && $viewingAs === 'MCP')
-                        <?php
-                        $showAddEntry = 0;
-                        $expectation = 0;
-                        ?>
-                        @if($dayOfTheMonth >= 7 && $minsBilled < 5)
-                            <?php
-                            $showAddEntry = 5 - $minsBilled;
-                            $expectation = 5;
-                            ?>
-                        @elseif($dayOfTheMonth >= 14 && $minsBilled < 10)
-                            <?php
-                            $showAddEntry = 10 - $minsBilled;
-                            $expectation = 10;
-                            ?>
-                        @elseif($dayOfTheMonth >= 21 && $minsBilled < 15)
-                            <?php
-                            $showAddEntry = 15 - $minsBilled;
-                            $expectation = 15;
-                            ?>
-                        @elseif($dayOfTheMonth >= 28 && $minsBilled < 20)
+                @if($iPatient->mcp_name)
+                    <div class="d-flex align-items-baseline flex-nowrap">
+                        <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>
+                        @if(date('m') == $month && date('Y') == $year && $viewingAs === 'MCP')
                             <?php
-                            $showAddEntry = 20 - $minsBilled;
-                            $expectation = 20;
+                            $showAddEntry = 0;
+                            $expectation = 0;
                             ?>
+                            @if($dayOfTheMonth >= 7 && $minsBilled < 5)
+                                <?php
+                                $showAddEntry = 5 - $minsBilled;
+                                $expectation = 5;
+                                ?>
+                            @elseif($dayOfTheMonth >= 14 && $minsBilled < 10)
+                                <?php
+                                $showAddEntry = 10 - $minsBilled;
+                                $expectation = 10;
+                                ?>
+                            @elseif($dayOfTheMonth >= 21 && $minsBilled < 15)
+                                <?php
+                                $showAddEntry = 15 - $minsBilled;
+                                $expectation = 15;
+                                ?>
+                            @elseif($dayOfTheMonth >= 28 && $minsBilled < 20)
+                                <?php
+                                $showAddEntry = 20 - $minsBilled;
+                                $expectation = 20;
+                                ?>
+                            @endif
+                            @if($showAddEntry > 0)
+                                <i class="ml-1 fa fa-hourglass text-danger opacity-60 text-sm"></i>
+                                <div class="ml-1" title="Total expected billing by end of today: {{$expectation}}m">
+                                    @include('app.practice-management.rpm-manager.rpm_manager_care_month_add_entry_form', [
+                                        'right' => true,
+                                        'defaultDate' => date('Y-m-d'),
+                                        'cmUid' => $iPatient->care_month_uid,
+                                        'cmStartDate' => $iPatient->care_month_start_date,
+                                        'cmEndDate' => $iPatient->care_month_end_date,
+                                        'defaultMins' => $showAddEntry,
+                                        'defaultComment' => 'I have discussed remote monitoring data to date and encouraged patient to regularly measure and follow the care plan.',
+                                        'hook' => 'refresh-' . $iPatient->care_month_uid])
+                                </div>
+                            @endif
                         @endif
-                        @if($showAddEntry > 0)
-                            <i class="ml-1 fa fa-hourglass text-danger opacity-60 text-sm"></i>
-                            <div class="ml-1" title="Total expected billing by end of today: {{$expectation}}m">
-                                @include('app.practice-management.rpm-manager.rpm_manager_care_month_add_entry_form', [
-                                    'right' => true,
-                                    'defaultDate' => date('Y-m-d'),
-                                    'cmUid' => $iPatient->care_month_uid,
-                                    'cmStartDate' => $iPatient->care_month_start_date,
-                                    'cmEndDate' => $iPatient->care_month_end_date,
-                                    'defaultMins' => $showAddEntry,
-                                    'hook' => 'refresh-' . $iPatient->care_month_uid])
-                            </div>
-                        @endif
-                    @endif
-                </div>
+                    </div>
+                @else
+                    -
+                @endif
             </td>
         @endif
         @if($viewingAs === 'ADMIN' || $viewingAs === 'RMM')
             <?php $minsBilled = round($iPatient->rm_total_time_in_seconds_by_rmm_pro / 60); ?>
             <td>
-                <div class="d-flex align-items-baseline flex-nowrap">
-                    <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>
-                    @if(date('m') == $month && date('Y') == $year && $viewingAs === 'RMM')
-                        <?php
-                        $showAddEntry = 0;
-                        $expectation = 0;
-                        ?>
-                        @if($dayOfTheMonth >= 7 && $minsBilled < 5)
-                            <?php
-                            $showAddEntry = 5 - $minsBilled;
-                            $expectation = 5;
-                            ?>
-                        @elseif($dayOfTheMonth >= 14 && $minsBilled < 10)
-                            <?php
-                            $showAddEntry = 10 - $minsBilled;
-                            $expectation = 10;
-                            ?>
-                        @elseif($dayOfTheMonth >= 21 && $minsBilled < 15)
-                            <?php
-                            $showAddEntry = 15 - $minsBilled;
-                            $expectation = 15;
-                            ?>
-                        @elseif($dayOfTheMonth >= 28 && $minsBilled < 20)
+                @if($iPatient->rmm_name)
+                    <div class="d-flex align-items-baseline flex-nowrap">
+                        <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>
+                        @if(date('m') == $month && date('Y') == $year && $viewingAs === 'RMM')
                             <?php
-                            $showAddEntry = 20 - $minsBilled;
-                            $expectation = 20;
+                            $showAddEntry = 0;
+                            $expectation = 0;
                             ?>
+                            @if($dayOfTheMonth >= 7 && $minsBilled < 5)
+                                <?php
+                                $showAddEntry = 5 - $minsBilled;
+                                $expectation = 5;
+                                ?>
+                            @elseif($dayOfTheMonth >= 14 && $minsBilled < 10)
+                                <?php
+                                $showAddEntry = 10 - $minsBilled;
+                                $expectation = 10;
+                                ?>
+                            @elseif($dayOfTheMonth >= 21 && $minsBilled < 15)
+                                <?php
+                                $showAddEntry = 15 - $minsBilled;
+                                $expectation = 15;
+                                ?>
+                            @elseif($dayOfTheMonth >= 28 && $minsBilled < 20)
+                                <?php
+                                $showAddEntry = 20 - $minsBilled;
+                                $expectation = 20;
+                                ?>
+                            @endif
+                            @if($showAddEntry > 0)
+                                <i class="ml-1 fa fa-hourglass text-danger opacity-60 text-sm"></i>
+                                <div class="ml-1" title="Total expected billing by end of today: {{$expectation}}">
+                                    @include('app.practice-management.rpm-manager.rpm_manager_care_month_add_entry_form', [
+                                        'right' => true,
+                                        'defaultDate' => date('Y-m-d'),
+                                        'cmUid' => $iPatient->care_month_uid,
+                                        'cmStartDate' => $iPatient->care_month_start_date,
+                                        'cmEndDate' => $iPatient->care_month_end_date,
+                                        'defaultMins' => $showAddEntry,
+                                        'defaultComment' => 'I have discussed remote monitoring data to date and encouraged patient to regularly measure and follow the care plan.',
+                                        'hook' => 'refresh-' . $iPatient->care_month_uid])
+                                </div>
+                            @endif
                         @endif
-                        @if($showAddEntry > 0)
-                            <i class="ml-1 fa fa-hourglass text-danger opacity-60 text-sm"></i>
-                            <div class="ml-1" title="Total expected billing by end of today: {{$expectation}}">
-                                @include('app.practice-management.rpm-manager.rpm_manager_care_month_add_entry_form', [
-                                    'right' => true,
-                                    'defaultDate' => date('Y-m-d'),
-                                    'cmUid' => $iPatient->care_month_uid,
-                                    'cmStartDate' => $iPatient->care_month_start_date,
-                                    'cmEndDate' => $iPatient->care_month_end_date,
-                                    'defaultMins' => $showAddEntry,
-                                    'hook' => 'refresh-' . $iPatient->care_month_uid])
-                            </div>
-                        @endif
-                    @endif
-                </div>
+                    </div>
+                @else
+                    -
+                @endif
             </td>
         @endif
         @if($viewingAs === 'ADMIN')
@@ -475,6 +502,7 @@
                             'cmUid' => $iPatient->care_month_uid,
                             'cmStartDate' => $iPatient->care_month_start_date,
                             'cmEndDate' => $iPatient->care_month_end_date,
+                            'defaultComment' => 'I have discussed remote monitoring data to date and encouraged patient to regularly measure and follow the care plan.',
                             'hook' => 'refresh-' . $iPatient->care_month_uid])
                     </div>
                 </div>
@@ -484,108 +512,114 @@
 
     <!--Reimb.-->
     @if($viewingAs === 'ADMIN' || $viewingAs === 'MCP')
-        <td class="text-nowrap v-sep-before">
+        <td class="text-nowrap v-sep-before p-0 text-center">
             @if($iPatient->mcp_paid)
-                <i class="mr-1 fas fa-dollar-sign text-success opacity-60" title="Paid"></i>
+                <i class="px-3 py-2 fas fa-dollar-sign text-success opacity-60" title="Paid"></i>
             @else
                 @if($iPatient->is_billable_by_mcp)
                     @if($iPatient->is_billed_by_mcp)
-                        <i class="mr-1 fa fa-check text-info opacity-60" title="Billed"></i>
+                        <i class="px-3 py-2 fa fa-check text-info opacity-60" title="Billed"></i>
                     @else
-                        <i class="mr-1 fa fa-bolt text-primary" title="Billable"></i>
+                        <i class="px-3 py-2 fa fa-bolt text-primary" title="Billable"></i>
                     @endif
                 @else
-                    <i class="mr-1 fas fa-ban text-secondary" title="Not Billable"></i>
+                    <i class="px-3 py-2 fas fa-ban text-secondary" title="Not Billable"></i>
                 @endif
             @endif
         </td>
     @endif
     @if($viewingAs === 'ADMIN' || $viewingAs === 'RMM')
-        <td class="text-nowrap {{$viewingAs === 'RMM' ? 'v-sep-before' : ''}}">
-            @if($iPatient->rmm_paid)
-                <i class="mr-1 fas fa-dollar-sign text-success opacity-60" title="Paid"></i>
-            @else
-                @if($iPatient->is_billable_by_rmm)
-                    @if($iPatient->is_billed_by_rmm)
-                        <i class="mr-1 fa fa-check text-info opacity-60" title="Billed"></i>
+        <td class="text-nowrap p-0 text-center {{$viewingAs === 'RMM' ? 'v-sep-before' : ''}}">
+            @if($iPatient->rmm_name)
+                @if($iPatient->rmm_paid)
+                    <i class="px-3 py-2 fas fa-dollar-sign text-success opacity-60" title="Paid"></i>
+                @else
+                    @if($iPatient->is_billable_by_rmm)
+                        @if($iPatient->is_billed_by_rmm)
+                            <i class="px-3 py-2 fa fa-check text-info opacity-60" title="Billed"></i>
+                        @else
+                            <i class="px-3 py-2 fa fa-bolt text-primary" title="Billable"></i>
+                        @endif
                     @else
-                        <i class="mr-1 fa fa-bolt text-primary" title="Billable"></i>
+                        <i class="px-3 py-2 fas fa-ban text-secondary" title="Not Billable"></i>
                     @endif
-                @else
-                    <i class="mr-1 fas fa-ban text-secondary" title="Not Billable"></i>
                 @endif
+            @else
+                -
             @endif
         </td>
     @endif
     @if($viewingAs === 'ADMIN' || $viewingAs === 'RME')
-        <td class="text-nowrap {{$viewingAs === 'RMM' ? 'v-sep-before' : ''}}">
-            @if($iPatient->rme_paid)
-                <i class="mr-1 fas fa-dollar-sign text-success opacity-60" title="Paid"></i>
-            @else
-                @if($iPatient->is_billable_by_rme)
-                    @if($iPatient->is_billed_by_rme)
-                        <i class="mr-1 fa fa-check text-info opacity-60" title="Billed"></i>
+        <td class="text-nowrap p-0 text-center  {{$viewingAs === 'RMM' ? 'v-sep-before' : ''}}">
+            @if($iPatient->rme_name)
+                @if($iPatient->rme_paid)
+                    <i class="px-3 py-2 fas fa-dollar-sign text-success opacity-60" title="Paid"></i>
+                @else
+                    @if($iPatient->is_billable_by_rme)
+                        @if($iPatient->is_billed_by_rme)
+                            <i class="px-3 py-2 fa fa-check text-info opacity-60" title="Billed"></i>
+                        @else
+                            <i class="px-3 py-2 fa fa-bolt text-primary" title="Billable"></i>
+                        @endif
                     @else
-                        <i class="mr-1 fa fa-bolt text-primary" title="Billable"></i>
+                        <i class="px-3 py-2 fas fa-ban text-secondary" title="Not Billable"></i>
                     @endif
-                @else
-                    <i class="mr-1 fas fa-ban text-secondary" title="Not Billable"></i>
                 @endif
+            @else
+                -
             @endif
         </td>
     @endif
 
     <!--Claim-->
     @if($viewingAs === 'ADMIN' && !(date('m') == $month && date('Y') == $year))
-        <td class="v-sep-before">
+        <td class="v-sep-before p-0 text-center">
             @if($iPatient->is_99454_claiming_waived)
-                <span title="{{$iPatient->why_claiming_99454_waived ?: ''}}">Waived</span>
+                <span class="px-1 py-2" 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>
+                        <i class="px-2 py-2 fa fa-check text-success opacity-60" title="Claimed"></i>
                     @else
-                        <i class="mr-1 fa fa-bolt text-primary" title="Claimable"></i>
+                        <i class="px-2 py-2 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>
+                    <i class="px-2 py-2 fas fa-ban text-secondary" title="Not Claimable: {{$iPatient->why_99454_not_claimable_reason ?: ''}}"></i>
                 @endif
             @endif
         </td>
-        <td>
+        <td class=" p-0 text-center">
             @if($iPatient->is_99457_claiming_waived)
-                <span title="{{$iPatient->why_claiming_99457_waived ?: ''}}">Waived</span>
+                <span class="px-1 py-2" 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>
+                        <i class="px-2 py-2 fa fa-check text-success opacity-60" title="Claimed"></i>
                     @else
-                        <i class="mr-1 fa fa-bolt text-primary" title="Claimable"></i>
+                        <i class="px-2 py-2 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>
+                    <i class="px-2 py-2 fas fa-ban text-secondary" title="Not Claimable: {{$iPatient->why_99457_not_claimable_reason ?: ''}}"></i>
                 @endif
             @endif
         </td>
-        <td>
+        <td class=" p-0 text-center">
             @if($iPatient->is_99458_claiming_waived)
-                <span title="{{$iPatient->why_claiming_99458_waived ?: ''}}">Waived</span>
+                <span class="px-1 py-2" 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>
+                        <i class="px-2 py-2 fa fa-check text-success opacity-60" title="Claimed"></i>
                     @else
-                        <i class="mr-1 fa fa-bolt text-primary" title="Claimable"></i>
+                        <i class="px-2 py-2 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>
+                    <i class="px-2 py-2 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>