@extends ('layouts.patient')

@section('inner-content')
    <div class="">
        <div class="d-flex align-items-center pb-2">
            <h4 class="font-weight-bold m-0">Care Team</h4>
            <span class="mx-2 text-secondary">|</span>
            <div moe>
                <a start show class="">Add</a>
                <form url="/api/clientInfoLine/create">
                    <input type="hidden" name="clientUid" value="{{ $patient->uid }}">
                    <input type="hidden" name="category" value="care_team">
                    <div class="mb-2"><input type="text" class="form-control form-control-sm" name="contentText" value="" placeholder="Name"></div>
                    <div class="mb-2"><input type="text" class="form-control form-control-sm" name="Specialty" value="" placeholder="Specialty"></div>
                    <div class="mb-2"><input type="text" class="form-control form-control-sm" name="Organization" value="" placeholder="Organization"></div>
                    <div class="mb-2"><input type="text" class="form-control form-control-sm" name="Phone" value="" placeholder="Phone"></div>
                    <div class="mb-2"><input type="text" class="form-control form-control-sm" name="Fax" value="" placeholder="Fax"></div>
                    <div class="mb-2"><input type="date" class="form-control form-control-sm" name="Next Appointment" value="" placeholder="Next Appointment"></div>
                    <div class="mb-2"><input type="text" class="form-control form-control-sm" name="Memo" value="" placeholder="Memo"></div>
                    <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>
        </div>
        <table class="table table-striped table-sm table-bordered">
            <thead>
            <tr>
                <th class="px-2 text-secondary">Name</th>
                <th class="px-2 text-secondary">Specialty</th>
                <th class="px-2 text-secondary">Organization</th>
                <th class="px-2 text-secondary">Phone</th>
                <th class="px-2 text-secondary">Fax</th>
                <th class="px-2 text-secondary">Next Appointment</th>
                <th class="px-2 text-secondary">Memo</th>
                <th class="px-2 text-secondary">Created By</th>
                <th class="px-2 text-secondary">Created At</th>
                <th class="px-2 text-secondary delete-column">&nbsp;</th>
            </tr>
            </thead>
            <tbody>
            @foreach($infoLines as $line)
                <tr>
                    <td class="px-2">{{$line->content_text}}</td>
                    <td class="px-2">{{ $line->contentDetail()->{"Specialty"} }}</td>
                    <td class="px-2">{{ $line->contentDetail()->{"Organization"} }}</td>
                    <td class="px-2">{{ $line->contentDetail()->{"Phone"} }}</td>
                    <td class="px-2">{{ $line->contentDetail()->{"Fax"} }}</td>
                    <td class="px-2">{{ $line->contentDetail()->{"Next Appointment"} }}</td>
                    <td class="px-2">{{ $line->contentDetail()->{"Memo"} }}</td>
                    <td class="px-2">{{$line->createdBySession && $line->createdBySession->pro ? $line->createdBySession->pro->displayName() : '-'}}</td>
                    <td class="px-2">{{ friendly_date_time($line->created_at) }}</td>
                    <td class="px-2 text-center delete-column">
                        <div moe relative>
                            <a start show class="on-hover-opaque"><i class="fa fa-trash-alt text-danger"></i></a>
                            <form url="/api/clientInfoLine/remove" right>
                                <input type="hidden" name="uid" value="{{ $line->uid }}">
                                <p class="small">Are you sure you want to delete this entry?</p>
                                <div class="d-flex align-items-center">
                                    <button class="btn btn-sm btn-danger mr-2" submit>Delete</button>
                                    <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
                                </div>
                            </form>
                        </div>
                    </td>
                </tr>
            @endforeach
            </tbody>
        </table>
    </div>
@endsection
