@extends('backend.template.layouts.template-base') @section('title', (($activeTab ?? 'overview') === 'orders' ? 'Orders' : (($activeTab ?? 'overview') === 'sales' ? 'Sales' : (($activeTab ?? 'overview') === 'customers' ? 'Customers' : (($activeTab ?? 'overview') === 'salad-orders' ? 'Salad Orders' : 'Dashboard')))) . ' | ' . config('app.name')) @section('styles') @endsection @section('content') @php $routeUrl = fn ($name, $params = []) => \Illuminate\Support\Facades\Route::has($name) ? route($name, $params) : 'javascript:void(0);'; $fallbackProductImage = asset('backend/template/svg-icon/product-img.svg'); $imageUrl = fn ($path) => $path ? (preg_match('/^https?:\/\//i', (string) $path) ? $path : asset($path)) : $fallbackProductImage; $dashboardTabUrl = fn ($tab) => $routeUrl('backend.template.dashboard.index', array_filter([ 'tab' => $tab === 'overview' ? null : $tab, 'from' => $filters['from'] ?? null, 'to' => $filters['to'] ?? null, ], fn ($value) => $value !== null && $value !== '')); $resetUrl = $routeUrl('backend.template.dashboard.index', in_array($activeTab, ['orders', 'sales', 'customers', 'salad-orders'], true) ? ['tab' => $activeTab] : []); $pageTitle = match ($activeTab) { 'orders' => 'Orders', 'sales' => 'Sales', 'customers' => 'Customers', 'salad-orders' => 'Salad Orders', default => 'Dashboard', }; $pageSubtitle = match ($activeTab) { 'orders' => 'Order analytics overview for ' . $filters['label'], 'sales' => 'Sales analytics overview for ' . $filters['label'], 'customers' => 'Customer analytics overview for ' . $filters['label'], 'salad-orders' => 'Salad order performance overview for ' . $filters['label'], default => 'Analytics overview for ' . $filters['label'], }; $tabs = [ ['label' => 'Overview', 'icon' => 'ri-dashboard-line', 'url' => $dashboardTabUrl('overview'), 'active' => $activeTab === 'overview'], ['label' => 'Orders', 'icon' => 'ri-shopping-bag-3-line', 'url' => $dashboardTabUrl('orders'), 'active' => $activeTab === 'orders'], ['label' => 'Sales', 'icon' => 'ri-line-chart-line', 'url' => $dashboardTabUrl('sales'), 'active' => $activeTab === 'sales'], ['label' => 'Customers', 'icon' => 'ri-group-line', 'url' => $dashboardTabUrl('customers'), 'active' => $activeTab === 'customers'], ['label' => 'Revenue', 'icon' => 'ri-wallet-3-line', 'url' => $routeUrl('backend.template.revenue.index')], ['label' => 'Products', 'icon' => 'ri-box-3-line', 'url' => $routeUrl('backend.template.product-dashboard.index')], ['label' => 'Stocks', 'icon' => 'ri-archive-stack-line', 'url' => $routeUrl('backend.template.stock-dashboard.index')], ['label' => 'Delivery', 'icon' => 'ri-truck-line', 'url' => $routeUrl('backend.template.delivery-dashboard.index')], ['label' => 'Salad Orders', 'icon' => 'ri-restaurant-2-line', 'url' => $dashboardTabUrl('salad-orders'), 'active' => $activeTab === 'salad-orders'], ]; @endphp

{{ $pageTitle }}

{{ $pageSubtitle }}

@if ($activeTab !== 'overview') @endif -
@foreach ($tabs as $tab) {{ $tab['label'] }} @endforeach
@if ($activeTab === 'overview')
@foreach ($kpis as $kpi)

{{ $kpi['label'] }}

{{ $kpi['display'] }}

{{ $kpi['trend']['display'] }} {{ $kpi['note'] }}
@endforeach

Sales Overview

Revenue and order volume trend

Delivered revenue

Revenue Breakdown

Total {{ $revenueBreakdown['total'] > 0 ? 'Rs. ' . number_format($revenueBreakdown['total'], 0) : 'Rs. 0' }}

@foreach ($revenueBreakdown['items'] as $item)
{{ $item['label'] }}
{{ $item['display'] }}
@endforeach

Quick Pulse

Live store health

Active Coupons

{{ number_format($quickStats['active_coupons']) }}

Verified Customers

{{ number_format($quickStats['verified_customers']) }}

Manual Customers

{{ number_format($quickStats['manual_customers']) }}

Active Products

{{ number_format($quickStats['products_active']) }}

Top Selling Products

