@php $canEdit = false; $canEditDeclined = false; $lastReturnRemark = $lastReturnRemark ?? null; $workflowHistory = $workflowHistory ?? []; $departmentNames = ($departmentNames ?? null) instanceof \Illuminate\Support\Collection ? $departmentNames : collect(); $allSchemes = $plan->latestVersion?->schemes ?? collect(); $declinedSchemes = ($declinedSchemes ?? null) instanceof \Illuminate\Support\Collection ? $declinedSchemes : $allSchemes->filter(fn ($s) => filled($s->rd_rejected_at ?? null))->values(); $planMeta = $planMeta ?? [ 'region_label' => plan_region_label_for_plan($plan), 'created_by_display' => $plan->creator->name ?? '—', 'consolidated_by_label' => $plan->consolidatedSourcePlanIds() !== [] ? ($plan->creator->name ?? '—') : '—', 'plan_type_label' => match ($plan->plan_type ?? '') { 'RVP' => 'Regular Visit Plan (RVP)', 'CVP' => 'Compliance Visit Plan (CVP)', 'SVP' => 'Special Visit Plan (SVP)', 'DRP' => 'Desk Review Plan (DRP)', 'ERP' => 'Evaluation Plan (ERP)', 'PMP' => 'Project Monitoring Plan (PMP)', default => $plan->plan_type ?? 'Plan', }, ]; $periodLabel = \Carbon\Carbon::create()->month((int) $plan->month)->format('F').' '.$plan->year; $accordionDomId = 'reportPlanSchemesAccordion-'.$plan->id; $schemeNameColorClassByProjectId = is_array($schemeNameColorClassByProjectId ?? null) ? $schemeNameColorClassByProjectId : []; @endphp
{{ plan_declined_status_label($plan) }}
Reason: {{ $declineReason !== '' ? $declineReason : '—' }}
{{ plan_returned_status_label($plan) }}
Reason: {{ $returnReason !== '' ? $returnReason : '—' }}
@if($rdSchemeFlaggedCount > 0){{ $rdSchemeFlaggedCount }} scheme(s) were flagged individually for revision (see each scheme below).
@endifNo schemes in this plan.
@else{{ $schemeName }}
@if($p)Reason: {{ \Illuminate\Support\Str::limit((string) $scheme->rd_rejection_remarks, 160) }}
@endifRD note: {{ $scheme->rd_rejection_remarks }}
@endif{{ $scheme->visit_location ?: '—' }}
{{ $monitoringOfficerDisplay }}
@if($scheme->visit_date){{ $schemeName }}
@if($p){{ $scheme->visit_location ?: '—' }}
{{ $visitTeamNames ?: '—' }}
{{ $monitoringOfficerDisplay }}