@extends('layouts.practice-onboarding') @section('title', 'Practice Onboarding') @section('content') @php $statusClasses = [ 'action_required' => 'status-pill-warning', 'pending' => 'status-pill-warning', 'under_review' => 'status-pill-neutral', 'completed' => 'status-pill-good', 'rejected' => 'status-pill-critical', 'locked' => 'status-pill-neutral', 'not_applicable' => 'status-pill-neutral', ]; $categoryLabels = [ 'registration' => 'Registration', 'access' => 'Access', 'compliance' => 'Compliance', 'practice_setup' => 'Practice Setup', 'clinical_setup' => 'Clinical Setup', 'integration' => 'Integration', 'billing' => 'Billing', 'patient_access' => 'Patient Access', 'activation' => 'Activation', ]; $documentStatusClasses = [ 'under_review' => 'status-pill-neutral', 'verified' => 'status-pill-good', 'rejected' => 'status-pill-critical', 'superseded' => 'status-pill-neutral', ]; $setupStatus = fn (string $key): string => $setupTaskStatuses->get($key)?->status ?? 'action_required'; $setupStatusLabel = fn (string $key): string => ucfirst(str_replace('_', ' ', $setupStatus($key))); $setupStatusClass = fn (string $key): string => $statusClasses[$setupStatus($key)] ?? 'status-pill-neutral'; $locationIntake = data_get($tenant->public_signup_intake, 'location', []); $commonTimezones = [ 'America/New_York' => 'Eastern', 'America/Chicago' => 'Central', 'America/Denver' => 'Mountain', 'America/Los_Angeles' => 'Pacific', 'America/Phoenix' => 'Arizona', 'America/Anchorage' => 'Alaska', 'Pacific/Honolulu' => 'Hawaii', 'UTC' => 'UTC', ]; if ($tenant->operational_timezone && ! array_key_exists($tenant->operational_timezone, $commonTimezones)) { $commonTimezones = [$tenant->operational_timezone => $tenant->operational_timezone] + $commonTimezones; } $psychiatricStatusLabels = [ 'internal' => 'Internal consultant', 'external' => 'External consultant', 'needs_assistance' => 'Need Meduvo assistance', 'not_required' => 'Not required', ]; $ehrStatusLabels = [ 'not_started' => 'Not started', 'planning' => 'Planning', 'authorization_submitted' => 'Authorization submitted', 'not_needed' => 'Not needed', ]; $consentDeliveryLabels = [ 'verbal' => 'Verbal', 'written' => 'Written', 'esign' => 'e-sign', 'verbal_and_written' => 'Verbal + written', ]; $currentUser = auth()->user(); $canManagePracticeProfile = $currentUser?->canManagePracticeProfile() ?? false; $canManagePracticeLocations = $currentUser?->canManagePracticeLocations() ?? false; $canManageClinicalSetup = $currentUser?->canManageClinicalSetup() ?? false; $canInvitePracticeStaff = $currentUser?->canInvitePracticeStaff() ?? false; $canManageIntegrationSetup = $currentUser?->canManageIntegrationSetup() ?? false; $canManageBillingSetup = $currentUser?->canManageBillingSetup() ?? false; $canManageConsentConfiguration = $currentUser?->canManageConsentConfiguration() ?? false; $canManageComplianceDocuments = $currentUser?->canManageComplianceDocuments() ?? false; $progressTotal = max((int) $progress['total'], 0); $progressDone = max((int) $progress['done'], 0); $progressRemaining = max($progressTotal - $progressDone, 0); $progressPercentage = min(100, max(0, (int) $progress['percentage'])); $taskCounts = collect($progress['counts'] ?? []); $progressSegments = [ ['label' => 'Complete', 'count' => $progressDone, 'class' => 'bg-status-good'], ['label' => 'In review', 'count' => (int) $taskCounts->get('under_review', 0), 'class' => 'bg-accent'], ['label' => 'Needs work', 'count' => (int) $taskCounts->get('action_required', 0) + (int) $taskCounts->get('rejected', 0), 'class' => 'bg-status-critical'], ['label' => 'Pending', 'count' => (int) $taskCounts->get('pending', 0), 'class' => 'bg-status-warning'], ['label' => 'Locked', 'count' => (int) $taskCounts->get('locked', 0), 'class' => 'bg-ink-muted'], ]; $onboardingTabs = [ 'profile' => ['label' => 'Profile', 'status' => $setupStatusLabel('practice_profile')], 'locations' => ['label' => 'Locations', 'status' => $setupStatusLabel('locations')], 'team' => ['label' => 'Team', 'status' => $setupStatusLabel('clinical_team')], 'configuration' => ['label' => 'Configuration', 'status' => 'Setup'], 'documents' => ['label' => 'Documents', 'status' => $requirements->count().' required'], 'tasks' => ['label' => 'Tasks', 'status' => $progressDone.'/'.$progressTotal], ]; $tabPanelClass = 'mt-5 rounded-lg border border-accent/15 bg-[linear-gradient(135deg,rgba(255,255,255,0.97),rgba(233,238,247,0.92)_48%,rgba(255,241,233,0.88))] p-5 shadow-[inset_0_1px_0_rgba(255,255,255,0.98),0_1px_2px_rgba(11,39,84,0.08),0_28px_78px_-46px_rgba(11,39,84,0.82),0_0_42px_-30px_rgba(255,122,53,0.72)] backdrop-blur-xl sm:p-6'; $tabHeaderClass = 'mb-5 flex flex-col gap-3 border-b border-accent/10 pb-4 sm:flex-row sm:items-start sm:justify-between'; $contentCardClass = 'rounded-lg border border-accent/10 bg-white/[0.84] p-4 shadow-[inset_0_1px_0_rgba(255,255,255,0.88),0_14px_34px_-28px_rgba(11,39,84,0.54)]'; $rowCardClass = 'rounded-lg border border-accent/10 bg-white/[0.84] px-4 py-3 shadow-[inset_0_1px_0_rgba(255,255,255,0.86),0_12px_30px_-26px_rgba(11,39,84,0.52)]'; $emptyStateClass = 'rounded-lg border border-accent/10 bg-accent-muted/60 px-3 py-3 text-sm text-ink-secondary shadow-sm'; @endphp
@if ($errors->any())
{{ $errors->first() }}
@endif @if (session('setup_link'))
Secure setup link: {{ session('setup_link') }}
@endif

