@extends('layouts.app') @section('title', 'Analytics Inventaire') @section('content')
{{-- En-tête --}}

📊 Analytics Inventaire

Statistiques et analyses de votre stock

@if(isset($tableNotExists) && $tableNotExists)
⚠️ La table d'inventaire n'est pas encore configurée.
@endif @if(isset($error))
{{ $error }}
@endif {{-- Statistiques principales --}}

Total articles

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

Valeur de vente

{{ number_format($stats['selling_value'] ?? 0, 2) }} €

Bénéfice potentiel

{{ number_format($stats['profit'] ?? 0, 2) }} €

Marge moyenne

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

{{-- Alertes stock --}}

Stock faible

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

articles à réapprovisionner

Rupture de stock

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

articles en rupture

{{-- Répartition par catégorie --}}

📦 Répartition par catégorie

@if(isset($stats['items_by_category']) && $stats['items_by_category']->count() > 0)
@foreach($stats['items_by_category'] as $category)
{{ ucfirst($category->category ?? 'Non catégorisé') }} ({{ $category->count }} articles)
{{ number_format($category->value ?? 0, 2) }} €
@endforeach
@else

Aucune donnée disponible

@endif
{{-- Articles en stock faible --}}

⚠️ Articles à réapprovisionner

@if(isset($stats['low_stock_items']) && $stats['low_stock_items']->count() > 0)
@foreach($stats['low_stock_items'] as $item)
{{ $item->name }} SKU: {{ $item->sku ?? 'N/A' }}
{{ $item->quantity }} {{ $item->unit ?? 'unités' }} min: {{ $item->reorder_level ?? 5 }}
@endforeach
@else

✅ Tous vos stocks sont OK !

@endif
{{-- Articles récents --}}

🕐 Articles récemment ajoutés

@if(isset($stats['recent_items']) && $stats['recent_items']->count() > 0)
@foreach($stats['recent_items'] as $item) @endforeach
Article Catégorie Quantité Prix Ajouté le
{{ $item->name }} {{ ucfirst($item->category ?? 'N/A') }} {{ $item->quantity }} {{ $item->unit ?? '' }} {{ number_format($item->selling_price ?? 0, 2) }} € {{ $item->created_at->format('d/m/Y') }}
@else

Aucun article récent

@endif
@endsection