@php 
    $reportsPendingAck = $performer->pro->reportsPendingAckRecordsAsRd();
@endphp 
<div class="p-3" id="patients-list">
    <div class="card">
        <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">Patient</th>
                        <th class="border-0">Title</th>
                        <th class="border-0">Category</th>
                        <th class="border-0">Report Date</th>
                        <th class="border-0">Sign</th>
                        <th class="border-0"></th>
                    </tr>
                </thead>
                <tbody>
                    @foreach($reportsPendingAck as $report)
                    <tr class="{{$report->is_entry_error ? 'entry-error' : ''}}">
                        <td class="border-bottom-0">{{$report->client->displayName()}}</td>
                        <td>
                            <a native target="_blank" href="{{route('patients.view.incoming-reports', ['patient' => $report->client, 'currentReport' => $report])}}" class="{{@$currentReport->uid === $report->uid ? 'font-weight-bold' : ''}}">
                                {{ $report->title ? $report->title : '(not set)' }}
                            </a>
                        </td>
                        <td>{{ $report->category }}{{ $report->subcategory ? ' / ' . $report->subcategory : '' }}</td>
                        <td>{{ friendly_date_time($report->report_date, false) }}</td>
                        <td>
                            @if(!$report->has_hcp_pro_signed)
                            -
                            @else
                            <div class="text-success mb-1">
                                <i class="fa fa-check"></i>
                                Signed
                            </div>
                            @if($report->hcp)
                            <div class="text-secondary">
                                <div class="text-sm font-weight-bold">{{$report->hcp->displayName()}}</div>
                                <div class="text-sm">{{friendlier_date_time($report->hcp_pro_signed_at)}}</div>
                            </div>
                            @endif
                            @endif
                        </td>
                        <td>
                            @if(!$report->has_na_pro_signed)
                            <div moe relative class="ml-auto">
                                <form show url="/api/incomingReport/signAsNaPro">
                                    <input type="hidden" name="uid" value="{{ $report->uid }}">
                                    <button submit class="bg-transparent border-0 p-0 text-primary">Ack.</button>
                                </form>
                            </div>
                            @endif
                        </td>
                    </tr>
                    @endforeach

                    @if(count($reportsPendingAck) === 0)
                    <tr>
                        <td colspan="6">No records found!</td>
                    </tr>
                    @endif
                </tbody>

            </table>
            @if($reportsPendingAck->hasPages())
                <div class="ml-2 mt-2">
                    {{ $reportsPendingAck->appends(request()->input())->links() }}
                </div>
            @endif
        </div>
    </div>
</div>