From 705dc69d683a451eda1371db7eceb280047b2895 Mon Sep 17 00:00:00 2001 From: Paulo Massingue Date: Wed, 4 Nov 2026 15:52:55 +0200 Subject: [PATCH] pesquisa intelignte --- resources/js/components/portal-hero.tsx | 4 ++-- resources/js/pages/PortalInvestidor.tsx | 5 ----- routes/web.php | 1 + tests/frontend/quick-opportunity-search.test.mjs | 8 ++++---- 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/resources/js/components/portal-hero.tsx b/resources/js/components/portal-hero.tsx index a2cc918f..400636d5 100644 --- a/resources/js/components/portal-hero.tsx +++ b/resources/js/components/portal-hero.tsx @@ -226,14 +226,14 @@ export default function PortalHero({

{ event.preventDefault(); const value = new FormData(event.currentTarget).get( 'q', ); - router.get('/oportunidades', { + router.get('/pesquisa', { q: typeof value === 'string' ? value.trim() diff --git a/resources/js/pages/PortalInvestidor.tsx b/resources/js/pages/PortalInvestidor.tsx index e28c46b9..908a138a 100644 --- a/resources/js/pages/PortalInvestidor.tsx +++ b/resources/js/pages/PortalInvestidor.tsx @@ -971,11 +971,6 @@ export default function PortalInvestidorApp({ router.get('/oportunidades'); } - function handleHeroSearch(event: FormEvent) { - event.preventDefault(); - router.get('/oportunidades', { q: heroQuery.trim() }); - } - function handleView(opportunity: Opportunity) { router.get('/oportunidades/' + encodeURIComponent(opportunity.slug)); } diff --git a/routes/web.php b/routes/web.php index c4ef53ec..02af514b 100644 --- a/routes/web.php +++ b/routes/web.php @@ -115,6 +115,7 @@ Route::get('/artigos/{id}', [EditorialArticleController::class, 'show'])->whereN Route::get('/carteira', [InvestmentPortfolioController::class, 'index'])->name('portfolio.index'); Route::get('/carteira/{id}', [InvestmentPortfolioController::class, 'show'])->whereUuid('id')->name('portfolio.show'); Route::get('/carteira/{id}/interesse', [InvestmentPortfolioController::class, 'resumeInterest'])->whereUuid('id')->middleware(['auth', \App\Http\Middleware\VerifiedOrSimpleParticipation::class])->name('portfolio.interest'); +Route::get('/pesquisa', \App\Http\Controllers\GlobalSearchController::class)->name('portal.search'); Route::get('/oportunidades', [InvestmentDiscoveryController::class, 'index'])->name('portal.opportunities'); Route::get('/oportunidades/{slug}', [InvestmentDiscoveryController::class, 'detail'])->name('portal.opportunity'); Route::get('/negocios', [PublicBusinessOpportunityController::class, 'index'])->name('business-marketplace.index'); diff --git a/tests/frontend/quick-opportunity-search.test.mjs b/tests/frontend/quick-opportunity-search.test.mjs index 96dc30bf..31283ba7 100644 --- a/tests/frontend/quick-opportunity-search.test.mjs +++ b/tests/frontend/quick-opportunity-search.test.mjs @@ -55,7 +55,7 @@ await test('the quick search has a native GET destination and submits the actual const input = nodes(tree).find( (node) => node.type === 'input' && node.props.name === 'q', ); - assert.equal(form.props.action, '/oportunidades'); + assert.equal(form.props.action, '/pesquisa'); assert.equal(form.props.method, 'get'); assert.equal(input.props.maxLength, 120); input.props.onChange({ target: { value: 'plantio de algodao' } }); @@ -80,15 +80,15 @@ await test('the quick search has a native GET destination and submits the actual }); assert.equal(prevented, true); assert.deepEqual(sent, { - url: '/oportunidades', + url: '/pesquisa', data: { q: 'plantio de algodao' }, }); } finally { globalThis.FormData = original; } const html = renderToStaticMarkup(tree); - assert.ok(html.includes('Pesquisa rápida de oportunidades')); - assert.ok(html.includes('action="/oportunidades"')); + assert.ok(html.includes('Pesquisa rápida no InvesteMoz')); + assert.ok(html.includes('action="/pesquisa"')); assert.ok(html.includes('Pesquisar')); });