Practice onboarding

{{ $tenant->name }}

Complete setup items here while Meduvo verifies compliance and prepares activation.

Progress

{{ $progress['percentage'] }}%

Done

{{ $progress['done'] }}

Open

{{ $blockers->count() }}

{{ $progressPercentage }}%

Complete

Onboarding readiness

Track setup work, review status, and remaining activation items in one place.

Done

{{ $progressDone }}

Left

{{ $progressRemaining }}

Blocked

{{ $blockers->count() }}

@if ($progressTotal > 0) @foreach ($progressSegments as $segment) @if ($segment['count'] > 0)
@endif @endforeach @endif
@foreach ($progressSegments as $segment) @if ($segment['count'] > 0) {{ $segment['label'] }} {{ $segment['count'] }} @endif @endforeach

Practice profile

Registration details and primary implementation contact.

{{ $setupStatusLabel('practice_profile') }}
@if ($canManagePracticeProfile)
@csrf
@else

Your role can view this section but cannot edit practice profile details.

@endif

Practice locations

Service addresses and launch phone/fax details.

{{ $setupStatusLabel('locations') }}
@if ($practiceLocations->isNotEmpty())
@foreach ($practiceLocations as $location)

{{ $location->name }}

@if ($location->is_primary) Primary @endif

{{ $location->formattedAddress() }}

@if ($location->phone || $location->fax)

@if ($location->phone) Phone {{ \App\Support\UsFormat::phone($location->phone) }} @endif @if ($location->fax) · Fax {{ \App\Support\UsFormat::phone($location->fax) }} @endif

@endif
@endforeach
@else

No practice locations have been added yet. Add the main clinic location to keep activation moving.

@endif @if ($canManagePracticeLocations)
@csrf
@else

Your role can view locations but cannot add or change them.

@endif

Clinical team

Staff invitations and psychiatric consultant setup.

{{ $setupStatusLabel('clinical_team') }}

Active staff

@forelse ($activeStaff as $member)

{{ $member->name }}

{{ $member->email }}

{{ $staffRoleLabels[$member->role] ?? ucfirst($member->role) }}
@empty

No active staff yet.

@endforelse

Recent invitations

@forelse ($staffInvitations as $invitation)

