@extends ('layouts/template')

@section('content')
    <style>
        #admin-table-rm-matrix_wrapper {
            padding-top: 10px;
        }
    </style>
    <link rel="stylesheet" href="https://cdn.datatables.net/1.11.5/css/jquery.dataTables.min.css">
    <script src="https://cdn.datatables.net/1.11.5/js/jquery.dataTables.min.js"></script>
    <style>
        #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;
        }

        #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-remote-monitoring" v-cloak>

        <div class="card h-100">

            <div class="card-header px-2 py-2 d-flex align-items-baseline">
                <form class="d-block w-100" action="" method="GET" id="rpm-matrix-filter">

                    <div class="d-flex align-items-baseline">
                        <span class="font-size-14">RPM (Admin)</span>
                        <span class="mx-2 text-secondary text-sm">|</span>
                        <a href="#" onclick="$('#rpm-admin-filters').toggle(); return false;">Toggle Filters</a>
                        <span class="mx-2 text-secondary text-sm">|</span>
                        <a href="#" onclick="$('#rpm-admin-stats-graph').toggle(); return false;">Toggle Stats & Graph</a>
                    </div>

                    <div id="rpm-admin-filters">

                    <div class="d-flex d-none align-items-start mt-2 pt-1 border-top">

                        <div class="max-width-110px mr-2">
                            <label class="mb-0 text-sm {{request()->input('m') && request()->input('m') !== 'ACTIVE' ? 'font-weight-bold text-info' : 'text-secondary'}}">Month</label>
                            <select name="m" class="mr-2 form-control form-control-sm min-width-unset max-width-110px pl-0">
                                <option value="">All</option>
                                <option value="01" {{request()->input('m') && intval(request()->input('m')) === 1 ? 'selected' : ''}}>Jan</option>
                                <option value="02" {{request()->input('m') && intval(request()->input('m')) === 2 ? 'selected' : ''}}>Feb</option>
                                <option value="03" {{request()->input('m') && intval(request()->input('m')) === 3 ? 'selected' : ''}}>Mar</option>
                                <option value="04" {{request()->input('m') && intval(request()->input('m')) === 4 ? 'selected' : ''}}>Apr</option>
                                <option value="05" {{request()->input('m') && intval(request()->input('m')) === 5 ? 'selected' : ''}}>May</option>
                                <option value="06" {{request()->input('m') && intval(request()->input('m')) === 6 ? 'selected' : ''}}>Jun</option>
                                <option value="07" {{request()->input('m') && intval(request()->input('m')) === 7 ? 'selected' : ''}}>Jul</option>
                                <option value="08" {{request()->input('m') && intval(request()->input('m')) === 8 ? 'selected' : ''}}>Aug</option>
                                <option value="09" {{request()->input('m') && intval(request()->input('m')) === 9 ? 'selected' : ''}}>Sep</option>
                                <option value="10" {{request()->input('m') && intval(request()->input('m')) === 10 ? 'selected' : ''}}>Oct</option>
                                <option value="11" {{request()->input('m') && intval(request()->input('m')) === 11 ? 'selected' : ''}}>Nov</option>
                                <option value="12" {{request()->input('m') && intval(request()->input('m')) === 12 ? 'selected' : ''}}>Dec</option>
                            </select>
                        </div>

                        <div class="max-width-110px mr-2">
                            <label class="mb-0 text-sm {{request()->input('y') && request()->input('y') !== 'ACTIVE' ? 'font-weight-bold text-info' : 'text-secondary'}}">Year</label>
                            <select name="y" class="mr-2 form-control form-control-sm min-width-unset max-width-110px pl-0">
                                <option value="">All</option>
                                <option value="2020" {{request()->input('y') && intval(request()->input('y')) === 2020 ? 'selected' : ''}}>2020</option>
                                <option value="2021" {{request()->input('y') && intval(request()->input('y')) === 2021 ? 'selected' : ''}}>2021</option>
                                <option value="2022" {{request()->input('y') && intval(request()->input('y')) === 2022 ? 'selected' : ''}}>2022</option>
                                <option value="2023" {{request()->input('y') && intval(request()->input('y')) === 2023? 'selected' : ''}}>2023</option>
                            </select>
                        </div>

                        <div>
                            <label class="mb-0 text-sm {{request()->input('f_ces') && request()->input('f_ces') !== 'ACTIVE' ? 'font-weight-bold text-info' : 'text-secondary'}}">Status</label>
                            <select name="f_ces" class="mr-2 form-control form-control-sm min-width-unset max-width-110px pl-0">
                                <option {{!request()->input('f_ces') || request()->input('f_ces') === 'ACTIVE' ? 'selected' : ''}} value="ACTIVE">Active</option>
                                <option {{request()->input('f_ces') === 'INACTIVE' ? 'selected' : ''}} value="INACTIVE">Inactive</option>
                                <option {{request()->input('f_ces') === 'ENTRY_ERROR' ? 'selected' : ''}} value="ENTRY_ERROR">Entry Error</option>
                                <option {{request()->input('f_ces') === 'DUMMY' ? 'selected' : ''}} value="DUMMY">Test Chart</option>
                                <option {{request()->input('f_ces') === 'DECEASED' ? 'selected' : ''}} value="DECEASED">Deceased</option>
                                <option {{request()->input('f_ces') === 'DUPLICATE' ? 'selected' : ''}} value="DUPLICATE">Duplicate</option>
                                <option {{request()->input('f_ces') === 'NO_LONGER_INTERESTED' ? 'selected' : ''}} value="NO_LONGER_INTERESTED">No Longer Interested</option>
                                <option {{request()->input('f_ces') === 'BAD_RECORD' ? 'selected' : ''}} value="BAD_RECORD">Bad Record</option>
                                <option {{request()->input('f_ces') === 'NO_LONGER_ELIGIBLE' ? 'selected' : ''}} value="NO_LONGER_ELIGIBLE">No Longer Eligible</option>
                            </select>
                        </div>

                        <div class="max-width-110px mr-2">
                            <label class="mb-0 text-sm {{request()->input('f_name') ? 'font-weight-bold text-info' : 'text-secondary'}}">Name</label>
                            <input type="text"
                                   class="form-control form-control-sm min-width-unset max-width-110px"
                                   name="f_name" value="{{request()->input('f_name')}}">
                        </div>

                        <div class="max-width-110px mr-2">
                            <label class="mb-0 text-sm {{request()->input('f_payer_type') ? 'font-weight-bold text-info' : 'text-secondary'}}">Payer Type</label>
                            <div class="d-flex align-items-start">
                                <select name="f_payer_type"
                                        class=" form-control form-control-sm min-width-unset width-140px pl-0">
                                    <option value="">Any</option>
                                    <option {{request()->input('f_payer_type') === 'Medicare' ? 'selected' : ''}} value="Medicare">Medicare</option>
                                    <option {{request()->input('f_payer_type') === 'Non Medicare' ? 'selected' : ''}} value="Non Medicare">Non Medicare</option>
                                    <option {{request()->input('f_payer_type') === 'Medicaid' ? 'selected' : ''}} value="Medicaid">Medicaid</option>
                                    <option {{request()->input('f_payer_type') === 'Commercial' ? 'selected' : ''}} value="Commercial">Commercial</option>
                                </select>
                            </div>
                        </div>

                        <div class="max-width-110px mr-2">
                            <label class="mb-0 text-sm {{request()->input('f_payer') ? 'font-weight-bold text-info' : 'text-secondary'}}">Comm. Payer</label>
                            <input name="f_payer" class="form-control form-control-sm min-width-unset" value="{{request()->input('f_payer')}}" autocomplete="off" stag-suggest stag-suggest-ep="/search-payer/json" />
                        </div>

                        <div class="max-width-110px mr-2">
                            <label class="mb-0 text-sm {{request()->input('f_state') ? 'font-weight-bold text-info' : 'text-secondary'}}">State</label>
                            <div class="d-flex align-items-start">
                                <select name="f_state"
                                        class=" form-control form-control-sm min-width-unset pl-0">
                                    <option value="">Any</option>
                                    <option {{request()->input('f_state') === 'NONE' ? 'selected' : ''}} value="NONE">Not Available</option>
                                    <option {{request()->input('f_state') === 'NOT_MD' ? 'selected' : ''}} value="NOT_MD">Not MD</option>
                                    <option {{request()->input('f_state') === 'AL' ? 'selected' : ''}} value="AL">Alabama</option>
                                    <option {{request()->input('f_state') === 'AK' ? 'selected' : ''}} value="AK">Alaska</option>
                                    <option {{request()->input('f_state') === 'AZ' ? 'selected' : ''}} value="AZ">Arizona</option>
                                    <option {{request()->input('f_state') === 'AR' ? 'selected' : ''}} value="AR">Arkansas</option>
                                    <option {{request()->input('f_state') === 'CA' ? 'selected' : ''}} value="CA">California</option>
                                    <option {{request()->input('f_state') === 'CO' ? 'selected' : ''}} value="CO">Colorado</option>
                                    <option {{request()->input('f_state') === 'CT' ? 'selected' : ''}} value="CT">Connecticut</option>
                                    <option {{request()->input('f_state') === 'DE' ? 'selected' : ''}} value="DE">Delaware</option>
                                    <option {{request()->input('f_state') === 'FL' ? 'selected' : ''}} value="FL">Florida</option>
                                    <option {{request()->input('f_state') === 'GA' ? 'selected' : ''}} value="GA">Georgia</option>
                                    <option {{request()->input('f_state') === 'HI' ? 'selected' : ''}} value="HI">Hawaii</option>
                                    <option {{request()->input('f_state') === 'ID' ? 'selected' : ''}} value="ID">Idaho</option>
                                    <option {{request()->input('f_state') === 'IL' ? 'selected' : ''}} value="IL">Illinois</option>
                                    <option {{request()->input('f_state') === 'IN' ? 'selected' : ''}} value="IN">Indiana</option>
                                    <option {{request()->input('f_state') === 'IA' ? 'selected' : ''}} value="IA">Iowa</option>
                                    <option {{request()->input('f_state') === 'KS' ? 'selected' : ''}} value="KS">Kansas</option>
                                    <option {{request()->input('f_state') === 'KY' ? 'selected' : ''}} value="KY">Kentucky</option>
                                    <option {{request()->input('f_state') === 'LA' ? 'selected' : ''}} value="LA">Louisiana</option>
                                    <option {{request()->input('f_state') === 'ME' ? 'selected' : ''}} value="ME">Maine</option>
                                    <option {{request()->input('f_state') === 'MD' ? 'selected' : ''}} value="MD">Maryland</option>
                                    <option {{request()->input('f_state') === 'MA' ? 'selected' : ''}} value="MA">Massachusetts</option>
                                    <option {{request()->input('f_state') === 'MI' ? 'selected' : ''}} value="MI">Michigan</option>
                                    <option {{request()->input('f_state') === 'MN' ? 'selected' : ''}} value="MN">Minnesota</option>
                                    <option {{request()->input('f_state') === 'MS' ? 'selected' : ''}} value="MS">Mississippi</option>
                                    <option {{request()->input('f_state') === 'MO' ? 'selected' : ''}} value="MO">Missouri</option>
                                    <option {{request()->input('f_state') === 'MT' ? 'selected' : ''}} value="MT">Montana</option>
                                    <option {{request()->input('f_state') === 'NE' ? 'selected' : ''}} value="NE">Nebraska</option>
                                    <option {{request()->input('f_state') === 'NV' ? 'selected' : ''}} value="NV">Nevada</option>
                                    <option {{request()->input('f_state') === 'NH' ? 'selected' : ''}} value="NH">New Hampshire</option>
                                    <option {{request()->input('f_state') === 'NJ' ? 'selected' : ''}} value="NJ">New Jersey</option>
                                    <option {{request()->input('f_state') === 'NM' ? 'selected' : ''}} value="NM">NewMexico</option>
                                    <option {{request()->input('f_state') === 'NY' ? 'selected' : ''}} value="NY">New York</option>
                                    <option {{request()->input('f_state') === 'NC' ? 'selected' : ''}} value="NC">North Carolina</option>
                                    <option {{request()->input('f_state') === 'ND' ? 'selected' : ''}} value="ND">North Dakota</option>
                                    <option {{request()->input('f_state') === 'OH' ? 'selected' : ''}} value="OH">Ohio</option>
                                    <option {{request()->input('f_state') === 'OK' ? 'selected' : ''}} value="OK">Oklahoma</option>
                                    <option {{request()->input('f_state') === 'OR' ? 'selected' : ''}} value="OR">Oregon</option>
                                    <option {{request()->input('f_state') === 'PA' ? 'selected' : ''}} value="PA">Pennsylvania</option>
                                    <option {{request()->input('f_state') === 'RI' ? 'selected' : ''}} value="RI">RhodeIsland</option>
                                    <option {{request()->input('f_state') === 'SC' ? 'selected' : ''}} value="SC">South Carolina</option>
                                    <option {{request()->input('f_state') === 'SD' ? 'selected' : ''}} value="SD">South Dakota</option>
                                    <option {{request()->input('f_state') === 'TN' ? 'selected' : ''}} value="TN">Tennessee</option>
                                    <option {{request()->input('f_state') === 'TX' ? 'selected' : ''}} value="TX">Texas</option>
                                    <option {{request()->input('f_state') === 'UT' ? 'selected' : ''}} value="UT">Utah</option>
                                    <option {{request()->input('f_state') === 'VT' ? 'selected' : ''}} value="VT">Vermont</option>
                                    <option {{request()->input('f_state') === 'VA' ? 'selected' : ''}} value="VA">Virginia</option>
                                    <option {{request()->input('f_state') === 'WA' ? 'selected' : ''}} value="WA">Washington</option>
                                    <option {{request()->input('f_state') === 'WV' ? 'selected' : ''}} value="WV">West Virginia</option>
                                    <option {{request()->input('f_state') === 'WI' ? 'selected' : ''}} value="WI">Wisconsin</option>
                                    <option {{request()->input('f_state') === 'WY' ? 'selected' : ''}} value="WY">Wyoming</option>
                                </select>
                            </div>
                        </div>

                        <div class="max-width-110px mr-2 position-relative">
                            <label class="mb-0 text-sm {{request()->input('f_mcp') ? 'font-weight-bold text-info' : 'text-secondary'}}">MCP</label>
                            <select name="f_mcp" class="form-control form-control-sm min-width-unset" provider-search provider-type="hcp" data-pro-uid="{{request()->input('f_mcp')}}">
                                <option value="">--select--</option>
                            </select>
                        </div>

                        <div>
                            <label class="mb-0 text-sm {{request()->input('f_dob') ? 'font-weight-bold 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 class="max-width-110px">
                            <label class="mb-0 text-sm {{request()->input('f_claim_closed') ? 'font-weight-bold text-info' : 'text-secondary'}}">Claim Closed</label>
                            <div class="d-flex align-items-start">
                                <select name="f_claim_closed"
                                        class="mr-1 form-control form-control-sm min-width-unset pl-0">
                                    <option value="">All</option>
                                    <option {{request()->input('f_claim_closed') === 'yes' ? 'selected' : ''}} value="yes">Closed</option>
                                    <option {{request()->input('f_claim_closed') === 'no' ? 'selected' : ''}} value="no">Not Closed</option>
                                </select>
                            </div>
                        </div>

                        <div class="width-70px mr-2">
                            <label class="mb-0 text-sm {{request()->input('f_mcp_billable') ? 'font-weight-bold text-info' : 'text-secondary'}}">MCP Billable</label>
                            <div class="d-flex align-items-start">
                                <select name="f_mcp_billable" class=" form-control form-control-sm min-width-unset pl-0">
                                    <option value="">Any</option>
                                    <option {{request()->input('f_mcp_billable') === 'Yes' ? 'selected' : ''}} value="Medicare">Yes</option>
                                    <option {{request()->input('f_mcp_billable') === 'No' ? 'selected' : ''}} value="Non Medicare">No</option>
                                </select>
                            </div>
                        </div>

                        <div class="width-70px mr-2">
                            <label class="mb-0 text-sm {{request()->input('f_rmm_billable') ? 'font-weight-bold text-info' : 'text-secondary'}}">RMM Billable</label>
                            <div class="d-flex align-items-start">
                                <select name="f_rmm_billable" class=" form-control form-control-sm min-width-unset pl-0">
                                    <option value="">Any</option>
                                    <option {{request()->input('f_rmm_billable') === 'Yes' ? 'selected' : ''}} value="Medicare">Yes</option>
                                    <option {{request()->input('f_rmm_billable') === 'No' ? 'selected' : ''}} value="Non Medicare">No</option>
                                </select>
                            </div>
                        </div>

                    </div>

                    <div class="d-flex align-items-start mt-2">
                        <div>
                            <label class="mb-0 text-sm {{request()->input('f_cell_bp') && request()->input('f_cell_bp') !== 'any' ? 'font-weight-bold 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' ? 'font-weight-bold 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>

                        <div>
                            <label class="mb-0 text-sm {{request()->input('f_lmb') && request()->input('f_lmb') !== 'any' ? 'font-weight-bold text-info' : 'text-secondary'}}">LMB</label>
                            <select name="f_lmb" class="mr-2 form-control form-control-sm min-width-unset width-70px pl-0">
                                <option {{request()->input('f_lmb') === 'any' ? 'selected' : ''}} value="any">Any</option>
                                <option {{request()->input('f_lmb') === '1' ? 'selected' : ''}} value="1">1 day</option>
                                <option {{request()->input('f_lmb') === '2' ? 'selected' : ''}} value="2">2 days</option>
                                <option {{request()->input('f_lmb') === '3' ? 'selected' : ''}} value="3">3 days</option>
                                <option {{request()->input('f_lmb') === '3+' ? 'selected' : ''}} value="3+">3+ days</option>
                            </select>
                        </div>

                        <div>
                            <label class="mb-0 text-sm {{request()->input('f_comm') && request()->input('f_comm') !== 'any' ? 'font-weight-bold 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>

                        <div>
                            <label class="mb-0 text-sm {{request()->input('f_md') ? 'font-weight-bold 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>

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

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

                        <div>
                            <label class="mb-0 text-sm {{request()->input('f_dslm') ? 'font-weight-bold text-info' : 'text-secondary'}}">DSLM</label>
                            <div class="d-flex align-items-start">
                                <select name="f_dslm_op"
                                        class="mr-1 form-control form-control-sm min-width-unset width-40px pl-0">
                                    <option {{request()->input('f_dslm_op') === '=' ? 'selected' : ''}} value="=">&equals;</option>
                                    <option {{request()->input('f_dslm_op') === '>' ? 'selected' : ''}} value=">">&gt;</option>
                                    <option {{request()->input('f_dslm_op') === '<' ? 'selected' : ''}} value="<">&lt;</option>
                                    <option {{request()->input('f_dslm_op') === '>=' ? 'selected' : ''}} value=">=">&ge;</option>
                                    <option {{request()->input('f_dslm_op') === '<=' ? 'selected' : ''}} value="<=">&le;</option>
                                </select>
                                <input type="number" name="f_dslm"
                                       value="{{request()->input('f_dslm')}}"
                                       class="mr-2 form-control form-control-sm min-width-unset width-70px">
                            </div>
                        </div>

                        <div>
                            <label class="mb-0 text-sm {{request()->input('f_dslv') ? 'font-weight-bold text-info' : 'text-secondary'}}">DSLV</label>
                            <div class="d-flex align-items-start">
                                <select name="f_dslv_op"
                                        class="mr-1 form-control form-control-sm min-width-unset width-40px pl-0">
                                    <option {{request()->input('f_dslv_op') === '=' ? 'selected' : ''}} value="=">&equals;</option>
                                    <option {{request()->input('f_dslv_op') === '>' ? 'selected' : ''}} value=">">&gt;</option>
                                    <option {{request()->input('f_dslv_op') === '<' ? 'selected' : ''}} value="<">&lt;</option>
                                    <option {{request()->input('f_dslv_op') === '>=' ? 'selected' : ''}} value=">=">&ge;</option>
                                    <option {{request()->input('f_dslv_op') === '<=' ? 'selected' : ''}} value="<=">&le;</option>
                                </select>
                                <input type="number" name="f_dslv"
                                       value="{{request()->input('f_dslv')}}"
                                       class="mr-2 form-control form-control-sm min-width-unset width-70px">
                            </div>
                        </div>

                        <div class="min-width-110px mr-2">
                            <label class="mb-0 text-sm {{request()->input('f_454') ? 'font-weight-bold text-info' : 'text-secondary'}}">454</label>
                            <div class="d-flex align-items-start">
                                <select name="f_454"
                                        class=" form-control form-control-sm min-width-unset pl-0">
                                    <option value="">Any</option>
                                    <option {{request()->input('f_454') === 'Claimable' ? 'selected' : ''}} value="Claimable">Claimable</option>
                                    <option {{request()->input('f_454') === 'Not Claimable' ? 'selected' : ''}} value="Not Claimable">Not Claimable</option>
                                    <option {{request()->input('f_454') === 'Claimed' ? 'selected' : ''}} value="Claimed">Claimed</option>
                                    <option {{request()->input('f_454') === 'Not Claimed' ? 'selected' : ''}} value="Not Claimed">Not Claimed</option>
                                    <option {{request()->input('f_454') === 'Waived' ? 'selected' : ''}} value="Waived">Waived</option>
                                </select>
                            </div>
                        </div>

                        <div class="min-width-110px mr-2">
                            <label class="mb-0 text-sm {{request()->input('f_457') ? 'font-weight-bold text-info' : 'text-secondary'}}">457</label>
                            <div class="d-flex align-items-start">
                                <select name="f_457"
                                        class=" form-control form-control-sm min-width-unset pl-0">
                                    <option value="">Any</option>
                                    <option {{request()->input('f_457') === 'Claimable' ? 'selected' : ''}} value="Claimable">Claimable</option>
                                    <option {{request()->input('f_457') === 'Not Claimable' ? 'selected' : ''}} value="Not Claimable">Not Claimable</option>
                                    <option {{request()->input('f_457') === 'Claimed' ? 'selected' : ''}} value="Claimed">Claimed</option>
                                    <option {{request()->input('f_457') === 'Not Claimed' ? 'selected' : ''}} value="Not Claimed">Not Claimed</option>
                                    <option {{request()->input('f_457') === 'Waived' ? 'selected' : ''}} value="Waived">Waived</option>
                                </select>
                            </div>
                        </div>

                        <div class="min-width-110px mr-2">
                            <label class="mb-0 text-sm {{request()->input('f_458') ? 'font-weight-bold text-info' : 'text-secondary'}}">458</label>
                            <div class="d-flex align-items-start">
                                <select name="f_458"
                                        class=" form-control form-control-sm min-width-unset pl-0">
                                    <option value="">Any</option>
                                    <option {{request()->input('f_458') === 'Claimable' ? 'selected' : ''}} value="Claimable">Claimable</option>
                                    <option {{request()->input('f_458') === 'Not Claimable' ? 'selected' : ''}} value="Not Claimable">Not Claimable</option>
                                    <option {{request()->input('f_458') === 'Claimed' ? 'selected' : ''}} value="Claimed">Claimed</option>
                                    <option {{request()->input('f_458') === 'Not Claimed' ? 'selected' : ''}} value="Not Claimed">Not Claimed</option>
                                    <option {{request()->input('f_458') === 'Waived' ? 'selected' : ''}} value="Waived">Waived</option>
                                </select>
                            </div>
                        </div>


                        <!--<div class="max-width-110px">
                            <label class="mb-0 text-sm {{request()->input('f_visit_90_days') ? 'font-weight-bold text-info' : 'text-secondary'}}">Visit 90 Days</label>
                            <div class="d-flex align-items-start">
                                <select name="f_visit_90_days"
                                        class="mr-2 form-control form-control-sm min-width-unset pl-0">
                                    <option value="">All</option>
                                    <option {{request()->input('f_visit_90_days') === 'yes' ? 'selected' : ''}} value="yes">Closed</option>
                                    <option {{request()->input('f_visit_90_days') === 'no' ? 'selected' : ''}} value="no">Not Closed</option>
                                </select>
                            </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>

                    <input type="hidden" name="not-enrolled" value="{{request()->input('not-enrolled')}}">

                    </div>

                    <div id="rpm-admin-stats-graph">

                        <div class="mt-2 pt-2 border-top">
                            <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); $('.btn-apply').trigger('click');"
                                               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); $('.btn-apply').trigger('click');"
                                               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>
                            <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>
                        </div>

                    </div>

                </form>
            </div>

            <?php $rc = request()->input('rc') ? request()->input('rc') : 1; ?>

            <div class="card-body p-0">
                <div class="d-flex align-items-baseline p-2 border-bottom">
                    <div class="d-inline-flex align-items-baseline" tab-links="">
                        <a class="{{ !request()->input('not-enrolled') ? 'tab-link-active' : '' }} text-dark c-pointer"
                           onclick="$('[name=not-enrolled]').val(''); return fastLoad('{{route('practice-management.rpm-matrix-admin')}}?' + $('#rpm-matrix-filter').serialize());"
                           tab-link="rpm">Enrolled in RPM</a>
                        <a class="{{ request()->input('not-enrolled') ? 'tab-link-active' : '' }} text-dark c-pointer"
                           onclick="$('[name=not-enrolled]').val('1'); return fastLoad('{{route('practice-management.rpm-matrix-admin')}}?' + $('#rpm-matrix-filter').serialize());"
                           tab-link="no-rpm">Not Enrolled in RPM</a>
                    </div>
                    @if($paginator->total() || true)
                        <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> care months</div>
                            {!! $paginator->onEachSide(2)->withQueryString()->links() !!}
                            <select class="form-control form-control-sm min-width-unset width-140px px-2 ml-2" onchange="fastLoad('{{ route('practice-management.rpm-matrix-admin') }}?{{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>
                                <option {{$perPage == 150 ? 'selected' : ''}} value="150">150/page</option>
                                <option {{$perPage == 200 ? 'selected' : ''}} value="200">200/page</option>
                            </select>
                        </div>
                    @endif
                </div>
                <div class="cm-tab {{!request()->input('not-enrolled') ? '' : 'd-none'}}" tab-key="rpm">
                    @include('app.practice-management.rpm-matrix-for-admin-table')
                </div>
                <div class="cm-tab {{request()->input('not-enrolled') ? '' : 'd-none'}}" tab-key="no-rpm">
                    @include('app.practice-management.rpm-matrix-for-admin-table')
                </div>
            </div>
        </div>
    </div>
    <script>
        (function () {

            function init() {
                $('#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-admin')}}?' + $(this).closest('form').serialize());
                        return false;
                    });

                parent.find('.btn-reset')
                    .off('click.reset')
                    .on('click.reset', function() {
                        fastLoad('{{route("practice-management.rpm-matrix-admin")}}');
                        return false;
                    });

                initMoes();
            }

            addMCInitializer('practice-remote-monitoring', init, '#practice-remote-monitoring');
        }).call(window);
    </script>
@endsection
