Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
40002db40f | ||
|
|
f1db53fdbf |
@@ -126,7 +126,7 @@ class PortalServicesController extends Controller
|
||||
'r.source_url', 'r.language', 'r.version_label', 'r.document_group_id', 'r.territorial_scope', 'r.territory_id',
|
||||
'r.source_confirmation', 'r.legal_status', 'r.rights_status', 'r.last_reviewed_at', 'r.last_reviewed_by', 'r.independent_review', 'r.metadata_version', 'r.source_reference', 'r.essential',
|
||||
'd.file_name', 'd.media_type', 'd.size_bytes', 'd.issuer', 'd.issued_on', 'd.valid_until', 'd.version_no',
|
||||
])->paginate(5)->withQueryString();
|
||||
])->paginate(3)->withQueryString();
|
||||
$pageResult->getCollection()->transform(fn ($resource) => app(PublicDocumentPresentation::class)->resource($resource));
|
||||
$props['resources'] = $pageResult;
|
||||
app(PublicSearchMetrics::class)->candidate($request, 'documents', $pageResult->total(), $filters);
|
||||
|
||||
@@ -9,6 +9,7 @@ export default function CountrySelect({
|
||||
label = 'País',
|
||||
required = false,
|
||||
error,
|
||||
className,
|
||||
}: {
|
||||
countries: Country[];
|
||||
value: string;
|
||||
@@ -19,6 +20,7 @@ export default function CountrySelect({
|
||||
required?: boolean;
|
||||
allowLegacyValue?: boolean;
|
||||
error?: string;
|
||||
className?: string;
|
||||
}) {
|
||||
return (
|
||||
<CatalogueChoiceSelect
|
||||
@@ -34,6 +36,7 @@ export default function CountrySelect({
|
||||
disabled={disabled}
|
||||
required={required}
|
||||
error={error}
|
||||
className={className}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -96,23 +96,31 @@ function QueryStatus({
|
||||
function TopBar({
|
||||
onNavigate,
|
||||
requestCount,
|
||||
hideBrand = false,
|
||||
}: {
|
||||
onNavigate: (view: View) => void;
|
||||
requestCount: number;
|
||||
hideBrand?: boolean;
|
||||
}) {
|
||||
return (
|
||||
<nav
|
||||
aria-label="Navegação das manifestações"
|
||||
className="sticky top-0 z-30 border-b border-slate-200 bg-white/95 backdrop-blur"
|
||||
>
|
||||
<div className="mx-auto flex max-w-6xl flex-wrap items-center justify-between gap-3 px-5 py-4">
|
||||
<div
|
||||
className={`mx-auto flex max-w-6xl flex-wrap items-center gap-3 px-5 py-4 ${hideBrand ? 'justify-end' : 'justify-between'}`}
|
||||
>
|
||||
{!hideBrand && (
|
||||
<button
|
||||
onClick={() => onNavigate('home')}
|
||||
className="flex items-baseline gap-1 font-black tracking-tight text-slate-900"
|
||||
>
|
||||
<span className="text-lg">INVESTE</span>
|
||||
<span className="text-lg text-emerald-700">Moçambique</span>
|
||||
<span className="text-lg text-emerald-700">
|
||||
Moçambique
|
||||
</span>
|
||||
</button>
|
||||
)}
|
||||
|
||||
<div className="flex items-center gap-3 text-xs text-slate-500">
|
||||
<a href="/investidor/manifestacoes" className="underline">
|
||||
@@ -123,12 +131,14 @@ function TopBar({
|
||||
recebido
|
||||
{requestCount === 1 ? '' : 's'}
|
||||
</span>
|
||||
{!hideBrand && (
|
||||
<button
|
||||
onClick={() => onNavigate('interest')}
|
||||
className="rounded-lg bg-slate-900 px-4 py-2 text-sm font-bold text-white hover:bg-slate-700"
|
||||
>
|
||||
Manifestar interesse
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -528,6 +538,9 @@ function OpportunityDetail({
|
||||
);
|
||||
}
|
||||
|
||||
const interestControlClass =
|
||||
'w-full rounded-xl border border-slate-300 bg-white px-3.5 py-3 text-sm text-slate-900 shadow-sm placeholder:text-slate-400 hover:border-slate-400 focus:border-[#ed1c24] focus:outline-none focus:ring-4 focus:ring-[#ed1c24]/10';
|
||||
|
||||
function InterestForm({
|
||||
preselected,
|
||||
onSubmitted,
|
||||
@@ -660,14 +673,17 @@ function InterestForm({
|
||||
}
|
||||
|
||||
return (
|
||||
<section className="mx-auto max-w-xl px-5 py-12">
|
||||
<h1 className="text-3xl font-black text-slate-900">
|
||||
<section className="mx-auto max-w-4xl px-5 py-10 sm:py-14">
|
||||
<div className="overflow-hidden rounded-3xl bg-slate-50 p-5 shadow-xl ring-1 ring-black/5 sm:p-8 lg:p-10">
|
||||
<div className="text-center">
|
||||
<h1 className="text-2xl font-bold text-slate-950 sm:text-3xl">
|
||||
Manifestar interesse
|
||||
</h1>
|
||||
<p className="mt-2 text-slate-600">
|
||||
Preencha os dados abaixo para que a equipa do portal possa
|
||||
analisar o seu interesse e entrar em contacto.
|
||||
Preencha os dados abaixo para que a equipa do portal
|
||||
possa analisar o seu interesse e entrar em contacto.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{preselected && (
|
||||
<div className="mt-5 rounded-xl border border-emerald-200 bg-emerald-50 p-4 text-sm text-emerald-900">
|
||||
@@ -686,10 +702,17 @@ function InterestForm({
|
||||
{submitError}
|
||||
</p>
|
||||
)}
|
||||
<fieldset disabled={submitting} className="space-y-5">
|
||||
<Field label="Nome completo" error={errors.name} required>
|
||||
<fieldset
|
||||
disabled={submitting}
|
||||
className="grid gap-5 sm:grid-cols-2"
|
||||
>
|
||||
<Field
|
||||
label="Nome completo"
|
||||
error={errors.name}
|
||||
required
|
||||
>
|
||||
<input
|
||||
className="input"
|
||||
className={interestControlClass}
|
||||
value={form.name}
|
||||
onChange={(e) => update('name', e.target.value)}
|
||||
/>
|
||||
@@ -698,17 +721,22 @@ function InterestForm({
|
||||
<Field label="Email" error={errors.email} required>
|
||||
<input
|
||||
type="email"
|
||||
className="input"
|
||||
className={interestControlClass}
|
||||
value={form.email}
|
||||
onChange={(e) => update('email', e.target.value)}
|
||||
onChange={(e) =>
|
||||
update('email', e.target.value)
|
||||
}
|
||||
/>
|
||||
</Field>
|
||||
|
||||
<Field label="Telefone" error={errors.phone}>
|
||||
<input
|
||||
className="input"
|
||||
className={interestControlClass}
|
||||
type="tel"
|
||||
value={form.phone}
|
||||
onChange={(e) => update('phone', e.target.value)}
|
||||
onChange={(e) =>
|
||||
update('phone', e.target.value)
|
||||
}
|
||||
/>
|
||||
</Field>
|
||||
|
||||
@@ -718,7 +746,7 @@ function InterestForm({
|
||||
required
|
||||
>
|
||||
<select
|
||||
className="input"
|
||||
className={interestControlClass}
|
||||
value={form.investorType}
|
||||
onChange={(e) =>
|
||||
update('investorType', e.target.value)
|
||||
@@ -729,7 +757,9 @@ function InterestForm({
|
||||
Investidor individual
|
||||
</option>
|
||||
<option value="empresa">Empresa</option>
|
||||
<option value="fundo">Fundo de investimento</option>
|
||||
<option value="fundo">
|
||||
Fundo de investimento
|
||||
</option>
|
||||
<option value="entidade_publica">
|
||||
Entidade pública
|
||||
</option>
|
||||
@@ -737,10 +767,17 @@ function InterestForm({
|
||||
</select>
|
||||
</Field>
|
||||
|
||||
<Field label="País" error={errors.country}>
|
||||
<Field
|
||||
label="País"
|
||||
error={errors.country}
|
||||
required
|
||||
htmlFor="interest-country"
|
||||
>
|
||||
<CountrySelect
|
||||
countries={countries}
|
||||
label="País do requerente"
|
||||
id="interest-country"
|
||||
className={interestControlClass}
|
||||
value={form.country}
|
||||
onChange={(value) => update('country', value)}
|
||||
required
|
||||
@@ -750,17 +787,23 @@ function InterestForm({
|
||||
|
||||
<Field
|
||||
label="País de origem do pedido (opcional)"
|
||||
htmlFor="interest-origin-country"
|
||||
error={errors.declared_origin_country_code}
|
||||
>
|
||||
<CountrySelect
|
||||
countries={countries}
|
||||
label="País de origem do pedido (opcional)"
|
||||
id="interest-origin-country"
|
||||
className={interestControlClass}
|
||||
value={form.declared_origin_country_code ?? ''}
|
||||
onChange={(value) =>
|
||||
update('declared_origin_country_code', value)
|
||||
update(
|
||||
'declared_origin_country_code',
|
||||
value,
|
||||
)
|
||||
}
|
||||
/>
|
||||
<p className="text-sm">
|
||||
<p className="mt-2 text-sm font-normal text-slate-600">
|
||||
País de onde apresenta este pedido. Pode ser
|
||||
diferente do país do requerente.
|
||||
</p>
|
||||
@@ -772,7 +815,7 @@ function InterestForm({
|
||||
required
|
||||
>
|
||||
<select
|
||||
className="input"
|
||||
className={interestControlClass}
|
||||
value={form.sectorInterest}
|
||||
onChange={(e) =>
|
||||
update('sectorInterest', e.target.value)
|
||||
@@ -813,14 +856,16 @@ function InterestForm({
|
||||
error={errors.investmentRange}
|
||||
>
|
||||
<select
|
||||
className="input"
|
||||
className={interestControlClass}
|
||||
value={form.investmentRange}
|
||||
onChange={(e) =>
|
||||
update('investmentRange', e.target.value)
|
||||
}
|
||||
>
|
||||
<option value="">Seleccione</option>
|
||||
<option value="ate-100000">Até USD 100.000</option>
|
||||
<option value="ate-100000">
|
||||
Até USD 100.000
|
||||
</option>
|
||||
<option value="100000-500000">
|
||||
USD 100.000 – 500.000
|
||||
</option>
|
||||
@@ -833,37 +878,47 @@ function InterestForm({
|
||||
</select>
|
||||
</Field>
|
||||
|
||||
<Field label="Mensagem" error={errors.message} required>
|
||||
<Field
|
||||
label="Mensagem"
|
||||
error={errors.message}
|
||||
required
|
||||
className="sm:col-span-2"
|
||||
>
|
||||
<textarea
|
||||
rows={4}
|
||||
className="input"
|
||||
className={interestControlClass}
|
||||
value={form.message}
|
||||
onChange={(e) => update('message', e.target.value)}
|
||||
onChange={(e) =>
|
||||
update('message', e.target.value)
|
||||
}
|
||||
placeholder="Descreva o seu interesse ou a informação pretendida."
|
||||
/>
|
||||
</Field>
|
||||
|
||||
<label className="flex items-start gap-3 text-sm text-slate-600">
|
||||
<label className="flex items-start gap-3 rounded-xl border border-slate-200 bg-white p-4 text-sm leading-6 text-slate-700 sm:col-span-2">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={form.privacyConsent}
|
||||
onChange={(e) =>
|
||||
update('privacyConsent', e.target.checked)
|
||||
}
|
||||
className="mt-1"
|
||||
className="mt-1.5 accent-[#ed1c24]"
|
||||
/>
|
||||
Aceito que os meus dados sejam usados para efeitos de
|
||||
contacto e análise da manifestação de interesse.
|
||||
Aceito que os meus dados sejam usados para efeitos
|
||||
de contacto e análise da manifestação de interesse.
|
||||
</label>
|
||||
{errors.privacyConsent && (
|
||||
<p className="text-sm text-red-600">
|
||||
<p
|
||||
role="alert"
|
||||
className="text-sm text-red-600 sm:col-span-2"
|
||||
>
|
||||
{errors.privacyConsent}
|
||||
</p>
|
||||
)}
|
||||
|
||||
<button
|
||||
type="submit"
|
||||
className="w-full rounded-lg bg-slate-900 py-3 font-bold text-white hover:bg-slate-700"
|
||||
className="w-full rounded-xl bg-[#ed1c24] px-5 py-3 font-bold text-white transition-colors hover:bg-[#c8171e] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[#ed1c24] disabled:opacity-60 sm:col-span-2"
|
||||
>
|
||||
{submitting
|
||||
? 'A enviar...'
|
||||
@@ -871,6 +926,7 @@ function InterestForm({
|
||||
</button>
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -880,22 +936,41 @@ function Field({
|
||||
required,
|
||||
error,
|
||||
children,
|
||||
htmlFor,
|
||||
className,
|
||||
}: {
|
||||
label: string;
|
||||
required?: boolean;
|
||||
error?: string;
|
||||
children: ReactNode;
|
||||
htmlFor?: string;
|
||||
className?: string;
|
||||
}) {
|
||||
return (
|
||||
<div>
|
||||
<label className="block text-sm font-semibold text-slate-700">
|
||||
<span className="mb-1 block">
|
||||
<div className={className}>
|
||||
{htmlFor ? (
|
||||
<label
|
||||
htmlFor={htmlFor}
|
||||
className="mb-1.5 block text-xs font-bold text-slate-800"
|
||||
>
|
||||
{label}{' '}
|
||||
{required && <span className="text-red-600">*</span>}
|
||||
</label>
|
||||
) : (
|
||||
<label className="block text-xs font-bold text-slate-800">
|
||||
<span className="mb-1.5 block">
|
||||
{label}{' '}
|
||||
{required && <span className="text-red-600">*</span>}
|
||||
</span>
|
||||
{children}
|
||||
</label>
|
||||
{error && <p className="mt-1 text-sm text-red-600">{error}</p>}
|
||||
)}
|
||||
{htmlFor && children}
|
||||
{error && (
|
||||
<p role="alert" className="mt-1 text-sm text-red-600">
|
||||
{error}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -985,7 +1060,11 @@ export default function PortalInvestidorApp({
|
||||
<SectorContext.Provider value={sectors}>
|
||||
<div className="min-h-screen bg-slate-50 font-sans text-slate-900">
|
||||
{view !== 'home' && (
|
||||
<TopBar onNavigate={navigate} requestCount={requestCount} />
|
||||
<TopBar
|
||||
onNavigate={navigate}
|
||||
requestCount={requestCount}
|
||||
hideBrand={view === 'interest'}
|
||||
/>
|
||||
)}
|
||||
<PortalMenu />
|
||||
<main>
|
||||
@@ -1234,20 +1313,6 @@ export default function PortalInvestidorApp({
|
||||
)}
|
||||
</main>
|
||||
<Footer />
|
||||
|
||||
<style>{`
|
||||
.input {
|
||||
width: 100%;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 0.5rem;
|
||||
padding: 0.6rem 0.75rem;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
.input:focus {
|
||||
outline: none;
|
||||
box-shadow: 0 0 0 2px #10b981;
|
||||
}
|
||||
`}</style>
|
||||
</div>
|
||||
</SectorContext.Provider>
|
||||
);
|
||||
|
||||
@@ -225,7 +225,7 @@ class PortalServicesTest extends TestCase
|
||||
$this->assertDatabaseCount('portal_resource_links', 20);
|
||||
}
|
||||
|
||||
public function test_public_document_lists_paginate_five_results_and_preserve_filters(): void
|
||||
public function test_public_document_lists_paginate_three_results_and_preserve_filters(): void
|
||||
{
|
||||
Storage::fake('local');
|
||||
$this->withoutMiddleware(\Illuminate\Routing\Middleware\ThrottleRequests::class);
|
||||
@@ -254,14 +254,14 @@ class PortalServicesTest extends TestCase
|
||||
|
||||
auth()->logout();
|
||||
foreach (['documentos', 'legislacao'] as $path) {
|
||||
foreach ([1 => [5, 1, 5], 2 => [5, 6, 10], 3 => [1, 11, 11]] as $number => [$count, $from, $to]) {
|
||||
foreach ([1 => [3, 1, 3], 2 => [3, 4, 6], 3 => [3, 7, 9], 4 => [2, 10, 11]] as $number => [$count, $from, $to]) {
|
||||
$this->get('/'.$path.'?topic=Investimento&page='.$number)->assertOk()->assertInertia(fn (Assert $page) => $page
|
||||
->has('resources.data', $count)->where('resources.total', 11)
|
||||
->where('resources.current_page', $number)->where('resources.last_page', 3)
|
||||
->where('resources.current_page', $number)->where('resources.last_page', 4)
|
||||
->where('resources.from', $from)->where('resources.to', $to)
|
||||
->where('resources.data.0.title', sprintf('Pagination QA %02d', $from))
|
||||
->where('resources.prev_page_url', fn ($url) => $number === 1 ? $url === null : str_contains($url, 'topic=Investimento') && str_contains($url, 'page='.($number - 1)))
|
||||
->where('resources.next_page_url', fn ($url) => $number === 3 ? $url === null : str_contains($url, 'topic=Investimento') && str_contains($url, 'page='.($number + 1))));
|
||||
->where('resources.next_page_url', fn ($url) => $number === 4 ? $url === null : str_contains($url, 'topic=Investimento') && str_contains($url, 'page='.($number + 1))));
|
||||
}
|
||||
$this->get('/'.$path.'?q=Pagination%20QA%2001')->assertOk()->assertInertia(fn (Assert $page) => $page
|
||||
->has('resources.data', 1)->where('resources.total', 1)->where('resources.data.0.title', 'Pagination QA 01'));
|
||||
@@ -349,7 +349,7 @@ class PortalServicesTest extends TestCase
|
||||
'target_key' => 'fiscal.iva.lei_13_2016_rectification_2017', 'review_status' => 'pending', 'applicability' => 'evidence']);
|
||||
$this->assertDatabaseHas('audit_events', ['source_system' => 'portal-services', 'entity_type' => 'portal_resources',
|
||||
'actor_user_id' => $manager->id, 'action' => 'published_under_user_authorization']);
|
||||
$this->get('/documentos')->assertInertia(fn (Assert $page) => $page->has('resources.data', 4));
|
||||
$this->get('/documentos')->assertInertia(fn (Assert $page) => $page->has('resources.data', 3)->where('resources.total', 4));
|
||||
$this->get('/documentos?q=22%2F2022')->assertInertia(fn (Assert $page) => $page
|
||||
->has('resources.data', 1)->where('resources.data.0.id', $resourceIds[0]));
|
||||
$this->get('/documentos?category=Guia&document_type=legislation')->assertInertia(fn (Assert $page) => $page
|
||||
|
||||
Reference in New Issue
Block a user