@extends('layouts.app') @php $dashboardCurrency = currency_code(default_currency()); @endphp @section('title', 'Admin Dashboard') @section('content')
{{-- Page Header --}}

Dashboard

Overview of your marketplace performance and key metrics

{{ now()->format('M d, Y H:i') }}
{{-- Time Range Filter --}}
Range: @foreach(['day' => 'Today', 'week' => 'This Week', 'month' => 'This Month', 'year' => 'This Year', 'all' => 'All Time'] as $key => $label) {{ $label }} @endforeach
{{-- Key Metrics --}} @include('admin.partials.dashboard-metrics', ['metrics' => $metrics, 'comparison' => $comparison]) {{-- Pending Actions Alert --}} @if(($pendingActions['total'] ?? 0) > 0) @include('admin.partials.dashboard-pending-actions', ['pendingActions' => $pendingActions]) @endif {{-- Charts Section --}}
Performance Overview
Revenue, orders, and user growth trends
Order Fulfilment
{{ number_format((int) collect($orderStatusSummary)->sum()) }}
@php $orderStatusPresentation = [ 'pending_payment' => ['label' => __('Pending Payment'), 'color' => 'warning'], 'processing' => ['label' => __('Processing'), 'color' => 'info'], 'shipped' => ['label' => __('Shipped'), 'color' => 'primary'], 'completed' => ['label' => __('Completed'), 'color' => 'success'], 'cancelled' => ['label' => __('Cancelled'), 'color' => 'danger'], 'refunded' => ['label' => __('Refunded'), 'color' => 'secondary'], ]; @endphp @foreach($orderStatusSummary as $status => $count) @php $presentation = $orderStatusPresentation[$status] ?? [ 'label' => ucfirst(str_replace('_', ' ', $status)), 'color' => 'secondary', ]; @endphp @if((int) $count > 0)
  {{ $presentation['label'] }} {{ number_format((int) $count) }}
