versao compilada 1
tests / ci (push) Canceled after 0s

This commit is contained in:
2026-10-16 09:17:28 +02:00
parent c13f250b87
commit 6a76aac80f
901 changed files with 253428 additions and 252 deletions
@@ -0,0 +1,73 @@
--- antes/app/Http/Controllers/InvestorPathController.php
+++ candidata/app/Http/Controllers/InvestorPathController.php
@@ -2,8 +2,10 @@
namespace App\Http\Controllers;
+use App\Services\FintechInvestment;
use App\Services\InvestorPath;
use App\Services\LegacyContent;
+use App\Services\SectorInvestment;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
@@ -21,19 +23,43 @@
return $request->expectsJson() ? response()->json($data) : Inertia::render('investor-path/index', $data);
}
+ public function sectorStart(Request $request, string $sectorSlug, InvestorPath $path): JsonResponse|Response
+ {
+ abort_unless($path->available(), 404);
+ $data = ['contexts' => $path->contexts($request->user()), 'sectorSource' => app(SectorInvestment::class)->context($sectorSlug)];
+
+ return $request->expectsJson() ? response()->json($data) : Inertia::render('investor-path/index', $data);
+ }
+
+ public function sectorAttach(Request $request, string $id): JsonResponse|RedirectResponse
+ {
+ app(SectorInvestment::class)->attach($request->user(), $id, $request->all());
+
+ return $request->expectsJson() ? response()->json(['ok' => true]) : redirect('/investimentos/'.$id)->with('success', 'Setor associado ao mesmo dossier.');
+ }
+
public function create(Request $request, InvestorPath $path): JsonResponse|RedirectResponse
{
+ $sector = $request->validate(['sector_slug' => 'nullable|string|max:150'])['sector_slug'] ?? null;
+ if ($sector !== null) {
+ app(SectorInvestment::class)->context($sector);
+ }
$source = $request->input('content_resource_id');
if ($source !== null) {
$resourceId = filter_var($source, FILTER_VALIDATE_INT);
abort_unless(is_int($resourceId) && $resourceId !== 0, 422);
app(LegacyContent::class)->articleForResource($resourceId);
}
- $id = DB::transaction(function () use ($path, $request, $source): string {
+ $id = DB::transaction(function () use ($path, $request, $source, $sector): string {
$id = $path->create($request->user(), $request->all());
if ($source !== null) {
$case = $path->view($request->user(), $id)['case'];
app(LegacyContent::class)->attach($request->user(), $id, ['version' => $case['version'], 'resource_id' => (int) $source]);
+ }
+
+ if ($sector !== null) {
+ $case = $path->view($request->user(), $id)['case'];
+ app(SectorInvestment::class)->attach($request->user(), $id, ['version' => $case['version'], 'sector_slug' => $sector]);
}
return $id;
@@ -80,6 +106,14 @@
return $request->expectsJson() ? response()->json(['id' => $task], 201) : back()->with('success', 'Tarefa assumida no acompanhamento interno.');
}
+ public function fintech(Request $request, string $id, InvestorPath $path): JsonResponse|RedirectResponse
+ {
+ abort_unless($path->available(), 404);
+ app(FintechInvestment::class)->save($request->user(), $id, $request->all());
+
+ return $this->saved($request, 'Caracterização Fintech guardada no mesmo dossier; pendências e histórico preservados.');
+ }
+
private function saved(Request $request, string $message): JsonResponse|RedirectResponse
{
return $request->expectsJson() ? response()->json(['message' => $message]) : back()->with('success', $message);
@@ -0,0 +1,14 @@
--- antes/app/Http/Controllers/OpportunityManagementController.php
+++ candidata/app/Http/Controllers/OpportunityManagementController.php
@@ -136,6 +136,11 @@
'profileMode' => $record ? $record->owner_user_id !== null : str_starts_with($request->path(), 'minhas-oportunidades'),
'profileActions' => $record && $record->owner_user_id !== null ? app(OpportunityProfileWorkflow::class)->actions($request->user(), $record) : [], 'profileContext' => $record?->workflow_context, 'profileOrganization' => $record?->organization_id]);
$values = $record ? $service->values($record) : [];
+ if (! $record && $request->filled('sector_id')) {
+ $selection = $request->validate(['sector_id' => ['required', 'integer', Rule::exists('sectors', 'id')->where('is_active', true)->whereNull('deleted_at')]]);
+ $values['sector_id'] = (int) $selection['sector_id'];
+ $values['canonical']['sector_id'] = (int) $selection['sector_id'];
+ }
Inertia::share('publicationPreview', app(OpportunityCanonicalContract::class)->publicProjection($values['canonical'] ?? []));
$classification = $id ? DB::table('audit_events')->where('source_system', 'opportunity-origin-review')->where('after_data->opportunity_id', $id)->orderByDesc('occurred_at')->orderByDesc('id')->value('after_data') : null;
@@ -0,0 +1,18 @@
--- antes/app/Http/Controllers/PublicPortalController.php
+++ candidata/app/Http/Controllers/PublicPortalController.php
@@ -5,6 +5,7 @@
use App\Models\Opportunity;
use App\Models\Sector;
use App\Services\CountryCatalogue;
+use App\Services\SectorInvestment;
use Illuminate\Http\Request;
use Inertia\Inertia;
use Inertia\Response;
@@ -23,6 +24,7 @@
$sector = Sector::where('slug', $slug)->where('is_active', true)->firstOrFail();
return Inertia::render('portal/services', ['section' => 'sector', 'sector' => $sector->only(['name', 'slug', 'description', 'short_description']),
+ 'sectorEntry' => array_key_exists($sector->slug, SectorInvestment::CONTENT) ? app(SectorInvestment::class)->publicView($sector) : null,
'opportunities' => $sector->opportunities()->published()->latest('published_at')->limit(12)->get(['title', 'slug', 'province', 'summary'])]);
}