@extends('layout.app') @section('content')
{{-- ── Page title ─────────────────────────────────────── --}}

Dashboard

{{-- ── Row 1: KPI stat cards ───────────────────────────── --}}
{{-- Sales Revenue --}}

Sales This Month

₹{{ number_format($salesThisMonth->revenue, 0) }}

@if($salesRevenueChange >= 0) {{ abs($salesRevenueChange) }}% @else {{ abs($salesRevenueChange) }}% @endif vs last month

{{ $salesThisMonth->count }} invoices View all →
{{-- Purchase Spend --}}

Purchases This Month

₹{{ number_format($purchasesThisMonth->spend, 0) }}

@if($purchaseSpendChange >= 0) {{ abs($purchaseSpendChange) }}% @else {{ abs($purchaseSpendChange) }}% @endif vs last month

{{ $purchasesThisMonth->count }} invoices View all →
{{-- Products --}}

Products

{{ number_format($totalProducts) }}

{{ $activeProducts }} active

{{ $inStockCount }} in stock View all →
{{-- Customers --}}

Customers

{{ number_format($totalCustomers) }}

{{ $activeCustomers }} active

{{ $totalSuppliers }} suppliers View all →
{{-- end KPI row --}} {{-- ── Row 2: Charts ───────────────────────────────────── --}}
{{-- 12-Month Sales vs Purchases Trend --}}

Sales vs Purchases — Last 12 Months

Sales Purchases
{{-- Today Summary --}}

Today's Summary

Sales Today
{{ $todaySalesCount }} invoices
Purchases Today
{{ $todayPurchaseCount }} invoices
In Stock (pieces)
{{ number_format($inStockCount) }}
Active Suppliers
{{ $activeSuppliers }}
{{-- end charts row --}} {{-- ── Row 3: Recent Sales + Recent Purchases ──────────── --}}
{{-- Recent Sales --}}

Recent Sales

New Sale
@forelse($recentSales as $sale) @empty @endforelse
Invoice Customer Date Amount Status
{{ $sale->sale_number }} {{ $sale->customer?->display_name ?? 'Walk-in' }} {{ $sale->sale_date->format('d M Y') }} ₹{{ number_format($sale->grand_total, 2) }} {{ $sale->statusLabel() }}
No sales recorded yet
{{-- Recent Purchases --}}

Recent Purchases

New Purchase
@forelse($recentPurchases as $purchase) @empty @endforelse
Invoice Supplier Amount Status
{{ $purchase->invoice_number }}
{{ $purchase->purchase_date->format('d M Y') }}
{{ $purchase->supplier?->display_name }} ₹{{ number_format($purchase->grand_total, 0) }} {{ $purchase->statusLabel() }}
No purchases recorded yet
{{-- end recent tables row --}} {{-- ── Row 4: Quick Actions ─────────────────────────────── --}}
{{-- end quick actions --}}
@endsection @push('scripts') @php $chartMonths = $months; $chartSalesData = $salesData; $chartPurchaseData = $purchaseData; $todaySales = $todaySalesCount; $todayPurchases = $todayPurchaseCount; @endphp @endpush