@if(isset($trackingFlows) && $trackingFlows->isNotEmpty())
@php
$totalApprovals = $trackingFlows->count();
$completedApprovals = $trackingFlows->filter(function($flow){
return !empty($flow->flow_result);
})->count();
$remainingApprovals = $totalApprovals - $completedApprovals;
$progressPercent = $totalApprovals > 0 ? round(($completedApprovals / $totalApprovals) * 100) : 0;
$isStopped = in_array($project->project_status, ['Not Recommended', 'Disapproved'], true);
@endphp
{{ $totalApprovals }}
Total Steps
{{ $completedApprovals }}
Completed
{{ $remainingApprovals }}
Remaining
Approval tracking · {{ $trackingSteps->count() }} displayed roles, {{ $totalApprovals }} actual approval actions. Merged roles inherit the decision of their final approving role.
@foreach($trackingSteps as $index => $step)
@php
$source = $step['source_flow'];
$hasDecision = !empty($source->flow_result);
$state = $hasDecision ? 'completed' : ($source->flow_status === 'Pending' ? 'pending' : ($isStopped ? 'stopped' : 'upcoming'));
$decisionDate = $source->flow_updated ?: ($hasDecision ? $source->flow_created : null);
@endphp
{{ $index + 1 }}
{{ $step['role'] }}
{{ $step['name'] }}
@if(!empty($step['activity']))
{{ $step['activity'] }}
@endif
@if($step['is_merged'])
Merged into {{ $step['merged_from'] }}
@endif
@if($hasDecision)
{{ $source->flow_result }} @if($decisionDate) · {{ \Carbon\Carbon::parse($decisionDate)->format('d M Y, H:i') }}@endif
@if($source->flow_comment !== null && $source->flow_comment !== '')
Comment: {{ $source->flow_comment }}
@endif
@endif
{{ ucfirst($state) }}
@endforeach
@else
@if($reference)
{{ $reference['name'] ?? '-' }}
Reference Researcher · {{ $reference['role'] ?? '-' }} · Faculty Member
@else
Reference Researcher not found No eligible Faculty Member identified
@endif
{{ count($actual) }} Required steps
@if($submitted)
Submitted
@elseif($ready)
Ready to submit
@else
{{ count($issues) }} issue(s)
@endif
@if(count($issues))
{{ count($issues) }} item(s) need attention
@foreach($issues as $issue)
{{ is_array($issue) ? ($issue['message'] ?? '-') : $issue }}
@endforeach
@endif
@if($hasRouteDifferences)
Actual Workflow ({{ count($actual) }})
Workflow Structure ({{ count($structure) }})
@endif
Required approval steps, including any missing or ambiguous recipients. Excluded project members and merged roles are not sent.
@forelse($actual as $index => $step)
{{ $index + 1 }}
{{ $step['role'] ?? '-' }}
{{ $step['name'] ?? 'Not identified' }}
@if(!empty($step['activity']))
{{ $step['activity'] }}
@endif
@if(!empty($step['note']))
{{ $step['note'] }}
@endif
@if(!empty($step['candidates']))
@foreach($step['candidates'] as $candidate){{ $personName($candidate) }} @endforeach
@endif
@php $state = $step['status'] ?? 'missing'; @endphp
{{ $state === 'ready' ? 'Identified' : ($state === 'multiple' ? 'Multiple matches' : 'Missing') }}
@empty
No actual workflow steps are available.
@endforelse
@if($hasRouteDifferences)
Complete route from flowsetting, including skipped steps due to no Center/Unit affiliation, excluded project members, merged roles and unresolved recipients.
@forelse($structure as $index => $step)
{{ $index + 1 }}
{{ $step['role'] ?? '-' }}
{{ $step['name'] ?? 'Not identified' }}
@if(!empty($step['activity']))
{{ $step['activity'] }}
@endif
@if(!empty($step['note']))
{{ $step['note'] }}
@endif
@if(!empty($step['candidates']))
@foreach($step['candidates'] as $candidate){{ $personName($candidate) }} @endforeach
@endif
@php $state = $step['status'] ?? 'missing'; @endphp
{{ ['ready'=>'Identified','missing'=>'Missing','multiple'=>'Multiple matches','excluded'=>'Project member','merged'=>'Merged into later role','skipped'=>'Not applicable'][$state] ?? 'Check required' }}
@empty
No workflow settings were found for this form.
@endforelse
@endif
@endif