<div class="pb-3 mb-2 border-bottom">
    <div class="d-flex align-items-center mb-2 pt-2">
        <h6 class="my-0 font-weight-bold">RPM: {{friendly_month($careMonth->start_date)}}</h6>
        <span class="mx-2 text-secondary">|</span>
        <a href="/patients/view/{{ $patient->uid }}/care-months/view/{{ $careMonth->uid }}">View</a>
    </div>
    <div class="mt-2">
        <?php $daysDiff = -1; ?>
        @if($patient->most_recent_completed_mcp_note_date)
            <?php
            $careMonthLastDay = date_add(date_create($careMonth->start_date), 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($patient->most_recent_completed_mcp_note_date))->days;
            ?>
        @endif
        <span class="font-weight-bold text-secondary">Last Visit:</span>
        <b class="{{$daysDiff === -1 ? 'text-secondary' : ($daysDiff <= config('app.maxDaysSinceLastVisit') ? 'text-success' : 'text-warning-mellow')}}">
            {{friendly_date($patient->most_recent_completed_mcp_note_date)}}
            @if($daysDiff !== -1)
                @if($daysDiff > config('app.maxDaysSinceLastVisit'))
                    <i class="fa fa-exclamation-triangle"></i>
                    <span class="ml-1 text-secondary text-sm font-weight-normal">({{$daysDiff}} days ago)</span>
                @else
                    <i class="fa fa-check"></i>
                @endif
            @endif
        </b>
    </div>

    <div class="mt-2">
        <span class="font-weight-bold text-secondary">Days with meas.:</span>
        <b class="{{$careMonth->number_of_days_with_remote_measurements >= 16 ? 'text-success' : 'text-warning-mellow'}}">
            {{$careMonth->number_of_days_with_remote_measurements}}
            @if($careMonth->number_of_days_with_remote_measurements >= 16)
                <i class="fa fa-check"></i>
            @else
                <i class="fa fa-exclamation-triangle"></i>
            @endif
            <span class="ml-1 text-secondary text-sm font-weight-normal">(16 needed)</span>
        </b>
        @if($careMonth->number_of_days_with_remote_measurements < 16)
            <div moe relative class="ml-2">
                <a href="#" start show class="text-sm">SMS Patient</a>
                <form url="/api/clientSms/createOutgoing" right="" class="mcp-theme-1" noreload="" style="display: none;">
                    <input type="hidden" name="uid" value="{{ $patient->uid }}">
                    <div class="mb-2">
                        <label for="" class="text-sm text-secondary mb-1">Cell Number</label>
                        <input type="text" class="form-control form-control-sm" name="cellNumber" value="{{$patient->cell_number}}">
                    </div>
                    <div class="mb-2">
                        <label for="" class="text-sm text-secondary mb-1">Message</label>
                        <textarea rows="5" class="form-control form-control-sm" name="message">Hi! This is {{$pro->displayName(true)}}, from Cardio 1st. Please check your blood pressure.</textarea>
                    </div>
                    <div class="d-flex align-items-center">
                        <button class="btn btn-sm btn-primary mr-2" submit="">Send</button>
                        <button class="btn btn-sm btn-default mr-2 border" cancel="">Cancel</button>
                    </div>
                </form>
            </div>
        @endif
    </div>
    @if($careMonth->showMeasurementDaysWarning())
        <div class="alert alert-warning p-2 mt-1">
            Need <b>{{16 - $careMonth->number_of_days_with_remote_measurements}} more days</b> with measurements before RM becomes billable.
        </div>
    @endif

    <div class="mt-2">
        <?php $spoken = $careMonth->has_anyone_interacted_with_client_about_rm_outside_note; ?>
        <span class="font-weight-bold text-secondary">MCP spoke to patient:</span>
        <b class="{{$spoken ? 'text-success' : 'text-warning-mellow'}}">
            {{$spoken ? 'Yes' : 'No'}}
            @if(!$spoken)
                <i class="fa fa-exclamation-triangle"></i>
            @else
                <i class="fa fa-check"></i>
            @endif
        </b>
        @if($careMonth->mcp && $pro->id === $careMonth->mcp->id)
            <div moe relative class="ml-2">
                <a href="#" start show class="text-sm">Toggle</a>
                <form url="/api/careMonth/setHasAnyoneInteractedWithClientAboutRmOutsideNoteTo{{$spoken ? 'False' : 'True'}}" right>
                    <input type="hidden" name="uid" value="{{$careMonth->uid}}">
                    <p>Set to {{$spoken ? 'No' : 'Yes'}}?</p>
                    <div class="d-flex align-items-center">
                        <button class="btn btn-sm btn-primary mr-2" submit>Save</button>
                        <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
                    </div>
                </form>
            </div>
        @endif
    </div>
</div>