@extends('backend.layouts.app') @section('content')

All Sellers

{{ translate('Sellers') }}
@can('delete_seller') @endcan
{{-- Filters Row --}}
{{-- Filter by Seller Type --}} {{-- Filter by Approval --}} {{-- Filter by Plan Status --}} {{-- Search --}}
{{-- Clear filters --}} @if(request()->anyFilled(['search_seller','approved_status','plan_status','search'])) ✕ Clear @endif
@if(empty($business_partner_id)) @endif @foreach($shops as $key => $shop) @php $initial = strtoupper(substr($shop->name ?? 'S', 0, 2)); $emiSub = \Illuminate\Support\Facades\DB::table('seller_emi_subscriptions') ->where('user_id', $shop->user_id) ->whereIn('subscription_status', ['active','created']) ->first(); // Plan expiry — directly from shops.package_invalid_at $expireDate = $shop->package_invalid_at ? \Carbon\Carbon::parse($shop->package_invalid_at) : null; $daysLeft = $expireDate ? now()->diffInDays($expireDate, false) : null; // Plan color based on name $pkgName = strtolower($shop->seller_package->name ?? ''); if (str_contains($pkgName, 'diamond')) $planClass = 'sl-plan-diamond'; elseif (str_contains($pkgName, 'platinum')) $planClass = 'sl-plan-platinum'; elseif (str_contains($pkgName, 'gold')) $planClass = 'sl-plan-gold'; elseif (str_contains($pkgName, 'silver')) $planClass = 'sl-plan-silver'; else $planClass = 'sl-plan-basic'; // Override if expiring/expired if ($daysLeft !== null && $daysLeft <= 0) $planClass = 'sl-plan-expired'; elseif ($daysLeft !== null && $daysLeft <= 7) $planClass = 'sl-plan-expiring'; // Rating $rating = $shop->rating ?? 0; $fullStars = floor($rating); $emptyStars = 5 - $fullStars; @endphp {{-- Checkbox --}} {{-- Seller Info --}} {{-- Contact --}} {{-- Package / EMI --}} {{-- Products --}} {{-- Due --}} {{-- Approval toggle --}} {{-- Verification --}} {{-- Options --}} @if(empty($business_partner_id)) @endif @endforeach
@if(auth()->user()->can('delete_seller')) @else # @endif {{ translate('Seller') }} {{ translate('Contact') }} {{ translate('Package / EMI') }} {{ translate('Products') }} {{ translate('Due') }} {{ translate('Approval') }} {{ translate('Verification') }}{{ translate('Options') }}
@if(auth()->user()->can('delete_seller')) @else {{ ($key+1) + ($shops->currentPage() - 1)*$shops->perPage() }} @endif
@if($shop->logo) @else {{ $initial }} @endif
#{{ $shop->user_id }}
@if($shop->user->banned == 1) @endif {{ $shop->name }} @if(isset($shop->sub_cat_ids) && !empty($shop->sub_cat_ids)) K @endif
{{ $shop->user->name }}
{{ $shop->user->email }}
@if($rating > 0)
{{ str_repeat('★', $fullStars) }}{{ str_repeat('★', $emptyStars) }} {{ number_format($rating,1) }}
@endif
@if($emiSub) 💳 EMI @php $paid = $emiSub->paid_emi_count ?? 0; $total = $emiSub->total_emis > 0 ? $emiSub->total_emis : 1; $pct = round(($paid/$total)*100); @endphp
{{ $paid }}/{{ $emiSub->total_emis }} EMIs
View EMI → @elseif(isset($shop->seller_package->name)) {{ $shop->seller_package->name }} @if($daysLeft !== null && $daysLeft <= 0) ⛔ @elseif($daysLeft !== null && $daysLeft <= 7) ⚠️ @endif @if($expireDate)
@if($daysLeft !== null && $daysLeft <= 0) Expired {{ $expireDate->diffForHumans() }} @elseif($daysLeft !== null && $daysLeft <= 7) Expires in {{ $daysLeft }} days @else Expires {{ $expireDate->format('d M Y') }} @endif
@endif @else No Package @endif
{{ $shop->user->products->count() }} @if($shop->admin_to_pay >= 0) {{ single_price($shop->admin_to_pay) }} @else {{ single_price(abs($shop->admin_to_pay)) }} (to Admin) @endif @if($shop->verification_info != null) View @else @endif
{{ $shops->appends(request()->input())->links() }}
@endsection @section('modal') @include('modals.delete_modal') @endsection @section('script') @endsection