@extends ('layouts.patient')
@section('inner-content')
    <div>
        <div class="d-flex align-items-center pb-2">
            <h4 class="font-weight-bold m-0">SMS Numbers</h4>
            <span class="mx-2 text-secondary">|</span>
            <div moe relative>
                <a start show class="">+ Add New</a>
                <form url="/api/clientSmsNumber/create" class="mcp-theme-1">
                    <input type="hidden" name="clientUid" value="{{ $patient->uid }}">
                    <div class="mb-2">
                        <label for="" class="text-sm text-secondary mb-1">SMS Number</label>
                        <input type="text" class="form-control form-control-sm" name="smsNumber">
                    </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>
        </div>
        <table class="table table-striped table-sm table-bordered">
            <thead class="bg-light">
            <tr>
                <th class="border-0 text-secondary">Created</th>
                <th class="border-0 text-secondary w-75">Number</th>
                <th class="border-0 text-secondary">Actions</th>
            </tr>
            </thead>
            <tbody>
            @foreach($patient->smsNumbers as $number)
                <tr>
                    <td>{{ friendly_date_time($number->created_at) }}</td>
                    <td>{{ $number->sms_number }}</td>
                    <td>
                        <div class="d-flex align-items-center">
                            <div moe relative>
                                <a start show class="">Edit</a>
                                <form url="/api/clientSmsNumber/update" right class="mcp-theme-1">
                                    <input type="hidden" name="uid" value="{{ $number->uid }}">
                                    <div class="mb-2">
                                        <label for="" class="text-sm text-secondary mb-1">SMS Number</label>
                                        <input type="text" class="form-control form-control-sm" name="smsNumber" value="{{$number->sms_number}}">
                                    </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>
                        </div>
                    </td>
                </tr>
            @endforeach
            @if(!count($patient->smsNumbers))
                <tr>
                    <td colspan="3">No records found.</td>
                </tr>
            @endif
            </tbody>
        </table>
    </div>
@endsection
