@extends('layouts.app') @section('title', 'Batch - ' . $batch->batch_number) @section('content')
{{ $batch->batch_number }} @if($batch->status === 'Draft') Draft @elseif($batch->status === 'In Production') In Production @elseif($batch->status === 'Completed') Completed @elseif($batch->status === 'Under Verification') Under Verification @elseif($batch->status === 'Closed') Closed Batch @endif

{{ $batch->product->name }}

SKU: {{ $batch->product->sku }} • Category: {{ $batch->product->category->name }}
@if(!$batch->isClosed())
@csrf
@can('update', $batch) Edit @endcan
@csrf
@endif Label Print Center
@php $progressPercent = $batch->planned_quantity > 0 ? min(100, round(($batch->actual_quantity / $batch->planned_quantity) * 100)) : 0; @endphp
Planned Output
{{ number_format($batch->planned_quantity) }} {{ $batch->product->unit_of_measurement }}
Actual Recorded Output
{{ number_format($batch->actual_quantity) }} {{ $batch->product->unit_of_measurement }}
Units Serialized & QRs
{{ number_format($unitsSummary['total_generated']) }} / {{ number_format($batch->actual_quantity > 0 ? $batch->actual_quantity : $batch->planned_quantity) }}
Batch Completion: {{ $progressPercent }}%
Manufacturing Specifications
Manufacturing Date {{ $batch->manufacturing_date->format('d M Y') }}
Product Expiry Date {{ $batch->expiry_date->format('d M Y') }}
Production Start {{ $batch->production_start_at ? $batch->production_start_at->format('d M Y, H:i') : 'Not started' }}
Production Completed {{ $batch->production_completed_at ? $batch->production_completed_at->format('d M Y, H:i') : 'In progress' }}
Operator / Supervisor {{ $batch->production_operator ?? 'Not assigned' }}
Created By {{ $batch->creator ? $batch->creator->name : 'System' }}
Formulation & Batch Notes

{{ $batch->notes ?? 'No special notes recorded.' }}

Unit Lifecycle Status Distribution View All Units →
QA Verified {{ number_format($unitsSummary['verified']) }}
Awaiting QA Scan {{ number_format($unitsSummary['unverified']) }}
Ready for Warehouse {{ number_format($unitsSummary['ready_for_warehouse']) }}
Quarantined {{ number_format($unitsSummary['quarantined']) }}
Damaged / Reject {{ number_format($unitsSummary['damaged']) }}
@if($unitsSummary['total_generated'] > 0) @endif
Serialized Units in this Batch (Latest 10 of {{ number_format($unitsSummary['total_generated']) }}) View All {{ number_format($unitsSummary['total_generated']) }} Units →
@forelse($recentUnits as $unit) @empty @endforelse
Serial Number Cryptographic QR Token Status Verification Prints Inspect
{{ $unit->serial_number }} {{ $unit->unit_id }} {{ substr($unit->qr_token, 0, 16) }}... {{ $unit->status }} @if($unit->isVerified()) Verified @else Unverified @endif {{ $unit->print_count }}x
No physical units have been generated for this batch yet. @if(!$batch->isClosed())
@csrf
@endif
Production Counter & Machine Recording Log
@forelse($batch->productionRecords as $record) @empty @endforelse
Timestamp Source / Protocol Quantity Added Resulting Total Operator Notes
{{ $record->recorded_at->format('Y-m-d H:i:s') }} {{ $record->source }} @if($record->machine_identifier) Machine: {{ $record->machine_identifier }} @endif +{{ number_format($record->quantity_added) }} {{ number_format($record->resulting_quantity) }} {{ $record->user ? $record->user->name : 'System' }} {{ $record->notes ?? '-' }}
No incremental production recordings logged.
@if(!$batch->isClosed()) @endif @endsection