@extends('backEnd.layouts.master') @section('title', 'Repeat Customer') @section('content')

Repeat Customer

Search by customer phone to see all orders and products purchased

@if(!empty($summary)) New Order @endif
@if($phone !== '' && empty($summary))
No orders found for phone {{ $phone }}.
@endif @if(!empty($summary))
Customer Summary
Name
{{ $summary['name'] ?: '—' }}
Total Orders
{{ $summary['total_orders'] }}
Total Spent
৳{{ number_format($summary['total_spent'], 2) }}
Address
{{ $summary['address'] ?: '—' }}
@if($products->isNotEmpty())
Products Purchased
@foreach($products as $product) @endforeach
Product Total Quantity Order Count Amount
@if($product['thumbnail']) @else
@endif {{ $product['name'] }}
{{ $product['total_qty'] }} {{ $product['order_count'] }} ৳{{ number_format($product['amount'], 2) }}
@endif
Order Details
@foreach($orders as $order) @php $statusClass = match((int) $order->order_status) { 0 => 'bg-warning text-dark', 1, 2 => 'bg-primary', 3 => 'bg-info', 4 => 'bg-success', 5, 6 => 'bg-danger', default => 'bg-secondary', }; @endphp
Order #{{ $order->invoice_id ?? $order->id }} {{ \App\Models\Order::statusLabel($order->order_status) }} {{ $order->created_at?->format('d M Y, h:i A') }}
৳{{ number_format($order->amount, 2) }} Repeat Order
@forelse($order->items as $item) @php $thumb = $item->product_thumbnail ?: $item->product?->thumbnail; $variant = $item->variant_label ?: trim(collect([$item->size, $item->color])->filter()->join(', ')); @endphp
@if($thumb) @else
@endif
{{ $item->product_name }}
{{ $item->qty }} {{ $variant ?: 'pc' }}
৳{{ number_format($item->total ?? ($item->unit_price * $item->qty), 2) }}
@empty
No items
@endforelse
@endforeach
@endif
@endsection