@php $allListingsCount = isset($allListingsTotal) ? (int) $allListingsTotal : (int) $listings->total(); $resultListingsCount = isset($filteredListingsTotal) ? (int) $filteredListingsTotal : (int) $listings->total(); $activeCategoryName = $selectedCategory?->name ? trim((string) $selectedCategory->name) : ''; $seoHeading = $activeCategoryName !== '' ? $activeCategoryName.' Listings and Prices' : 'All Listings and Prices'; $canSaveSearch = $search !== '' || ! is_null($categoryId); $normalizeQuery = static fn ($value): bool => ! is_null($value) && $value !== ''; $baseCategoryQuery = array_filter([ 'search' => $search !== '' ? $search : null, 'user' => $sellerUserId ?? null, 'country' => $countryId, 'city' => $cityId, 'min_price' => $minPriceInput !== '' ? $minPriceInput : null, 'max_price' => $maxPriceInput !== '' ? $maxPriceInput : null, 'date_filter' => $dateFilter !== 'all' ? $dateFilter : null, 'sort' => $sort !== 'smart' ? $sort : null, ], $normalizeQuery); $clearFiltersQuery = array_filter([ 'search' => $search !== '' ? $search : null, 'user' => $sellerUserId ?? null, ], $normalizeQuery); @endphp

{{ $seoHeading }}

{{ number_format($resultListingsCount) }} {{ $activeCategoryName !== '' ? ' listings found in '.$activeCategoryName : ' listings found' }}

@auth
@csrf
@else Save search @endauth
@if($search !== '') @endif @if($categoryId) @endif @if(! empty($sellerUserId)) @endif @if($countryId) @endif @if($cityId) @endif @if($minPriceInput !== '') @endif @if($maxPriceInput !== '') @endif @if($dateFilter !== 'all') @endif
@if($listings->isEmpty())
No listings match this filter.
@else
@foreach($listings as $listing) @php $listingImage = $listing->getFirstMediaUrl('listing-images'); $isFavorited = in_array($listing->id, $favoriteListingIds ?? [], true); $priceValue = ! is_null($listing->price) ? (float) $listing->price : null; $locationParts = array_filter([ trim((string) ($listing->city ?? '')), trim((string) ($listing->country ?? '')), ], fn ($value) => $value !== ''); $locationText = implode(', ', $locationParts); @endphp @endforeach
@endif
{{ $listings->links() }}