浏览代码

RPM matrix updated filters

Vijayakrishnan 3 年之前
父节点
当前提交
d5783bfa09

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

@@ -1335,6 +1335,79 @@ WHERE care_month.uid = '{$careMonthUid}' AND client.uid = '{$clientUid}'
         $sortDir = $request->input('sort_dir') ?: 'ASC';
         $orderBy = "ORDER BY $sortBy $sortDir NULLS LAST";
 
+        // filters from the UI
+        if(trim($request->input('f_name'))) {
+            $v = trim($request->input('f_name'));
+            $conditions[] = "(client.name_first ILIKE '%{$v}%' OR client.name_last ILIKE '%{$v}%')";
+        }
+        if(trim($request->input('f_dob_op')) && trim($request->input('f_dob'))) {
+            $o = trim($request->input('f_dob_op'));
+            $v = trim($request->input('f_dob'));
+            $conditions[] = "(client.dob {$o} '{$v}')";
+        }
+        if(trim($request->input('f_rpm'))) {
+            $v = trim($request->input('f_rpm'));
+            if($v === 'yes') {
+                $conditions[] = "(client.is_enrolled_in_rm IS NOT NULL AND client.is_enrolled_in_rm = 'YES')";
+            }
+            elseif($v === 'no') {
+                $conditions[] = "(client.is_enrolled_in_rm IS NULL OR client.is_enrolled_in_rm != 'YES')";
+            }
+        }
+        if(trim($request->input('f_cell_bp'))) {
+            $v = trim($request->input('f_cell_bp'));
+            if($v === 'yes') {
+                $conditions[] = "(client.is_assigned_cellular_bp_device IS NOT NULL AND client.is_assigned_cellular_bp_device = TRUE)";
+            }
+            elseif($v === 'no') {
+                $conditions[] = "(client.is_assigned_cellular_bp_device IS NULL OR client.is_assigned_cellular_bp_device = FALSE)";
+            }
+        }
+        if(trim($request->input('f_cell_wt'))) {
+            $v = trim($request->input('f_cell_wt'));
+            if($v === 'yes') {
+                $conditions[] = "(client.is_assigned_cellular_weight_scale_device IS NOT NULL AND client.is_assigned_cellular_weight_scale_device = TRUE)";
+            }
+            elseif($v === 'no') {
+                $conditions[] = "(client.is_assigned_cellular_weight_scale_device IS NULL OR client.is_assigned_cellular_weight_scale_device = FALSE)";
+            }
+        }
+        if(trim($request->input('f_comm'))) {
+            $v = trim($request->input('f_comm'));
+            if($v === 'yes') {
+                $conditions[] = "(care_month.has_mcp_interacted_with_client_about_rm IS NOT NULL AND care_month.has_mcp_interacted_with_client_about_rm = TRUE)";
+            }
+            elseif($v === 'no') {
+                $conditions[] = "(care_month.has_mcp_interacted_with_client_about_rm IS NULL OR care_month.has_mcp_interacted_with_client_about_rm = FALSE)";
+            }
+        }
+
+        if(trim($request->input('f_md_op')) && trim($request->input('f_md')) !== '') {
+            $o = trim($request->input('f_md_op'));
+            $v = trim($request->input('f_md'));
+            $conditions[] = "(care_month.number_of_days_with_remote_measurements {$o} {$v})";
+        }
+        if(trim($request->input('f_unst_op')) && trim($request->input('f_unst')) !== '') {
+            $o = trim($request->input('f_unst_op'));
+            $v = trim($request->input('f_unst'));
+            $conditions[] = "(care_month.rm_num_measurements_not_stamped_by_mcp {$o} {$v})";
+        }
+        if(trim($request->input('f_mins_op')) && trim($request->input('f_mins')) !== '') {
+            $o = trim($request->input('f_mins_op'));
+            $v = intval(trim($request->input('f_mins'))) * 60;
+            $field = 'rm_total_time_in_seconds_by_mcp';
+            switch($mode) {
+                case 'mcp':
+                    $field = 'rm_total_time_in_seconds_by_mcp';
+                    break;
+                case 'rmm':
+                    $field = 'rm_total_time_in_seconds_by_rmm_pro';
+                    break;
+                break;
+            }
+            $conditions[] = "(care_month.{$field} {$o} {$v})";
+        }
+
         $query = "
 SELECT client.name_first, client.name_last,
        (client.name_first || ' ' || client.name_last) as client_name,
