@php
$detail = isset($getState) ? $getState() : ($detail ?? null);
$detail = is_array($detail) ? $detail : [];
$mainSections = array_values(array_filter($detail['mainSections'] ?? [], 'is_array'));
$supportingCards = array_values(array_filter($detail['supportingCards'] ?? [], 'is_array'));
$technicalSections = array_values(array_filter($detail['technicalSections'] ?? [], 'is_array'));
$emptyStateNotes = array_values(array_filter($detail['emptyStateNotes'] ?? [], 'is_array'));
@endphp
@include('filament.infolists.entries.enterprise-detail.header', [
'header' => is_array($detail['header'] ?? null) ? $detail['header'] : [],
])
@if ($emptyStateNotes !== [])
@foreach ($emptyStateNotes as $state)
@include('filament.infolists.entries.enterprise-detail.empty-state', ['state' => $state])
@endforeach
@endif
@foreach ($mainSections as $section)
@php
$view = is_string($section['view'] ?? null) && trim($section['view']) !== '' ? trim($section['view']) : null;
$items = is_array($section['items'] ?? null) ? $section['items'] : [];
$emptyState = is_array($section['emptyState'] ?? null) ? $section['emptyState'] : null;
@endphp
@if ($view !== null)
@include($view, is_array($section['viewData'] ?? null) ? $section['viewData'] : [])
@elseif ($items !== [])
@include('filament.infolists.entries.enterprise-detail.section-items', [
'items' => $items,
'action' => is_array($section['action'] ?? null) ? $section['action'] : null,
])
@elseif ($emptyState !== null)
@include('filament.infolists.entries.enterprise-detail.empty-state', ['state' => $emptyState])
@endif
@endforeach
@if ($supportingCards !== [])
@endif
@if ($technicalSections !== [])
@foreach ($technicalSections as $section)
@include('filament.infolists.entries.enterprise-detail.technical-detail', ['section' => $section])
@endforeach
@endif