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

        <div class="card-header px-2 py-1 hide-inside-popup border-bottom-0">
            <strong class="mr-4">
                <i class="fas fa-box"></i>
                Unsigned Incoming Reports
            </strong>
        </div>

        <div class="card-body p-0 border-top-0 pb-0">

            <table class="table table-sm table-striped mb-0">
                <thead class="bg-light">
                <tr>
                    <th class="border-0 text-secondary">Created</th>
                    <th class="border-0 text-secondary">Patient</th>
                    <th class="border-0 text-secondary">Title</th>
                    <th class="border-0 text-secondary">Report Date</th>
                    <th class="border-0 text-secondary">Sign</th>
                    <th class="border-0 text-secondary">Category</th>
                </tr>
                </thead>
                <tbody>
                @foreach($records as $document)
                    <tr class="{{$document->is_entry_error ? 'entry-error' : ''}} {{@$currentReport->uid === $document->uid ? 'bg-aliceblue' : ''}}">
                        <td>
                            {{ friendly_date_time($document->created_at, false) }}
                            @if(request()->input('noteUid') && $document->note && $document->note->uid === request()->input('noteUid'))
                                <div class="mt-1 text-info text-sm">Created on this note</div>
                            @endif
                        </td>
                        <td>
                            <a href="{{route('patients.view.dashboard', ['patient' => $document->client])}}">
                                {{$document->client->displayName()}}
                            </a>
                        </td>
                        <td>
                            <a open-in-stag-popup
                               popup-style="stag-popup-md overflow-visible"
                               mc-initer="incoming-reports"
                               title="Incoming Report: {{ $document->title ? $document->title : '(not set)' }}"
                               href="{{route('patients.view.incoming-reports', ['patient' => $document->client, 'currentReport' => $document])}}?noteUid={{request()->input('noteUid') ?: ''}}&documentViewFromNote=1"
                               class="{{@$currentReport->uid === $document->uid ? 'font-weight-bold' : ''}}">
                                {{ $document->title ? $document->title : '(not set)' }}
                            </a>
                        </td>
                        <td>{{ friendly_date_time($document->report_date, false) }}</td>
                        <td>
                            @if(!$document->has_hcp_pro_signed)
                                -
                            @else
                                <div class="text-success mb-1">
                                    <i class="fa fa-check"></i>
                                    Signed
                                </div>
                                @if($document->hcp)
                                    <div class="text-secondary">
                                        <div class="text-sm font-weight-bold">{{$document->hcp->displayName()}}</div>
                                        <div class="text-sm">{{friendlier_date_time($document->hcp_pro_signed_at)}}</div>
                                    </div>
                                @endif
                            @endif
                        </td>
                        <td>{{ $document->category }}{{ $document->subcategory ? ' / ' . $document->subcategory : '' }}</td>
                    </tr>
                @endforeach
                @if(!count($records))
                    <tr>
                        <td colspan="6">No records found.</td>
                    </tr>
                @endif
                </tbody>
            </table>

        </div>
    </div>
</div>
