@extends ('layouts/template')

@section('content')

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

        <div class="d-flex align-items-baseline pb-3">
            <h2 class="font-size-16 font-weight-bold m-0">Picked Notes</h2>
            <a class="ml-auto" href="{{route('practice-management.process-notes')}}">Process Notes ({{$counts['unpicked']}})</a>
        </div>

        <div class="card">

            <div class="card-body p-0">

                <table class="table table-sm table-condensed table-striped p-0 m-0">
                    <thead class="bg-light">
                    <tr>
                        <th class="border-0">Effective Date</th>
                        <th class="border-0">Patient</th>
                        <th class="border-0 w-50">Picked Up By</th>
                        <th class="border-0"></th>
                    </tr>
                    </thead>
                    <tbody>
                    @foreach ($notes as $note)
                        <tr class="{{ $note->is_cancelled ? 'cancelled-item always-clickable' : '' }}">
                            <td class="">
                                <a href="/patients/view/{{ $note->client->uid }}/notes/view/{{ $note->uid }}" class="font-weight-bold text-nowrap">
                                    {{ friendly_date_time($note->effective_dateest, false) }}
                                </a>
                                <span class="ml-1">{{ $note->is_cancelled ? '[cancelled]' : '' }}</span>
                            </td>
                            <td class="">
                                <a href="/patients/view/{{ $note->client->uid }}" class="text-nowrap">{{ $note->client->displayName() }}</a>
                            </td>
                            <td class="text-nowrap">
                                @if(@$note->currentNotePickupForProcessing->pro)
                                    <b>{{ $note->currentNotePickupForProcessing->pro->displayName()}}</b>
                                    <span class="text-sm mx-1">at</span>
                                    <span class="text-secondary">{{ friendlier_date_time($note->currentNotePickupForProcessing->created_at)}}</span>
                                @else
                                -
                                @endif
                            </td>
                            <td class="">
                                <a native target="_blank"
                                   open-in-stag-popup
                                   update-parent
                                   mc-initer="note-single"
                                   title="Note Details"
                                   href="/patients/view/{{ $note->client->uid }}/notes/view/{{ $note->uid }}">
                                    View
                                </a>
                            </td>
                        </tr>
                    @endforeach
                    </tbody>
                </table>
            </div>
        </div>
        <div class="mt-3">
            {{$notes->links()}}
        </div>
    </div>

@endsection
