@extends('layouts.admin.app', ['page' => $menuAdmin['dashboard']['active'] ?? ""]) @section('title', __('labels.dashboard')) @section('header_data') @php $page_title = __('labels.dashboard'); $page_pretitle = __('labels.admin') . " " . __('labels.dashboard'); @endphp @endsection @php $breadcrumbs = [ ['title' => __('labels.home'), 'url' => ''] ]; @endphp @section('admin-content') @if($viewPermission ?? false) {{-- Home Page Builder Mandatory & Migration Notice --}} {{-- Zone Selector Bar --}}
{{ __('labels.zone') }}
@foreach(array_slice($activeZones, 0, 5) as $zone) @endforeach @if(count($activeZones) > 5) +{{ count($activeZones) - 5 }} {{ __('labels.more') }} @endif
@if($zoneId ?? null) {{ __('labels.filtered_by_zone') }} @else {{ __('labels.showing_all_zones') }} @endif

Welcome back, {{$user->name ?? "Power"}}

{{ $conversionRateData['rate'] ?? 0 }}%
{{ __('labels.conversion_rate') }}
{{ abs($conversionRateData['percentage_change'] ?? 0) }}%
{{ $conversionRateData['delivered_orders'] ?? 0 }} {{ __('labels.delivered_out_of_total_orders') }} {{ $conversionRateData['total_orders'] ?? 0 }}
{{ $conversionRateData['rate'] ?? 0 }}% {{ __('labels.complete') }}
Sales Illustration
{{ $revenueDataBg['currency_totals_display'] ?? $revenueDataBg['formatted_total'] ?? 0 }}
{{ count($revenueDataBg['daily'] ?? []) }} {{ __('labels.days') }}
{{ $newUserRegistrationsData['count'] }}
{{ abs($newUserRegistrationsData['percentage_change']) }}% @if($newUserRegistrationsData['is_increase']) @else @endif
{{-- Revenue vs Orders Dual-Axis Chart --}}
{{ $revenueVsOrders['total_orders'] }}
{{ __('labels.orders') }}
{{ $revenueVsOrders['formatted_total_revenue'] }}
{{ __('labels.revenue') }}
{{ $revenueVsOrders['formatted_aov'] }}
{{ __('labels.avg_order_value') }}
{{ $enhancedCommissionsData['total_commission'] }}
{{ __('labels.total_commission') }}
{{ $enhancedCommissionsData['total_orders'] }}
{{ __('labels.total_orders') }}
{{ $enhancedCommissionsData['avg_commission'] }}
{{ __('labels.avg_commission') }}
@forelse($topSellers as $index => $seller)
{{ $index + 1 }}
@if(!empty($seller['avatar'])) {{ $seller['name'] }} @else {{ strtoupper(substr($seller['name'], 0, 2)) }} @endif
{{ $seller['name'] }}
{{ $seller['total_orders'] }} {{ __('labels.orders') }}
{{ $seller['total_revenue'] }}
@empty
No data found
@endforelse
@forelse($topSellingProducts as $index => $product)
{{ $index + 1 }}
@if(!empty($product['image'])) {{ $product['name'] }} @else {{ strtoupper(substr($product['name'], 0, 1)) }} @endif
{{ $product['category'] }}
{{ $product['total_quantity'] }} {{ __('labels.sold') }}
{{ $product['total_revenue'] }}
@empty
No products found
@endforelse
@forelse($topDeliveryBoys as $index => $deliveryBoy)
{{ $index + 1 }}
@if(!empty($deliveryBoy['avatar'])) {{ ($deliveryBoy['name'] ?? @else {{ strtoupper(substr(($deliveryBoy['name'] ?? ""), 0, 2)) }} @endif
{{ ($deliveryBoy['name'] ?? "") }}
{{ $deliveryBoy['total_deliveries'] ?? 0 }} {{ __('labels.deliveries') }}
{{ $deliveryBoy['total_revenue'] ?? 0 }}
@empty
No products found
@endforelse
@foreach($categoriesWithFilters as $category)
@if($category['image']) {{ $category['title'] }} @else
{{ substr($category['title'], 0, 2) }}
@endif

{{ $category['title'] }}

{{ $category['products_count'] }} {{ __('labels.products') }}
@if(isset($category['total_sold']))
{{ $category['total_sold'] }} {{ __('labels.sold') }}
@endif
@endforeach
{{ __('labels.daily_orders_history') }}
{{ __('labels.todays_earning') }} : {{ $todaysEarning['formatted_today_display'] ?? $todaysEarning['formatted_today'] }}
@if($todaysEarning['is_increase']) @else @endif {{ abs($todaysEarning['percentage_change']) }} % {{ $todaysEarning['is_increase'] ? __('labels.more') : __('labels.less') }} {{ __('labels.than_yesterday') }}
{{-- Order Status Funnel --}}
@foreach($orderFunnel['funnel'] as $index => $stage) @php $maxCount = $orderFunnel['funnel'][0]['count'] ?? 1; $widthPercent = $maxCount > 0 ? max(20, ($stage['count'] / $maxCount) * 100) : 20; $bgColor = match($index) { 0 => 'bg-primary', 1 => 'bg-info', 2 => 'bg-azure', 3 => 'bg-success', 4 => 'bg-danger', default => 'bg-secondary', }; @endphp
{{ $stage['stage'] }} {{ $stage['count'] }}
@endforeach
{{ __('labels.conversion_rate') }}
{{ $orderFunnel['conversion_rate'] }}%
{{ __('labels.cancellation_rate') }}
{{ $orderFunnel['cancellation_rate'] }}%
{{-- Alerts & Action Items --}}

{{ __('labels.alerts_action_items') }}

{{ $alertsData['total'] }}
@if(count($alertsData['alerts']) > 0)
@foreach($alertsData['alerts'] as $alert)
{{ $alert['message'] }}
@if(isset($alert['action_route'])) {{ __('labels.view') }} @endif
@endforeach
@else

{{ __('labels.no_alerts') }}

@endif
{{-- Financial Overview Section --}}

{{ __('labels.financial_overview') }}

{{ __('labels.eod_reconciliation') }}
{{-- Seller Settlements --}}
{{ $sellerSettlements['pending_amount_display'] ?? $sellerSettlements['pending_amount'] }}
{{ __('labels.pending') }} ({{ $sellerSettlements['pending_count'] }})
{{ $sellerSettlements['settled_amount_display'] ?? $sellerSettlements['settled_amount'] }}
{{ __('labels.settled') }} ({{ $sellerSettlements['settled_count'] }})
{{ __('labels.total_outstanding') }}
{{ $sellerSettlements['total_outstanding_display'] ?? $sellerSettlements['total_outstanding'] }}
{{-- Delivery Boy Settlements --}}
{{ $dbSettlements['pending_amount'] }}
{{ __('labels.unpaid') }} ({{ $dbSettlements['pending_count'] }})
{{ $dbSettlements['paid_amount'] }}
{{ __('labels.paid') }} ({{ $dbSettlements['paid_count'] }})
{{ __('labels.total_unpaid_balance') }}
{{ $dbSettlements['total_unpaid'] }}
{{-- Withdrawals --}}
{{ $withdrawals['total_pending'] }}
{{ __('labels.pending') }}
{{ $withdrawals['approved_amount_display'] ?? $withdrawals['approved_amount'] }}
{{ __('labels.approved') }}
{{ $withdrawals['total_rejected'] }}
{{ __('labels.rejected') }}
{{ __('labels.seller') }}: {{ $withdrawals['seller_pending'] }} {{ __('labels.pending') }} {{ __('labels.delivery_boy') }}: {{ $withdrawals['db_pending'] }} {{ __('labels.pending') }}
@if($withdrawals['oldest_pending_days'] > 3)
{{ __('labels.oldest_pending_request') }}: {{ $withdrawals['oldest_pending_days'] }} {{ __('labels.days_ago') }}
@endif
{{-- Cash Collection --}}
{{ $cashCollection['total_collected_display'] ?? $cashCollection['total_collected'] }}
{{ __('labels.collected') }}
{{ $cashCollection['total_submitted_display'] ?? $cashCollection['total_submitted'] }}
{{ __('labels.submitted') }}
{{ $cashCollection['unsubmitted_display'] ?? $cashCollection['unsubmitted'] }}
{{ __('labels.unsubmitted') }}
@if($cashCollection['top_collector_name'])
{{ __('labels.top_collector') }}: {{ $cashCollection['top_collector_name'] }} ({{ $cashCollection['top_collector_amount'] }})
@endif
{{-- Ad Campaigns --}}
{{ $adCampaigns['active_campaigns'] }}
{{ __('labels.active') }}
{{ $adCampaigns['total_spend'] }}
{{ __('labels.spend') }}
{{ $adCampaigns['total_clicks'] }}
{{ __('labels.clicks') }}
@if(count($adCampaigns['top_campaigns']) > 0)
@foreach($adCampaigns['top_campaigns'] as $campaign)
{{ Str::limit($campaign['name'], 20) }}
{{ $campaign['clicks'] }} {{ __('labels.clicks') }} {{ $campaign['spent'] }}
@endforeach
@endif
{{-- Seller Subscriptions --}}
{{ $subscriptions['active_count'] }}
{{ __('labels.active_subscriptions') }}
{{ $subscriptions['revenue'] }}
{{ __('labels.revenue') }}
{{ __('labels.popular_plan') }}: {{ $subscriptions['popular_plan'] }}
@if($subscriptions['expiring_soon'] > 0) {{ $subscriptions['expiring_soon'] }} {{ __('labels.expiring_soon') }} @else {{ __('labels.none_expiring') }} @endif
{{-- Customer Insights --}}
{{ $customerInsights['repeat_rate'] }}%
{{ __('labels.repeat_rate') }}
{{ $customerInsights['avg_basket_size'] }}
{{ __('labels.avg_basket_size') }}
{{ $customerInsights['churn_risk'] }}
{{ __('labels.churn_risk') }}

{{ __('labels.new_customers') }} {{ $customerInsights['new_customers'] }}
{{ __('labels.returning_customers') }} {{ $customerInsights['returning_customers'] }}
{{ __('labels.total_active_customers') }}: {{ $customerInsights['total_customers'] }}
{{-- Top Stores --}}
@if(count($topStores) > 0)
@foreach($topStores as $index => $store)
{{ $store['name'] }}
{{ $store['total_orders'] }} {{ __('labels.orders') }}
{{ $store['total_revenue'] }}
@endforeach
@else

{{ __('labels.no_data_found') }}

@endif
{{-- Top Zones (only in "All Zones" mode) --}} @if(!($zoneId ?? null))
@if(count($topZones) > 0)
@foreach($topZones as $zone)
{{ $zone['name'] }}
{{ $zone['total_orders'] }} {{ __('labels.orders') }} ยท {{ $zone['active_delivery_boys'] }} {{ __('labels.delivery_boys') }}
{{ $zone['total_revenue'] }}
{{ $zone['delivery_rate'] }}% {{ __('labels.delivered') }}
@endforeach
@else

{{ __('labels.no_data_found') }}

@endif
@endif {{-- Zone Health Panel --}}
@foreach($zoneHealth['zones'] as $zone) @endforeach
{{ __('labels.zone') }} {{ __('labels.orders') }} {{ __('labels.delivered') }} {{ __('labels.delivery_rate') }} {{ __('labels.revenue') }} {{ __('labels.growth') }} {{ __('labels.delivery_boys') }} {{ __('labels.stores') }}
{{ $zone['name'] }}
{{ $zone['total_orders'] }} {{ $zone['delivered_orders'] }} {{ $zone['delivery_rate'] }}% {{ $zone['revenue'] }} {{ $zone['revenue_growth'] >= 0 ? '+' : '' }}{{ $zone['revenue_growth'] }}% {{ $zone['active_delivery_boys'] }}/{{ $zone['total_delivery_boys'] }} {{ $zone['store_count'] }}
@endif @endsection @push('styles') @endpush @push('scripts') @endpush