@extends('layouts.app') @section('title', 'Inventory Ledger') @section('page_title', 'Inventory Ledger') @section('content')
Live overview of product stock volumes and batch distributions.
| Product Name | Category | Current Stock | Min Stock Alert | Earliest Batch Expiry | System Status | @if(auth()->user()->isAdmin())Actions | @endif
|---|---|---|---|---|---|---|
| {{ $product->name }} | {{ explode('-', $product->category)[0] }} {{ ucwords(str_replace('-', ' ', $product->category)) }} | {{ $product->stock }} {{ $product->unit }} | {{ $product->min_stock }} {{ $product->unit }} | @php $nearest = $product->batches() ->where('remaining_quantity', '>', 0) ->orderByRaw('expiry_date IS NULL ASC') ->orderBy('expiry_date', 'asc') ->first(); @endphp @if($nearest && $nearest->expiry_date) 📅 {{ \Carbon\Carbon::parse($nearest->expiry_date)->format('d M Y') }} @elseif($nearest) No expiry @else No batches active @endif | {{-- UPDATED SYSTEM STATUS COLUMN --}}@php $isExpired = $nearest && $nearest->expiry_date && \Carbon\Carbon::parse($nearest->expiry_date)->isPast(); $isLowStock = $product->stock <= $product->min_stock && $product->stock > 0; $isOutOfStock = $product->stock <= 0; @endphp {{ $isExpired ? 'Expired' : ($isOutOfStock ? 'Out of Stock' : ($isLowStock ? 'Low Stock' : 'Stable')) }} | @if(auth()->user()->isAdmin())@endif |
| No products found. | ||||||