@php $state = $getState() ?? []; $state = is_array($state) ? $state : []; $resultAttention = is_array($state['resultAttention'] ?? null) ? $state['resultAttention'] : []; $executionSafetySnapshot = is_array($state['executionSafetySnapshot'] ?? null) ? $state['executionSafetySnapshot'] : []; $state = is_array($state['results'] ?? null) ? $state['results'] : $state; $isFoundationEntry = function ($item) { return is_array($item) && array_key_exists('decision', $item) && array_key_exists('sourceId', $item); }; if (is_array($state) && array_key_exists('items', $state)) { $foundationItems = collect($state['foundations'] ?? [])->filter($isFoundationEntry); $policyItems = collect($state['items'] ?? [])->values(); $results = $state; } else { $results = $state; $foundationItems = collect($results)->filter($isFoundationEntry); $policyItems = collect($results)->reject($isFoundationEntry); } $tenant = rescue(fn () => \App\Models\Tenant::current(), null); $groupLabelResolver = $tenant ? app(\App\Services\Directory\EntraGroupLabelResolver::class) : null; $formatGroupId = function ($groupId, $fallbackName = null) use ($tenant, $groupLabelResolver) { if (! is_string($groupId) || $groupId === '') { return null; } $cachedName = null; if ($tenant && $groupLabelResolver) { $cached = $groupLabelResolver->lookupMany($tenant, [$groupId]); $cachedName = $cached[strtolower($groupId)] ?? null; } $name = is_string($fallbackName) && $fallbackName !== '' ? $fallbackName : null; return \App\Services\Directory\EntraGroupLabelResolver::formatLabel($cachedName ?? $name, $groupId); }; @endphp @if ($foundationItems->isEmpty() && $policyItems->isEmpty())
No restore results have been recorded yet.
@else @php $needsAttention = (bool) ($resultAttention['follow_up_required'] ?? false) || $policyItems->contains(function ($item) { $status = $item['status'] ?? null; return in_array($status, ['partial', 'manual_required'], true); }); $attentionSpec = \App\Support\Badges\BadgeRenderer::spec( \App\Support\Badges\BadgeDomain::RestoreResultStatus, $resultAttention['state'] ?? ($needsAttention ? 'completed_with_follow_up' : 'completed') ); $executionBasisLabel = \App\Support\RestoreSafety\RestoreSafetyCopy::safetyStateLabel( is_string($executionSafetySnapshot['safety_state'] ?? null) ? $executionSafetySnapshot['safety_state'] : null ); $primaryNextAction = \App\Support\RestoreSafety\RestoreSafetyCopy::primaryNextAction( is_string($resultAttention['primary_next_action'] ?? null) ? $resultAttention['primary_next_action'] : 'review_result' ); $primaryCauseFamily = \App\Support\RestoreSafety\RestoreSafetyCopy::primaryCauseFamily( is_string($resultAttention['primary_cause_family'] ?? null) ? $resultAttention['primary_cause_family'] : 'none' ); $recoveryBoundary = \App\Support\RestoreSafety\RestoreSafetyCopy::recoveryBoundary( is_string($resultAttention['recovery_claim_boundary'] ?? null) ? $resultAttention['recovery_claim_boundary'] : 'run_completed_not_recovery_proven' ); @endphp