{{ $category->name }}
@php
$activeFilters = collect((array) ($appliedFilters ?? []))
->filter(fn ($value) => is_scalar($value) && trim((string) $value) !== '')
->values();
if (request()->filled('price_from') || request()->filled('price_to')) {
$priceFromLabel = trim((string) request('price_from', ''));
$priceToLabel = trim((string) request('price_to', ''));
$activeFilters->push("Цена: {$priceFromLabel} - {$priceToLabel}");
}
foreach ((array) ($filters ?? []) as $filter) {
if ((string) ($filter['filter'] ?? 'select') !== 'range') {
continue;
}
$rangeKey = (string) ($filter['key'] ?? '');
if ($rangeKey === '') {
continue;
}
$fromParam = $rangeKey . '_from';
$toParam = $rangeKey . '_to';
if (!request()->filled($fromParam) && !request()->filled($toParam)) {
continue;
}
$fromLabel = trim((string) request($fromParam, ''));
$toLabel = trim((string) request($toParam, ''));
$activeFilters->push(($filter['label'] ?? $rangeKey) . ": {$fromLabel} - {$toLabel}");
}
@endphp
@if ($activeFilters->isNotEmpty())
@foreach ($activeFilters as $key => $value)
{{ $value }}
@endforeach
@endif
@forelse ($products as $product)
@include('partials.product-card', ['product' => $product])
@empty
Пока нет товаров в этой категории.
@endforelse
@endsection