@extends('admin.layouts.app')
@section('title', 'Dashboard')
@section('heading', 'Dashboard')
@section('content')
{{-- Stats Grid --}}
Total Orders
{{ $stats['total_orders'] }}
Pending
{{ $stats['pending_orders'] }}
Today
Rs {{ number_format($stats['today_revenue'], 0) }}
This Week
Rs {{ number_format($stats['week_revenue'], 0) }}
This Month
Rs {{ number_format($stats['month_revenue'], 0) }}
This Year
Rs {{ number_format($stats['year_revenue'], 0) }}
{{-- User Activity Stats --}}
Today's New Users
{{ $activityStats['today_users'] }}
Today's Logins
{{ $activityStats['today_logins'] }}
Guest Visitors
{{ $activityStats['today_guests'] }}
Total Users
{{ $activityStats['total_users'] }}
{{-- Real-time Analytics --}}
Live Visitors
{{ $onlineUsers }}
Registered: {{ $registeredOnline }}
Guests: {{ $guestsOnline }}
@if($mostViewedPages->count())
@foreach($mostViewedPages as $page)
{{ $page->page_url }}
{{ $page->views }}
@endforeach
@else
No data yet
@endif
@if($mostClickedImages->count())
@foreach($mostClickedImages as $img)
{{ basename($img->image_src) }}
{{ $img->clicks }}
@endforeach
@else
No data yet
@endif
{{-- Device Breakdown --}}
@foreach(['desktop', 'mobile', 'tablet'] as $device)
{{ ucfirst($device) }}
{{ $deviceStats[$device] ?? 0 }}
@endforeach
{{-- Revenue Summary --}}
Total Revenue (All Time)
Rs {{ number_format($stats['total_revenue'], 0) }}
Day
Rs {{ number_format($stats['today_revenue'], 0) }}
Week
Rs {{ number_format($stats['week_revenue'], 0) }}
Month
Rs {{ number_format($stats['month_revenue'], 0) }}
Year
Rs {{ number_format($stats['year_revenue'], 0) }}
{{-- Order Status Breakdown --}}
@foreach(['pending','confirmed','complete'] as $st)
@php $count = $byStatus[$st] ?? 0; $total = max($stats['total_orders'], 1); $pct = round($count / $total * 100); @endphp
{{ $st }}
{{ $count }} ({{ $pct }}%)
@endforeach
{{-- Quick Links --}}
{{-- User Activity Section --}}
{{-- New Users --}}
@if($newUsers->count())
@foreach($newUsers as $log)
{{ $log->metadata['user_name'] ?? 'User' }}
{{ $log->metadata['user_email'] ?? '' }}
{{ $log->created_at->format('M d') }}
{{ $log->created_at->format('h:i A') }}
@endforeach
@else
No new registrations today
@endif
{{-- Recent Logins --}}
@if($recentLogins->count())
@foreach($recentLogins as $log)
{{ $log->user?->name ?? 'User' }}
{{ $log->user?->email ?? '' }}
{{ $log->created_at->format('M d') }}
{{ $log->created_at->format('h:i A') }}
@endforeach
@else
No logins today
@endif
{{-- Guest Visitors --}}
@if($guestVisitors->count())
@foreach($guestVisitors as $guest)
{{ $guest->page ?? 'Unknown' }}
{{ $guest->created_at->format('h:i A') }}
@endforeach
@else
No guest visitors today
@endif
{{-- Recent Orders --}}
@if($recentOrders->count())
| # | Customer | Items | Total | Status | Date | |
@foreach($recentOrders as $o)
| #{{ $o->id }} |
{{ $o->name }} {{ $o->email }} |
{{ $o->items->count() }} item{{ $o->items->count() != 1 ? 's' : '' }} |
Rs {{ number_format($o->total, 0) }} |
{{ ucfirst($o->status) }} |
{{ $o->created_at->format('M d, Y') }} |
|
@endforeach
@else
No orders yet.
@endif
@endsection