@extends('layouts.dashboard.managerapp') @section('title', 'Production Execution') @section('content')

Route Card: #{{ $routeCard->route_no }}

Production Execution Board

@php $total = $routeCard->processes->count(); $done = $routeCard->processes->where('status', 'approved')->count(); $percent = $total ? round(($done / $total) * 100) : 0; @endphp
{{ $percent }}% Completed
@foreach ($routeCard->processes as $index => $proc)
{{ $index + 1 }}
{{ $proc->process }}

{{ $proc->description ?: 'No description provided' }}

@php $statusColors = [ 'pending' => 'bg-warning text-dark', 'in_production' => 'bg-primary text-white', 'qc_check' => 'bg-info text-white', 'completed' => 'bg-success text-white', 'approved' => 'bg-success text-white', ]; $badgeClass = $statusColors[$proc->status] ?? 'bg-secondary text-white'; @endphp {{ ucfirst(str_replace('_', ' ', $proc->status)) }}
@php $qcBefore = $proc->qcApprovals->where('stage', 'before')->first(); $qcDuring = $proc->qcApprovals->where('stage', 'during')->first(); $qcAfter = $proc->qcApprovals->where('stage', 'after')->first(); function getStepClass($qc) { if (!$qc) return ''; // pending/waiting if ($qc->status == 'approved') return 'completed'; if ($qc->status == 'rejected') return 'rejected'; return 'active'; // pending approval } function getStepIcon($qc) { if (!$qc) return 'fa-circle'; if ($qc->status == 'approved') return 'fa-check'; if ($qc->status == 'rejected') return 'fa-times'; return 'fa-clock'; } @endphp
Pre-Check
In-Process
Final QC
Machine: {{ $proc->machine }} Op: {{ isset($employees[$proc->operator]) ? $employees[$proc->operator] : ($proc->operator ?: '-') }}
@if ($proc->status == 'pending') @elseif ($proc->status == 'in_production') @elseif($proc->status == 'qc_check') Awaiting Final QC @elseif($proc->status == 'completed' || $proc->status == 'approved') Done @endif @if($qcBefore && $qcBefore->status === 'rejected')
Pre-QC Rejected!
@endif
@endforeach
@endsection