@extends('layouts.admin') @section('title', 'Care Team') @php $roleLabels = [ 'clinic_admin' => 'Clinic Admin', 'pcp' => 'PCP', 'bhcm' => 'BHCM', 'psychiatrist' => 'Psychiatrist', 'billing_staff' => 'Billing Staff', 'practice_manager' => 'Practice Manager', 'clinical_support' => 'Clinical Support', 'front_desk' => 'Front Desk', ]; $canSendTestPush = request()->user()?->isClinicAdmin() || request()->user()?->isSuperAdmin(); @endphp @section('content')

Practice access

Care team directory

Invite clinical staff, monitor access status, and keep BHCM capacity aligned before assigning patients.

Patient onboarding
@if ($errors->any())
{{ $errors->first() }}
@endif @if (session('setup_link'))

One-time setup link

Email delivery is queued through the configured mailer. For local testing, use this link now; it will not be shown again.

@endif

Active accounts

{{ $metrics['active_staff'] }}

Accepted staff logins

BHCM accounts

{{ $metrics['bhcms'] }}

Available for assignment

Pending invites

{{ $metrics['pending_invites'] }}

Waiting for setup

Suspended accounts

{{ $metrics['suspended_staff'] }}

Cannot access portal

Invite staff member

The invited person creates their own password from a secure email link.

@csrf
BHCM accounts use the default capacity of {{ $defaultBhcmCaseload }} patients until a clinic admin updates the value after activation.

Care team members

Accepted staff accounts. Pending invitations appear below until setup is complete.

@forelse ($staff as $member) @php $panelText = null; if ($member->isPcp()) { $panelText = $member->pcp_patient_count.' PCP patients'; } elseif ($member->isBhcm()) { $panelText = $member->bhcm_patient_count.' BHCM patients'; } @endphp

{{ $member->name }}

{{ $member->email }}

{{ $roleLabels[$member->role] ?? $member->role }} @if ($member->status === 'active') Active @else Suspended @endif @if ($panelText) {{ $panelText }} @endif @if ($member->isBhcm()) {{ $member->max_caseload ?? $defaultBhcmCaseload }} capacity @endif @if ((int) $member->active_provider_device_count > 0) Push ready @else No push token @endif
@if ($canSendTestPush)
@csrf
@endif
@empty

No staff members have accepted an invitation for this practice yet.

@endforelse

Invitation history

These are invite records, not active users. A pending invite moves into the care team after the recipient accepts the setup link.

@forelse ($invitations as $invitation) @empty @endforelse
Email Role Status Invited by Expires
{{ $invitation->email }} {{ $roleLabels[$invitation->role] ?? $invitation->role }} @if ($invitation->isAccepted()) Accepted @elseif ($invitation->isExpired()) Expired @else Pending @endif {{ $invitation->invitedBy?->name ?? 'System' }} {{ \App\Support\UsFormat::date($invitation->expires_at) }}
No staff invitations yet.
@endsection