{{ $typeTitle }} - {{ $record->title }} @isset($breadcrumbs) @endisset

{{ $record->title ?? $typeTitle ?? '' }}

@if(auth()->user()->isAdmin()) @endif Back @if(!auth()->user()->isClient()) Edit
@endif
{{-- Work Order Closed Overlay --}} @if($record->status === 'H' || $workOrderClose)

This Work Order has been closed

No further operations can be performed on this work order. @if($workOrderClose) The Work Order Close record was created on {{ $workOrderClose->created_at?->format('M d, Y') ?? 'N/A' }}. @endif

@if($workOrderClose) @endif
@endif @if($progressBarEnabled && $progressBarField && !empty($progressBarOptions))
@endif
@php // Load Additional Work Instructions keyed by woit_wo_seqno so each // task can look up its single matching instruction by step number (O(1)). $awiBySeqno = \Domain\AdditionalWorkInstructions\Models\AdditionalWorkInstruction ::where('woit_wo_link', $record->refid) ->where('isinactive', false) ->get(['id', 'title', 'woit_wo_seqno', 'woit_wo_url', 'woit_wo_printimage']) ->keyBy('woit_wo_seqno') ->map(fn ($wi) => [ 'id' => $wi->id, 'title' => $wi->title, 'seqno' => $wi->woit_wo_seqno, 'url' => $wi->woit_wo_url, 'print_image' => (bool) $wi->woit_wo_printimage, ]); @endphp @php // Transform manufacturing tasks from database to display format $tasks = $manufacturingTasks->map(function($task, $index) use ($record, $awiBySeqno) { // Calculate run rate (progress percentage) $runrate = 0; if (isset($task->estimatedwork) && $task->estimatedwork > 0 && isset($task->actualwork)) { $runrate = min(100, ($task->actualwork / $task->estimatedwork) * 100); } elseif (isset($task->completedquantity) && isset($task->inputquantity) && $task->inputquantity > 0) { $runrate = min(100, ($task->completedquantity / $task->inputquantity) * 100); } elseif (isset($task->completedquantity) && isset($task->quantity) && $task->quantity > 0) { $runrate = min(100, ($task->completedquantity / $task->quantity) * 100); } // Determine status display $status = 'Not Started'; if (isset($task->status)) { // Map database refids to display text if (in_array($task->status, ['COMPLETE', 'Completed', 'complete', 'C'])) { $status = 'Completed'; } elseif (in_array($task->status, ['PROGRESS', 'In Progress', 'inprogress', 'B'])) { $status = 'In Progress'; } elseif (in_array($task->status, ['NOTSTART', 'Not Started', 'notstarted', 'A'])) { $status = 'Not Started'; } } return [ 'id' => $task->id, 'step' => $index + 1, 'title' => $task->title ?? $task->operationname ?? 'Operation ' . ($index + 1), 'message' => $task->message ?? $task->memo ?? '', 'status' => $status, 'enddate' => $task->enddate ?? $task->expectedcompletiondate ?? now()->format('Y-m-d'), 'completedquantity' => $task->completedquantity ?? 0, 'inputquantity' => $task->inputquantity ?? 0, 'estimatedwork' => $task->estimatedwork ?? 0, 'remainingwork' => $task->remainingwork ?? ($task->estimatedwork ?? 0), 'actualwork' => $task->actualwork ?? 0, 'actualruntime' => $task->actualruntime ?? $task->runningtime ?? 0, 'actualsetuptime' => $task->actualsetuptime ?? 0, 'setuptime' => $task->setuptime ?? 0, 'runrate' => round($runrate), 'workorder' => $record->title ?? $record->refid ?? '', // Timer fields 'runtime_current_time' => $task->runtime_current_time ?? 0, 'setup_current_time' => $task->setup_current_time ?? 0, 'runtime_timer_running' => $task->runtime_timer_running ?? false, 'setup_timer_running' => $task->setup_timer_running ?? false, 'runtime_timer_started_at' => $task->runtime_timer_started_at, 'setup_timer_started_at' => $task->setup_timer_started_at, // Legacy free-text field stored on the task itself 'work_instructions' => $task->work_instructions ?? '', // Single AdditionalWorkInstruction matched by seqno == step (1-based index) 'work_instruction' => $awiBySeqno->get($index + 1), ]; })->toArray(); // If no tasks exist, show a placeholder message if (empty($tasks)) { $tasks = []; } @endphp
@if(empty($tasks))

