@extends('layouts.app') @section('title', 'Dashboard') @section('content') {{-- Hero Welcome Section --}}

{{ __('Good ' . (now()->hour < 12 ? 'Morning' : (now()->hour < 17 ? 'Afternoon' : 'Evening')) . ', ' . Auth::user()->name) }}

Professional invoices made easy. Quickly understand who your best customers are and motivate them to pay their bills.

{{-- Top Stats Row --}}

Active Products

{{ $activeProducts }}

Total active

Active Customers

{{ $activeCustomers }}

Total active

Taxable Revenue

₹{{ number_format($taxableRevenue, 0) }}

Date range

Non-Taxable Revenue

₹{{ number_format($nonTaxableRevenue, 0) }}

Date range

Pending Payments

₹{{ number_format($pendingPayments, 0) }}

Unpaid total

Low Stock

{{ $lowStockProducts }}

Alert items

{{-- Main Charts Row --}}
{{-- Payment Activity --}}

Sales Overview

@foreach(['7days' => '7 Days', '30days' => '30 Days', '6months' => '6 Months', '1year' => '1 Year'] as $key => $label) @endforeach
{{-- {{-- Structure Widget --}}

Structure

Invoiced ₹{{ number_format($invoicedTotal, 0) }}
@php $invPct = $invoicedTotal > 0 ? 100 : 0; @endphp
Collected ₹{{ number_format($collectedTotal, 0) }}
@php $colPct = $invoicedTotal > 0 ? round(($collectedTotal / $invoicedTotal) * 100) : 0; @endphp
Outstanding ₹{{ number_format($outstandingTotal, 0) }}
@php $outPct = $invoicedTotal > 0 ? round(($outstandingTotal / $invoicedTotal) * 100) : 0; @endphp
Collection Rate {{ $colPct }}%
{{-- Dashboard Widgets Row --}}
{{-- Payment Overview --}}

Payment Overview

Monthly
Received Amount

₹{{ number_format($collectedTotal, 0) }}

Due Amount

₹{{ number_format($outstandingTotal, 0) }}

{{-- Recent Transactions --}}

Recent Transaction

Latest stock movements

View All
@if($recentTransactions->count() > 0)
@foreach($recentTransactions as $txn)
@if($txn->transaction_type === 'in') @else @endif

{{ $txn->product->name ?? 'Unknown Product' }}

{{ $txn->created_at->format('d M, Y h:i A') }}

{{ $txn->transaction_type === 'in' ? '+' : '-' }}{{ number_format($txn->quantity, 0) }}
@endforeach
@else

No transactions yet

@endif
{{-- Recently Sold + Top Customers Row --}}
{{-- Recently Sold Products --}}

Recently Sold Products

Latest product sales

@if($recentlySoldProducts->count() > 0)
@foreach($recentlySoldProducts as $item)

{{ $item->product->name ?? 'Unknown' }}

Qty: {{ $item->quantity }} — ₹{{ number_format($item->line_total, 2) }}

{{ $item->created_at->format('d M') }}
@endforeach
@else

No sales yet

@endif
{{-- Top Purchased Customers --}}

Top Purchased Customers

Highest spending customers

@if($topCustomers->count() > 0)
@foreach($topCustomers as $index => $entry)
{{ $loop->iteration }}

{{ $entry->customer->customer_name ?? 'Unknown' }}

{{ ['dealer' => 'Distributor', 'shop' => 'Shop', 'ecom' => 'Ecom', 'customer' => 'Customer'][$entry->customer->customer_type] ?? $entry->customer->customer_type ?? '' }}

₹{{ number_format($entry->total_amount, 0) }}
@endforeach
@else

No data yet

@endif
{{-- Sales Bar Chart --}} {{-- Secondary Charts Row --}}

Top Selling Products

Customer Growth (Last 30 Days)

--}} {{-- Low Stock Alerts --}}

Low Stock Alerts

Products that need restocking

@if($lowStockProductsList->count() > 0) {{ $lowStockProductsList->count() }} products @endif
@if($lowStockProductsList->count() > 0)
@foreach($lowStockProductsList as $index => $product)

{{ $product->name }}

SKU: #{{ $product->id }}

{{ $product->stock_quantity }} left
Stock level {{ $product->stock_quantity }} / {{ $product->stock_alert_limit }} (alert limit)
@php $pct = $product->stock_alert_limit > 0 ? ($product->stock_quantity / $product->stock_alert_limit) * 100 : 0; @endphp
@endforeach
@else

All stocked up!

No low stock products to worry about.

@endif
@endsection @push('scripts') @endpush