View All
@if ($topProducts->isEmpty())
No delivered product sales found for this period.
@else
@foreach ($topProducts as $product)
{{ $loop->iteration }} {{ $product['name'] }}

{{ $product['name'] }}

{{ number_format($product['quantity']) }} units sold

{{ $product['revenue_display'] }}
@endforeach
@endif

Order Status

View Orders
@foreach ($orderStatus['items'] as $status)
{{ $status['label'] }} {{ number_format($status['count']) }}
@endforeach

Stock Alerts

View All
@if ($stockAlerts->isEmpty())
No low stock or pre order products right now.
@else
@foreach ($stockAlerts as $stock)
{{ $stock['name'] }}

{{ $stock['name'] }}

{{ $stock['status_label'] }} - {{ number_format($stock['qty']) }} left

Manage
@endforeach
@endif

Customer Growth

Customers

Monthly Performance

6 months

Customer Mix

Source split
@foreach ($customerSources['items'] as $source)
{{ $source['label'] }} {{ number_format($source['count']) }}
@endforeach

Payments

@foreach ($smartInsights as $insight)

{{ $insight['label'] }}

{{ $insight['display'] }}

{{ $insight['trend']['display'] }}

{{ $insight['note'] }}

@endforeach

Recent Orders

View All
@forelse ($recentOrders as $order) @empty @endforelse
Order ID Customer Items Amount Payment Placed On Status Action
{{ $order['order_no'] }}

{{ $order['customer'] }}

{{ $order['mobile'] }}

{{ number_format($order['items_count']) }} {{ $order['amount_display'] }} {{ $order['payment_method'] }} {{ $order['placed_at'] }} {{ $order['status_label'] }} View
No orders available.

Attention Required

Action center
@foreach ($attentionItems as $item) {{ $item['title'] }} {{ number_format($item['count']) }} @endforeach

Top Customers

View All
@if ($topCustomers->isEmpty())
No delivered customer revenue found for this period.
@else
@foreach ($topCustomers as $customer)
{{ $loop->iteration }}

{{ $customer['name'] }}

{{ $customer['orders'] }} completed orders

{{ $customer['revenue_display'] }}
@endforeach
@endif

Delivery Intelligence

Delivery Team

Active Riders

{{ number_format($deliveryAnalytics['active']) }}

Inactive Riders

{{ number_format($deliveryAnalytics['inactive']) }}

Live Assignments

{{ number_format($deliveryAnalytics['assigned_live']) }}

Delivered

{{ number_format($deliveryAnalytics['delivered']) }}

Average dispatch to delivery time

{{ $deliveryAnalytics['avg_minutes'] !== null ? number_format($deliveryAnalytics['avg_minutes']) . ' mins' : 'Not available' }}

Customer Locations

Top cities
@if ($citySplit->isEmpty())
Customer address city data will appear here.
@else
@foreach ($citySplit as $city)
{{ $city['city'] }}
{{ number_format($city['customers']) }} customers
@endforeach
@endif
@elseif ($activeTab === 'sales')
@foreach ($salesDashboard['kpis'] as $kpi)

{{ $kpi['label'] }}

{{ $kpi['display'] }}

{{ $kpi['trend']['display'] }} {{ $kpi['note'] }}
@endforeach

Sales Trend

Net sales and order volume

Daily

Sales by Category

Total {{ $salesDashboard['categories']['total'] > 0 ? 'Rs. ' . number_format($salesDashboard['categories']['total'], 0) : 'Rs. 0' }}
@forelse ($salesDashboard['categories']['items'] as $item)
{{ $item['label'] }} {{ $item['display'] }} ({{ $item['percentage'] }}%)
@empty
Category sales will appear here.
@endforelse

Sales by Payment Method

Total {{ $salesDashboard['payments']['total'] > 0 ? 'Rs. ' . number_format($salesDashboard['payments']['total'], 0) : 'Rs. 0' }}
@foreach ($salesDashboard['payments']['items'] as $item)
{{ $item['label'] }} {{ $item['display'] }} ({{ $item['percentage'] }}%)
@endforeach
@foreach ($salesDashboard['insights'] as $insight)

{{ $insight['label'] }}

{{ $insight['title'] }}

@if ($insight['display'] !== '')

{{ $insight['display'] }}

@endif
{{ $insight['trend']['display'] }} {{ $insight['note'] }}
@endforeach

Sales by Date

