@extends('layouts.admin')
@section('title', $tenant->name)
@push('head')
@vite('resources/js/admin-tenant-review.js')
@endpush
@section('content')
@php
$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',
];
$statusLabel = $statusLabels[$tenant->status] ?? ucfirst(str_replace('_', ' ', $tenant->status));
$onboardingStatusLabel = ucfirst(str_replace('_', ' ', $tenant->onboarding_status ?? 'registration_submitted'));
$pendingClinicAdminInvitations = $clinicAdminInvitations->filter(fn ($invitation) => $invitation->isPending());
$canInviteClinicAdmin = $activeClinicAdmins->isEmpty() && in_array($tenant->status, ['verified', 'onboarding'], true);
$taskStatusClasses = [
'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',
];
$documentStatusClasses = [
'under_review' => 'status-pill-neutral',
'verified' => 'status-pill-good',
'rejected' => 'status-pill-critical',
'superseded' => 'status-pill-neutral',
];
$progressTotal = max((int) $onboardingProgress['total'], 0);
$progressDone = max((int) $onboardingProgress['done'], 0);
$progressRemaining = max($progressTotal - $progressDone, 0);
$progressPercentage = min(100, max(0, (int) $onboardingProgress['percentage']));
$taskCounts = collect($onboardingProgress['counts'] ?? []);
$progressPendingCount = (int) $taskCounts->get('pending', 0);
$progressLockedCount = (int) $taskCounts->get('locked', 0);
$progressNeedsWorkCount = (int) $taskCounts->get('action_required', 0) + (int) $taskCounts->get('rejected', 0);
$progressInReviewCount = (int) $taskCounts->get('under_review', 0);
$notCompleteBreakdown = collect([
'Pending '.$progressPendingCount => $progressPendingCount,
'Locked '.$progressLockedCount => $progressLockedCount,
'In review '.$progressInReviewCount => $progressInReviewCount,
'Needs work '.$progressNeedsWorkCount => $progressNeedsWorkCount,
])->filter(fn (int $count): bool => $count > 0)->keys()->join(' · ');
$progressSegments = [
['label' => 'Complete', 'count' => $progressDone, 'class' => 'bg-status-good'],
['label' => 'In review', 'count' => $progressInReviewCount, 'class' => 'bg-accent'],
['label' => 'Needs work', 'count' => $progressNeedsWorkCount, 'class' => 'bg-status-critical'],
['label' => 'Pending', 'count' => $progressPendingCount, 'class' => 'bg-status-warning'],
['label' => 'Locked', 'count' => $progressLockedCount, 'class' => 'bg-ink-muted'],
];
$pendingComplianceDocumentsCount = $pendingComplianceDocuments->count();
$overviewNeedsAttention = ! empty($reviewBlockers);
$registrationNeedsAttention = $tenant->verified_at === null || in_array($tenant->status, ['pending_review', 'needs_information'], true);
$tasksNeedAttention = $progressRemaining > 0;
$complianceNeedsAttention = $pendingComplianceDocumentsCount > 0
|| $tenant->baa_executed_at === null
|| $tenant->esign_compliance_verified_at === null;
$documentRequirementCount = $documentRequirements->count();
$latestRequiredComplianceDocuments = $documentRequirements
->map(fn ($_requirement, $documentType) => $complianceDocumentsByType->get($documentType, collect())->first())
->filter();
$uploadedComplianceDocumentsCount = $latestRequiredComplianceDocuments->count();
$verifiedComplianceDocumentsCount = $latestRequiredComplianceDocuments->where('status', 'verified')->count();
$underReviewComplianceDocumentsCount = $latestRequiredComplianceDocuments->where('status', 'under_review')->count();
$rejectedComplianceDocumentsCount = $latestRequiredComplianceDocuments->where('status', 'rejected')->count();
$missingComplianceDocumentsCount = max($documentRequirementCount - $uploadedComplianceDocumentsCount, 0);
$evidenceUploadPercent = $documentRequirementCount > 0 ? (int) round(($uploadedComplianceDocumentsCount / $documentRequirementCount) * 100) : 0;
$evidenceVerifiedPercent = $documentRequirementCount > 0 ? (int) round(($verifiedComplianceDocumentsCount / $documentRequirementCount) * 100) : 0;
$tabs = [
'overview' => [
'label' => 'Overview',
'status' => $overviewNeedsAttention ? count($reviewBlockers).' blocker'.(count($reviewBlockers) === 1 ? '' : 's') : null,
'attention' => $overviewNeedsAttention,
],
'clinic-admin' => ['label' => 'Clinic Admin'],
'setup-evidence' => ['label' => 'Setup Evidence'],
'onboarding-tasks' => [
'label' => 'Tasks',
'status' => $tasksNeedAttention ? $progressRemaining.' not complete' : null,
'attention' => $tasksNeedAttention,
],
'registration' => [
'label' => 'Registration',
'status' => $registrationNeedsAttention ? 'Verify' : null,
'attention' => $registrationNeedsAttention,
],
'compliance' => [
'label' => 'Compliance',
'status' => $pendingComplianceDocumentsCount > 0
? $pendingComplianceDocumentsCount.' review'
: ($complianceNeedsAttention ? 'Pending' : null),
'attention' => $complianceNeedsAttention,
],
'activity' => ['label' => 'Activity'],
];
$tabPanelClass = 'mt-5 overflow-hidden rounded-lg border border-accent/15 bg-[linear-gradient(135deg,rgba(255,255,255,0.98),rgba(244,248,252,0.96)_54%,rgba(255,249,244,0.94))] p-5 shadow-[inset_0_1px_0_rgba(255,255,255,0.98),0_1px_2px_rgba(11,39,84,0.08),0_30px_84px_-50px_rgba(11,39,84,0.76),0_0_48px_-36px_rgba(255,122,53,0.58)] 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.92] p-4 shadow-[inset_0_1px_0_rgba(255,255,255,0.95),0_16px_36px_-28px_rgba(11,39,84,0.44)]';
$rowCardClass = 'rounded-lg border border-accent/10 bg-white/[0.94] px-4 py-3 shadow-[inset_0_1px_0_rgba(255,255,255,0.92),0_14px_32px_-26px_rgba(11,39,84,0.42)]';
$summaryCardClass = 'relative overflow-hidden rounded-lg border border-accent/10 bg-white/[0.94] p-4 shadow-[inset_0_1px_0_rgba(255,255,255,0.96),0_16px_36px_-28px_rgba(11,39,84,0.44)] before:absolute before:inset-y-0 before:left-0 before:w-1 before:bg-accent';
$evidenceCardClass = 'overflow-hidden rounded-lg border border-accent/10 bg-white/[0.96] shadow-[inset_0_1px_0_rgba(255,255,255,0.96),0_18px_40px_-30px_rgba(11,39,84,0.52)]';
$missingEvidenceCardClass = 'overflow-hidden rounded-lg border border-dashed border-status-warning/45 bg-[linear-gradient(135deg,rgba(255,255,255,0.95),rgba(255,248,230,0.72))] shadow-[inset_0_1px_0_rgba(255,255,255,0.92),0_14px_32px_-28px_rgba(250,178,25,0.54)]';
$blockerCardClass = 'rounded-lg border border-status-warning/30 bg-[linear-gradient(135deg,rgba(255,255,255,0.95),rgba(255,248,230,0.78))] px-3 py-2.5 text-sm text-ink-secondary shadow-sm';
$fieldGridClass = 'grid gap-3 text-sm sm:grid-cols-2 [&>div]:rounded-lg [&>div]:border [&>div]:border-accent/10 [&>div]:bg-white/[0.80] [&>div]:px-3 [&>div]:py-2.5 [&>div]:shadow-sm';
$emptyStateClass = 'rounded-lg border border-accent/10 bg-accent-muted/60 px-3 py-3 text-sm text-ink-secondary shadow-sm';
@endphp
Practice review
{{ $tenant->name }}
Clinic ID #{{ $tenant->id }} · {{ $tenant->operational_timezone ?: 'Timezone not set' }} · {{ $onboardingStatusLabel }}
@if ($tenant->isActive())
Active
@elseif (in_array($tenant->status, ['pending_review', 'needs_information', 'verified', 'onboarding', 'ready_for_approval'], true))
{{ $statusLabel }}
@else
{{ $statusLabel }}
@endif
{{ $onboardingProgress['percentage'] }}% complete
@if ($errors->any())
@endif
@if (session('setup_link'))
@endif
{{ $progressPercentage }}%
Complete
Completion progress
A quick read of finished onboarding work
versus remaining activation work.
Done
{{ $progressDone }}
Open
{{ $progressRemaining }}
Total
{{ $progressTotal }}
@if ($notCompleteBreakdown !== '')
Open: {{ $notCompleteBreakdown }}
@endif
@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
@if ($pendingComplianceDocuments->isNotEmpty())
{{ $pendingComplianceDocumentsCount }} compliance document{{ $pendingComplianceDocumentsCount === 1 ? '' : 's' }} ready for SuperAdmin review
Latest:
{{ $pendingComplianceDocuments->take(3)->map(fn ($document) => $document->document_name.' from '.($document->uploadedBy?->name ?? 'practice user'))->join(', ') }}
Open Compliance
@endif
@foreach ($tabs as $tabKey => $tab)
@php
$tabNeedsAttention = (bool) ($tab['attention'] ?? false);
@endphp
@switch($tabKey)
@case('overview')
@break
@case('clinic-admin')
@break
@case('setup-evidence')
@break
@case('onboarding-tasks')
@break
@case('registration')
@break
@case('compliance')
@break
@case('activity')
@break
@endswitch
{{ $tab['label'] }}
@if (! empty($tab['status']))
{{ $tab['status'] }}
@endif
@endforeach
Onboarding status
{{ $onboardingStatusLabel }}
Registration submitted
{{ \App\Support\UsFormat::dateTime($tenant->created_at) }}
Task progress
{{ $onboardingProgress['done'] }} of {{ $onboardingProgress['total'] }} complete · {{ $onboardingProgress['percentage'] }}%
Verified
@if ($tenant->verified_at)
{{ \App\Support\UsFormat::dateTime($tenant->verified_at) }} by {{ $tenant->verifiedBy?->name ?? 'Unknown' }}
@else
Not verified
@endif
Clinic Admin
@if ($activeClinicAdmins->isNotEmpty())
{{ $activeClinicAdmins->pluck('name')->join(', ') }}
@elseif ($pendingClinicAdminInvitations->isNotEmpty())
Pending invite to {{ $pendingClinicAdminInvitations->pluck('email')->join(', ') }}
@elseif (in_array($tenant->status, ['verified', 'onboarding'], true))
Ready to invite
@else
Not invited
@endif
@if ($tenant->rejected_at)
Rejection reason
{{ $tenant->rejection_reason }}
@endif
@if (empty($reviewBlockers))
No current activation blockers
This practice has cleared the enforced review, compliance, and onboarding checks.
@else
Cannot activate yet
@foreach ($reviewBlockers as $blocker)
{{ $blocker }}
@endforeach
@endif
@can('verify', $tenant)
@if ($tenant->canBeVerified())
@endif
@endcan
@can('requestInformation', $tenant)
@if ($tenant->canRequestInformation())
@endif
@endcan
@can('reject', $tenant)
@if ($tenant->canBeRejected())
@csrf
Reject registration
Use this when the practice should not continue onboarding.
Rejection reason
Reject Registration
@endif
@endcan
@if ($tenant->practiceInformationRequests->isNotEmpty())
Information requests
@foreach ($tenant->practiceInformationRequests as $informationRequest)
{{ ucfirst(str_replace('_', ' ', $informationRequest->category)) }}
{{ ucfirst($informationRequest->status) }}
{{ $informationRequest->message }}
@if ($informationRequest->internal_note)
Internal: {{ $informationRequest->internal_note }}
@endif
Requested by {{ $informationRequest->requestedBy?->name ?? 'Unknown' }} on {{ \App\Support\UsFormat::dateTime($informationRequest->created_at) }}
@endforeach
@endif
Current state
@if ($activeClinicAdmins->isNotEmpty())
Account active
@elseif ($pendingClinicAdminInvitations->isNotEmpty())
Invite pending
@elseif ($canInviteClinicAdmin)
Ready
@else
Blocked
@endif
@forelse ($activeClinicAdmins as $clinicAdmin)
{{ $clinicAdmin->name }}
{{ $clinicAdmin->email }}
@empty
@if ($clinicAdminInvitations->isEmpty())
No Clinic Admin invitation has been sent yet.
@endif
@endforelse
@foreach ($clinicAdminInvitations as $invitation)
@php
$invitationState = $invitation->isRevoked()
? 'Revoked'
: ($invitation->isAccepted() ? 'Accepted' : ($invitation->isExpired() ? 'Expired' : 'Pending'));
@endphp
{{ $invitation->recipientName() }}
{{ $invitationState }}
@can('inviteClinicAdmin', $tenant)
@if ($invitation->isPending())
@csrf
Revoke
@endif
@endcan
{{ $invitation->email }}
Sent {{ \App\Support\UsFormat::dateTime($invitation->created_at) }}
· Expires {{ \App\Support\UsFormat::date($invitation->expires_at) }}
@endforeach
@can('inviteClinicAdmin', $tenant)
@csrf
Invite Clinic Admin
Prefilled from registration contact details. Confirm before sending the secure setup link.
@unless ($canInviteClinicAdmin)
Unavailable
@endunless
Send Clinic Admin Invite
@endcan
Practice profile
Practice
{{ $tenant->name }}
Legal name
{{ $tenant->legal_business_name ?: 'Not provided' }}
Type
{{ $tenant->practice_type ?: 'Not provided' }}
NPI
{{ $tenant->organization_npi ?: 'Not provided' }}
Contact
{{ $tenant->primary_contact_name ?: 'Not provided' }}
Contact email
{{ $tenant->primary_contact_email ?: 'Not provided' }}
Locations
@forelse ($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
@empty
No locations submitted yet.
@endforelse
Clinical team
Active staff
@forelse ($onboardingStaff as $member)
{{ $member->name }}
{{ $member->email }}
{{ $staffRoleLabels[$member->role] ?? ucfirst($member->role) }}
@empty
No active staff.
@endforelse
Invitations
@forelse ($onboardingStaffInvitations as $invitation)
{{ $invitation->recipientName() }}
{{ $invitation->email }} · {{ $staffRoleLabels[$invitation->role] ?? ucfirst($invitation->role) }}
{{ ucfirst(str_replace('_', ' ', $invitation->status)) }}
@empty
No invitations.
@endforelse
Psych consultant
{{ ucfirst(str_replace('_', ' ', $practiceOnboardingSetting->psychiatric_consultant_status ?? 'not configured')) }}
Consultant name
{{ $practiceOnboardingSetting->psychiatric_consultant_name ?: 'Not provided' }}
Configuration
EHR
{{ $practiceOnboardingSetting->ehr_system_name ?: 'Not provided' }}
Integration status
{{ ucfirst(str_replace('_', ' ', $practiceOnboardingSetting->ehr_integration_status ?? 'not started')) }}
Billing contact
{{ $practiceOnboardingSetting->billing_contact_name ?: 'Not provided' }}
Billing email
{{ $practiceOnboardingSetting->billing_contact_email ?: 'Not provided' }}
Consent method
{{ ucfirst(str_replace('_', ' ', $practiceOnboardingSetting->consent_delivery_method ?? 'not configured')) }}
Cost sharing
{{ $practiceOnboardingSetting->cost_sharing_acknowledgement_required ? 'Required' : 'Not required' }}
@foreach ($onboardingTasks 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 }}
@if ($task->is_blocking)
Blocking
@endif
{{ $task->description }}
{{ ucfirst(str_replace('_', ' ', $task->category)) }}
· Assigned to {{ ucfirst(str_replace('_', ' ', $task->assigned_role ?? 'system')) }}
@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
{{ $task->rejection_reason }}
{{ ucfirst(str_replace('_', ' ', $task->status)) }}
@can('review', $task)
@csrf
Approve
@if ($task->status !== 'pending')
@csrf
Reject
@endif
@endcan
@endforeach
@php
$intake = $tenant->public_signup_intake ?? [];
$practice = $intake['practice'] ?? [];
$contact = $intake['primary_contact'] ?? [];
$location = $intake['location'] ?? [];
$program = $intake['cocm_program'] ?? [];
@endphp
@if ($tenant->legal_business_name)
Legal business name
{{ $tenant->legal_business_name }}
@endif
@if ($tenant->practice_type)
Practice type
{{ $tenant->practice_type }}
@endif
@if ($tenant->organization_npi)
Organization NPI
{{ $tenant->organization_npi }}
@endif
Primary contact
{{ $tenant->primary_contact_name ?? 'Not provided' }}
@if (data_get($contact, 'role_label'))
Contact role
{{ data_get($contact, 'role_label') }}
@endif
Contact email
{{ $tenant->primary_contact_email ?? 'Not provided' }}
Phone
{{ \App\Support\UsFormat::nullablePhone($tenant->primary_contact_phone) }}
Website
{{ $tenant->website ?? 'Not provided' }}
@if (data_get($location, 'practice_phone'))
Practice phone
{{ \App\Support\UsFormat::phone(data_get($location, 'practice_phone')) }}
@endif
@if (data_get($location, 'fax'))
Fax
{{ \App\Support\UsFormat::phone(data_get($location, 'fax')) }}
@endif
Monthly CoCM estimate
{{ $tenant->estimated_monthly_cocm_patients ?? 'Not provided' }}
@if (data_get($program, 'current_cocm_status_label'))
CoCM status
{{ data_get($program, 'current_cocm_status_label') }}
@endif
@if (data_get($program, 'current_ehr_label'))
EHR / EMR
{{ data_get($program, 'current_ehr_label') }}
@endif
@if (data_get($program, 'ehr_integration_needed_label'))
EHR integration
{{ data_get($program, 'ehr_integration_needed_label') }}
@if ($tenant->integration_onboarding_required)
Integration onboarding
@endif
@endif
@if (data_get($program, 'number_of_pcps') !== null || data_get($program, 'number_of_bhcms') !== null)
CoCM team size
{{ data_get($program, 'number_of_pcps', 0) }} PCPs · {{ data_get($program, 'number_of_bhcms', 0) }} BHCMs
@endif
@if (data_get($program, 'psychiatric_consultant_status_label'))
Psychiatric consultant
{{ data_get($program, 'psychiatric_consultant_status_label') }}
@if ($tenant->psychiatric_consultant_assistance_needed)
Assistance needed
@elseif ($tenant->psychiatric_consultant_onboarding_required)
Setup pending
@endif
@endif
@if (data_get($program, 'eligible_patient_population') !== null)
Eligible population
{{ data_get($program, 'eligible_patient_population') }}
@endif
@if (data_get($program, 'target_go_live_not_sure') || data_get($program, 'target_go_live_date'))
Target go-live
{{ data_get($program, 'target_go_live_not_sure') ? 'Not sure yet' : \App\Support\UsFormat::date(\Carbon\CarbonImmutable::parse(data_get($program, 'target_go_live_date'))) }}
@endif
@if ($tenant->authorized_representative_name)
Authorized representative
{{ $tenant->authorized_representative_name }} · {{ $tenant->authorized_representative_title }}
@endif
BAA/eSign intake
{{ $tenant->authority_intake_acknowledged_at ? 'Authority acknowledged' : 'Authority missing' }}
·
{{ $tenant->baa_intake_acknowledged_at ? 'BAA acknowledged' : 'BAA missing' }}
·
{{ $tenant->esign_intake_acknowledged_at ? 'eSign acknowledged' : 'eSign missing' }}
@if ($tenant->practice_address)
Practice address
{{ $tenant->practice_address }}
@endif
@if ($tenant->signup_notes)
Implementation notes
{{ $tenant->signup_notes }}
@endif
Authority acknowledgement
{{ $tenant->authority_intake_acknowledged_at ? \App\Support\UsFormat::dateTime($tenant->authority_intake_acknowledged_at) : 'Missing' }}
BAA acknowledgement
{{ $tenant->baa_intake_acknowledged_at ? \App\Support\UsFormat::dateTime($tenant->baa_intake_acknowledged_at) : 'Missing' }}
BAA verification
@if ($tenant->baa_executed_at)
Verified
{{ \App\Support\UsFormat::dateTime($tenant->baa_executed_at) }}
@else
Pending
@endif
eSign/compliance verification
@if ($tenant->esign_compliance_verified_at)
Verified
{{ \App\Support\UsFormat::dateTime($tenant->esign_compliance_verified_at) }}
@else
Pending
@endif
Document evidence
Required signed PDFs uploaded by the practice for SuperAdmin review.
{{ $evidenceUploadPercent }}% received
{{ $evidenceVerifiedPercent }}% verified
{{ $uploadedComplianceDocumentsCount }} of {{ $documentRequirementCount }} documents uploaded
Review
{{ $underReviewComplianceDocumentsCount }}
Verified
{{ $verifiedComplianceDocumentsCount }}
Missing
{{ $missingComplianceDocumentsCount }}
Rejected
{{ $rejectedComplianceDocumentsCount }}
Evidence checklist
{{ $documentRequirementCount }} required
@foreach ($documentRequirements as $documentType => $requirement)
@php
$documents = $complianceDocumentsByType->get($documentType, collect());
$latestDocument = $documents->first();
@endphp
@php
$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
@if ($latestDocument)
@else
@endif
{{ $requirement['label'] }}
{{ $latestDocument ? 'Latest submitted evidence is ready for review history and action tracking.' : 'Waiting for the practice to upload this signed PDF.' }}
@if ($latestDocument)
{{ ucfirst(str_replace('_', ' ', $latestDocument->status)) }}
@else
Missing
@endif
@if ($latestDocument)
File
{{ $latestDocument->original_filename }}
Size
{{ number_format($latestDocument->file_size / 1024, 1) }} KB
Version
{{ $latestDocument->version }}
Uploaded
{{ \App\Support\UsFormat::dateTime($latestDocument->uploaded_at) }}
Uploaded by
{{ $latestDocument->uploadedBy?->name ?? 'Unknown' }}
@if ($latestDocument->reviewed_at)
Reviewed
{{ $latestDocument->reviewedBy?->name ?? 'Unknown' }} · {{ \App\Support\UsFormat::dateTime($latestDocument->reviewed_at) }}
@endif
@if ($latestDocument->signed_by_name)
Signed by {{ $latestDocument->signed_by_name }}{{ $latestDocument->signed_by_title ? ', '.$latestDocument->signed_by_title : '' }}
{{ $latestDocument->signed_at ? 'on '.\App\Support\UsFormat::date($latestDocument->signed_at) : '' }}
@endif
@if ($documents->count() > 1)
{{ $documents->count() - 1 }} previous version(s)
@endif
@if ($latestDocument->rejection_reason)
{{ $latestDocument->rejection_reason }}
@endif
@else
No signed document has been uploaded for this practice requirement yet.
Ask the clinic admin for Clinic ID #{{ $tenant->id }} to upload it from their Documents tab.
@endif
@if ($latestDocument)
Review actions
Download
@can('review', $latestDocument)
@if ($latestDocument->isReviewable())
@csrf
Verify
@csrf
Rejection reason
Reject
@else
This document already has a final review status.
@endif
@endcan
@endif
@endforeach
@if ($auditLogs->isEmpty())
No practice review activity has been recorded yet.
@else
@foreach ($auditLogs as $auditLog)
@php
$oldStatus = data_get($auditLog->old_values, 'status');
$newStatus = data_get($auditLog->new_values, 'status');
$oldCompliance = [
'baa_executed_at' => data_get($auditLog->old_values, 'baa_executed_at'),
'esign_compliance_verified_at' => data_get($auditLog->old_values, 'esign_compliance_verified_at'),
];
$newCompliance = [
'baa_executed_at' => data_get($auditLog->new_values, 'baa_executed_at'),
'esign_compliance_verified_at' => data_get($auditLog->new_values, 'esign_compliance_verified_at'),
];
@endphp
{{ ucfirst($auditLog->action) }} practice
{{ \App\Support\UsFormat::dateTime($auditLog->created_at) }}
By {{ $auditLog->user?->name ?? 'System' }}
@if ($oldStatus || $newStatus)
Status:
{{ $statusLabels[$oldStatus] ?? ucfirst(str_replace('_', ' ', $oldStatus ?? 'unknown')) }}
→
{{ $statusLabels[$newStatus] ?? ucfirst(str_replace('_', ' ', $newStatus ?? 'unknown')) }}
@elseif (array_filter($oldCompliance) || array_filter($newCompliance))
Compliance timestamps updated.
@endif
@endforeach
@endif
@if (! $tenant->isActive())
Activation gate
Approve and activate this practice
Activation opens PHI access for authorized staff only after registration, compliance, and onboarding work are complete.
@if (empty($reviewBlockers))
Ready
@else
{{ count($reviewBlockers) }} blockers
@endif
@if (! empty($reviewBlockers))
@foreach ($reviewBlockers as $blocker)
{{ $blocker }}
@endforeach
@endif
@csrf
Approve and Activate Practice
@else
Practice is active
Use workspace mode to review operational dashboards for this practice.
Activated
@csrf
Enter {{ $tenant->name }}'s workspace
@endif
@endsection