{{-- show.blade.php --}} @extends('layouts.app') @section('title', 'Production Order Details') @section('content')

Production Order Details

@include('manufacturing.partials.navigation') {{-- Main Card with White Background --}}
{{-- Production Header --}}

{{ $order->production_order_number }}

Created: {{ $order->created_at->format('d M Y, H:i') }}

{{ $order->status_label }}
{{ $order->priority_label }}
{{-- Progress Bar --}}
Progress {{ number_format($order->progress_percentage, 1) }}%
{{ number_format($order->progress_percentage, 1) }}%
Planned: {{ $order->planned_quantity }} {{ $order->unit_of_measure }} Produced: {{ $order->produced_quantity }} {{ $order->unit_of_measure }}

{{-- Info Cards --}}
Product
{{ $order->product->name ?? 'N/A' }}
SKU: {{ $order->product->sku ?? 'N/A' }}
BOM
{{ $order->billOfMaterial->bom_code ?? 'N/A' }}
{{ $order->billOfMaterial->name ?? '' }}
Schedule
{{ $order->planned_start_date ? $order->planned_start_date->format('d M Y') : 'N/A' }} @if($order->planned_end_date)
→ {{ $order->planned_end_date->format('d M Y') }} @endif
@if($order->planned_end_date && $order->planned_end_date < now() && $order->status != 'completed') ⚠ Overdue @endif
Assignment
{{ $order->assignedTo->username ?? 'Unassigned' }}
@if($order->machine) {{ $order->machine->name }} @endif @if($order->shift) | {{ $order->shift }} @endif

{{-- Ingredients Table --}}
Raw Materials {{ $order->ingredients->count() }}
@if($order->ingredients->count() > 0)
@foreach($order->ingredients as $index => $ingredient) @endforeach
# Raw Material Planned Qty Used Qty Wastage % Unit Usage % Status
{{ $index + 1 }} {{ $ingredient->rawMaterial->name ?? 'N/A' }} @if($ingredient->alternative_material_id)
Alt: {{ $ingredient->alternativeMaterial->name ?? 'N/A' }} @endif @if($ingredient->is_optional) Optional @endif
{{ number_format($ingredient->planned_quantity, 2) }} {{ number_format($ingredient->used_quantity, 2) }} {{ number_format($ingredient->wastage_percentage, 1) }}% {{ $ingredient->unit_of_measure }} @php $usagePercent = $ingredient->usage_percentage; @endphp
{{ number_format($usagePercent, 1) }}%
@if($ingredient->used_quantity >= $ingredient->planned_quantity) Fulfilled @elseif($ingredient->used_quantity > 0) Partial @else Pending @endif
Totals {{ number_format($order->ingredients->sum('planned_quantity'), 2) }} {{ number_format($order->ingredients->sum('used_quantity'), 2) }}
@else
No ingredients added to this production.
@endif

{{-- Stages / Timeline --}} @if($order->stages->count() > 0)
Activity Timeline
@foreach($order->stages as $stage)
{{ ucfirst(str_replace('_', ' ', $stage->stage)) }} @if($stage->notes)

{{ $stage->notes }}

@endif
{{ $stage->created_at->format('d M Y, H:i') }}
{{ $stage->user->username ?? 'System' }}
@endforeach

@endif {{-- Notes --}} @if($order->notes)
Notes
{{ $order->notes }}

@endif {{-- Schedule Info --}} @if($order->schedule)
Schedule Information
Schedule Code
{{ $order->schedule->schedule_code }}
Schedule Status
{{ ucfirst($order->schedule->status) }}

@endif {{-- Actions --}}
@if(in_array($order->status, ['draft', 'approved'])) Edit Production @endif @if($order->status == 'draft') @endif @if($order->status == 'approved') @endif @if($order->status == 'in_production') @endif @if($order->status == 'on_hold') @endif Back to List
@endsection