{{ $invitation->recipientName() }}

{{ $invitation->email }} · {{ $staffRoleLabels[$invitation->role] ?? ucfirst($invitation->role) }}

{{ ucfirst(str_replace('_', ' ', $invitation->status)) }}
@empty

No staff invitations yet.

@endforelse
@if ($canInvitePracticeStaff)
@csrf
@else

Your role can view the team list but cannot send account invitations.

@endif @if ($canManageClinicalSetup)
@csrf
@else

Your role can view clinical setup but cannot submit changes.

@endif

Configuration

Coordinate EHR readiness, billing contacts, and patient consent defaults.

Integration · Billing · Consent

Integration

EHR system and onboarding status without credential collection.

{{ $setupStatusLabel('ehr_integration') }}
@if ($canManageIntegrationSetup)
@csrf
integration_onboarding_required)>
@else

Your role can view integration setup but cannot submit changes.

@endif

Billing

Billing contact and claims readiness notes.

{{ $setupStatusLabel('billing_setup') }}
@if ($canManageBillingSetup)
@csrf
@else

Your role can view billing setup but cannot submit changes.

@endif

Patient consent

Practice-level consent defaults for CoCM launch.

{{ $setupStatusLabel('patient_consent_configuration') }}
@if ($canManageConsentConfiguration)
@csrf
@else

Your role can view consent configuration but cannot submit changes.

@endif
@if ($canManageComplianceDocuments)

Compliance documents

Upload signed PDF evidence for Meduvo review.

{{ $requirements->count() }} required
@foreach ($requirements as $documentType => $requirement) @php $documents = $documentsByType->get($documentType, collect()); $latestDocument = $documents->first(); $documentAccentClass = $latestDocument ? match ($latestDocument->status) { 'verified' => 'border-l-status-good', 'rejected' => 'border-l-status-critical', 'under_review' => 'border-l-accent', default => 'border-l-ink-muted', } : 'border-l-status-warning'; @endphp

{{ $requirement['label'] }}

@if ($latestDocument)

Version {{ $latestDocument->version }} · Uploaded {{ \App\Support\UsFormat::dateTime($latestDocument->uploaded_at) }}

@else

No document uploaded yet.

@endif
@if ($latestDocument) {{ ucfirst(str_replace('_', ' ', $latestDocument->status)) }} @else Missing @endif
@if ($latestDocument)

{{ $latestDocument->document_name }}

{{ $latestDocument->original_filename }} · {{ number_format($latestDocument->file_size / 1024, 1) }} KB

@if ($latestDocument->signed_by_name)

Signed by {{ $latestDocument->signed_by_name }}{{ $latestDocument->signed_by_title ? ', '.$latestDocument->signed_by_title : '' }}

@endif @if ($latestDocument->rejection_reason)

{{ $latestDocument->rejection_reason }}

@endif Download
@endif
@csrf
@if ($documentType === 'business_associate_agreement')
@endif
@endforeach
@else

Compliance documents

BAA and eSign evidence are managed by the Clinic Admin or Practice Manager.

Restricted

Your role can view compliance readiness, but document uploads are restricted.

@endif

Onboarding tasks

Current practice status: {{ ucfirst(str_replace('_', ' ', $tenant->status)) }}

@if ($tenant->isActive()) Activated @else Pre-activation @endif
@foreach ($tasksByCategory as $category => $categoryTasks)

{{ $categoryLabels[$category] ?? ucfirst(str_replace('_', ' ', $category)) }}

@foreach ($categoryTasks as $task) @php $taskAccentClass = match ($task->status) { 'completed', 'not_applicable' => 'border-l-status-good', 'rejected' => 'border-l-status-critical', 'under_review' => 'border-l-accent', 'locked' => 'border-l-ink-muted', default => 'border-l-status-warning', }; @endphp

{{ $task->title }}

{{ $task->description }}

@if ($task->completed_at) Submitted {{ \App\Support\UsFormat::dateTime($task->completed_at) }} @endif @if ($task->reviewed_at) · Reviewed {{ \App\Support\UsFormat::dateTime($task->reviewed_at) }} @endif

@if ($task->rejection_reason)

{{ $task->rejection_reason }}

@endif
{{ ucfirst(str_replace('_', ' ', $task->status)) }}
@can('submit', $task)
@csrf
@endcan
@endforeach
@endforeach
@endsection