<tr data-client-uid="{{$iPatient->client_uid}}" data-care-month-uid="{{$iPatient->care_month_uid}}">
<td class="pl-2">{{ $loop->index + 1 }}</td>
    <td class="pl-2">
        <a href="/patients/view/{{ $iPatient->client_uid }}/care-months/view/{{$iPatient->care_month_uid}}" class="text-nowrap"
           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}}"
        ><span class="sort-data">{{ $iPatient->chart_number }}</span></a>
    </td>
    <td class="pl-2">
        <a href="/patients/view/{{ $iPatient->client_uid }}/care-months/view/{{$iPatient->care_month_uid}}" class="text-nowrap"
           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}}"
        ><span class="sort-data">{{ $iPatient->client_name }}</span></a>
    </td>

    <td>{{friendly_date($iPatient->dob)}}</td>
    <td>{!! $iPatient->is_client_enrolled_in_rm ? '<i class="fa fa-check text-success"></i>' : 'No' !!}</td>
    <td>{!! $iPatient->is_assigned_cellular_bp_device ? '<i class="fa fa-check text-success"></i>' : 'No' !!}</td>
    <td>{!! $iPatient->is_assigned_cellular_weight_scale_device ? '<i class="fa fa-check text-success"></i>' : 'No' !!}</td>
    <td>
        <div class="text-nowrap">
            <span class="sort-data">{{$iPatient->most_recent_cellular_bp_sbp_mm_hg ?: '-'}}</span>/{{$iPatient->most_recent_cellular_bp_dbp_mm_hg ?: '-'}}
            @if($iPatient->most_recent_cellular_bp_measurement_at)
                <span class="text-sm text-secondary text-nowrap ml-1"
                      title="{{friendly_date_time($iPatient->most_recent_cellular_bp_measurement_at)}}">({{friendly_date($iPatient->most_recent_cellular_bp_measurement_at)}})</span>
            @endif
        </div>
    </td>
    <td>
        <div class="text-nowrap">
            <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 ml-1"
                      title="{{friendly_date_time($iPatient->most_recent_cellular_weight_measurement_at)}}">({{friendly_date($iPatient->most_recent_cellular_weight_measurement_at)}})</span>
            @endif
        </div>
    </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'}}"></i>
            <span class="sort-data">{{$daysDiff !== -1 ? $daysDiff : '-'}}</span>
        </div>
    </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'}}"></i>
            <span>{{$iPatient->has_mcp_interacted_with_client_about_rm ? 'Yes' : 'No'}}</span>
        </div>
        {{--@if(!$iPatient->has_mcp_interacted_with_client_about_rm)
            <div class="text-sm font-italic text-secondary">{{$performerRole === 'MCP' ? 'Not' : "MCP hasn't"}} interacted this month!</div>
        @endif--}}
    </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'}}"></i>
            <span class="sort-data">{{$iPatient->number_of_days_with_remote_measurements ?: 0}}</span>
        </div>
        {{--@if($iPatient->number_of_days_with_remote_measurements < 16)
            <div class="text-sm font-italic text-secondary">Meas. days < 16</div>
        @endif--}}
    </td>
    <td>
        <div class="d-flex align-items-baseline">
            <span class="sort-data">{{$iPatient->rm_num_measurements_not_stamped_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_mcp >= 1200 ? 'fa-check text-success' : 'fa-exclamation-triangle text-danger'}}"></i>
            <span class="text-nowrap">{{round($iPatient->rm_total_time_in_seconds_by_mcp / 60)}}m {{round($iPatient->rm_total_time_in_seconds_by_mcp % 60)}}s</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'}}"></i>
            <span class="text-nowrap">{{round($iPatient->rm_total_time_in_seconds_by_rmm_pro / 60)}}m {{round($iPatient->rm_total_time_in_seconds_by_rmm_pro % 60)}}s</span>
            <span class="sort-data d-none">{{$iPatient->rm_total_time_in_seconds_by_rmm_pro}}</span>
        </div>
    </td>
    <td>{{$iPatient->mcp_pro_name}}</td>
    <td>{{$iPatient->rmm_pro_name}}</td>
    <td>
        @if($lastVisitWithinDays && $iPatient->has_mcp_interacted_with_client_about_rm && $iPatient->number_of_days_with_remote_measurements >= 16 && $iPatient->rm_total_time_in_seconds_by_mcp >= 1200)
            <span class="text-success font-weight-bold">
                <i class="fa fa-check"></i>
                Yes
            </span>
        @else
            <span class="text-danger font-weight-normal">
                Not yet
            </span>
        @endif
    </td>
    <td>
        @if($lastVisitWithinDays && $iPatient->has_mcp_interacted_with_client_about_rm && $iPatient->number_of_days_with_remote_measurements >= 16 && $iPatient->rm_total_time_in_seconds_by_rmm_pro >= 1200)
            <span class="text-success font-weight-bold">
                <i class="fa fa-check"></i>
                Yes
            </span>
        @else
            <span class="text-danger font-weight-normal">
                Not yet
            </span>
        @endif
    </td>
    <td>
        @if($iPatient->number_of_days_with_remote_measurements >= 16 && $lastVisitWithin90Days)
            <span class="text-success font-weight-bold">
                <i class="fa fa-check"></i>
                Yes
            </span>
        @else
            <span class="text-danger font-weight-normal">
                Not yet
            </span>
        @endif
    </td>
    <td>
        @if($iPatient->number_of_days_with_remote_measurements >= 16 && $iPatient->has_anyone_interacted_with_client_about_rm &&
            $lastVisitWithinDays &&
            ($iPatient->rm_total_time_in_seconds_by_mcp + $iPatient->rm_total_time_in_seconds_by_rmm_pro) >= 1200)
            <span class="text-success font-weight-bold">
                <i class="fa fa-check"></i>
                Yes
            </span>
        @else
            <span class="text-danger font-weight-normal">
                Not yet
            </span>
        @endif
    </td>
</tr>