@extends('Kitchen.layout') @section('content')
Aging — Batch Expiry Tracker
@forelse($batches as $index => $batch) @php $today = \Carbon\Carbon::today(); $expiry = \Carbon\Carbon::parse($batch->expiry_date); $daysLeft = $today->diffInDays($expiry, false); if ($daysLeft < 0) { $rowClass = 'table-danger'; $statusText = 'Expired (' . abs($daysLeft) . ' days ago)'; } elseif ($daysLeft == 0) { $rowClass = 'table-danger'; $statusText = 'Expires Today'; } elseif ($daysLeft <= 3) { $rowClass = 'table-warning'; $statusText = $daysLeft . ' day(s) left'; } else { $rowClass = ''; $statusText = $daysLeft . ' day(s) left'; } @endphp @empty @endforelse
Sno Category Product Name Product Id Batch Stock (this batch) Packed Date Expiry Date Status
{{ $index + 1 }} {{ $batch->product->category?->category ?? '-' }} {{ $batch->product->product_name ?? '-' }} {{ $batch->product->product_id ?? '-' }} Batch {{ $batch->batch_number }} {{ $batch->stock }} {{ $batch->packed_date ? \Carbon\Carbon::parse($batch->packed_date)->format('d-m-Y') : '-' }} {{ \Carbon\Carbon::parse($batch->expiry_date)->format('d-m-Y') }} {{ $statusText }}
No batches with expiry date set.
@endsection