@php $s = $report['snapshot'] ?? []; $health = $report['health'] ?? []; @endphp

Workflow Diagnostic Report

PC Form #{{ $pcFormId }} · Generated {{ $generatedAt }} · By {{ $generatedBy }} · READ ONLY
{{ $health['score'] ?? 0 }}% — {{ $health['label'] ?? '—' }}
PASS {{ $health['pass'] ?? 0 }} · WARNING {{ $health['warning'] ?? 0 }} · FAIL {{ $health['fail'] ?? 0 }}

1. General

PC Number{{ $s['pc_number'] ?? '—' }}
UID / ADP / Scheme{{ $s['uid'] ?? '—' }} / {{ $s['adp'] ?? '—' }} / {{ $s['scheme'] ?? '—' }}
Kind / Department{{ $s['kind'] ?? '—' }} / {{ $s['department'] ?? '—' }}
Revision (current / parent / root) #{{ $s['current_revision_id'] ?? '—' }} / #{{ $s['parent_form_id'] ?? '—' }} / #{{ $s['root_form_id'] ?? '—' }}
Created / Updated{{ $s['created_at'] ?? '—' }} / {{ $s['updated_at'] ?? '—' }}
PCFMS Import {{ !empty($s['imported_from_pcfms']) ? 'Yes' : 'No' }} · {{ $s['source_table'] ?? '' }} #{{ $s['source_id'] ?? '' }} · {{ $s['import_batch'] ?? '' }}

2. Workflow

State / Stage{{ $s['state'] ?? '—' }} / {{ $s['workflow_stage'] ?? '—' }}
Current Owner{{ $s['current_owner'] ?? '—' }}
Created By{{ $s['created_by_name'] ?? '—' }} @if(!empty($s['created_by'])) (#{{ $s['created_by'] }}) @endif
Forward Workflow{{ !empty($s['uses_forward_workflow']) ? 'Yes' : 'No' }}
Allowed Actions{{ !empty($s['allowed_actions']) ? implode(', ', $s['allowed_actions']) : '—' }}
Meeting{{ $s['meeting_details'] ?? '—' }}
Forward / Review / Signature {{ $s['forward_count'] ?? 0 }} / {{ $s['review_count'] ?? 0 }} / {{ $s['signature_count'] ?? 0 }}

3. Revision Chain

@foreach ($s['revision_chain'] ?? [] as $rev) @endforeach
FormStatusStateStageActor
#{{ $rev['id'] }} {{ !empty($rev['status']) ? 'ACTIVE' : 'Inactive' }} {{ $rev['state'] ?? '—' }} {{ $rev['workflow_stage'] ?? '—' }} {{ $rev['current_actor_id'] ?? '—' }}

4. Health Report

@foreach ($health['rules'] ?? [] as $rule) @endforeach
RuleResultDetail
{{ $rule['label'] }} {{ $rule['result'] }} {{ $rule['detail'] }}

5. Findings

@foreach ($report['findings'] ?? [] as $f)

{{ $f['severity'] }} — {{ $f['title'] }}
{{ $f['detail'] }}
Cause: {{ $f['cause'] }} · Fix: {{ $f['fix'] }}

@endforeach

6. Permission Analysis

@if (! empty($report['permission']['user']))

User: {{ $report['permission']['user']['name'] }} (#{{ $report['permission']['user']['id'] }})

@foreach ($report['permission']['checks'] as $check) @endforeach
CheckResultReason
{{ $check['label'] }} {{ $check['allowed'] ? 'TRUE' : 'FALSE' }} {{ $check['allowed'] ? '—' : ($check['reason'] ?? '—') }}
@else

No user probed for this export. Re-export with probe_user_id to include permission analysis.

@endif

7. Timeline

@foreach ($report['timeline'] ?? [] as $row) @endforeach
DateActionFromToStageOrigin
{{ $row['date'] ?? '—' }} {{ $row['action'] }} {{ $row['from_user'] }} {{ $row['to_user'] }} {{ $row['stage'] }} {{ $row['origin'] ?? '—' }}

8. Recommendations

@foreach ($report['recommendations'] ?? [] as $rec)

{{ $rec['recommendation'] }} ({{ $rec['severity'] }})
Reason: {{ $rec['reason'] }}

@endforeach