@endif @endforeach
{{-- Top Performers --}}
@include('admin.partials.dashboard-top-list', [ 'title' => 'Top Sellers', 'icon' => 'fa-trophy', 'color' => 'warning', 'items' => $topSellers, 'primaryField' => 'seller_name', 'secondaryField' => 'total_orders', 'valueField' => 'total_revenue', 'currency' => $dashboardCurrency, 'extraField' => 'total_items_sold', 'extraLabel' => 'items', 'emptyMessage' => 'No seller data available yet' ])
@include('admin.partials.dashboard-top-list', [ 'title' => 'Top Products', 'icon' => 'fa-crown', 'color' => 'primary', 'items' => $topProducts, 'primaryField' => 'product_title', 'secondaryField' => 'total_orders', 'valueField' => 'total_revenue', 'currency' => $dashboardCurrency, 'extraField' => 'total_quantity_sold', 'extraLabel' => 'sold', 'imageField' => 'image', 'emptyMessage' => 'No product data available yet' ])
@include('admin.partials.dashboard-top-list', [ 'title' => 'Top Categories', 'icon' => 'fa-tags', 'color' => 'success', 'items' => $topCategories, 'primaryField' => 'category_name', 'secondaryField' => 'product_count', 'secondaryLabel' => 'total products', 'badgeField' => 'active_products', 'badgeLabel' => 'active', 'emptyMessage' => 'No category data available yet' ])
{{-- Recent Activity --}}
@include('admin.partials.dashboard-recent-list', [ 'title' => 'Recent Orders', 'icon' => 'fa-clock', 'color' => 'info', 'items' => $recentOrders, 'route' => 'admin.orders.show', 'routeParam' => 'id', 'routeList' => 'admin.orders.index', 'primaryField' => 'order_number', 'primaryPrefix' => '#', 'secondaryField' => 'buyer_name', 'valueField' => 'total', 'currency' => $dashboardCurrency, 'currencyField' => 'price_currency', 'badgeField' => 'status', 'emptyMessage' => 'No recent orders' ])
@include('admin.partials.dashboard-recent-list', [ 'title' => 'Recent Users', 'icon' => 'fa-user-plus', 'color' => 'success', 'items' => $recentUsers, 'route' => 'admin.users.show', 'routeParam' => 'id', 'routeList' => 'admin.users.index', 'primaryField' => 'username', 'secondaryField' => 'email', 'badgeField' => 'role', 'metaField' => 'joined', 'avatarField' => 'avatar', 'emptyMessage' => 'No recent users' ])
Quick Actions
@foreach([ ['route' => 'admin.orders.index', 'icon' => 'fa-shopping-bag', 'label' => 'Orders', 'color' => 'primary'], ['route' => 'admin.products.index', 'icon' => 'fa-cube', 'label' => 'Products', 'color' => 'primary'], ['route' => 'admin.users.index', 'icon' => 'fa-users', 'label' => 'Users', 'color' => 'primary'], ['route' => 'admin.wallet.index', 'icon' => 'fa-wallet', 'label' => 'Wallet', 'color' => 'primary'], ['route' => 'admin.payments.bank-transfers', 'icon' => 'fa-university', 'label' => 'Bank Transfers', 'color' => 'warning'], ['route' => 'admin.refunds.index', 'icon' => 'fa-undo', 'label' => 'Refunds', 'color' => 'danger'], ['route' => 'admin.payouts.index', 'icon' => 'fa-money-bill-wave', 'label' => 'Payouts', 'color' => 'success'], ['route' => 'admin.support.index', 'icon' => 'fa-headset', 'label' => 'Support', 'color' => 'info'], ['route' => 'admin.blog-posts.index', 'icon' => 'fa-newspaper', 'label' => 'Blog', 'color' => 'secondary'], ['route' => 'admin.settings.edit', 'icon' => 'fa-cog', 'label' => 'Settings', 'color' => 'dark'], ['route' => 'admin.reports.index', 'icon' => 'fa-chart-bar', 'label' => 'Reports', 'color' => 'secondary'], ['route' => 'admin.audit-logs.index', 'icon' => 'fa-history', 'label' => 'Audit Log', 'color' => 'secondary'], ] as $action) @endforeach
{{-- Sales Overview --}} @if(!empty($salesOverview['by_payment_method']) || !empty($salesOverview['by_product_type']))
Sales Overview
@if(!empty($salesOverview['by_payment_method']))
By Payment Method
@php $total = array_sum($salesOverview['by_payment_method']); @endphp @foreach($salesOverview['by_payment_method'] as $method => $amount)
{{ ucfirst(str_replace('_', ' ', $method)) }} {{ money($amount, $dashboardCurrency) }} ({{ $total > 0 ? round(($amount / $total) * 100, 1) : 0 }}%)
@endforeach
@endif @if(!empty($salesOverview['by_product_type']))
By Product Type
@php $total = array_sum($salesOverview['by_product_type']); @endphp @foreach($salesOverview['by_product_type'] as $type => $amount)
{{ ucfirst($type) }} {{ money($amount, $dashboardCurrency) }} ({{ $total > 0 ? round(($amount / $total) * 100, 1) : 0 }}%)
@endforeach
@endif
Net Revenue
{{ money($salesOverview['net_revenue'] ?? 0, $dashboardCurrency) }}
Refunds
{{ money($salesOverview['refunds'] ?? 0, $dashboardCurrency) }}
Period Revenue
{{ money(($salesOverview['net_revenue'] ?? 0) + ($salesOverview['refunds'] ?? 0), $dashboardCurrency) }}
@endif {{-- Geographic Data --}} @if(!empty($geoData['countries']) || !empty($geoData['states']))
@if(!empty($geoData['countries']))
Top Countries
@foreach($geoData['countries'] as $country)
{{ $country['country'] ?? 'Unknown' }} {{ $country['total_orders'] ?? 0 }} orders
@endforeach
@endif @if(!empty($geoData['states']))
Top States
@foreach($geoData['states'] as $state)
{{ $state['state'] ?? 'Unknown' }} {{ $state['total_orders'] ?? 0 }} orders
@endforeach
@endif
@endif
@endsection @push('styles') @endpush @push('scripts') @endpush