@extends('layouts.app') @section('title', 'PC-IV Workflow') @push('stylesheets') @endpush @section('contents') @php $definition = $definition ?? []; $issues = $issues ?? []; $summary = $summary ?? []; $catalog = $catalog ?? []; $canEdit = (bool) ($canEdit ?? false); $actions = is_array($definition['actions'] ?? null) ? $definition['actions'] : []; $whoCat = $catalog['who'] ?? []; $allSubs = $definition['all_sub_stages'] ?? ($catalog['sub_stages'] ?? []); @endphp

PC-IV Workflow

Option D — Phase → State → Transition (Action + Who → Next state). Super Admin can add stages/states and edit the flow here.

@if ($canEdit) @endif
{{ (int) ($summary['stages'] ?? 0) }} stages {{ (int) ($summary['sub_stages'] ?? 0) }} states {{ (int) ($summary['transitions'] ?? 0) }} transitions {{ (int) ($summary['errors'] ?? 0) }} errors {{ (int) ($summary['warnings'] ?? 0) }} warnings
@forelse ($issues as $issue) @php $sev = (string) ($issue['severity'] ?? 'info'); @endphp
{{ strtoupper($sev) }} — {{ $issue['message'] ?? '' }}
@empty
No issues — workflow looks healthy.
@endforelse
@foreach (($definition['stages'] ?? []) as $stage) @include('admin-controls.partials.pc-iv-wf-stage', ['stage' => $stage, 'canEdit' => $canEdit, 'actions' => $actions, 'allSubs' => $allSubs, 'whoCat' => $whoCat, 'catalog' => $catalog]) @endforeach

How it works: each state lists transitions. A transition = Action + Who may do it + Next state. Live cases use these rules for forward / return / edit (not the old permission checkboxes).

@endsection @push('scripts') @endpush