@php $pciVPoPrefill = is_array($pciVProjectObjectivePrefill ?? null) ? $pciVProjectObjectivePrefill : []; $pciVApprovedPcForm = $pciVApprovedPcForm ?? null; $pciVPoObjectives = (string) ($pciVPoPrefill['project_objectives'] ?? ''); $pciVPoScopes = (string) ($pciVPoPrefill['project_scopes'] ?? ''); $pciVPoObjAttRows = is_array($pciVPoPrefill['project_objectives_attachments'] ?? null) ? $pciVPoPrefill['project_objectives_attachments'] : []; $pciVPoObjAnnRows = is_array($pciVPoPrefill['project_objectives_annexures'] ?? null) ? $pciVPoPrefill['project_objectives_annexures'] : []; $pciVPoScopeAttRows = is_array($pciVPoPrefill['project_scopes_attachments'] ?? null) ? $pciVPoPrefill['project_scopes_attachments'] : []; $pciVPoScopeAnnRows = is_array($pciVPoPrefill['project_scopes_annexures'] ?? null) ? $pciVPoPrefill['project_scopes_annexures'] : []; $pciVPoFilePcForm = $pciVApprovedPcForm; $pciVPoMapRows = function (array $rows): array { $out = []; foreach ($rows as $row) { if (! is_array($row) || empty($row['path'])) { continue; } $out[] = [ 'path' => (string) $row['path'], 'title' => (string) ($row['title'] ?? basename((string) $row['path'])), ]; } return $out; }; $pciVPoObjAttRows = $pciVPoMapRows($pciVPoObjAttRows); $pciVPoObjAnnRows = $pciVPoMapRows($pciVPoObjAnnRows); $pciVPoScopeAttRows = $pciVPoMapRows($pciVPoScopeAttRows); $pciVPoScopeAnnRows = $pciVPoMapRows($pciVPoScopeAnnRows); $pciVEdit = canField('pc-forms', 'project_brief_descriptions', 'edit'); $pciVSrc = $pcForm ?? null; $pciVFill = $pciCrudDraftFill ?? []; $pciVReporting = old('pc_v_project_objective_reporting'); if (! is_array($pciVReporting)) { $pciVReporting = $pciVSrc?->pc_v_project_objective_reporting ?? ($pciVFill['pc_v_project_objective_reporting'] ?? []); if (! is_array($pciVReporting)) { $pciVReporting = []; } } $pciVPoShowObjectives = canField('pc-forms', 'project_objectives', 'view'); $pciVPoShowScopes = canField('pc-forms', 'project_scopes', 'view'); $pciVPoShowEvaluation = canField('pc-forms', 'project_brief_descriptions', 'view'); $pciVPoShowPage = $pciVPoShowObjectives || $pciVPoShowScopes || $pciVPoShowEvaluation; $pciVObjectiveWizardStep = (int) ($pciVObjectiveWizardStep ?? 2); $pciVObjectiveStepTitle = $pciVObjectiveStepTitle ?? ($pciVObjectiveWizardStep . '. Project Objective'); @endphp @if($pciVPoShowPage)