fix: correct V13 and public presentation patterns in isolated QA
This commit is contained in:
@@ -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.');
|
||||
|
||||
@@ -130,7 +130,11 @@ class InvestmentZoneController extends Controller
|
||||
|
||||
return $management ? $zone : [...app(InvestmentZoneOperationalProfile::class)->publicDetails($zone->toArray()), 'operational_details_public' => app(InvestmentZoneOperationalDetails::class)->publicData($zone)];
|
||||
});
|
||||
$props = ['detailsInstallation' => $management ? app(InvestmentZoneOperationalDetailsInstallation::class)->preview($request->user()) : null, 'installation' => $management ? app(InvestmentZoneProfileInstallation::class)->preview($request->user()) : null, 'records' => $rows, 'filters' => $filters, 'management' => $management, 'territorySelection' => $path,
|
||||
$groupAvailability = [];
|
||||
foreach (['zee', 'zfi', 'industrial_park'] as $category) {
|
||||
$groupAvailability[$category] = $zones->search(array_replace($filters, ['category' => $category]), $management)->count();
|
||||
}
|
||||
$props = ['groupAvailability' => $groupAvailability, 'detailsInstallation' => $management ? app(InvestmentZoneOperationalDetailsInstallation::class)->preview($request->user()) : null, 'installation' => $management ? app(InvestmentZoneProfileInstallation::class)->preview($request->user()) : null, 'records' => $rows, 'filters' => $filters, 'management' => $management, 'territorySelection' => $path,
|
||||
'zoneExtensionsAvailable' => Schema::hasColumn('investment_zones', 'source_evidence')];
|
||||
|
||||
return $request->is('api/*') ? response()->json($props) : Inertia::render('investment/zones', $props);
|
||||
|
||||
Reference in New Issue
Block a user