@extends('layouts.admin') @section('title', 'Dashboard') @section('page_title', 'Dashboard') @section('content') {{-- ── TODAY STRIP ───────────────────────────────────────────────────────── --}}

Orders Today

{{ $ordersToday }}

{{ $ordersThisMonth }} this month

Revenue Today

KES {{ number_format($revenueToday) }}

KES {{ number_format($revenueThisWeek) }} this week

Pending Action

{{ $pendingOrders + $pendingPayment }}

{{ $pendingOrders }} orders · {{ $pendingPayment }} payments

Stock Alerts

{{ $outOfStock + $lowStock }}

{{ $outOfStock }} out · {{ $lowStock }} low (≤5)

{{-- ── ALL-TIME STATS ───────────────────────────────────────────────────── --}}

{{ number_format($totalOrders) }}

Total Orders

KES {{ number_format($totalRevenue) }}

Total Revenue

KES {{ number_format($revenueThisMonth) }} this month

{{ number_format($totalProducts) }}

Active Products

{{ number_format($totalUsers) }}

Total Customers

@if($newCustomersWeek > 0)

+{{ $newCustomersWeek }} this week

@endif
{{-- ── PENDING ORDERS (needs action) ──────────────────────────────── --}}

Needs Action @if($pendingOrders + $pendingPayment > 0) {{ $pendingOrders + $pendingPayment }} @endif

View all
@if($urgentOrders->isEmpty())

All caught up! No pending orders.

@else
@foreach($urgentOrders as $order)
@if($order->payment_status === 'pending') @else @endif

{{ $order->order_number }}

{{ $order->shipping_name }} · {{ $order->created_at->diffForHumans() }}

KES {{ number_format($order->total) }}

{{ $order->payment_status === 'pending' ? 'Unpaid' : ucfirst($order->status) }}
@endforeach
@endif
{{-- ── LOW STOCK ALERT ─────────────────────────────────────────────── --}}

Stock Alerts @if($outOfStock + $lowStock > 0) {{ $outOfStock + $lowStock }} @endif

View all
@if($lowStockProducts->isEmpty())

All products well stocked.

@else
@foreach($lowStockProducts as $product)
@if($product->primary_image) @else
@endif

{{ $product->name }}

{{ $product->category?->name }}

{{ $product->stock }}

{{ $product->stock === 0 ? 'Out of stock' : 'units left' }}

@endforeach
@endif
{{-- ── RECENT ORDERS ────────────────────────────────────────────────────── --}}

Recent Orders

View all orders
@forelse($recentOrders as $order) @empty @endforelse
Order Customer Amount Payment Status Date
{{ $order->order_number }}

{{ $order->shipping_name }}

{{ $order->shipping_phone }}

KES {{ number_format($order->total) }} {{ ucfirst($order->payment_status) }} {{ ucfirst($order->status) }} {{ $order->created_at->format('d M, H:i') }}
No orders yet.
@endsection