View Full Report
@forelse ($salesDashboard['dailyTable']['rows'] as $row) @empty @endforelse
Date Orders Gross Sales Discounts Refunds Net Sales Growth
{{ $row['date'] }} {{ number_format($row['orders']) }} {{ $row['gross_sales_display'] }} {{ $row['discounts_display'] }} {{ $row['refunds_display'] }} {{ $row['net_sales_display'] }} @if ($row['growth']['display'] === '-') - @else {{ $row['growth']['display'] }} @endif
No sales data found for this date range.
Total {{ number_format($salesDashboard['dailyTable']['total']['orders']) }} {{ $salesDashboard['dailyTable']['total']['gross_sales_display'] }} {{ $salesDashboard['dailyTable']['total']['discounts_display'] }} {{ $salesDashboard['dailyTable']['total']['refunds_display'] }} {{ $salesDashboard['dailyTable']['total']['net_sales_display'] }} -

Showing {{ number_format($salesDashboard['dailyTable']['shown']) }} of {{ number_format($salesDashboard['dailyTable']['total_count']) }} entries

Sales Heatmap (Time vs Sales)

@foreach ($salesDashboard['heatmap']['hours'] as $hour) {{ $hour['visible'] ? $hour['label'] : '' }} @endforeach
@foreach ($salesDashboard['heatmap']['days'] as $day)
{{ $day['label'] }} @foreach ($day['cells'] as $cell) @endforeach
@endforeach
Low Sales @foreach (range(1, 8) as $level) @endforeach High Sales
@elseif ($activeTab === 'customers')
@foreach ($customersDashboard['kpis'] as $kpi)

{{ $kpi['label'] }}

{{ $kpi['display'] }}

{{ $kpi['trend']['display'] }} {{ $kpi['note'] }}
@endforeach

Customer Growth

New and total customers

Daily

Customers by City

Total {{ number_format($customersDashboard['cities']['total']) }}
@forelse ($customersDashboard['cities']['items'] as $item)
{{ $item['label'] }} {{ number_format($item['value']) }} ({{ $item['percentage'] }}%)
@empty
Customer city data will appear here.
@endforelse

Customers by Segment

Total {{ number_format($customersDashboard['segments']['total']) }}
@foreach ($customersDashboard['segments']['items'] as $item)
{{ $item['label'] }} {{ number_format($item['value']) }} ({{ $item['percentage'] }}%)
@endforeach

Top Customers

@forelse ($customersDashboard['topCustomers'] as $customer)
{{ $loop->iteration }} @if ($customer['image']) {{ $customer['name'] }} @else {{ $customer['initials'] }} @endif

{{ $customer['name'] }}

{{ $customer['segment'] }}

{{ $customer['revenue_display'] }}
@empty
Top customers will appear after delivered orders.
@endforelse

Customer Activity

Total {{ number_format($customersDashboard['activity']['total']) }}
@foreach ($customersDashboard['activity']['items'] as $item)
{{ $item['label'] }} {{ number_format($item['value']) }} ({{ $item['percentage'] }}%)
@endforeach

New Customers by Source

@foreach ($customersDashboard['sources']['items'] as $source)
{{ $source['label'] }} {{ number_format($source['value']) }} ({{ $source['percentage'] }}%)
@endforeach

Customer Lifetime Value (CLV)

Daily

Average CLV

{{ $customersDashboard['clv']['average_display'] }}

{{ $customersDashboard['clv']['trend']['display'] }}

Customer Demographics

@foreach ($customersDashboard['demographics']['rows'] as $row) @endforeach
Segment Customers Percentage Active Repeat Revenue
{{ $row['label'] }} {{ number_format($row['customers']) }} {{ $row['percentage'] }}% {{ number_format($row['active']) }} {{ number_format($row['repeat']) }} {{ $row['revenue_display'] }}
Total {{ number_format($customersDashboard['demographics']['total']['customers']) }} {{ $customersDashboard['demographics']['total']['percentage'] }}% {{ number_format($customersDashboard['demographics']['total']['active']) }} {{ number_format($customersDashboard['demographics']['total']['repeat']) }} {{ $customersDashboard['demographics']['total']['revenue_display'] }}

Customer Retention Rate

Retention Rate

{{ $customersDashboard['retention']['current_display'] }}

{{ $customersDashboard['retention']['trend']['display'] }}

Recent Registered Customers

View All
@forelse ($customersDashboard['recent'] as $customer)
@if ($customer['image']) {{ $customer['name'] }} @else {{ $customer['initials'] }} @endif

{{ $customer['name'] }}

{{ $customer['meta'] }}

{{ $customer['status'] }}

{{ $customer['created_at'] }}

@empty
Recent customer registrations will appear here.
@endforelse
@elseif ($activeTab === 'salad-orders')
@foreach ($saladOrdersDashboard['kpis'] as $kpi)

