@php use Illuminate\Support\Str; // Extract state from Filament ViewEntry $state = $getState(); $status = $state['status'] ?? 'success'; $warnings = $state['warnings'] ?? []; $settings = $state['settings'] ?? []; $settingsTable = $state['settings_table'] ?? null; $policyType = $state['policy_type'] ?? null; @endphp
{{-- Warnings --}} @if(!empty($warnings))
@foreach($warnings as $warning)
{{ $warning }}
@endforeach
@endif {{-- Settings Table (for Settings Catalog legacy format) --}} @if($settingsTable && !empty($settingsTable['rows'])) {{ count($settingsTable['rows']) }} {{ Str::plural('setting', count($settingsTable['rows'])) }}
@foreach($settingsTable['rows'] as $row)
{{ $row['definition'] ?? $row['label'] ?? $row['path'] ?? 'Setting' }}
@if(is_bool($row['value'])) {{ $row['value'] ? 'Enabled' : 'Disabled' }} @elseif(is_numeric($row['value'])) {{ $row['value'] }} @else {{ $row['value'] ?? 'N/A' }} @endif
@endforeach
@endif {{-- Settings Blocks (for OMA Settings, Key/Value pairs, etc.) --}} @foreach($settings as $block) @php $blockType = is_array($block) ? ($block['type'] ?? null) : null; @endphp @if($blockType === 'table') {{ count($block['rows'] ?? []) }} {{ Str::plural('item', count($block['rows'] ?? [])) }}
@foreach($block['rows'] ?? [] as $row)
{{ $row['label'] ?? $row['path'] ?? 'Setting' }} @if(!empty($row['description']))

{{ Str::limit($row['description'], 80) }}

@endif
@if(is_bool($row['value'])) {{ $row['value'] ? 'Enabled' : 'Disabled' }} @elseif(is_numeric($row['value'])) {{ $row['value'] }} @else @php $value = $row['value'] ?? 'N/A'; if (is_array($value) || is_object($value)) { $value = json_encode($value, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); } @endphp {{ Str::limit((string) $value, 200) }} @endif
@endforeach
@elseif($blockType === 'keyValue') {{ count($block['entries'] ?? []) }} {{ Str::plural('entry', count($block['entries'] ?? [])) }}
@foreach($block['entries'] ?? [] as $entry)
{{ $entry['key'] }}
@php $value = $entry['value'] ?? 'N/A'; $isScriptContent = in_array($entry['key'] ?? null, ['scriptContent', 'detectionScriptContent', 'remediationScriptContent'], true) && (bool) config('tenantpilot.display.show_script_content', false); if (is_array($value) || is_object($value)) { $value = json_encode($value, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); } @endphp @if($isScriptContent) @php $code = (string) $value; $firstLine = strtok($code, "\n") ?: ''; $grammar = 'powershell'; if ($policyType === 'deviceShellScript') { $shebang = trim($firstLine); if (str_starts_with($shebang, '#!')) { if (str_contains($shebang, 'zsh')) { $grammar = 'zsh'; } elseif (str_contains($shebang, 'bash')) { $grammar = 'bash'; } else { $grammar = 'sh'; } } else { $grammar = 'sh'; } } elseif ($policyType === 'deviceManagementScript' || $policyType === 'deviceHealthScript') { $grammar = 'powershell'; } $highlightedHtml = null; if (class_exists(\Torchlight\Engine\Engine::class)) { try { $highlightedHtml = (new \Torchlight\Engine\Engine())->codeToHtml( code: $code, grammar: $grammar, theme: [ 'light' => 'github-light', 'dark' => 'github-dark', ], withGutter: false, withWrapper: true, ); } catch (\Throwable $e) { $highlightedHtml = null; } } @endphp
Show Hide {{ number_format(Str::length($code)) }} chars
@if (is_string($highlightedHtml) && $highlightedHtml !== '') @once @include('filament.partials.torchlight-dark-overrides') @endonce
{!! $highlightedHtml !!}
@else
{{ $code }}
@endif
@else {{ Str::limit((string) $value, 200) }} @endif
@endforeach
@endif @endforeach {{-- Empty state --}} @if(empty($settings) && (!$settingsTable || empty($settingsTable['rows'])))

No settings data available

This policy may not contain settings, or they are in an unsupported format

@endif