@if(!$incomingSmsMessagesPendingReply || !count($incomingSmsMessagesPendingReply))
    <div class="p-2">No messages</div>
@else
    <table class="table table-sm m-0">
        <tbody>
        @foreach($incomingSmsMessagesPendingReply as $msg)
            <tr discardable-container>
                <td class="px-1">
                    <a href="{{route('patients.view.sms', $msg->client_uid)}}">
                        {{$msg->client_name_first}} {{$msg->client_name_last}}
                    </a>
                    <a class="text-sm text-nowrap d-block"
                       href="/messages-thread/{{$msg->client_uid}}"
                       native target="_blank"
                       open-in-stag-popup
                       popup-style="tall"
                       title="Messages for {{$msg->client_name_first}} {{$msg->client_name_last}}">
                        {{friendlier_date_time($msg->created_at)}}
                    </a>
                </td>
                <td class="px-1 w-75 text-left">
                    {{$msg->body}}
                </td>
                <td class="width-70px px-2 text-right">
                    @if($msg->is_reply_needed == 'YES')
                        <div>
                            <form url="/api/clientSms/updateIsReplyNeeded" class="mcp-theme-1" discardable>
                                <input type="hidden" name="uid" value="{{ $msg->uid }}">
                                <input type="hidden" name="isReplyNeeded" value="NO">
                                <button submit class="bg-transparent border-0 p-0 text-primary">Ack.</button>
                            </form>
                        </div>
                    @endif
                </td>
            </tr>
        @endforeach
        </tbody>
    </table>
@endif
