@extends('layouts.app') @section('title', 'Inventaire') @section('content')
{{-- Header & Actions --}}

📦 Inventaire

{{ $totalItems ?? 0 }} article(s) en stock

{{-- Stats Cards (Restored but cleaner) --}}

{{ $totalItems ?? 0 }}

Articles

{{ number_format($totalCost ?? 0, 0) }}€

Coût total

{{ number_format($totalSellingValue ?? 0, 0) }}€

Valeur vente

+{{ number_format($totalProfit ?? 0, 0) }}€

Bénéfice est.

{{ number_format($averageMargin ?? 0, 0) }}%

Marge moy.

{{-- Alertes Stock --}} @if(isset($lowStockItems) && $lowStockItems > 0)

{{ $lowStockItems }} article(s) en stock faible

@endif {{-- Filtres Compacts (Keep this part from the redesign) --}}
@csrf
{{-- Liste des Articles --}}
@if(isset($items) && $items->count() > 0) {{-- Vue Mobile (Cards) --}}
@foreach($items as $item) @php $costPrice = $item->cost_per_unit ?? 0; $sellingPrice = $item->selling_price ?? 0; $margin = $costPrice > 0 ? (($sellingPrice - $costPrice) / $costPrice) * 100 : 0; $stockStatus = $item->quantity <= 0 ? 'out' : ($item->quantity <= ($item->reorder_level ?? 5) ? 'low' : 'ok'); $firstPhotoUrl = $item->getFirstPhotoUrl(); $hasPhoto = count($item->getPhotoUrls()) > 0; @endphp
{{-- Image --}} @if($hasPhoto) {{ $item->name }} @else
@endif {{-- Infos --}}

{{ $item->name }}

{{ $item->sku ?? 'N/A' }} @if($item->urgent_sale_id)⚡@endif

{{ number_format($sellingPrice, 0) }}€
Qté: {{ $item->quantity }} {{ $margin >= 0 ? '+' : '' }}{{ number_format($margin, 0) }}%
@endforeach
{{-- Vue Desktop (Table Restored) --}} @if($items->hasPages())
{{ $items->links() }}
@endif @else {{-- État vide --}}

Inventaire vide

Ajoutez vos articles pour suivre votre stock et calculer vos marges.

@endif
{{-- Modal Ajustement Stock --}} @push('scripts') @endpush @endsection