@extends('admin.layout') @php $title = 'Product Explorer'; $currentSort = request('sort'); $currentDir = request('dir','asc'); function arrow($field,$sort,$dir){ if($field !== $sort) return ''; return $dir === 'asc' ? ' ▲' : ' ▼'; } function nextDir($field,$sort,$dir){ if($field !== $sort) return 'asc'; return $dir === 'asc' ? 'desc' : 'asc'; } @endphp @section('content')
Products

{{ $stats['products'] ?? 0 }}

With Supplier

{{ $stats['with_supplier'] ?? 0 }}

Without Supplier

{{ $stats['without_supplier'] ?? 0 }}

Avg Margin

{{ $stats['avg_margin'] ?? 0 }}%

@csrf
@csrf
{{-- TOP OPPORTUNITIES PANEL --}} @if(isset($topOpportunities) && $topOpportunities->count())
🔥 Top Opportunities
@foreach($topOpportunities as $p) @endforeach
Product Winning Cost Best Cost Opportunity Score
{{ $p->reference }} @if($p->cost) € {{ number_format($p->cost,4) }} @else - @endif @if($p->best_cost) € {{ number_format($p->best_cost,4) }} @else - @endif @if($p->opportunity_percent !== null) +{{ $p->opportunity_percent }}% @else - @endif 🔥 {{ $p->opportunity_score }}
@endif
@forelse($products ?? [] as $product) @empty @endforelse
ID{!! arrow('id',$currentSort,$currentDir) !!} Reference{!! arrow('reference',$currentSort,$currentDir) !!} Winning Supplier Stock{!! arrow('stock',$currentSort,$currentDir) !!} Cost{!! arrow('cost',$currentSort,$currentDir) !!} Final Price{!! arrow('final_price',$currentSort,$currentDir) !!} Margin{!! arrow('margin',$currentSort,$currentDir) !!} Suppliers{!! arrow('suppliers',$currentSort,$currentDir) !!} Best Cost Worst Cost Spread{!! arrow('spread',$currentSort,$currentDir) !!} Opportunity
@if(($product->suppliers_count ?? 0) > 0) @endif {{ $product->id }} {{ $product->reference }} {{ $product->winning_supplier ?? '-' }} {{ $product->winning_stock ?? '-' }} @if($product->cost) € {{ number_format($product->cost,4) }} @else - @endif @if($product->final_price) € {{ number_format($product->final_price,4) }} @else - @endif @if($product->margin !== null) {{ $product->margin }} % @else - @endif {{ $product->suppliers_count ?? 0 }} @if($product->best_cost) € {{ number_format($product->best_cost,4) }} @else - @endif @if($product->worst_cost) € {{ number_format($product->worst_cost,4) }} @else - @endif @if($product->spread) € {{ number_format($product->spread,4) }} @else - @endif @if($product->opportunity_percent !== null) +{{ $product->opportunity_percent }}% @else - @endif
No products found
@endsection