@php use App\Support\Badges\BadgeDomain; use App\Support\Badges\BadgeRenderer; use Illuminate\Support\Carbon; $assist = is_array($assist ?? null) ? $assist : []; $tenant = is_array($assist['tenant'] ?? null) ? $assist['tenant'] : []; $verification = is_array($assist['verification'] ?? null) ? $assist['verification'] : []; $overview = is_array($assist['overview'] ?? null) ? $assist['overview'] : []; $counts = is_array($overview['counts'] ?? null) ? $overview['counts'] : []; $freshness = is_array($overview['freshness'] ?? null) ? $overview['freshness'] : []; $missingPermissions = is_array($assist['missing_permissions'] ?? null) ? $assist['missing_permissions'] : []; $applicationRows = is_array($missingPermissions['application'] ?? null) ? $missingPermissions['application'] : []; $delegatedRows = is_array($missingPermissions['delegated'] ?? null) ? $missingPermissions['delegated'] : []; $copy = is_array($assist['copy'] ?? null) ? $assist['copy'] : []; $actions = is_array($assist['actions'] ?? null) ? $assist['actions'] : []; $fallback = is_array($assist['fallback'] ?? null) ? $assist['fallback'] : []; $overviewSpec = BadgeRenderer::spec(BadgeDomain::VerificationReportOverall, $overview['overall'] ?? null); $verificationSpec = BadgeRenderer::spec(BadgeDomain::VerificationReportOverall, $verification['overall'] ?? null); $lastRefreshedAt = is_string($freshness['last_refreshed_at'] ?? null) ? (string) $freshness['last_refreshed_at'] : null; $lastRefreshedLabel = 'Not yet refreshed'; if ($lastRefreshedAt !== null) { try { $lastRefreshedLabel = Carbon::parse($lastRefreshedAt)->diffForHumans(); } catch (\Throwable) { $lastRefreshedLabel = $lastRefreshedAt; } } $copyApplication = (string) ($copy['application'] ?? ''); $copyDelegated = (string) ($copy['delegated'] ?? ''); $fullPageAction = is_array($actions['full_page'] ?? null) ? $actions['full_page'] : []; $grantAdminConsentAction = is_array($actions['grant_admin_consent'] ?? null) ? $actions['grant_admin_consent'] : []; $manageProviderConnectionAction = is_array($actions['manage_provider_connection'] ?? null) ? $actions['manage_provider_connection'] : []; $rerunVerificationAction = is_array($actions['rerun_verification'] ?? null) ? $actions['rerun_verification'] : []; $renderActionLink = static function (array $action, string $testId, string $tone = 'primary'): string { $label = is_string($action['label'] ?? null) ? trim((string) $action['label']) : ''; $url = is_string($action['url'] ?? null) ? trim((string) $action['url']) : ''; $available = (bool) ($action['available'] ?? false); if (! $available || $label === '' || $url === '') { return ''; } $baseClasses = match ($tone) { 'secondary' => 'border-gray-300 bg-white text-gray-900 hover:bg-gray-50 dark:border-gray-700 dark:bg-gray-900 dark:text-white dark:hover:bg-gray-800', 'warning' => 'border-warning-300 bg-warning-50 text-warning-900 hover:bg-warning-100 dark:border-warning-700 dark:bg-warning-950/40 dark:text-warning-100 dark:hover:bg-warning-900/60', default => 'border-primary-300 bg-primary-50 text-primary-900 hover:bg-primary-100 dark:border-primary-700 dark:bg-primary-950/40 dark:text-primary-100 dark:hover:bg-primary-900/60', }; return sprintf( '%sOpens in new tab', e($url), e($testId), $baseClasses, e($label), ); }; @endphp
Tenant
{{ (string) ($tenant['name'] ?? 'Tenant') }}
{{ (string) ($tenant['external_id'] ?? 'Unknown tenant') }}
@if ($overviewSpec) {{ $overviewSpec->label }} @endif @if ($verificationSpec) Verification: {{ $verificationSpec->label }} @endif Refreshed {{ $lastRefreshedLabel }}
Missing (app)
{{ (int) ($counts['missing_application'] ?? 0) }}
Missing (delegated)
{{ (int) ($counts['missing_delegated'] ?? 0) }}
Present
{{ (int) ($counts['present'] ?? 0) }}
Errors
{{ (int) ($counts['error'] ?? 0) }}
@if ((bool) ($verification['is_stale'] ?? false))
Verification result is stale
{{ (string) ($verification['stale_reason'] ?? 'Start verification again to validate the current provider connection.') }}
@endif @if ((bool) ($freshness['is_stale'] ?? false))
Stored permission data needs refresh
The permission summary is based on stored diagnostics only. Re-run verification after fixing access to refresh the stored result.
@endif @if ((bool) ($fallback['has_incomplete_detail'] ?? false))
Compact detail is incomplete
{{ (string) ($fallback['message'] ?? 'Open the full page for more detail or rerun verification after addressing access issues.') }}
@endif
Recovery actions
{!! $renderActionLink($grantAdminConsentAction, 'verification-assist-admin-consent', 'warning') !!} {!! $renderActionLink($manageProviderConnectionAction, 'verification-assist-manage-provider-connection', 'primary') !!} {!! $renderActionLink($fullPageAction, 'verification-assist-full-page', 'secondary') !!}
{{ (string) ($rerunVerificationAction['label'] ?? 'Use the existing Start verification action in this step after reviewing changes.') }}
@if (trim($copyApplication) !== '')
Copy missing application permissions
Newline-separated payload for admin consent or handoff.
Copied
Copy missing application permissions
{{ $copyApplication }}
@endif @if (trim($copyDelegated) !== '')
Copy missing delegated permissions
Only shown when delegated permission detail exists in the stored diagnostics.
Copied
Copy missing delegated permissions
{{ $copyDelegated }}
@endif @if ($applicationRows !== [])
Missing application permissions
@foreach ($applicationRows as $row) @php $features = is_array($row['features'] ?? null) ? $row['features'] : []; @endphp
{{ (string) ($row['key'] ?? 'Unknown permission') }}
@if (filled($row['description'] ?? null))
{{ (string) $row['description'] }}
@endif
{{ ($row['status'] ?? null) === 'error' ? 'Error' : 'Missing' }}
@if ($features !== [])
@foreach ($features as $feature) {{ (string) $feature }} @endforeach
@endif
@endforeach
@endif @if ($delegatedRows !== [])
Missing delegated permissions
@foreach ($delegatedRows as $row) @php $features = is_array($row['features'] ?? null) ? $row['features'] : []; @endphp
{{ (string) ($row['key'] ?? 'Unknown permission') }}
@if (filled($row['description'] ?? null))
{{ (string) $row['description'] }}
@endif
{{ ($row['status'] ?? null) === 'error' ? 'Error' : 'Missing' }}
@if ($features !== [])
@foreach ($features as $feature) {{ (string) $feature }} @endforeach
@endif
@endforeach
@endif @if ($applicationRows === [] && $delegatedRows === [] && ! (bool) ($fallback['has_incomplete_detail'] ?? false))
No missing permission rows are currently stored for this tenant. Use the full page or rerun verification if the summary still needs attention.
@endif