<?php $lastVisitWithinDays = !is_null($iPatient->days_between_most_recent_mcp_note_date_and_end_of_care_month) && $iPatient->days_between_most_recent_mcp_note_date_and_end_of_care_month <= 120; ?>
<tr data-client-uid="{{$iPatient->client_uid}}" data-care-month-uid="{{$iPatient->care_month_uid}}">
    <td>{{ $trIndex + 1 }}</td>
    <td>{{friendly_month_short($iPatient->start_date)}}</td>
    <td>
        <a href="/patients/view/{{ $iPatient->client_uid }}/care-months/view/{{$iPatient->care_month_uid}}"
           native target="_blank"
           open-in-stag-popup
           update-parent="refresh-rpm-row-{{$trIndex}}"
           popup-style="tall overflow-visible"
           mc-initer="care-month-dashboard-{{$iPatient->client_uid}}"
           title="{{$iPatient->client_name}}"
           class="text-nowrap d-block max-width-170px overflow-hidden text-ellipsis"
        ><span class="sort-data">{{ $iPatient->client_name }}</span></a>
    </td>
    <td>{{$iPatient->payer_name}}</td>
    <td>{{$iPatient->mailing_address_state}}</td>
    <td>{{$iPatient->mcp_name}}</td>
    <td>
        @if($iPatient->is_assigned_cellular_bp_device)
            <div class="d-flex align-items-baseline">
            <i class="fa fa-check text-success"></i>
            @if($iPatient->most_recent_cellular_bp_sbp_mm_hg && $iPatient->most_recent_cellular_bp_dbp_mm_hg)
                <div class="text-nowrap ml-1">
                    <span class="sort-data">{{$iPatient->most_recent_cellular_bp_sbp_mm_hg ?: '-'}}</span>/{{$iPatient->most_recent_cellular_bp_dbp_mm_hg ?: '-'}}
                    @if($iPatient->most_recent_cellular_bp_measurement_at)
                        <span class="text-sm text-secondary text-nowrap"
                              title="{{friendly_date_time($iPatient->most_recent_cellular_bp_measurement_at)}}">{{friendly_date_est_compact($iPatient->most_recent_cellular_bp_measurement_at)}}</span>
                    @endif
                </div>
            @endif
            </div>
        @else
            <span class="text-secondary">No</span>
        @endif
    </td>
    <td>
        @if($iPatient->is_assigned_cellular_weight_scale_device)
            <div class="d-flex align-items-baseline">
                <i class="fa fa-check text-success"></i>
                @if($iPatient->most_recent_cellular_weight_value)
                    <div class="text-nowrap ml-1">
                        <span class="sort-data">{{$iPatient->most_recent_cellular_weight_value ? round($iPatient->most_recent_cellular_weight_value, 1) : '-'}}</span>
                        @if($iPatient->most_recent_cellular_weight_measurement_at)
                            <span class="text-sm text-secondary text-nowrap"
                                  title="{{friendly_date_time($iPatient->most_recent_cellular_weight_measurement_at)}}">{{friendly_date_est_compact($iPatient->most_recent_cellular_weight_measurement_at)}}</span>
                        @endif
                    </div>
                @endif
            </div>
        @else
            <span class="text-secondary">No</span>
        @endif
    </td>
    <td>
        {{$iPatient->dslm}}
    </td>
    <td>
        <div class="d-flex align-items-baseline">
            <i class="mr-1 text-sm fa {{$lastVisitWithinDays ? 'fa-check text-success' : 'fa-exclamation-triangle text-danger on-hover-opaque'}}"></i>
            <span class="sort-data">{{!is_null($iPatient->days_between_most_recent_mcp_note_date_and_end_of_care_month) ? $iPatient->days_between_most_recent_mcp_note_date_and_end_of_care_month : '-'}}</span>
        </div>
    </td>

    <td>
        {{$iPatient->next_visit_date ?: '-'}}
    </td>

    <td>
        <div class="d-flex align-items-baseline">
            <i class="mr-1 text-sm fa {{$iPatient->has_mcp_interacted_with_client_about_rm ? 'fa-check text-success' : 'fa-exclamation-triangle text-danger on-hover-opaque'}}"></i>
            <span class="sort-data">{{$iPatient->has_mcp_interacted_with_client_about_rm ? 'Yes' : 'No'}}</span>
        </div>
    </td>

    <td>
        <div class="d-flex align-items-baseline">
            <i class="mr-1 text-sm fa {{$iPatient->has_anyone_interacted_with_client_about_rm ? 'fa-check text-success' : 'fa-exclamation-triangle text-danger on-hover-opaque'}}"></i>
            <span class="sort-data">{{$iPatient->has_anyone_interacted_with_client_about_rm ? 'Yes' : 'No'}}</span>
        </div>
    </td>

    <td>
        <div class="d-flex align-items-baseline">
            <i class="mr-1 text-sm fa {{$iPatient->number_of_days_with_remote_measurements >= 16 ? 'fa-check text-success' : 'fa-exclamation-triangle text-danger on-hover-opaque'}}"></i>
            <span class="sort-data">{{$iPatient->number_of_days_with_remote_measurements ?: 0}}</span>
        </div>
    </td>

    <td>
        <div class="d-flex align-items-baseline">
            <i class="mr-1 text-sm fa {{$iPatient->rm_total_time_in_seconds_by_mcp >= 1200 ? 'fa-check text-success' : 'fa-exclamation-triangle text-danger on-hover-opaque'}}"></i>
            <span class="text-nowrap">{{round($iPatient->rm_total_time_in_seconds_by_mcp / 60)}}:{{round($iPatient->rm_total_time_in_seconds_by_mcp % 60)}}</span>
            <span class="sort-data d-none">{{$iPatient->rm_total_time_in_seconds_by_mcp}}</span>
        </div>
    </td>

    <td>
        <div class="d-flex align-items-baseline">
            <i class="mr-1 text-sm fa {{$iPatient->rm_total_time_in_seconds_by_rmm_pro >= 1200 ? 'fa-check text-success' : 'fa-exclamation-triangle text-danger on-hover-opaque'}}"></i>
            <span class="text-nowrap">{{round($iPatient->rm_total_time_in_seconds_by_rmm_pro / 60)}}:{{round($iPatient->rm_total_time_in_seconds_by_rmm_pro % 60)}}</span>
            <span class="sort-data d-none">{{$iPatient->rm_total_time_in_seconds_by_rmm_pro}}</span>
        </div>
    </td>

    <td>
        <div class="d-flex align-items-baseline">
            <i class="mr-1 text-sm fa {{$iPatient->rm_total_time_in_seconds >= 1200 ? 'fa-check text-success' : 'fa-exclamation-triangle text-danger on-hover-opaque'}}"></i>
            <span class="text-nowrap">{{round($iPatient->rm_total_time_in_seconds / 60)}}:{{round($iPatient->rm_total_time_in_seconds % 60)}}</span>
            <span class="sort-data d-none">{{$iPatient->rm_total_time_in_seconds}}</span>
        </div>
    </td>

    <td>
        @if($iPatient->is_billable_by_mcp)
            <span class="text-success">
                <i class="fa fa-check text-sm"></i>
            </span>
        @else
            <span class="text-danger font-weight-normal">No</span>
        @endif
    </td>
    <td>
        @if($iPatient->is_billable_by_rmm)
            <span class="text-success">
                <i class="fa fa-check text-sm"></i>
            </span>
        @else
            <span class="text-danger font-weight-normal">No</span>
        @endif
    </td>
    <td>
        @if($iPatient->is_99454_claimable)
            <span class="text-success">
                <i class="fa fa-check text-sm"></i>
            </span>
        @else
            <span class="text-danger font-weight-normal {{$iPatient->why_99454_not_claimable_reason ? 'font-underline c-pointer' : ''}}" title="{{$iPatient->why_99454_not_claimable_reason}}">No</span>
        @endif
    </td>
    <td>
        @if($iPatient->is_99454_claimed)
            <span class="text-success">
                <i class="fa fa-check text-sm"></i>
            </span>
        @else
            @if($iPatient->is_99454_claiming_waived)
                <span class="text-secondary font-weight-normal {{$iPatient->why_claiming_99454_waived ? 'font-underline c-pointer' : ''}}" title="{{$iPatient->why_claiming_99454_waived}}">Waived</span>
            @else
                <span class="text-danger font-weight-normal">No</span>
            @endif
        @endif
    </td>
    <td>
        @if($iPatient->is_99457_claimable)
            <span class="text-success">
                <i class="fa fa-check text-sm"></i>
            </span>
        @else
            <span class="text-danger font-weight-normal {{$iPatient->why_99457_not_claimable_reason ? 'font-underline c-pointer' : ''}}" title="{{$iPatient->why_99457_not_claimable_reason}}">No</span>
        @endif
    </td>
    <td>
        @if($iPatient->is_99457_claimed)
            <span class="text-success">
                <i class="fa fa-check text-sm"></i>
            </span>
        @else
            @if($iPatient->is_99457_claiming_waived)
                <span class="text-secondary font-weight-normal {{$iPatient->why_claiming_99457_waived ? 'font-underline c-pointer' : ''}}" title="{{$iPatient->why_claiming_99457_waived}}">Waived</span>
            @else
                <span class="text-danger font-weight-normal">No</span>
            @endif
        @endif
    </td>
    <td>
        @if($iPatient->is_99458_claimable)
            <span class="text-success">
                <i class="fa fa-check text-sm"></i>
            </span>
        @else
            <span class="text-danger font-weight-normal {{$iPatient->why_99458_not_claimable_reason ? 'font-underline c-pointer' : ''}}" title="{{$iPatient->why_99458_not_claimable_reason}}">No</span>
        @endif
    </td>
    <td>
        @if($iPatient->is_99458_claimed)
            <span class="text-success">
                <i class="fa fa-check text-sm"></i>
            </span>
        @else
            @if($iPatient->is_99458_claiming_waived)
                <span class="text-secondary font-weight-normal {{$iPatient->why_claiming_99458_waived ? 'font-underline c-pointer' : ''}}" title="{{$iPatient->why_claiming_99458_waived}}">Waived</span>
            @else
                <span class="text-danger font-weight-normal">No</span>
            @endif
        @endif
    </td>
</tr>
