@props([ 'id' => 'ajax-filters', 'filters' => [], 'wrapperClass' => 'ajax-filters d-flex flex-wrap align-items-start', 'itemClass' => 'mr-2 mb-2', 'labelClass' => 'form-label my_HalfFrame my_HalfFrameSearch-ajax input-group-text', 'selectClass' => 'form-control', 'inputClass' => 'form-control', 'autoBind' => true, 'eventName' => 'ajax-filters:changed', 'inputDebounceMs' => 250, 'emitOnInit' => false, 'showClearButton' => true, 'clearButtonTitle' => 'Wyczysc filtry', 'clearButtonClass' => 'btn btn-secondary btn_table_status btn-outline-secondary', 'clearButtonIconClass' => 'fas fa-times', 'showStatusIndicator' => false, 'statusId' => null, 'activeText' => 'Filtry aktywne', 'inactiveText' => 'Filtry wylaczone', ]) @php $jsId = preg_replace('/[^A-Za-z0-9_-]/', '_', (string) $id); $resolvedStatusId = $statusId ?: ($id . '_status_indicator'); $hasDefinedFilters = collect((array) $filters) ->contains(function ($filter) { return trim((string) ($filter['key'] ?? '')) !== ''; }); @endphp
@if($showStatusIndicator && $hasDefinedFilters)
@endif
@foreach($filters as $index => $filter) @php $type = strtolower((string) ($filter['type'] ?? 'select')); $key = (string) ($filter['key'] ?? ''); $filterId = (string) ($filter['id'] ?? ($id . '_filter_' . $index)); $name = (string) ($filter['name'] ?? $key); $label = (string) ($filter['label'] ?? ''); $placeholder = array_key_exists('placeholder', $filter) ? $filter['placeholder'] : null; $options = (array) ($filter['options'] ?? []); $value = (string) ($filter['value'] ?? ''); $currentItemClass = trim((string) ($filter['itemClass'] ?? $itemClass)); $currentLabelClass = (string) ($filter['labelClass'] ?? $labelClass); $currentSelectClass = (string) ($filter['selectClass'] ?? $selectClass); $currentInputClass = (string) ($filter['inputClass'] ?? $inputClass); @endphp
@if($label !== '') @endif @if($type === 'select') @else @endif
@endforeach
@if($showClearButton && $hasDefinedFilters) @endif
@if($autoBind) @endif