{{ $kpi['label'] }}

{{ $kpi['display'] }}

{{ $kpi['trend']['display'] }} {{ $kpi['note'] }}
@endforeach

Revenue Overview

Salad revenue and order volume

Daily

Orders by Status

Total {{ number_format($saladOrdersDashboard['statusDistribution']['total']) }}
@forelse ($saladOrdersDashboard['statusDistribution']['items'] as $item)
{{ $item['label'] }} {{ number_format($item['count']) }} ({{ $item['percentage'] }}%)
@empty
No salad orders found.
@endforelse

Orders by Source

Total {{ number_format($saladOrdersDashboard['sourceDistribution']['total']) }}
@forelse ($saladOrdersDashboard['sourceDistribution']['items'] as $item)
{{ $item['label'] }} {{ number_format($item['count']) }} ({{ $item['percentage'] }}%)
@empty
No source data found.
@endforelse

Top Selling Salad Bowls

View All
@forelse ($saladOrdersDashboard['topBowls'] as $row) @empty @endforelse
Salad Bowl Sold Revenue %
{{ $row['name'] }} {{ number_format($row['sold']) }} {{ $row['revenue_display'] }} {{ $row['percentage'] }}%
No salad bowl sales found.

Top Addons

View All
@forelse ($saladOrdersDashboard['topAddons'] as $row) @empty @endforelse
Addon Times Added Revenue
{{ $row['name'] }} {{ number_format($row['count']) }} {{ $row['revenue_display'] }}
No addons found.

Top Extra Quantity Selections

@forelse ($saladOrdersDashboard['topExtras'] as $row) @empty @endforelse
Extra Quantity Selected Revenue
{{ $row['name'] }} {{ number_format($row['count']) }} {{ $row['revenue_display'] }}
No extra quantity selections found.

Salad Category Performance

Total {{ $saladOrdersDashboard['categoryPerformance']['total'] > 0 ? 'Rs. ' . number_format($saladOrdersDashboard['categoryPerformance']['total'], 0) : 'Rs. 0' }}
@forelse ($saladOrdersDashboard['categoryPerformance']['items'] as $item)
{{ $item['label'] }} {{ $item['display'] }} ({{ $item['percentage'] }}%)
@empty
No category data found.
@endforelse

Sales Trend by Day of Week

Revenue

Health Benefits Popularity

View All
@forelse ($saladOrdersDashboard['benefitPopularity'] as $benefit)
{{ $benefit['label'] }} {{ $benefit['percentage'] }}%
@empty
No health benefit data found.
@endforelse

Recent Salad Orders

Latest salad orders in the selected period

View Order Management
@forelse ($saladOrdersDashboard['recentOrders'] as $order) @empty @endforelse
Order ID Customer Salad Bowl Amount Status Ordered At
{{ $order['order_no'] }} {{ $order['customer_initials'] }} {{ $order['customer'] }} {{ $order['bowl'] }} {{ $order['amount_display'] }} {{ $order['status_label'] }} {{ $order['ordered_at'] }}
No salad orders found for this date range.
@else
@foreach ($ordersDashboard['kpis'] as $kpi)

{{ $kpi['label'] }}

{{ $kpi['display'] }}

{{ $kpi['trend']['display'] }} {{ $kpi['note'] }}
@endforeach

Orders Trend

Total vs delivered orders

Daily

Orders Status Distribution

@foreach ($ordersDashboard['statusDistribution']['items'] as $item)
{{ $item['label'] }} {{ $item['percentage'] }}% ({{ number_format($item['count']) }})
@endforeach

Orders by Payment Method

@foreach ($ordersDashboard['paymentDistribution']['items'] as $item)
{{ $item['label'] }} {{ $item['percentage'] }}% ({{ number_format($item['count']) }})
@endforeach

Orders by Time Slot

All Days

Top Delivery Locations

@forelse ($ordersDashboard['topLocations'] as $location) @empty @endforelse
Location Orders % of Total
{{ $loop->iteration }}. {{ $location['location'] }} {{ number_format($location['orders']) }} {{ $location['percentage'] }}%
No delivery locations found.

Recent Orders

View All
@forelse ($ordersDashboard['recentOrders'] as $order)
{{ $order['customer_initials'] }}

{{ $order['order_no'] }}

{{ $order['customer'] }}

{{ $order['status_label'] }}

{{ $order['placed_relative'] }}

@empty
No recent orders in this period.
@endforelse

All Orders

Server-side order list for selected range

Show entries
View Orders
Order ID Customer Date & Time Payment Method Amount Status Delivery Type Actions
@endif
@endsection @section('scripts') @endsection