@extends('layouts.admin') @section('title', 'Mouvements de stock') @section('page-title', 'Stock') @section('content')

Mouvements de stock

Retour au stock
@if($errors->any())
@endif

Creer un mouvement

@csrf

Pour ADJUSTMENT, la quantite peut etre negative.

Reinitialiser
@if($movements->isEmpty())

Aucun mouvement.

@else
@foreach($movements as $movement) @php $rawQty = (int)$movement->quantity; $displayQty = $rawQty; if ($movement->type === 'OUT' && $rawQty > 0) { $displayQty = -$rawQty; } if ($movement->type === 'IN' && $rawQty < 0) { $displayQty = abs($rawQty); } $qtyClass = $displayQty < 0 ? 'text-red-600' : 'text-green-600'; $reason = $movement->reason ?? ''; $source = 'Manuel'; if ($reason !== '' && str_starts_with($reason, 'Commande #')) { $source = 'Commande'; } elseif ($movement->type === 'IN') { $source = 'Achat'; } elseif ($movement->type === 'OUT') { $source = 'Sortie'; } elseif ($movement->type === 'ADJUSTMENT') { $source = 'Ajustement manuel'; } elseif ($movement->type === 'TRANSFER') { $source = 'Transfert'; } $stockItem = $movement->stockItem; $storeName = ($stockItem && $stockItem->store) ? $stockItem->store->name : '-'; $productName = ($stockItem && $stockItem->product) ? $stockItem->product->name : '-'; $variantLabel = '-'; if ($stockItem && $stockItem->variant) { $variantLabel = $stockItem->variant->size ?? ($stockItem->variant->name ?? '-'); } @endphp @endforeach
Date / heure Magasin Produit Variante Type Quantite Source Commentaire
{{ $movement->created_at ? $movement->created_at->format('d/m/Y H:i') : '-' }} {{ $storeName }} {{ $productName }} {{ $variantLabel }} {{ $movement->type }} {{ $displayQty }} {{ $source }} {{ $reason !== '' ? $reason : '-' }}
{{ $movements->links() }}
@endif
@endsection