@extends('admin.layouts.app') @section('title','Stock History — '.$product->product_name) @section('breadcrumb') / Inventory / {{ $product->product_name }} / Stock History @endsection @section('content')
Current Stock
{{ $product->current_quantity }}
{{ $product->unit ?? 'units' }}
Total Added
{{ $transactions->where('transaction_type','stock_added')->sum('quantity') }}
Total Used
{{ $transactions->where('transaction_type','stock_used')->sum('quantity') }}
Transactions
{{ $transactions->total() }}
Transaction History
@forelse($transactions as $tx) @empty @endforelse
Transaction ID Type Qty Before After Reference Description By Date
{{ $tx->transaction_id }} @php $typeMap = ['stock_added'=>['success','plus-circle','Added'], 'stock_used'=>['danger','minus-circle','Used'], 'stock_adjustment'=>['warning','sliders-h','Adjusted'], 'stock_returned'=>['info','undo','Returned']]; $t = $typeMap[$tx->transaction_type] ?? ['secondary','circle','Unknown']; @endphp {{ $t[2] }} {{ in_array($tx->transaction_type,['stock_used']) ? '-' : '+' }}{{ $tx->quantity }} {{ $tx->previous_quantity }} {{ $tx->new_quantity }} {{ $tx->reference_type ? ucfirst($tx->reference_type).' #'.$tx->reference_id : '—' }} {{ Str::limit($tx->description,40) ?? '—' }} {{ $tx->createdBy->name ?? '—' }} {{ \Carbon\Carbon::parse($tx->created_at)->format('d M Y H:i') }}
No stock transactions yet
@if($transactions->hasPages()) @endif
@endsection