@extends ('layouts.patient')
@section('inner-content')
    <div class="">
        <div class="d-flex align-items-start pb-2">
            <h4 class="font-weight-bold m-0">Pros With Access</h4>
        </div>
        <table class="table table-striped table-sm table-bordered mb-0">
            @php $prosWithAccess = $patient->prosWithAccess(); @endphp
            @if($prosWithAccess && count($prosWithAccess))
                <thead>
                <tr>
                    <th class="px-2 text-secondary">Pro</th>
                    <th class="px-2 text-secondary w-75">Association</th>
                </tr>
                </thead>
                <tbody>
                @php $prevPro = ''; @endphp
                @foreach($prosWithAccess as $aPro)
                    <tr>
                        <td class="px-2 {{ $aPro['pro'] !== $prevPro ? 'font-weight-bold' : 'text-secondary' }}">{{ $aPro['pro'] }}</td>
                        <td class="px-2">{{ $aPro['association'] }}</td>
                        @php $prevPro = $aPro['pro']; @endphp
                    </tr>
                @endforeach
                </tbody>
            @else
                <tbody>
                    <tr>
                        <td class="text-secondary p-3">No pros (other than admin pros) have access to this patient</td>
                    </tr>
                </tbody>
            @endif
        </table>
    </div>
@endsection
