@extends ('layouts/empty')

@section('content')
<div class="mcp-theme-1">
    <div class="card-body">

        <div class="mcp-theme-1">

            <div class="card">
                @if(!$hideTitle)
                <div class="card-header px-3 py-2 d-flex align-items-center">
                    <strong class="text-nowrap">
                        <i class="fas fa-clipboard"></i>
                        My Notes Flagged By Supervisor
                    </strong>
                </div>
                @endif
                <div class="card-body p-0">

                    <table class="table table-sm table-striped p-0 m-0">
                        <thead class="bg-light">
                            <tr>
                                <th class="border-0">Created At</th>
                                <th class="border-0">Effective Date</th>
                                <th class="border-0">Patient</th>
                                <th class="border-0">Ally Pro</th>
                                <th class="border-0">&nbsp;</th>
                            </tr>
                        </thead>
                        <tbody>
                            @foreach($flaggedNotes as $note)
                            <tr>
                                <td>{{ friendly_date_time($note->created_at, true) }}</td>
                                <td>
                                    <a native href="/patients/view/{{ $note->client->uid }}/notes/view/{{ $note->uid }}">
                                        {{ friendly_date_time($note->effective_dateest, false) }}
                                    </a>
                                </td>
                                <td>{{ $note->hcpPro ? $note->hcpPro->displayName() : '-' }}</td>
                                <td>{{ $note->allyPro ? $note->allyPro->displayName() : '-' }}</td>
                                <td>
                                    @if($note->isProPhysicianSupervisor($performer->pro->id))
                                        @if($note->is_stamped_by_supervising_physician)
                                        <div moe class="ml-2">
                                            <a href="#" start show class="text-danger"><i class="fas fa-stamp"></i> Undo Stamp</a>
                                            <form url="/api/note/undoStampAsSupervisingPhysician">
                                                <input type="hidden" name="uid" value="{{ $note->uid }}">
                                                <div class="mb-2">
                                                    <label>Are you sure?</label>
                                                </div>
                                                <div class="mt-3">
                                                    <button submit class="btn btn-sm btn-danger mr-2">Undo Stamp</button>
                                                    <button cancel class="btn btn-sm btn-default border">Cancel</button>
                                                </div>
                                            </form>
                                        </div>
                                        @else
                                        <div moe class="">
                                            <a href="#" start show class="text-success"><i class="fas fa-stamp"></i> Stamp Note</a>
                                            <form url="/api/note/stampAsSupervisingPhysician">
                                                <input type="hidden" name="uid" value="{{ $note->uid }}">
                                                <div class="mb-2">
                                                    <label>Are you sure?</label>
                                                    <textarea name="memo" class="form-control"></textarea>
                                                </div>
                                                <div class="mt-3">
                                                    <button submit class="btn btn-sm btn-success mr-2">Stamp Note</button>
                                                    <button cancel class="btn btn-sm btn-default border">Cancel</button>
                                                </div>
                                            </form>
                                        </div>
                                        @endif
                                    @endif
                                </td>
                            </tr>
                            @endforeach
                        </tbody>
                    </table>
                </div>
            </div>

        </div>
    </div>
</div>
@endsection