@extends ('layouts/template')

@section('content')

    <div class="p-3 mcp-theme-1">
    <div class="card">

        <div class="card-header px-3 py-2 d-flex align-items-center">
            <strong class="mr-4">
                <i class="fas fa-user-injured"></i>
                Unmapped SMS
            </strong>
            {{--<select class="ml-auto max-width-300px form-control form-control-sm" onchange="fastLoad('/patients/' + this.value, true, false, false)">
                <option value="" {{ $filter === '' ? 'selected' : '' }}>All patients</option>
                <option value="not-yet-seen" {{ $filter === 'not-yet-seen' ? 'selected' : '' }}>Patients I have not seen yet</option>
            </select>--}}
        </div>
        <div class="card-body p-0">
            <table class="table table-condensed p-0 m-0">
                <thead class="bg-light">
                <tr>
                    <th class="px-3 border-0 w-25">Date &amp; Time</th>
                    <th class="border-0">From</th>
                    <th class="border-0 w-50">Content</th>
                    <th class="border-0 w-25">&nbsp;</th>
                </tr>
                </thead>
                <tbody>
                @foreach($unmappedSMS as $sms)
                    <tr>
                        <td class="px-3">{{ friendly_date_time($sms->created_at, true) }}</td>
                        <td>{{ $sms->from_number }}</td>
                        <td>{{ $sms->body }}</td>
                        <td>
                            <div moe>
                                <a start show>Map to Client</a>
                                <form url="/api/clientSms/assignIncomingSmsToClient">
                                    <input type="hidden" name="uid" value="{{$sms->uid}}">
                                    <div class="form-group mb-2">
                                        <label for="" class="text-secondary text-sm mb-1">Client</label>
                                        <select name="clientUid" class="form-control form-control-sm">
                                            <option value=""> --select-- </option>
                                            @foreach($patients as $patient)
                                                <option value="{{$patient->uid}}">{{$patient->displayName()}}</option>
                                            @endforeach
                                        </select>
                                    </div>
                                    <div class="form-group m-0">
                                        <button submit class="btn btn-primary btn-sm">submit</button>
                                    </div>
                                </form>
                            </div>
                        </td>
                    </tr>
                @endforeach
                </tbody>
            </table>
        </div>
    </div>
    </div>

@endsection
