@extends('layouts.admin') @section('title','Orders') @section('content') @php $columns = [ 'number' => 'Order', 'customer' => 'Customer', 'items' => 'Items', 'payment' => 'Payment', 'fulfillment' => 'Fulfillment', 'status' => 'Status', 'total' => 'Total', 'margin' => 'Margin', 'date' => 'Placed', 'actions' => 'Actions', ]; $label = fn (string $v) => ucwords(str_replace('_', ' ', $v)); $payTone = fn (string $s) => match ($s) { 'paid' => 'success', 'pending', 'authorized', 'partially_paid' => 'warning', 'failed', 'voided' => 'danger', 'refunded', 'partially_refunded' => 'muted', default => 'info', }; $fulTone = fn (string $s) => match ($s) { 'fulfilled' => 'success', 'partially_fulfilled', 'in_progress', 'scheduled' => 'warning', 'on_hold' => 'danger', 'unfulfilled' => 'muted', default => 'info', }; $statusTone = fn (string $s) => match ($s) { 'open' => 'info', 'canceled' => 'danger', 'archived' => 'muted', default => 'muted', }; $activeChips = collect([ 'payment_status' => request('payment_status'), 'fulfillment_status' => request('fulfillment_status'), 'status' => request('status'), 'fraud_status' => request('fraud_status'), 'costing' => request('costing'), 'from' => request('from'), 'to' => request('to'), 'sort' => request('sort') && request('sort') !== 'newest' ? request('sort') : null, ])->filter(); @endphp Draft orders Returns
Open {{ number_format($stats['open']) }} Active pipeline Unfulfilled {{ number_format($stats['unfulfilled']) }} Ready to ship Awaiting pay {{ number_format($stats['awaiting_payment']) }} Pending / auth Needs attention {{ number_format($stats['needs_attention']) }} Fraud / hold / failed
Paid today AUD {{ number_format($stats['revenue_today_cents'] / 100, 0) }} Gross paid
@foreach([ ['label' => 'All', 'params' => []], ['label' => 'Unfulfilled', 'params' => ['fulfillment_status' => 'unfulfilled', 'status' => 'open']], ['label' => 'Paid', 'params' => ['payment_status' => 'paid']], ['label' => 'Partial ship', 'params' => ['fulfillment_status' => 'partially_fulfilled']], ['label' => 'On hold', 'params' => ['fulfillment_status' => 'on_hold']], ['label' => 'Fraud review', 'params' => ['fraud_status' => 'review']], ['label' => 'Canceled', 'params' => ['status' => 'canceled']], ['label' => 'Needs costing'.($stats['needs_costing'] ? ' · '.$stats['needs_costing'] : ''), 'params' => ['costing' => 'missing']], ] as $chip) @php $isActive = collect($chip['params'])->every(fn ($v, $k) => request($k) === $v) && (empty($chip['params']) ? ! request()->hasAny(['payment_status','fulfillment_status','status','fraud_status','costing']) : true); @endphp {{ $chip['label'] }} @endforeach
@if($activeChips->isNotEmpty())
Active @foreach($activeChips as $key => $value) {{ $label($key) }}: {{ $label((string) $value) }} @endforeach Clear all
@endif
Order Customer Items Payment Fulfillment Status Total Margin Placed @forelse($orders as $order)
{{ $order->number }}
@if($order->fraud_status && $order->fraud_status !== 'clear')
Fraud {{ $label($order->fraud_status) }}@if($order->fraud_score) · {{ $order->fraud_score }}@endif
@endif
{{ $order->customer?->name ?: 'Guest' }}
{{ $order->email }}
{{ $order->lines_count }} {{ $label($order->payment_status) }} {{ $label($order->fulfillment_status) }} {{ $label($order->status) }}
{{ $order->money('total_cents') }}
@if($order->refunded_cents)
−{{ $order->money('refunded_cents') }}
@endif @if($order->cost) @php $summary = $profitability->summary($order); @endphp {{ $summary['margin_bps'] === null ? '—' : number_format($summary['margin_bps'] / 100, 1).'%' }}
{{ $order->moneyFromCents($summary['profit_cents']) }}{{ $order->cost->isFinal() ? '' : ' · est.' }}
@elseif($order->status !== 'canceled') Add costs @else — @endif
{{ $order->created_at?->format('M j, Y') }}
{{ $order->created_at?->format('g:i A') }} · {{ $order->created_at?->diffForHumans() }}
Open @empty
No orders match

Try clearing filters or searching by order number, email, SKU, or tracking.

Reset filters
@endforelse

Showing {{ $orders->firstItem() ?? 0 }}–{{ $orders->lastItem() ?? 0 }} of {{ number_format($orders->total()) }}

{{ $orders->links() }}
@endsection