{{-- Shared by admin/reports and seller/reports. $panel is "admin" or "seller". --}}
@php
$k = $report['kpis'] ?? null;
$exportRoute = $panel === 'admin' ? 'admin.reports.export' : 'seller.reports.export';
$indexRoute = $panel === 'admin' ? 'admin.reports.index' : 'seller.reports.index';
$query = ['range' => $range, 'tab' => $tab] + ($range === 'custom' ? ['from' => $from->toDateString(), 'to' => $to->toDateString()] : []);
$days = (int) $from->copy()->startOfDay()->diffInDays($to->copy()->startOfDay()) + 1;
$period = $days.' '.Str::plural('day', $days);
$change = function (?float $pct) use ($period) {
if ($pct === null) return 'No earlier data';
$cls = $pct > 0 ? 'up' : ($pct < 0 ? 'down' : 'flat');
$icon = $pct > 0 ? 'bi-arrow-up-right' : ($pct < 0 ? 'bi-arrow-down-right' : 'bi-dash');
return ' '.abs($pct).'% vs previous '.e($period).'';
};
$methodLabels = ['cod' => 'Cash on delivery', 'online' => 'Online', 'upi' => 'UPI', 'card' => 'Card', 'netbanking' => 'Netbanking'];
$soldTotal = max(1, $k['sales'] ?? 0);
@endphp
| Product | Units | Sales |
|---|---|---|
| {{ $p->name }} | {{ (int) $p->units }} | {{ inr($p->sales) }} |
No sales yet.
@endforelse @elseNo sales yet.
@endforelse @endifNo sales yet.
@endforelseNo orders yet.
@endforelseSales are item totals of placed orders (before coupons and delivery fees), excluding cancelled items and unpaid online orders. Commission is counted when items are delivered.
@endif