@php
$d = $insight;
$productUrl = fn ($p) => $panel === 'seller' ? route('seller.products.edit', $p->id) : route('admin.products.show', $p->id);
$lists = [
['Out of stock', 'out_list', 'danger', 'Live but customers can\'t buy them.'],
['Low stock', 'low_list', 'warning', 'At or below '.$d['low_at'].' left.'],
['Not selling', 'slow_list', 'secondary', 'Live, no sale in '.$d['slow_days'].' days. Highest stock value first: try a better photo, price or a coupon.'],
];
@endphp
Live products
{{ number_format($d['live']) }}
{{ number_format($d['units']) }} units in stock
Stock value
{{ inr($d['value']) }}
at selling price
Out of stock
{{ number_format($d['out']) }}
{{ number_format($d['low']) }} running low
Not selling
{{ number_format($d['slow_count']) }}
no sale in {{ $d['slow_days'] }} days
@if ($d['statuses']->isNotEmpty())
All products:
@foreach ($d['statuses'] as $status => $n){{ \App\Modules\Catalog\Models\Product::STATUSES[$status][0] ?? Str::headline($status) }} {{ $n }}@if (! $loop->last) · @endif @endforeach
@endif
@foreach ($lists as [$title, $key, $tone, $hint])
{{ $title }} {{ $d[$key]->count() }}{{ $d[$key]->count() >= 25 ? '+' : '' }}
{{ $hint }}
@if ($d[$key]->isEmpty())
None.
@else
@foreach ($d[$key] as $p)
-
{{ $p->name }}
@if ($panel === 'admin'){{ $p->seller }} · @endif{{ inr($p->price) }}@if (isset($p->last_sold)) · {{ $p->last_sold ? 'last sold '.\Illuminate\Support\Carbon::parse($p->last_sold)->format('d M Y') : 'never sold' }}@endif
{{ $p->stock }} left
@endforeach
@endif
@endforeach