@extends('layouts.app') @section('title', __('Browse Sellers & Shops')) @section('meta') @endsection @push('styles') @endpush @section('content')
{{-- Hero --}}

{{ __('Discover Sellers') }}

{{ __('Browse trusted shops and vendors. Follow your favorites and explore their unique collections.') }}

{{-- Filter Bar --}}
@if($search !== '' || $sort !== 'latest')
{{ __('Active filters:') }} @if($search !== '') {{ $search }} @endif @if($sort !== 'latest') {{ ucfirst($sort) }} @endif {{ __('Clear') }}
@endif
{{-- Results Count --}}

@if($sellers->total() > 0) {!! __('Showing :from–:to of :total sellers', [ 'from' => $sellers->firstItem(), 'to' => $sellers->lastItem(), 'total'=> $sellers->total(), ]) !!} @else {{ __('No sellers found') }} @endif

@if($sellers->total() > 0)

{{ trans_choice(':count shop|:count shops', $sellers->total(), ['count' => $sellers->total()]) }}

@endif
{{-- Sellers Grid --}} @if($sellers->count() > 0)
@foreach($sellers as $seller) @php // Prefer username, fall back to full name, then a safe default. $displayName = $seller->username ?: trim(($seller->first_name ?? '').' '.($seller->last_name ?? '')) ?: __('Seller'); // Same resolution as show.blade.php $avatarUrl = $seller->avatar ? asset('storage/' . ltrim($seller->avatar, '/')) : null; $initial = strtoupper(\Illuminate\Support\Str::substr($displayName, 0, 1)); $publishedCount = (int) ($seller->published_products_count ?? 0); $followersCount = (int) ($seller->followers_count ?? 0); $salesCount = (int) ($seller->number_of_sales ?? 0); $shopUrl = route('sellers.show', $seller->slug); // Same verified logic as show.blade.php $isVerified = !empty($seller->is_active_shop_request) && !empty($seller->email_status); @endphp
{{-- Avatar --}} @if($avatarUrl) {{ $displayName }} @else {{ $initial }} @endif @if($isVerified) @endif {{-- Name --}}

{{ $displayName }}

@if(!empty($seller->username))
@{{ $seller->username }}
@endif {{-- Bio --}}

{{ \Illuminate\Support\Str::limit(strip_tags($seller->about_me ?? ''), 90, '…') ?: __('No description provided yet.') }}

{{-- Stats --}}
{{ number_format($publishedCount) }} {{ __('Products') }}
{{ number_format($followersCount) }} {{ __('Followers') }}
{{ number_format($salesCount) }} {{ __('Sales') }}
{{-- CTA --}} {{ __('Visit Shop') }}
@endforeach
{{-- Pagination --}} @if($sellers->hasPages())
{{ $sellers->links() }}
@endif @else {{-- Empty State --}}

{{ __('No sellers found') }}

@if($search !== '') {{ __('We couldn\'t find any sellers matching ":search". Try a different keyword.', ['search' => $search]) }} @else {{ __('There are no active sellers at the moment. Please check back soon.') }} @endif

@if($search !== '' || $sort !== 'latest') {{ __('Reset Filters') }} @endif
@endif
@endsection