@extends('layouts.admin') @section('title', 'Practice Activation') @section('content')
@php $countFor = fn (array $statuses): int => collect($statuses)->sum(fn (string $status): int => (int) ($statusCounts[$status] ?? 0)); $reviewQueueCount = $countFor(['pending_review', 'needs_information']); $onboardingCount = $countFor(['verified', 'onboarding', 'ready_for_approval']); $activeCount = $countFor(['active', 'approved']); $blockedCount = $countFor(['suspended', 'rejected', 'deactivated']); $totalCount = (int) $statusCounts->sum(); $stageLabels = [ 'all' => ['All', $totalCount], 'review' => ['Review', $reviewQueueCount], 'onboarding' => ['Onboarding', $onboardingCount], 'active' => ['Active', $activeCount], 'blocked' => ['Blocked', $blockedCount], ]; $statusLabels = [ 'pending_review' => 'Pending review', 'needs_information' => 'Needs information', 'verified' => 'Verified', 'onboarding' => 'Onboarding', 'ready_for_approval' => 'Ready for approval', 'approved' => 'Approved', 'active' => 'Active', 'rejected' => 'Rejected', 'suspended' => 'Suspended', 'deactivated' => 'Deactivated', ]; $statusPill = function (string $status): string { return match (true) { in_array($status, ['active', 'approved'], true) => 'status-pill-good', in_array($status, ['pending_review', 'needs_information', 'verified', 'onboarding', 'ready_for_approval'], true) => 'status-pill-warning', default => 'status-pill-critical', }; }; $nextAction = function ($tenant): string { if ($tenant->status === 'pending_review') { return 'Review registration'; } if ($tenant->status === 'needs_information') { return 'Await requested info'; } if ($tenant->status === 'verified' && (int) $tenant->active_clinic_admins_count === 0 && (int) $tenant->pending_clinic_admin_invites_count === 0) { return 'Invite Clinic Admin'; } if (! $tenant->baa_executed_at) { return 'Verify BAA'; } if (! $tenant->esign_compliance_verified_at) { return 'Verify eSign docs'; } if ($tenant->status === 'ready_for_approval') { return 'Activate practice'; } if ($tenant->isActive()) { return 'Workspace active'; } return 'Continue onboarding'; }; @endphp

SuperAdmin activation

Practice Activation Hub

Triage registrations, compliance evidence, Clinic Admin setup, and final activation from one focused queue.

{{ $totalCount }} practices

Review queue

Now

{{ $reviewQueueCount }}

Onboarding

{{ $onboardingCount }}

Active

{{ $activeCount }}

Blocked

{{ $blockedCount }}

@if ($stage !== 'all') @endif
@if ($search !== '' || $stage !== 'all') Reset @endif

Practice review queue

{{ $tenants->count() }} result{{ $tenants->count() === 1 ? '' : 's' }} shown. Open a practice to verify registration, review BAA evidence, and decide activation.

{{ $stageLabels[$stage][0] ?? 'All' }}
@forelse ($tenants as $tenant) @empty @endforelse
Practice Stage Readiness Next action Submitted

{{ $tenant->name }}

{{ $tenant->primary_contact_email ?: 'No contact email' }}

{{ $tenant->operational_timezone ?: 'Timezone not set' }}

{{ $statusLabels[$tenant->status] ?? ucfirst(str_replace('_', ' ', $tenant->status)) }}

{{ ucfirst(str_replace('_', ' ', $tenant->onboarding_status ?? 'registration_submitted')) }}

BAA eSign Admin {{ (int) $tenant->active_clinic_admins_count > 0 ? 'active' : ((int) $tenant->pending_clinic_admin_invites_count > 0 ? 'invited' : 'needed') }}

{{ (int) $tenant->verified_compliance_documents_count }} verified docs @if ((int) $tenant->open_information_requests_count > 0) ยท {{ (int) $tenant->open_information_requests_count }} info request{{ (int) $tenant->open_information_requests_count === 1 ? '' : 's' }} @endif

{{ $nextAction($tenant) }}

{{ $tenant->isComplianceVerified() ? 'Compliance complete' : 'Compliance incomplete' }}

{{ \App\Support\UsFormat::date($tenant->created_at) }} Review
No practices match this view.
@endsection