@extends('layouts.app') {{-- Hidden element to store revenue data for JavaScript --}} @section('content') @if (session('success'))
{{ session('success') }}
@endif @if (session('error'))
{{ session('error') }}
@endif
Admin Dashboard
{{-- TOP CARDS SECTION --}}
{{-- TOTAL SALES CARD --}} {{-- TOTAL ORDERS CARD --}} {{-- PENDING ORDERS CARD (REPLACED TOTAL VISITORS) --}} {{-- TOTAL PRODUCTS CARD --}} {{-- TOTAL DELIVERED ORDERS CARD (REPLACED TOTAL EXPENSE) --}}
{{-- DYNAMIC REVENUE ANALYTICS CHART --}}
Revenue Analytics
@php $currentPeriodData = $revenueAnalytics['yearly']; $totalRevenue = array_sum($currentPeriodData['sales']); $avgRevenue = count($currentPeriodData['sales']) > 0 ? $totalRevenue / count($currentPeriodData['sales']) : 0; // Calculate growth (compare first half vs second half) $halfPoint = floor(count($currentPeriodData['sales']) / 2); $firstHalfTotal = array_sum(array_slice($currentPeriodData['sales'], 0, $halfPoint)); $secondHalfTotal = array_sum(array_slice($currentPeriodData['sales'], $halfPoint)); $growthPercentage = 0; if ($firstHalfTotal > 0) { $growthPercentage = (($secondHalfTotal - $firstHalfTotal) / $firstHalfTotal) * 100; } $isPositiveGrowth = $growthPercentage >= 0; @endphp
Rs. {{ number_format($totalRevenue, 2) }}
{{ number_format(abs($growthPercentage), 1) }}% + Rs. {{ number_format($avgRevenue, 2) }} Per Period
Monthly Target
5,000

10% - 20 Per Day

Top Category
  • New: 500
  • Subscribed: 300
{{-- ACTIVE & COMPLETED ORDERS TABLE --}}
View All
{{-- ACTIVE ORDER TAB --}}
@forelse($activeOrders as $order) @empty @endforelse
Users Order On Payment Status Status
{{ $order->customer->FullName ?? 'N/A' }}
{{ $order->customer->Email ?? 'N/A' }}
{{ \Carbon\Carbon::parse($order->CreatedDate)->format('d M Y') }} {{ $order->PaymentStatus ?? 'N/A' }} {{ $order->orderStatus->Name ?? 'N/A' }}
No active orders found.
{{-- COMPLETED ORDER TAB --}}
@forelse($completedOrders as $order) @empty @endforelse
Users Order On Payment Status Status
{{ $order->customer->FullName ?? 'N/A' }}
{{ $order->customer->Email ?? 'N/A' }}
{{ \Carbon\Carbon::parse($order->CreatedDate)->format('d M Y') }} {{ $order->PaymentStatus ?? 'N/A' }} {{ $order->orderStatus->Name ?? 'N/A' }}
No completed orders found.
{{-- TRAFFIC SOURCE --}}
Traffic Source
View All
Dianne Russell
Agent ID: 36254
Rs. 20
Wade Warren
Agent ID: 36254
Rs. 20
Albert Flores
Agent ID: 36254
Rs. 30
Bessie Cooper
Agent ID: 36254
Rs. 40
Arlene McCoy
Agent ID: 36254
Rs. 10
Arlene McCoy
Agent ID: 36254
Rs. 10
{{-- TOP COUNTRIES --}}
Top Countries
USA
1,240 Users
80%
Japan
1,240 Users
60%
France
1,240 Users
49%
Germany
1,240 Users
100%
South Korea
1,240 Users
30%
USA
1,240 Users
80%
Convertion Rate
  • Word: 500
  • Image: 300
@endsection @section('script') {{-- Include the revenue chart script --}} @endsection