@extends('backend.template.layouts.template-base') @section('title', 'Product Intelligence 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);'; $imageUrl = fn ($path) => \App\Helpers\Helper::storage_url($path, asset('backend/template/svg-icon/product-img.svg')); $trendIcon = fn ($d) => $d === 'up' ? 'ri-arrow-up-line' : ($d === 'down' ? 'ri-arrow-down-line' : 'ri-subtract-line'); $resetUrl = $routeUrl('backend.template.product-dashboard.index'); $dashTabUrl = fn ($tab) => $routeUrl('backend.template.dashboard.index', array_filter( ['tab' => $tab === 'overview' ? null : $tab], fn ($v) => $v !== null && $v !== '' )); $tabs = [ ['label' => 'Overview', 'icon' => 'ri-dashboard-line', 'url' => $dashTabUrl('overview'), 'active' => false], ['label' => 'Orders', 'icon' => 'ri-shopping-bag-3-line', 'url' => $dashTabUrl('orders'), 'active' => false], ['label' => 'Sales', 'icon' => 'ri-line-chart-line', 'url' => $dashTabUrl('sales'), 'active' => false], ['label' => 'Customers', 'icon' => 'ri-group-line', 'url' => $dashTabUrl('customers'), 'active' => false], ['label' => 'Revenue', 'icon' => 'ri-wallet-3-line', 'url' => $routeUrl('backend.template.revenue.index'), 'active' => false], ['label' => 'Products', 'icon' => 'ri-box-3-line', 'url' => $routeUrl('backend.template.product-dashboard.index'), 'active' => true], ['label' => 'Stocks', 'icon' => 'ri-archive-stack-line', 'url' => $routeUrl('backend.template.stock-dashboard.index'), 'active' => false], ['label' => 'Coupons', 'icon' => 'ri-coupon-3-line', 'url' => $routeUrl('backend.template.coupons.index'), 'active' => false], ['label' => 'Delivery', 'icon' => 'ri-truck-line', 'url' => $routeUrl('backend.template.delivery-dashboard.index'), 'active' => false], ['label' => 'Reports', 'icon' => 'ri-file-chart-line', 'url' => $routeUrl('backend.template.reports.SalesReport'), 'active' => false], ]; @endphp
{{-- Header --}}

Product Intelligence Dashboard

{{ $filters['label'] }}  ·  {{ $filters['compare_label'] }}

–
{{-- Top tabs --}}
@foreach ($tabs as $tab) {{ $tab['label'] }} @endforeach
{{-- ── KPI Row ── --}}
@foreach ($kpis as $kpi)

{{ $kpi['label'] }}

{{ $kpi['display'] }}

{{ $kpi['trend']['display'] }} {{ $kpi['note'] }}
@endforeach
{{-- ── Product Lists Row (5 columns) ── --}}
{{-- Top Selling --}}

Top Selling Products

By quantity

View All
@if ($topSelling->isEmpty())
No data
@else
@foreach ($topSelling as $p)
{{ $loop->iteration }} {{ $p['name'] }}

{{ $p['name'] }}

{{ $p['quantity_display'] }}

{{ $p['revenue_display'] }}
@endforeach
@endif
{{-- Lowest Selling --}}

Lowest Selling

Least quantity sold

View All
@if ($lowestSelling->isEmpty())
No data
@else
@foreach ($lowestSelling as $p)
{{ $loop->iteration }} {{ $p['name'] }}

{{ $p['name'] }}

{{ $p['quantity_display'] }}

{{ $p['revenue_display'] }}
@endforeach
@endif
{{-- Highest Revenue --}}

Highest Revenue

With growth %

View All
@if ($highestRevenue->isEmpty())
No data
@else
@foreach ($highestRevenue as $p)
{{ $loop->iteration }} {{ $p['name'] }}

{{ $p['name'] }}

{{ abs($p['growth']) }}%

{{ $p['revenue_display'] }}
@endforeach
@endif
{{-- Highest Margin --}}

Highest Margin

Best margin products

@if ($highestMargin->isEmpty())
Cost price data not available
@else
@foreach ($highestMargin as $p)
{{ $loop->iteration }} {{ $p['name'] }}

{{ $p['name'] }}

{{ $p['margin_pct'] }}%

{{ $p['price_display'] }}
@endforeach
@endif
{{-- Lowest Margin --}}

Lowest Margin

Needs pricing review

@if ($lowestMargin->isEmpty())
Cost price data not available
@else
@foreach ($lowestMargin as $p)
{{ $loop->iteration }} {{ $p['name'] }}

{{ $p['name'] }}

{{ $p['margin_pct'] }}%

{{ $p['price_display'] }}
@endforeach
@endif
{{-- ── Charts Row ── --}}
{{-- Revenue Trend --}}

Product Revenue Trend

Revenue & order volume

— Revenue (₹) — Orders
{{-- Category Contribution --}}

Category Contribution

Total Rs. {{ number_format($categoryContribution['total'], 0) }}

@if (empty($categoryContribution['items']))
No category data
@else
Total Rs.{{ number_format($categoryContribution['total'] / 100000, 1) }}L
@foreach ($categoryContribution['items'] as $item)
{{ $item['label'] }}
{{ $item['percentage'] }}% {{ $item['display'] }}
@endforeach
@endif
{{-- Profitability Matrix --}}

Profitability Matrix

Revenue vs {{ $profitabilityMatrix['y_label'] }}

@if (empty($profitabilityMatrix['data']))
No data for this period
@else
● Stars ● Cash Cows ● Question Marks ● Risk
@endif
{{-- ── Inventory Risk | Demand Intelligence | Seasonal Outlook ── --}}
{{-- Inventory Risk --}}

Inventory Risk Overview

Current stock health

@php $riskItems = [ ['key' => 'out_of_stock', 'label' => 'Pre Order', 'icon' => 'ri-shopping-bag-line', 'tone' => 'red'], ['key' => 'critical_stock', 'label' => 'Critical Stock', 'icon' => 'ri-alarm-warning-line', 'tone' => 'orange'], ['key' => 'overstocked', 'label' => 'Overstocked', 'icon' => 'ri-stack-line', 'tone' => 'green'], ['key' => 'dead_stock', 'label' => 'Dead Stock (60d)','icon' => 'ri-time-line', 'tone' => 'blue'], ]; @endphp @foreach ($riskItems as $ri) @php $rData = $inventoryRisk[$ri['key']]; @endphp
{{ number_format($rData['count']) }}
{{ $ri['label'] }}
{{ $rData['trend']['display'] }}
@endforeach
{{-- Demand Intelligence --}}

Demand Intelligence

Product demand classification

@php $demandItems = [ ['key' => 'high', 'label' => 'High Demand', 'icon' => 'ri-arrow-up-circle-line', 'tone' => 'green'], ['key' => 'normal', 'label' => 'Normal Demand', 'icon' => 'ri-pulse-line', 'tone' => 'blue'], ['key' => 'low', 'label' => 'Low Demand', 'icon' => 'ri-arrow-down-circle-line','tone' => 'red'], ]; @endphp @foreach ($demandItems as $di) @php $dData = $demandIntelligence[$di['key']]; @endphp
{{ number_format($dData['count']) }}
{{ $di['label'] }}
{{ $dData['trend']['display'] }}
@endforeach
{{-- Seasonal Outlook --}}

Seasonal Outlook

Next 30 days category forecast

High Demand
@forelse ($seasonalOutlook['high_demand'] as $cat)
{{ $cat }}
@empty

–

@endforelse
Moderate
@forelse ($seasonalOutlook['moderate'] as $cat)
{{ $cat }}
@empty

–

@endforelse
Low Demand
@forelse ($seasonalOutlook['low_demand'] as $cat)
{{ $cat }}
@empty

–

@endforelse
{{-- ── Executive Score | Fast Moving | AI Insights ── --}}
{{-- Executive Score --}}

Top Products by Executive Score

Composite of revenue & demand

@if ($executiveScore->isEmpty())
No data for this period
@else
@foreach ($executiveScore as $row) @endforeach
# Product Score Revenue Demand
{{ $row['rank'] }}
{{ $row['name'] }} {{ $row['name'] }}
{{ $row['executive_score'] }}
{{ $row['revenue_display'] }} {{ $row['demand_score'] }}
@endif
{{-- Fast Moving --}}

Fast Moving Products

Sold in < 7 days avg

@if ($fastMoving->isEmpty())
No fast moving products found
@else
@foreach ($fastMoving as $p)
{{ $p['name'] }}

{{ $p['name'] }}

Stock: {{ number_format($p['stock_left']) }} units

{{ $p['avg_days_to_sell'] }}d
{{ $p['status'] }}
@endforeach
@endif
{{-- AI Insights --}}

AI Generated Insights

Insights based on data up to {{ \Carbon\Carbon::parse($filters['to'])->format('M d, Y') }}

@foreach ($aiInsights as $insight) @php $insightTones = ['green' => 'pd-tone-green', 'blue' => 'pd-tone-blue', 'orange' => 'pd-tone-orange', 'red' => 'pd-tone-red', 'teal' => 'pd-tone-teal']; $toneCls = $insightTones[$insight['tone']] ?? 'pd-tone-blue'; @endphp

{{ $insight['text'] }}

@endforeach
@endsection @section('scripts') @endsection