@extends('layouts.app') @section('style') @endsection @section('content')
@if(isset($product))
{{ $product->name }}
SKU {{ $product->sku }}
Current Stock {{ $product->stock }} units
Batch Tracked {{ $product->track_batches ? 'Yes' : 'No' }}
Expiry Tracking {{ $product->has_expiry ? 'Yes' : 'No' }}
${{ number_format($product->cost_price, 2) }}
Cost Price
@endif

Total Batches

{{ $batchStats['total_batches'] ?? 0 }}

Active Batches

{{ $batchStats['active_batches'] ?? 0 }}

Expiring Soon

{{ $batchStats['expiring_soon'] ?? 0 }}

Expired

{{ $batchStats['expired_batches'] ?? 0 }}

to
@if(isset($product)) Product Batches @else All Batches @endif
@if(session('success')) @endif @if(session('error')) @endif
@forelse($batches as $batch) @php $expiryClass = ''; $status = 'active'; if ($batch->current_quantity <= 0) { $status = 'empty'; } elseif ($batch->expiry_date && $batch->expiry_date < now()) { $status = 'expired'; $expiryClass = 'expired'; } elseif ($batch->expiry_date && $batch->expiry_date <= now()->addDays(30)) { $status = 'expiring'; $expiryClass = 'expiring'; } else { $expiryClass = 'valid'; } @endphp @empty @endforelse
Batch Number Product Supplier Manufacture Date Expiry Date Quantity Cost Price Status Location Actions
{{ $batch->batch_number }}
@if($batch->product->image) {{ $batch->product->name }} @else
@endif
{{ $batch->product->name }}
{{ $batch->product->sku }}
{{ $batch->supplier->name ?? 'N/A' }} {{ $batch->manufacture_date ? $batch->manufacture_date->format('Y-m-d') : 'N/A' }} @if($batch->expiry_date)
{{ $batch->expiry_date->format('Y-m-d') }} @if($batch->expiry_date < now()) Expired {{ $batch->expiry_date->diffForHumans() }} @elseif($batch->expiry_date <= now()->addDays(30)) Expires in {{ $batch->expiry_date->diffForHumans(['parts' => 2]) }} @else Expires {{ $batch->expiry_date->diffForHumans() }} @endif
@else No expiry @endif
{{ $batch->current_quantity }}/{{ $batch->initial_quantity }}
${{ number_format($batch->batch_cost_price, 2) }} {{ ucfirst($status) }} {{ $batch->warehouse_location ?? 'Default' }}
No batches found

@if(request()->hasAny(['search', 'status', 'supplier_id', 'expiry_from'])) Try changing your filters @else No batches available @endif

@if(isset($product)) @else Create Batch @endif
Showing {{ $batches->firstItem() }} to {{ $batches->lastItem() }} of {{ $batches->total() }} batches
@if(isset($product)) @endif @endsection @section('script') @endsection