@push('title') Dashboard @endpush
{{-- Page Header --}}

Business Dashboard

Welcome back, {{ auth()->user()->name }} — here's what's happening today.

{{ now()->format('l, d M Y') }}
{{-- ═══════════════════════════════════════════════════════════════════ --}} {{-- KPI ROW 1 — Revenue, Profit, Debt, Returns --}} {{-- ═══════════════════════════════════════════════════════════════════ --}}
Today's Revenue

LKR {{ number_format($salesToday, 2) }}

Sales made today
Monthly Revenue

LKR {{ number_format($salesThisMonth, 2) }}

{{ abs($salesGrowth) }}% vs last month
Monthly Profit

LKR {{ number_format($profitThisMonth, 2) }}

Net after discounts
Outstanding Debt

LKR {{ number_format($totalDueAmount, 2) }}

Total from customers
Supplier Outstanding

LKR {{ number_format($totalSupplierOutstanding, 2) }}

Total payable to vendors
{{-- KPI ROW 2 — Customers, Products, Low Stock, Returns --}}
{{ number_format($totalCustomers) }}
Total Customers
+{{ $newCustomersThisMonth }} this month
{{ number_format($totalProducts) }}
Active Products
{{ $lowStockCount }}
Low Stock Batches
{{ $outOfStockCount }} out of stock
{{ $returnsThisMonth }}
Returns This Month
{{-- ═══════════════════════════════════════════════════════════════════ --}} {{-- CHARTS ROW --}} {{-- ═══════════════════════════════════════════════════════════════════ --}}
{{-- Revenue Trend --}}
Revenue Trend
Last 30 days daily revenue (LKR)
Last 30 Days
{{-- Payment Split --}}
Payment Split
Cash vs Credit — this month
LKR {{ number_format($cashSales, 0) }}
Cash
LKR {{ number_format($creditSales, 0) }}
Credit
{{-- Top Products + Top Customers --}}
Top Selling Products
By quantity sold — this month
@forelse($topProducts as $item) @php $maxQty = $topProducts->max('total_qty'); $pct = $maxQty > 0 ? round(($item->total_qty / $maxQty) * 100) : 0; @endphp
{{ $item->product->name ?? 'N/A' }} {{ number_format($item->total_qty) }} units
Revenue: LKR {{ number_format($item->total_revenue, 0) }}
@empty
No sales data this month.
@endforelse
Top Customers
By spend — this month
@forelse($topCustomers as $i => $tc) @empty @endforelse
# Customer Orders Total Spent
{{ $i + 1 }} {{ $tc->customer->name ?? 'Walk-in' }} {{ $tc->order_count }} LKR {{ number_format($tc->total_spent, 0) }}
No data this month.
{{-- ═══════════════════════════════════════════════════════════════════ --}} {{-- BOTTOM TABLES --}} {{-- ═══════════════════════════════════════════════════════════════════ --}}
{{-- Recent Sales --}}
Recent Sales
Latest 8 transactions
View All
@forelse($recentSales as $sale) @empty @endforelse
Invoice Customer Warehouse Type Amount Status
{{ $sale->invoice_no }}
{{ $sale->created_at->diffForHumans() }}
{{ $sale->customer->name ?? 'Walk-in' }} {{ $sale->warehouse->name ?? 'N/A' }} @if($sale->payment_type == 1) Cash @else Credit @endif LKR {{ number_format($sale->grand_total, 2) }} @if($sale->payment_status == 2) Paid @elseif($sale->payment_status == 1) Partial @else Unpaid @endif
No sales yet.
{{-- Outstanding Debts --}}
Outstanding Debts
Top unpaid balances
{{ $outstandingDebts->count() }}
@forelse($outstandingDebts as $debt)
{{ $debt->customer->name ?? 'Walk-in' }}
{{ $debt->invoice_no }}
LKR {{ number_format($debt->due_amount, 0) }}
@if($debt->payment_status == 1) Partial @else Unpaid @endif
@empty

No outstanding debts!

@endforelse
{{-- Sales Forecasting --}} @if(count($inventoryForecast) > 0)
Inventory Forecast (Next 30 Days)
Predicting needs based on last 30 days of sales
{{ count($inventoryForecast) }} Items Suggested
@foreach($inventoryForecast as $fItem) @endforeach
Product & Variation Sold (Last 30d) Current Total Stock Suggested to Order
{{ $fItem->product->name ?? 'N/A' }} @if($fItem->variation && $fItem->variation->variationType)
{{ $fItem->variation->variationType->name }}
@endif
{{ number_format($fItem->sold_last_30_days) }} {{ number_format($fItem->current_stock) }} {{ number_format($fItem->suggested_order) }} units
@endif {{-- Low Stock Alert --}} @if($lowStockCount > 0 || $outOfStockCount > 0)
Low Stock Alert
Batches with ≤10 units remaining
View Products
@foreach($lowStockItems as $batch) @endforeach
Product Details Variation Batch / Barcode Warehouse Stock Left Status
{{ $batch->product->name ?? 'N/A' }}
{{ $batch->product->brand->name ?? 'No Brand' }}
{{ $batch->productVariation->variationType->name ?? 'Single' }}
No: {{ $batch->batch_no }}
BC: {{ $batch->productVariation->barcode ?? 'N/A' }}
{{ $batch->warehouse->name ?? 'N/A' }} {{ $batch->current_stock }} @if($batch->current_stock <= 3) Critical @elseif($batch->current_stock <= 5) Very Low @else Low @endif
@endif
{{-- ═══════════════════════════════════════════════════════════════════════ --}} {{-- CHART.JS SCRIPTS --}} {{-- ═══════════════════════════════════════════════════════════════════════ --}}