@@ -1390,6 +1463,8 @@ WHERE
       $orderBy
 ";
 
+        // dd($query);
+
         $patients = DB::select($query);
 
         $timestamp = strtotime(date('Y-m-d'));

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

@@ -2,8 +2,9 @@
 
 @section('content')
     <?php
-    if(!function_exists('strategy_display')) {
-        function strategy_display($_strategy, $_mode) {
+    if (!function_exists('strategy_display')) {
+        function strategy_display($_strategy, $_mode)
+        {
             switch ($_strategy) {
                 case 'X16_DAYS_20_MINS_ON_OWN_MCP_COM_DURING_CM':
                     return '16 meas. days + 20 mins + comm. done during the caremonth';
@@ -26,9 +27,11 @@
         #table-rm-matrix_length, #table-rm-matrix_info {
             padding-left: 0.5rem;
         }
+
         #table-rm-matrix_filter {
             padding-right: 0.5rem;
         }
+
         #table-rm-matrix_paginate {
             padding: 0.5rem;
         }
@@ -37,65 +40,206 @@
 
         <div class="card">
 
-            <div class="card-header px-2 py-2 d-flex align-items-baseline">
-                <span class="mr-4">
-                    <span class="font-size-14">Remote Monitoring</span>
-                    <i class="fas fa-arrow-right text-sm mx-1"></i>
-                    <b class="font-size-14">{{friendly_month(date((request()->input('y') ?: 'Y') . '-' . (request()->input('m') ?: 'm') . '-d'))}}</b>
-                </span>
-                <?php
-
-                $mStr = request()->input('m') ? request()->input('m') : date('m');
-                $yStr = request()->input('y') ? request()->input('y') : date('Y');
-                $rcmStartDate = $yStr . '-' . $mStr . '-' . '01';
-                $m = +$mStr;
-                $y = +$yStr;
-                ?>
-                <a href="{{ route('practice-management.rpm_work_matrix') }}?m={{$mStr}}&y={{$yStr}}"
-                   native target="_blank"
-                   open-in-stag-popup
-                   update-parent
-                   popup-style="tall overflow-visible"
-                   class="mr-4 font-weight-bold"
-                   mc-initer="rpm-work-matrix"
-                   title="RPM Work Matrix">
-                    RPM Work Matrix
-                </a>
-                <span class="mr-2">Strategy:</span>
-                @if($mode === 'mcp')
-                    {{strategy_display($pro->mcp_rpm_payment_strategy, $mode)}}
-                    <?php $strategy = $pro->mcp_rpm_payment_strategy; ?>
-                @elseif($mode === 'rmm')
-                    {{strategy_display($pro->rme_payment_strategy, $mode)}}
-                    <?php $strategy = $pro->rmm_payment_strategy; ?>
-                @elseif($mode === 'rmm')
-                    {{strategy_display($pro->rmm_payment_strategy, $mode)}}
-                    <?php $strategy = $pro->rme_payment_strategy; ?>
-                @endif
-                <form class="ml-auto d-inline-flex flex-nowrap align-items-center" action="" method="GET">
-                    <span class="mr-2">Month</span>
-                    <select class="form-control form-control-sm min-width-unset width-100px mr-3" name="m"
-                            onchange="fastLoad('{{route('practice-management.rpm-matrix-' . $mode)}}?' + $(this).closest('form').serialize())">
-                        <option value="01" {{$m === 1 ? 'selected' : ''}}>Jan</option>
-                        <option value="02" {{$m === 2 ? 'selected' : ''}}>Feb</option>
-                        <option value="03" {{$m === 3 ? 'selected' : ''}}>Mar</option>
-                        <option value="04" {{$m === 4 ? 'selected' : ''}}>Apr</option>
-                        <option value="05" {{$m === 5 ? 'selected' : ''}}>May</option>
-                        <option value="06" {{$m === 6 ? 'selected' : ''}}>Jun</option>
-                        <option value="07" {{$m === 7 ? 'selected' : ''}}>Jul</option>
-                        <option value="08" {{$m === 8 ? 'selected' : ''}}>Aug</option>
-                        <option value="09" {{$m === 9 ? 'selected' : ''}}>Sep</option>
-                        <option value="10" {{$m === 10 ? 'selected' : ''}}>Oct</option>
-                        <option value="11" {{$m === 11 ? 'selected' : ''}}>Nov</option>
-                        <option value="12" {{$m === 12 ? 'selected' : ''}}>Dec</option>
-                    </select>
-                    <span class="mr-2">Year</span>
-                    <select class="form-control form-control-sm min-width-unset width-100px" name="y"
-                            onchange="fastLoad('{{route('practice-management.rpm-matrix-' . $mode)}}?' + $(this).closest('form').serialize())">
-                        <option value="2020" {{$y === 2020 ? 'selected' : ''}}>2020</option>
-                        <option value="2021" {{$y === 2021 ? 'selected' : ''}}>2021</option>
-                        <option value="2022" {{$y === 2022 ? 'selected' : ''}}>2022</option>
-                    </select>
+            <div class="card-header px-2 py-2 d-flex align-items-baseline overflow-hidden">
+                <form class="d-block w-100" action="" method="GET">
+
+                    <div class="d-flex align-items-baseline">
+                        <span class="mr-4">
+                            <span class="font-size-14">Remote Monitoring</span>
+                            <i class="fas fa-arrow-right text-sm mx-1"></i>
+                            <b class="font-size-14">{{friendly_month(date((request()->input('y') ?: 'Y') . '-' . (request()->input('m') ?: 'm') . '-d'))}}</b>
+                        </span>
+                        <?php
+
+                        $mStr = request()->input('m') ? request()->input('m') : date('m');
+                        $yStr = request()->input('y') ? request()->input('y') : date('Y');
+                        $rcmStartDate = $yStr . '-' . $mStr . '-' . '01';
+                        $m = +$mStr;
+                        $y = +$yStr;
+                        ?>
+                        <a href="{{ route('practice-management.rpm_work_matrix') }}?m={{$mStr}}&y={{$yStr}}"
+                           native target="_blank"
+                           open-in-stag-popup
+                           update-parent
+                           popup-style="tall overflow-visible"
+                           class="mr-4 font-weight-bold"
+                           mc-initer="rpm-work-matrix"
+                           title="RPM Work Matrix">
+                            RPM Work Matrix
+                        </a>
+                        <span class="mr-2">Strategy:</span>
+                        @if($mode === 'mcp')
+                            {{strategy_display($pro->mcp_rpm_payment_strategy, $mode)}}
+                            <?php $strategy = $pro->mcp_rpm_payment_strategy; ?>
+                        @elseif($mode === 'rmm')
+                            {{strategy_display($pro->rme_payment_strategy, $mode)}}
+                            <?php $strategy = $pro->rmm_payment_strategy; ?>
+                        @elseif($mode === 'rmm')
+                            {{strategy_display($pro->rmm_payment_strategy, $mode)}}
+                            <?php $strategy = $pro->rme_payment_strategy; ?>
+                        @endif
+
+                        <?php $strategy = 'X16_DAYS_20_MINS_ON_OWN_MCP_COM_DURING_CM'; ?>
+
+                        <div class="ml-auto d-inline-flex flex-nowrap align-items-baseline">
+                            <span class="mr-2">Month</span>
+                            <select class="form-control form-control-sm min-width-unset width-100px mr-3" name="m"
+                                    onchange="fastLoad('{{route('practice-management.rpm-matrix-' . $mode)}}?' + $(this).closest('form').serialize())">
+                                <option value="01" {{$m === 1 ? 'selected' : ''}}>Jan</option>
+                                <option value="02" {{$m === 2 ? 'selected' : ''}}>Feb</option>
+                                <option value="03" {{$m === 3 ? 'selected' : ''}}>Mar</option>
+                                <option value="04" {{$m === 4 ? 'selected' : ''}}>Apr</option>
+                                <option value="05" {{$m === 5 ? 'selected' : ''}}>May</option>
+                                <option value="06" {{$m === 6 ? 'selected' : ''}}>Jun</option>
+                                <option value="07" {{$m === 7 ? 'selected' : ''}}>Jul</option>
+                                <option value="08" {{$m === 8 ? 'selected' : ''}}>Aug</option>
+                                <option value="09" {{$m === 9 ? 'selected' : ''}}>Sep</option>
+                                <option value="10" {{$m === 10 ? 'selected' : ''}}>Oct</option>
+                                <option value="11" {{$m === 11 ? 'selected' : ''}}>Nov</option>
+                                <option value="12" {{$m === 12 ? 'selected' : ''}}>Dec</option>
+                            </select>
+                            <span class="mr-2">Year</span>
+                            <select class="form-control form-control-sm min-width-unset width-100px" name="y"
+                                    onchange="fastLoad('{{route('practice-management.rpm-matrix-' . $mode)}}?' + $(this).closest('form').serialize())">
+                                <option value="2020" {{$y === 2020 ? 'selected' : ''}}>2020</option>
+                                <option value="2021" {{$y === 2021 ? 'selected' : ''}}>2021</option>
+                                <option value="2022" {{$y === 2022 ? 'selected' : ''}}>2022</option>
+                            </select>
+                        </div>
+                    </div>
+
+                    <hr class="m-neg-3 my-2"/>
+
+                    <div class="d-flex align-items-start">
+
+                        <div>
+                            <label class="mb-0 text-sm {{request()->input('f_name') ? 'text-info' : 'text-secondary'}}">Name</label>
+                            <input type="text"
+                                   class="mr-2 form-control form-control-sm min-width-unset max-width-110px"
+                                   name="f_name" value="{{request()->input('f_name')}}">
+                        </div>
+
+                        <div>
+                            <label class="mb-0 text-sm {{request()->input('f_dob') ? 'text-info' : 'text-secondary'}}">DOB</label>
+                            <div class="d-flex align-items-start">
+                                <select name="f_dob_op"
+                                        class="mr-1 form-control form-control-sm min-width-unset width-40px pl-0">
+                                    <option {{request()->input('f_dob_op') === '=' ? 'selected' : ''}} value="=">&equals;</option>
+                                    <option {{request()->input('f_dob_op') === '>' ? 'selected' : ''}} value=">">&gt;</option>
+                                    <option {{request()->input('f_dob_op') === '<' ? 'selected' : ''}} value="<">&lt;</option>
+                                    <option {{request()->input('f_dob_op') === '>=' ? 'selected' : ''}} value=">=">&ge;</option>
+                                    <option {{request()->input('f_dob_op') === '<=' ? 'selected' : ''}} value="<=">&le;</option>
+                                </select>
+                                <input type="date" name="f_dob"
+                                       value="{{request()->input('f_dob')}}"
+                                       class="mr-2 form-control form-control-sm min-width-unset max-width-140px">
+                            </div>
+                        </div>
+
+                        <div>
+                            <label class="mb-0 text-sm {{request()->input('f_rpm') && request()->input('f_rpm') !== 'any' ? 'text-info' : 'text-secondary'}}">RPM</label>
+                            <select name="f_rpm"
+                                    class="mr-2 form-control form-control-sm min-width-unset width-70px pl-0">
+                                <option {{request()->input('f_rpm') === 'any' ? 'selected' : ''}} value="any">Any</option>
+                                <option {{request()->input('f_rpm') === 'yes' ? 'selected' : ''}} value="yes">Yes</option>
+                                <option {{request()->input('f_rpm') === 'no' ? 'selected' : ''}} value="no">No</option>
+                            </select>
+                        </div>
+
+                        <div>
+                            <label class="mb-0 text-sm {{request()->input('f_cell_bp') && request()->input('f_cell_bp') !== 'any' ? 'text-info' : 'text-secondary'}}">Cell. BP</label>
+                            <select name="f_cell_bp"
+                                    class="mr-2 form-control form-control-sm min-width-unset width-70px pl-0">
+                                <option {{request()->input('f_cell_bp') === 'any' ? 'selected' : ''}} value="any">Any</option>
+                                <option {{request()->input('f_cell_bp') === 'yes' ? 'selected' : ''}} value="yes">Yes</option>
+                                <option {{request()->input('f_cell_bp') === 'no' ? 'selected' : ''}} value="no">No</option>
+                            </select>
+                        </div>
+
+                        <div>
+                            <label class="mb-0 text-sm {{request()->input('f_cell_wt') && request()->input('f_cell_wt') !== 'any' ? 'text-info' : 'text-secondary'}}">Cell. Wt</label>
+                            <select name="f_cell_wt"
+                                    class="mr-2 form-control form-control-sm min-width-unset width-70px pl-0">
+                                <option {{request()->input('f_cell_wt') === 'any' ? 'selected' : ''}} value="any">Any</option>
+                                <option {{request()->input('f_cell_wt') === 'yes' ? 'selected' : ''}} value="yes">Yes</option>
+                                <option {{request()->input('f_cell_wt') === 'no' ? 'selected' : ''}} value="no">No</option>
+                            </select>
+                        </div>
+
+                        @if($mode === 'mcp' || $mode === 'rmm')
+                        <div>
+                            <label class="mb-0 text-sm {{request()->input('f_comm') && request()->input('f_comm') !== 'any' ? 'text-info' : 'text-secondary'}}">Comm.</label>
+                            <select name="f_comm"
+                                    class="mr-2 form-control form-control-sm min-width-unset width-70px pl-0">
+                                <option {{request()->input('f_comm') === 'any' ? 'selected' : ''}} value="any">Any</option>
+                                <option {{request()->input('f_comm') === 'yes' ? 'selected' : ''}} value="yes">Yes</option>
+                                <option {{request()->input('f_comm') === 'no' ? 'selected' : ''}} value="no">No</option>
+                            </select>
+                        </div>
+                        @endif
+
+                        <div>
+                            <label class="mb-0 text-sm {{request()->input('f_md') ? 'text-info' : 'text-secondary'}}">Meas. Days</label>
+                            <div class="d-flex align-items-start">
+                                <select name="f_md_op"
+                                        class="mr-1 form-control form-control-sm min-width-unset width-40px pl-0">
+                                    <option {{request()->input('f_md_op') === '=' ? 'selected' : ''}} value="=">&equals;</option>
+                                    <option {{request()->input('f_md_op') === '>' ? 'selected' : ''}} value=">">&gt;</option>
+                                    <option {{request()->input('f_md_op') === '<' ? 'selected' : ''}} value="<">&lt;</option>
+                                    <option {{request()->input('f_md_op') === '>=' ? 'selected' : ''}} value=">=">&ge;</option>
+                                    <option {{request()->input('f_md_op') === '<=' ? 'selected' : ''}} value="<=">&le;</option>
+                                </select>
+                                <input type="number" name="f_md"
+                                       value="{{request()->input('f_md')}}"
+                                       class="mr-2 form-control form-control-sm min-width-unset width-70px">
+                            </div>
+                        </div>
+
+                        @if($mode === 'mcp' || $mode === 'rmm')
+                        <div>
+                            <label class="mb-0 text-sm {{request()->input('f_unst') ? 'text-info' : 'text-secondary'}}">Unstamped</label>
+                            <div class="d-flex align-items-start">
+                                <select name="f_unst_op"
+                                        class="mr-1 form-control form-control-sm min-width-unset width-40px pl-0">
+                                    <option {{request()->input('f_unst_op') === '=' ? 'selected' : ''}} value="=">&equals;</option>
+                                    <option {{request()->input('f_unst_op') === '>' ? 'selected' : ''}} value=">">&gt;</option>
+                                    <option {{request()->input('f_unst_op') === '<' ? 'selected' : ''}} value="<">&lt;</option>
+                                    <option {{request()->input('f_unst_op') === '>=' ? 'selected' : ''}} value=">=">&ge;</option>
+                                    <option {{request()->input('f_unst_op') === '<=' ? 'selected' : ''}} value="<=">&le;</option>
+                                </select>
+                                <input type="number" name="f_unst"
+                                       value="{{request()->input('f_unst')}}"
+                                       class="mr-2 form-control form-control-sm min-width-unset width-70px">
+                            </div>
+                        </div>
+                        @endif
+
+                        <div>
+                            <label class="mb-0 text-sm {{request()->input('f_mins') ? 'text-info' : 'text-secondary'}}">{{strtoupper($mode)}} Mins.</label>
+                            <div class="d-flex align-items-start">
+                                <select name="f_mins_op"
+                                        class="mr-1 form-control form-control-sm min-width-unset width-40px pl-0">
+                                    <option {{request()->input('f_mins_op') === '=' ? 'selected' : ''}} value="=">&equals;</option>
+                                    <option {{request()->input('f_mins_op') === '>' ? 'selected' : ''}} value=">">&gt;</option>
+                                    <option {{request()->input('f_mins_op') === '<' ? 'selected' : ''}} value="<">&lt;</option>
+                                    <option {{request()->input('f_mins_op') === '>=' ? 'selected' : ''}} value=">=">&ge;</option>
+                                    <option {{request()->input('f_mins_op') === '<=' ? 'selected' : ''}} value="<=">&le;</option>
+                                </select>
+                                <input type="number" name="f_mins"
+                                       value="{{request()->input('f_mins')}}"
+                                       class="mr-2 form-control form-control-sm min-width-unset width-70px">
+                            </div>
+                        </div>
+
+                        <div>
+                            <label class="mb-0 text-sm text-secondary">&nbsp;</label>
+                            <div class="d-flex align-items-start">
+                                <button class="btn-apply btn btn-sm btn-primary mr-2"><i class="fa fa-check"></i></button>
+                                <button class="btn-reset btn btn-sm btn-default bg-white text-secondary border"><i class="fa fa-times"></i></button>
+                            </div>
+                        </div>
+                    </div>
+
                 </form>
             </div>
 
@@ -119,7 +263,7 @@
                         <table class="table table-sm table-striped table-hover p-0 m-0" id="table-rm-matrix">
                             <thead class="bg-light">
                             <tr>
-                                <!--<th class="border-0 pl-2">Name</th>
+                            <!--<th class="border-0 pl-2">Name</th>
                                 <th class="border-0">DOB</th>
                                 <th class="border-0">RPM?</th>
                                 <th class="border-0">Cell. BP?</th>
@@ -153,12 +297,13 @@
                                         <th class="border-0">@include('app.practice-management._sort_header', ['route' => route("practice-management.rpm-matrix-" . $mode), 'label' => '#MCP Mins.', 'key' => 'rm_total_time_in_seconds_by_mcp'])</th>
                                     @else
                                         <th class="border-0">@include('app.practice-management._sort_header', ['route' => route("practice-management.rpm-matrix-" . $mode), 'label' => '#RMM Mins.', 'key' => 'rm_total_time_in_seconds_by_rmm_pro'])</th>
-                                     @endif
+                                    @endif
                                 @elseif($mode === 'rme')
                                     <th class="border-0">@include('app.practice-management._sort_header', ['route' => route("practice-management.rpm-matrix-" . $mode), 'label' => '#Meas. Days', 'key' => 'number_of_days_with_remote_measurements'])</th>
                                     <th class="border-0">@include('app.practice-management._sort_header', ['route' => route("practice-management.rpm-matrix-" . $mode), 'label' => '#RME Mins.', 'key' => 'rm_total_time_in_seconds_by_rme_pro'])</th>
                                 @endif
-                                <th class="border-0 text-secondary"">Billable</th>
+                                <th class="border-0 text-secondary"
+                                ">Billable</th>
                             </tr>
                             </thead>
                             <tbody>
@@ -167,7 +312,7 @@
                                 <?php
 
                                 $daysDiff = -1;
-                                if($iPatient->most_recent_completed_mcp_note_date) {
+                                if ($iPatient->most_recent_completed_mcp_note_date) {
                                     $careMonthLastDay = date_add(date_create($rcmStartDate), date_interval_create_from_date_string("1 month"));
                                     $careMonthLastDay = date_sub($careMonthLastDay, date_interval_create_from_date_string("1 day"));
                                     $daysDiff = date_diff($careMonthLastDay, date_create($iPatient->most_recent_completed_mcp_note_date))->days;
@@ -186,39 +331,40 @@
         </div>
     </div>
     <script>
-        (function() {
+        (function () {
             let dataTableInst = null;
-            window.refreshRpmRow = function(_index) {
+            window.refreshRpmRow = function (_index) {
                 let tr = $('#table-rm-matrix tbody tr:eq(' + _index + ')');
-                if(!tr.length) return;
+                if (!tr.length) return;
                 let clientUid = tr.attr('data-client-uid'), careMonthUid = tr.attr('data-care-month-uid');
                 $.get('/rpm-matrix-row-{{$mode}}?m={{$mStr}}&y={{$yStr}}&clientUid=' + clientUid + '&careMonthUid=' + careMonthUid + '&trIndex=' + _index, _data => {
                     let row = $(_data);
                     @if(request()->input('dt'))
-                        row.find('>td').each(function(_columnIndex) {
-                            dataTableInst.cell(_index, _columnIndex).data(this.innerHTML); //.draw();
-                        });
+                    row.find('>td').each(function (_columnIndex) {
+                        dataTableInst.cell(_index, _columnIndex).data(this.innerHTML); //.draw();
+                    });
                     @else
-                        tr.replaceWith(row);
+                    tr.replaceWith(row);
                     @endif
                     $('#practice-remote-monitoring [moe][initialized]').removeAttr('initialized');
                     initMoes();
                     tr.addClass('post-refresh-highlight');
-                    setTimeout(function() {
+                    setTimeout(function () {
                         tr.removeClass('post-refresh-highlight');
                     }, 1000);
                 });
             }
+
             function init() {
                 @if(request()->input('dt'))
-                dataTableInst = $('#table-rm-matrix').DataTable({
+                    dataTableInst = $('#table-rm-matrix').DataTable({
                     paging: false,
                     columnDefs: [
                         {
                             targets: [0, 8],
                             type: 'string',
                             render: function (data, type, row, meta) {
-                                if(type === 'sort') {
+                                if (type === 'sort') {
                                     return $(data).find('.sort-data').first().text();
                                 }
                                 return data;
@@ -229,7 +375,7 @@
                             targets: 7,
                             type: 'num',
                             render: function (data, type, row, meta) {
-                                if(type === 'sort') {
+                                if (type === 'sort') {
                                     return $(data).find('.sort-data').first().text();
                                 }
                                 return data;
@@ -239,7 +385,7 @@
                             targets: [5, 6, 10, 11, 12],
                             type: 'num',
                             render: function (data, type, row, meta) {
-                                if(type === 'sort') {
+                                if (type === 'sort') {
                                     return +($(data).find('.sort-data').first().text());
                                 }
                                 return data;
@@ -250,8 +396,26 @@
                 @endif
                 $('#practice-remote-monitoring').removeAttr('v-cloak');
                 $('#practice-remote-monitoring [moe][initialized]').removeAttr('initialized');
+
+                let parent = $('#practice-remote-monitoring');
+
+                parent.find('.btn-apply')
+                    .off('click.filter')
+                    .on('click.filter', function() {
+                        fastLoad('{{route('practice-management.rpm-matrix-' . $mode)}}?' + $(this).closest('form').serialize());
+                        return false;
+                    });
+
+                parent.find('.btn-reset')
+                    .off('click.reset')
+                    .on('click.reset', function() {
+                        fastLoad('{{route("practice-management.rpm-matrix-" . $mode)}}');
+                        return false;
+                    });
+
                 initMoes();
             }
+
             addMCInitializer('practice-remote-monitoring', init, '#practice-remote-monitoring');
         }).call(window);
     </script>