@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
{{ $copyApplication }}
{{ $copyDelegated }}