@extends ('layouts.patient')
@section('inner-content')
    <div class="">
        <div class="d-flex align-items-center pb-2">
            <h4 class="font-weight-bold m-0">Pros With Access</h4>
            <div class="d-inline ml-2">
                <div moe>
                    <a href="" show start>Add Client Pro Access</a>
                    <form action="" url="/api/clientProAccess/create">
                        <input type="hidden" value="{{$patient->uid}}" name="clientUid">
                        <div class="form-group">
                            <label for="" class="control-label">Pro</label>
                            <select provider-search name="proUid" id="" class="form-control input-sm">
                            </select>
                        </div>
                        <div class="form-group">
                            <label for="" class="control-label">Reason category</label>
                            <input type="text" name="reasonCategory" class="form-control input-sm">
                        </div>
                        <div class="form-group">
                            <label for="" class="control-label">Reason memo</label>
                            <textarea name="reasonMemo" class="form-control input-sm"></textarea>
                        </div>
                        <div class="form-group">
                            <button class="btn btn-primary btn-sm" submit>Submit</button>
                            <button class="btn btn-danger btn-sm" cancel>Cancel</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
        <table class="table table-striped table-sm table-bordered mb-0">
            @if($rows && count($rows))
                <thead class="bg-light">
                <tr>
                    <th class="border-0 text-secondary">Pro</th>
                    <th class="border-0 text-secondary">Reason category</th>
                    <th class="border-0 text-secondary">Reason memo</th>
                    <th></th>
                </tr>
                </thead>
                <tbody>
                @foreach($rows as $row)
                    <tr>
                        <td class="">{{ @$row->pro->name_display }}</td>
                        <td>{{ $row->reason_category}}</td>
                        <td>{{ $row->reason_memo}}</td>
                        <td>
                            <div moe>
                                <a href="" show start>Update Reason</a>
                                <form action="" url="/api/clientProAccess/updateReason">
                                    <input type="hidden" value="{{$row->uid}}" name="uid">

                                    <div class="form-group">
                                        <label for="" class="control-label">Reason category</label>
                                        <input type="text" name="reasonCategory" class="form-control input-sm" value="{{$row->reason_category}}">
                                    </div>
                                    <div class="form-group">
                                        <label for="" class="control-label">Reason memo</label>
                                        <textarea name="reasonMemo" class="form-control input-sm">{{$row->reason_memo}}</textarea>
                                    </div>
                                    <div class="form-group">
                                        <button class="btn btn-primary btn-sm" submit>Submit</button>
                                        <button class="btn btn-danger btn-sm" cancel>Cancel</button>
                                    </div>
                                </form>
                            </div>
                        </td>
                    </tr>
                @endforeach
                </tbody>
            @else
                <tbody>
                    <tr>
                        <td class="text-secondary p-3">No client pro access records.</td>
                    </tr>
                </tbody>
            @endif
        </table>
    </div>
@endsection
