@extends ('layouts.template')
@section('content')
<div class="p-3 mcp-theme-1">
    <div class="">
        @if(!@$hideTitle)
        <div class="d-flex align-items-center pb-2">
            <h4 class="font-weight-bold mb-0 mr-3">Review Requests</h4>
        </div>
        @endif
        <table class="table table-striped table-sm table-bordered">
            <thead class="bg-light">
                <tr>
                    <th class="border-0 text-secondary text-nowrap">Created At</th>
                    <th class="border-0 text-secondary text-nowrap">Chart #</th>
                    <th class="border-0 text-secondary text-nowrap">Patient</th>
                    <th class="border-0 text-secondary">Scoped Month Start Date</th>
                    <th class="border-0 text-secondary">Access Start Date</th>
                    <th class="border-0 text-secondary">Access End Date</th>
                    <th class="border-0 text-secondary">Pro</th>
                    <th class="border-0 text-secondary">Created By</th>
                    <th class="border-0 text-secondary">Is Active</th>
                    <th class="border-0 text-secondary">Status</th>
                </tr>
            </thead>
            <tbody>
                @foreach($reviewRequests as $rr)
                <tr>
                    <td class="text-nowrap">{{ friendly_date_time($rr->created_at) }}</td>
                    <td>
                    <a native target="_blank" href="{{route('patients.view.dashboard', $rr->client)}}">
						{{$rr->client->chart_number}}
					</a>
                    </td>
                    <td>
                    <a native target="_blank" href="{{route('patients.view.dashboard', $rr->client)}}">
						{{$rr->client->displayName()}}
					</a>
                    </td>
                    <td>{{ friendly_date($rr->scoped_month_start_date) }}</td>
                    <td>{{ friendly_date($rr->access_start_date) }}</td>
                    <td>{{ friendly_date($rr->access_end_date) }}</td>
                    <td>{{ $rr->pro->displayName() }}</td>
                    <td>{{ $rr->createdBySession->pro->displayName() }}</td>
                    <td>
                        @if($rr->is_active)
                        <span class="text-success mr-2">YES
                            @if($rr->reactivation_memo)
                            <i class="fas fa-info-circle text-muted" title="{{ $rr->reactivation_memo }}"></i>
                            @endif
                        </span>
                        @else
                        <span class="text-secondary mr-2">NO
                            @if($rr->deactivation_memo)
                            <i class="fas fa-info-circle text-muted" title="{{ $rr->deactivation_memo }}"></i>
                            @endif
                        </span>
                        @endif
                    </td>
                    <td>
                        <span class="mr-2">{{ $rr->status ?? '--' }}
                            @if($rr->status_memo )
                            <i class="fas fa-info-circle text-muted" title="{{ $rr->status_memo }}"></i>
                            @endif
                        </span>
                    </td>
                </tr>
                @endforeach
            </tbody>
        </table>
        <div class="p-3">
            {{$reviewRequests->withQueryString()->links()}}
        </div>
    </div>
</div>
@endsection