No Manufacturing Operation Tasks

This work order doesn't have any manufacturing operation tasks yet. They will appear here once synchronized from NetSuite.

@else

Manufacturing Process

@if($allTasksComplete) All Steps Complete @else Step {{ $currentStep }} of {{ $totalSteps }} @endif
@foreach($tasks as $task)
@if($task['step'] < $currentStep) @elseif($task['step'] == $currentStep) {{ $task['step'] }} @else {{ $task['step'] }} @endif
Step {{ $task['step'] }}
@endforeach
@foreach($tasks as $task) @php $taskStep = $task['step']; @endphp

Please wait...

@if($task['status'] == 'Completed') @else {{ $task['step'] }} @endif

{{ $task['title'] }}

{{ $task['status'] }}
@if($task['message'])

{{ $task['message'] }}

@endif

{{ $task['workorder'] }}

{{ \Carbon\Carbon::parse($task['enddate'])->format('M d, Y') }}

{{ $task['completedquantity'] }} of {{ $task['inputquantity'] }} units
@if($task['runrate'] > 0)
Progress {{ $task['runrate'] }}%
@endif
{{--

{{ number_format($task['estimatedwork'], 2) }}h

{{ number_format(($task['actualruntime'] ?? 0) + ($task['actualsetuptime'] ?? 0), 2) }}m

{{ number_format($task['remainingwork'], 2) }}h

--}}
Time Tracking

{{ number_format($task['estimatedwork'], 2) }} hrs

@php $runtimeMinutes = floor($task['runtime_current_time'] / 60); $runtimeSeconds = $task['runtime_current_time'] % 60; @endphp {{ sprintf('%02d:%02d', $runtimeMinutes, $runtimeSeconds) }}

@if($task['step'] == $currentStep && $task['status'] == 'In Progress') @endif

{{ $task['setuptime'] }} min

@php $setupMinutes = floor($task['setup_current_time'] / 60); $setupSeconds = $task['setup_current_time'] % 60; @endphp {{ sprintf('%02d:%02d', $setupMinutes, $setupSeconds) }}

@if($task['step'] == $currentStep && $task['status'] == 'In Progress') @endif

@php $taskId = $manufacturingTasks[$task['step'] - 1]->id ?? null; @endphp @if($taskId)
@if($task['status'] == 'Not Started' && $task['step'] == $currentStep) @endif @if($task['status'] == 'In Progress') @endif
@if($task['status'] == 'In Progress') @elseif($task['status'] == 'Completed')
Completed
@endif
@endif
@endforeach @if($allTasksComplete) @php $summaryStep = $totalSteps + 1; @endphp

Work Order Summary

All Tasks Complete
Task Results
@foreach($tasks as $task)

Step {{ $task['step'] }}: {{ $task['title'] }}

@php $totalTimeSec = ($task['runtime_current_time'] ?? 0) + ($task['setup_current_time'] ?? 0); $totalTimeHrs = round($totalTimeSec / 3600, 2); @endphp

Time logged: {{ $totalTimeHrs }}h

{{ $task['completedquantity'] }} @if($task['inputquantity'] > 0) / {{ $task['inputquantity'] }} @endif units
@endforeach
@php $totalCompleted = collect($tasks)->sum('completedquantity'); $totalInput = collect($tasks)->sum('inputquantity'); $totalRuntimeSec = collect($tasks)->sum('runtime_current_time'); $totalSetupSec = collect($tasks)->sum('setup_current_time'); $totalAllTimeSec = $totalRuntimeSec + $totalSetupSec; $totalAllTimeHrs = round($totalAllTimeSec / 3600, 2); @endphp

{{ $totalCompleted }}@if($totalInput > 0) / {{ $totalInput }}@endif

units

{{ round($totalRuntimeSec / 3600, 2) }}h

{{ round($totalSetupSec / 3600, 2) }}h

@if($record->status === 'H' || $workOrderClose) {{-- Work Order is already closed — show link to WO Close record --}} Closed @if($workOrderClose) @endif @else @endif
@endif

Update Progress

Mark Task Complete

of units

Edit Completed Quantity

of units

@endif
Loading...
@if(!empty($tasks)) @endif @if(!empty($tasks)) @endif