@extends('vendor.layouts.app') @section('title', 'Customers') @section('page-title', 'Customer List') @push('styles') @endpush @section('content')

Customer List

Manage and view your store's customer details.

Total Customers: {{ $customers->total() }}
@forelse($customers as $customer) @empty @endforelse
Customer Profile Contact Info Orders Total Spent Last Activity Status
{{ strtoupper(substr($customer->name ?? 'G', 0, 1)) }}
{{ $customer->name ?? 'Guest User' }}
{{ $customer->email ?? 'No email provided' }}
{{ $customer->phone ?? 'N/A' }}
@if($customer->address)
{{ Str::limit($customer->address, 25) }}
@endif
{{ $customer->orders_count ?? 0 }} Orders
৳{{ number_format($customer->total_spent ?? 0, 2) }}
@php // Optimized logic moved inside view for compatibility $lastOrder = \App\Models\Order::whereIn('id', function($query) use ($vendor) { $query->select('order_id') ->from('order_details') ->whereIn('product_id', function($q) use ($vendor) { $q->select('id')->from('products')->where('vendor_id', $vendor->id); }); }) ->where('customer_id', $customer->id) ->latest() ->first(); @endphp @if($lastOrder)
{{ $lastOrder->created_at->format('d M, Y') }} {{ $lastOrder->created_at->format('h:i A') }}
@else Never @endif
@if($customer->status == 1) Active @else Inactive @endif
No Customers Found

It looks like you don't have any customers yet.

@if($customers->hasPages())
Showing {{ $customers->firstItem() }} to {{ $customers->lastItem() }} of {{ $customers->total() }} entries
@endif
@endsection