fix: correct V13 and public presentation patterns in isolated QA

This commit is contained in:
2026-11-21 12:36:28 +02:00
parent 1950bb69ec
commit e239a31a76
66 changed files with 3977 additions and 278 deletions
@@ -123,7 +123,7 @@ class InvestmentPortfolioController extends Controller
});
}
return Inertia::render('portfolio/index', ['records' => $results, 'publishedOpportunities' => $publishedOpportunities,
return Inertia::render('portfolio/index', ['publicReferenceNames' => $management ? [] : $this->publicReferenceNames(), 'records' => $results, 'publishedOpportunities' => $publishedOpportunities,
'management' => $management, 'filters' => $filters, 'sectors' => $sectorOptions, 'territorySelection' => $territorySelection]);
}
@@ -183,7 +183,7 @@ class InvestmentPortfolioController extends Controller
->orderByDesc('updated_at')->limit(10)->get(['id', 'version', 'updated_at'])
: collect();
return Inertia::render('portfolio/show', ['editorialEnabled' => $editorial, 'complements' => $management ? [] : app(InvestmentComplements::class)->options('portfolio:'.$record->id), 'record' => $record, 'related' => $related, 'management' => $management, 'zones' => $zones,
return Inertia::render('portfolio/show', ['publicReferenceNames' => $management ? [] : $this->publicReferenceNames(), 'editorialEnabled' => $editorial, 'complements' => $management ? [] : app(InvestmentComplements::class)->options('portfolio:'.$record->id), 'record' => $record, 'related' => $related, 'management' => $management, 'zones' => $zones,
'anchorProject' => $anchorProject, 'existingSubmissions' => $existingSubmissions,
'competitiveness' => $record->cluster_id ? app(ClusterCompetitiveness::class)->publicData($record->cluster_id) : null,
'geography' => app(InvestmentRelations::class)->dossier($record, $management),
@@ -218,6 +218,13 @@ class InvestmentPortfolioController extends Controller
return back()->with('success', 'Rascunho guardado. A publicacao aguarda um revisor diferente do editor.');
}
/** Resolve public cross-references for display without rewriting editorial content. */
private function publicReferenceNames(): array
{
return self::visible()->get(['title', 'content'])->filter(fn ($row) => ! empty($row->content['code']))
->mapWithKeys(fn ($row) => [$row->content['code'] => $row->title])->all();
}
public function publish(Request $request, InvestmentDossier $dossier): RedirectResponse
{
abort_if(app(PortalEditorialWorkflow::class)->portfolioWrites($dossier->id), 409, 'Use a aprovação e publicação separadas da edição no circuito editorial.');