@php $normalizedSearchDefinitions = $searchDefinitions ?? collect($searchFields ?? [])->mapWithKeys(function ($definition, $key) { if (! is_array($definition)) { $definition = ['label' => $definition, 'type' => 'text']; } return [$key => [ 'label' => $definition['label'] ?? $key, 'type' => $definition['type'] ?? 'text', 'fields' => array_values((array) ($definition['fields'] ?? [$key])), 'options' => $definition['options'] ?? [], ]]; })->all(); $selectedSearchField = $searchField ?: array_key_first($normalizedSearchDefinitions); $currentSearchValues = $searchValues ?? []; @endphp @if (!empty($filters))
@endif @if (!empty($normalizedSearchDefinitions))
@foreach ($normalizedSearchDefinitions as $key => $definition)
@if ($definition['type'] === 'select') @elseif ($definition['type'] === 'date') @elseif ($definition['type'] === 'date_range') @else @endif
@endforeach
@endif