Entrega dashboard e correccoes transversais preservando Ofertas instalado
tests / ci (push) Canceled after 0s

This commit is contained in:
2026-11-15 18:56:39 +02:00
parent 1349789226
commit fb076c174f
117 changed files with 10380 additions and 1905 deletions
+259 -100
View File
@@ -9,14 +9,25 @@ import {
import { Link, useForm } from '@inertiajs/react';
import { Frame, card, button } from '@/pages/investment/shared';
import { type Programme, windowLabels } from './shared';
import { useRef, useState } from 'react';
import {
TerritoryFields,
type TerritoryOption,
} from '@/components/investment-territory';
export default function Index({
export default function FundingIndex(props: Parameters<typeof Index>[0]) {
return <Index key={JSON.stringify(props.filters)} {...props} />;
}
function Index({
items,
filters,
kinds,
management,
options,
needs = {},
categoryTypes = {},
territorySelection = [],
criteriaErrors = {},
}: {
items: {
data: Programme[];
@@ -36,6 +47,10 @@ export default function Index({
institution_type?: string;
location_mode?: string;
include_historical?: string;
province_id?: string;
district_id?: string;
admin_post_id?: string;
locality_id?: string;
};
options: {
sectors: { id: number; name: string }[];
@@ -44,7 +59,11 @@ export default function Index({
kinds: Record<string, string>;
needs?: Record<string, string>;
management: boolean;
categoryTypes?: Record<string, string[]>;
territorySelection?: TerritoryOption[];
criteriaErrors?: Record<string, string[]>;
}) {
const [notice, setNotice] = useState('');
const form = useForm({
category: filters.category ?? '',
institution_type: filters.institution_type ?? '',
@@ -57,9 +76,21 @@ export default function Index({
kind: filters.kind ?? '',
sector: filters.sector ?? '',
territory: filters.territory ?? '',
province_id: filters.province_id ?? '',
district_id: filters.district_id ?? '',
admin_post_id: filters.admin_post_id ?? '',
locality_id: filters.locality_id ?? '',
certainty: filters.certainty ?? 'include_unknown',
state: filters.state ?? '',
});
const applied = useRef(JSON.stringify(form.data));
const criteriaChanged = JSON.stringify(form.data) !== applied.current;
const typeAllowed = (category: string, type: string) =>
!category ||
category === 'other' ||
!type ||
type === 'other' ||
(categoryTypes[category] ?? []).includes(type);
return (
<Frame title="Instituições financeiras, fundos e programas de apoio">
{management && (
@@ -76,20 +107,96 @@ export default function Index({
investimento.
</p>
<form
className={`${card} flex flex-wrap gap-4`}
className={`${card} flex flex-wrap gap-4 [&_select]:w-full [&_select]:max-w-full [&_select]:min-w-0 [&>label]:w-full [&>label]:max-w-full [&>label]:min-w-0 sm:[&>label]:w-auto`}
onSubmit={(e) => {
e.preventDefault();
form.get('/fundos');
}}
>
{Object.keys(criteriaErrors).length > 0 && (
<aside
className="basis-full rounded border border-amber-600 p-3"
role="alert"
>
<h2 className="font-semibold">
Reveja esta combinação de critérios
</h2>
{Object.entries(criteriaErrors).map(
([key, messages]) => (
<p key={key}>{messages.join(' ')}</p>
),
)}
<p>
A pesquisa não foi executada. Corrija os critérios
indicados e volte a pesquisar.
</p>
</aside>
)}
{notice && (
<p className="basis-full" role="status">
{notice}
</p>
)}
{Object.entries(form.errors).map(([key, error]) => (
<p className="basis-full" role="alert" key={key}>
{error}
</p>
))}
{form.data.kind &&
form.data.kind !== 'institution' &&
(form.data.category ||
form.data.institution_type ||
form.data.location_mode === 'physical') && (
<aside className="basis-full rounded border p-3">
<p>
Categoria, tipo de instituição e presença física
não identificam um fundo ou programa. Reveja o
tipo de registo ou retire apenas estes critérios
incompatíveis.
</p>
<button
type="button"
className="underline"
onClick={() => {
form.setData({
...form.data,
category: '',
institution_type: '',
location_mode: 'coverage',
});
setNotice(
'Critérios de instituição retirados por sua escolha. Local, sector, necessidade e janela foram preservados.',
);
}}
>
Manter o fundo/programa e rever os critérios de
instituição
</button>
</aside>
)}
<label>
Categoria
Categoria da instituição
<select
className="block rounded border p-2"
value={form.data.category}
onChange={(e) =>
form.setData('category', e.target.value)
}
onChange={(e) => {
const category = e.target.value;
const valid = typeAllowed(
category,
form.data.institution_type,
);
if (!valid)
setNotice(
'O tipo anterior não pertence à nova categoria e foi retirado. Escolha um dos tipos aplicáveis.',
);
form.setData({
...form.data,
category,
institution_type: valid
? form.data.institution_type
: '',
});
}}
>
<option value="">Todas</option>
{Object.entries(financialCategories).map(
@@ -102,7 +209,7 @@ export default function Index({
</select>
</label>
<label>
Tipo
Tipo de instituição
<select
className="block rounded border p-2"
value={form.data.institution_type}
@@ -111,11 +218,19 @@ export default function Index({
}
>
<option value="">Todos</option>
{Object.entries(financialTypes).map(([id, label]) => (
<option key={id} value={id}>
{label}
</option>
))}
{Object.entries(financialTypes)
.filter(
([id]) =>
typeAllowed(form.data.category, id) ||
id === form.data.institution_type,
)
.map(([id, label]) => (
<option key={id} value={id}>
{typeAllowed(form.data.category, id)
? label
: 'Incompatível: ' + label}
</option>
))}
</select>
</label>
<label>
@@ -174,7 +289,7 @@ export default function Index({
/>
</label>
<label>
Tipo
Tipo de registo a consultar
<select
className="block rounded border p-2"
value={form.data.kind}
@@ -206,23 +321,41 @@ export default function Index({
))}
</select>
</label>
<label>
Local de interesse
<select
className="block rounded border p-2"
value={form.data.territory}
onChange={(e) =>
form.setData('territory', e.target.value)
<fieldset className="min-w-0 basis-full">
<legend>
Local de interesse — seleccione até ao nível conhecido
</legend>
<TerritoryFields
initial={territorySelection}
showMap={false}
onChange={(path) =>
form.setData({
...form.data,
territory: path.at(-1)?.id ?? '',
province_id:
path.find(
(node) =>
node.location_type === 'province',
)?.id ?? '',
district_id:
path.find(
(node) =>
node.location_type === 'district',
)?.id ?? '',
admin_post_id:
path.find(
(node) =>
node.location_type === 'admin_post',
)?.id ?? '',
locality_id:
path.find(
(node) =>
node.location_type === 'locality',
)?.id ?? '',
})
}
>
<option value="">Todos</option>
{options.territories.map((item) => (
<option key={item.id} value={item.id}>
{item.name}
</option>
))}
</select>
</label>
/>
</fieldset>
<label>
Informação por confirmar
<select
@@ -256,82 +389,108 @@ export default function Index({
</select>
</label>
</form>
<p className="text-sm">
Explore as instituições e soluções adequadas ao seu
investimento. Use os filtros para encontrar a informação de que
precisa.
</p>
{items.data.length === 0 && (
<p>
Não foram encontrados programas publicados para esta
pesquisa.
{criteriaChanged && (
<p role="status">
Alterou os critérios. Clique em Pesquisar para os aplicar.
Os resultados anteriores ficam separados abaixo.
</p>
)}
{items.data.map((item) => (
<article className={card} key={item.id}>
<h2 className="text-xl font-semibold">
<Link
className="underline"
href={`/fundos/${item.id}?${new URLSearchParams(Object.entries(filters).filter((entry): entry is [string, string] => typeof entry[1] === 'string'))}`}
>
{item.payload.title}
</Link>
</h2>
{item.payload.kind === 'institution' ? (
<InstitutionView
compact
value={
item.payload as InstitutionDetails & {
title: string;
summary: string;
}
}
/>
) : (
<>
<p>{item.payload.summary}</p>
<p>Entidade gestora: {item.payload.manager_name}</p>
{Object.entries(item.filter_explanation ?? {}).map(
([key, message]) => (
<p key={key}>{message}</p>
),
)}
</>
)}
{item.payload.kind === 'institution' &&
item.payload.windows.length === 0 ? null : item.payload
.windows.length === 0 ? (
<details
open={
!criteriaChanged && Object.keys(criteriaErrors).length === 0
}
className="space-y-3"
>
<summary>
{Object.keys(criteriaErrors).length
? 'Pesquisa não executada — critérios inválidos'
: criteriaChanged
? 'Resultados da pesquisa anterior — não correspondem aos critérios por aplicar'
: 'Resultados correspondentes à pesquisa'}
</summary>
<p className="text-sm">
Explore as instituições e soluções adequadas ao seu
investimento. Use os filtros para encontrar a informação de
que precisa.
</p>
{items.data.length === 0 &&
Object.keys(criteriaErrors).length === 0 && (
<p>
Não existe uma janela de candidatura confirmada para
este programa.
Não foram encontradas instituições, fundos ou
programas publicados que correspondam a todos os
critérios desta pesquisa.
</p>
) : (
<ul>
{item.payload.windows.map((window) => (
<li key={window.code}>
{window.title}: {windowLabels[window.state]}
</li>
))}
</ul>
)}
</article>
))}
<nav aria-label="Páginas do catálogo" className="flex gap-3">
{items.links.map((link, index) =>
link.url ? (
<Link
key={index}
href={link.url}
aria-current={link.active ? 'page' : undefined}
className="underline"
>
{link.label
.replace(/&laquo;/g, '«')
.replace(/&raquo;/g, '»')}
</Link>
) : null,
)}
</nav>
{items.data.map((item) => (
<article className={card} key={item.id}>
<h2 className="text-xl font-semibold">
<Link
className="underline"
href={`/fundos/${item.id}?${new URLSearchParams(Object.entries(filters).filter((entry): entry is [string, string] => typeof entry[1] === 'string'))}`}
>
{item.payload.title}
</Link>
</h2>
{item.payload.kind === 'institution' ? (
<InstitutionView
compact
value={
item.payload as InstitutionDetails & {
title: string;
summary: string;
}
}
/>
) : (
<>
<p>{item.payload.summary}</p>
<p>
Entidade gestora:{' '}
{item.payload.manager_name}
</p>
{Object.entries(
item.filter_explanation ?? {},
).map(([key, message]) => (
<p key={key}>{message}</p>
))}
</>
)}
{item.payload.kind === 'institution' &&
item.payload.windows.length === 0 ? null : item.payload
.windows.length === 0 ? (
<p>
Não existe uma janela de candidatura confirmada
para este programa.
</p>
) : (
<ul>
{item.payload.windows.map((window) => (
<li key={window.code}>
{window.title}:{' '}
{windowLabels[window.state]}
</li>
))}
</ul>
)}
</article>
))}
<nav aria-label="Páginas do catálogo" className="flex gap-3">
{items.links.map((link, index) =>
link.url ? (
<Link
key={index}
href={link.url}
aria-current={link.active ? 'page' : undefined}
className="underline"
>
{link.label
.replace(/&laquo;/g, '«')
.replace(/&raquo;/g, '»')}
</Link>
) : null,
)}
</nav>
</details>
</Frame>
);
}
@@ -3,6 +3,7 @@ import {
persistOpportunitySelection,
} from '@/lib/opportunity-selection';
import CatalogueGuideLinks from '@/components/catalogue-guide-links';
import PublishedOpportunitiesEmpty from '@/components/published-opportunities-empty';
import DemographicContext from '@/components/demographic-context';
import OpportunityCorridorGroups, {
type CorridorGroup,
@@ -409,6 +410,10 @@ export default function Catalogue({
: 'Catálogo de investimento'
}
>
<section className="my-4 space-y-3 rounded border p-4" aria-label="Estudar a localização">
<h2 className="font-semibold">Estudar a localização e preparar uma ideia</h2>
<p>A análise territorial é independente dos anúncios publicados. Os filtros comerciais abaixo aplicam-se à pesquisa de oportunidades.</p>
<div className="flex flex-wrap items-center gap-4">
<Link
className="underline"
href={
@@ -435,6 +440,8 @@ export default function Catalogue({
Iniciar ou continuar ideia nesta localização
</Link>
)}
</div>
</section>
<p className="catalogue-intro">
Combine os filtros para encontrar oportunidades publicadas.
Nenhum critério é alargado automaticamente.
@@ -506,6 +513,15 @@ export default function Catalogue({
error={searchError}
total={results.total}
/>
{!searchLoading &&
!searchError &&
results.total === 0 &&
selectedStructures.length === 0 && (
<PublishedOpportunitiesEmpty
href="/localizacoes/demografia"
label="Consultar indicadores territoriais"
/>
)}
{!searchLoading &&
!searchError &&
results.total === 0 &&
@@ -36,6 +36,7 @@ type Result = {
}[];
};
type Props = {
entity_kind?: string;
definition: { version: string; questions: Record<string, Question> };
case: { id: string; title: string; version: number } | null;
canWrite: boolean;
@@ -98,7 +99,7 @@ function Comparator(props: Props) {
}),
);
};
async function save() {
async function save(next?: string) {
if (!dossier || busy) return;
setBusy(true);
setError('');
@@ -107,8 +108,9 @@ function Comparator(props: Props) {
version: dossier.version,
operation_key: operation.current,
answers: currentValues(),
...(next ? { continue_preparation: true } : {}),
});
router.visit(base, { preserveState: false });
router.visit(next ?? base, { preserveState: false });
} catch (e) {
setError(
e instanceof Error
@@ -222,7 +224,7 @@ function Comparator(props: Props) {
type="button"
className={button}
disabled={busy}
onClick={save}
onClick={() => void save()}
>
{busy ? 'A guardar…' : 'Guardar no dossier'}
</button>
@@ -321,9 +323,36 @@ function Comparator(props: Props) {
</article>
))}
</div>
<h3 className="mt-4 font-semibold">
Preparar a próxima conversa
</h3>
<h3 className="mt-4 font-semibold">Continuar a preparação</h3>
{dossier &&
!['company', 'organization'].includes(
props.entity_kind ?? '',
) &&
!readOnly &&
props.canWrite &&
answers.preferred &&
answers.preferred !== 'unknown' && (
<button
className={button}
type="button"
disabled={busy}
onClick={() =>
void save(
`/investimentos/${dossier.id}/preparar-empresa?form=${encodeURIComponent(answers.preferred)}`,
)
}
>
Usar esta opção e continuar a preparação da empresa
</button>
)}
{dossier && (
<Link
className="block underline"
href={`/simulador-fiscal?context=${dossier.id}`}
>
Continuar a viabilidade sem repetir esta comparação
</Link>
)}
<ul className="list-disc pl-5">
{result.preparation.map((item) => (
<li key={item}>{item}</li>
@@ -1,9 +1,11 @@
import CurrencySelect from '@/components/currency-select';
import { useRef, useState } from 'react';
import { Link, router } from '@inertiajs/react';
import { Frame, card, input, button } from './shared';
import { profileJson, ProfileValidationError } from '@/lib/profile-json';
import { createOperationKey } from '@/lib/operation-key';
import {
companyPreparationNotice,
preparationValues,
type CompanyFacts,
type Party,
@@ -34,12 +36,17 @@ type Props = {
>;
history: { id: string; revision: number; at: string }[];
historyNext: number | null;
entity?: {
kind: string;
snapshot?: { name?: string; legal_form?: string };
} | null;
proposedForm?: string | null;
};
export default function CompanyPreparation(props: Props) {
return (
<Preparation
key={`${props.case.id}:${props.saved?.revision}:${props.historical}`}
key={`${props.case.id}:${props.saved?.revision}:${props.historical}:${props.proposedForm ?? ''}`}
{...props}
/>
);
@@ -86,19 +93,19 @@ function Preparation(props: Props) {
onChange={(e) => update(key, e.target.value)}
maxLength={2000}
/>
) : key === 'currency' ? (
<CurrencySelect
label="Moeda"
value={facts[key] ?? ''}
onChange={(value) => update(key, value)}
/>
) : (
<input
className={input}
name={key}
value={facts[key] ?? ''}
onChange={(e) => update(key, e.target.value)}
maxLength={
key === 'proposed_name'
? 250
: key === 'currency'
? 3
: 25
}
maxLength={key === 'proposed_name' ? 250 : 25}
/>
)}
</label>
@@ -138,7 +145,7 @@ function Preparation(props: Props) {
</label>
);
}
async function save() {
async function save(next?: string) {
if (busy || readOnly) return;
setBusy(true);
setError('');
@@ -151,7 +158,7 @@ function Preparation(props: Props) {
operation_key: operation.current,
facts: values,
});
router.visit(base, { preserveState: false });
router.visit(next ?? base, { preserveState: false });
} catch (e) {
setError(
e instanceof Error
@@ -178,7 +185,41 @@ function Preparation(props: Props) {
}
}
return (
<Frame title="Preparar a constituição da empresa">
<Frame
title={
['company', 'organization'].includes(props.entity?.kind ?? '')
? 'Preparação da empresa existente'
: 'Preparar a constituição da empresa'
}
>
{props.entity?.snapshot?.name && (
<p>
Entidade associada: {props.entity.snapshot.name}. Os dados
recuperados não alteram o cadastro nem comprovam um acto
legal.
</p>
)}
{props.proposedForm &&
facts.form !== props.proposedForm &&
!readOnly && (
<aside className={card}>
<p>
A alternativa escolhida não substituiu a forma já
preparada.
</p>
<button
type="button"
className="underline"
onClick={() => {
update('form', props.proposedForm!);
setDirty(true);
operation.current = createOperationKey();
}}
>
Usar a alternativa escolhida nesta preparação
</button>
</aside>
)}
<p>
<Link
className="underline"
@@ -194,7 +235,7 @@ function Preparation(props: Props) {
Comparar formas jurídicas
</Link>
</p>
<p>{props.definition.template_notice}</p>
<p>{companyPreparationNotice(props.definition.template_notice)}</p>
<p>
Guarde mesmo que faltem dados. Só se pedem informações desta
preparação; valores indicados como realizados são declarações,
@@ -619,6 +660,18 @@ function Preparation(props: Props) {
<button type="submit" className={button}>
Guardar ficha no dossier
</button>
<button
type="button"
className={button}
disabled={busy}
onClick={() =>
void save(
`/simulador-fiscal?context=${props.case.id}`,
)
}
>
Guardar e continuar para a viabilidade
</button>
</section>
</fieldset>
</form>
+126 -23
View File
@@ -1,11 +1,21 @@
import { router } from '@inertiajs/react';
import { useState } from 'react';
import CatalogueChoiceSelect from '@/components/catalogue-choice-select';
import DemographicEvidence, {
type DemographicAnalysis,
} from '@/components/demographic-evidence';
import { Frame, button } from './shared';
export default function Demography({
export default function Demography(
props: Parameters<typeof DemographySelection>[0],
) {
// Server filters identify this consultation, including browser back/forward.
return (
<DemographySelection key={JSON.stringify(props.filters)} {...props} />
);
}
function DemographySelection({
evidence,
filters,
territories,
@@ -27,6 +37,10 @@ export default function Demography({
sectors: Record<string, string>;
}) {
const [selected, setSelected] = useState(filters.territories ?? []);
const [province, setProvince] = useState('');
const [district, setDistrict] = useState('');
const [selectionNotice, setSelectionNotice] = useState('');
const candidate = district || province;
const [start, setStart] = useState(
filters.start_year ?? new Date().getFullYear(),
);
@@ -55,31 +69,96 @@ export default function Demography({
);
}}
>
<label>
Províncias ou distritos (até quatro)
<select
multiple
className="block h-48 w-full rounded border p-2"
value={selected}
onChange={(e) =>
setSelected(
Array.from(
e.target.selectedOptions,
(o) => o.value,
).slice(0, 4),
<fieldset className="min-w-0 space-y-3">
<legend>Localizações a comparar (até quatro)</legend>
<label htmlFor="demography-province" className="block">
Província
</label>
<CatalogueChoiceSelect
id="demography-province"
label="Província da comparação"
value={province}
options={territories
.filter((t) => t.location_type === 'province')
.map((t) => ({ value: t.id, label: t.name }))}
onChange={(value) => {
setProvince(value);
if (district)
setSelectionNotice(
'A escolha do distrito foi limpa. Os locais já acrescentados à comparação foram mantidos.',
);
setDistrict('');
}}
/>
<label htmlFor="demography-district" className="block">
Distrito (opcional)
</label>
<CatalogueChoiceSelect
id="demography-district"
label="Distrito da comparação (opcional)"
value={district}
disabled={!province}
options={territories
.filter(
(t) =>
t.location_type === 'district' &&
t.parent_id === province,
)
.map((t) => ({ value: t.id, label: t.name }))}
onChange={setDistrict}
/>
<p>
Pode comparar apenas a província ou escolher um dos seus
distritos.
</p>
{selectionNotice && <p role="status">{selectionNotice}</p>}
<button
type="button"
className={button}
disabled={
!candidate ||
selected.length >= 4 ||
selected.includes(candidate)
}
onClick={() =>
setSelected((current) => [...current, candidate])
}
>
{territories.map((t) => (
<option key={t.id} value={t.id}>
{t.name} —{' '}
{t.location_type === 'province'
? 'Província'
: `Distrito (${territories.find((p) => p.id === t.parent_id)?.name ?? ''})`}
</option>
))}
</select>
</label>
Acrescentar à comparação
</button>
<ul className="space-y-2">
{selected.map((id) => {
const t = territories.find(
(item) => item.id === id,
);
const label = t
? `${t.name} — ${t.location_type === 'province' ? 'Província' : 'Distrito'}`
: 'Localização guardada';
return (
<li
key={id}
className="flex flex-wrap items-center gap-2"
>
<span>{label}</span>
<button
type="button"
className="underline"
aria-label={`Retirar ${label} da comparação`}
onClick={() =>
setSelected((current) =>
current.filter(
(value) => value !== id,
),
)
}
>
Retirar
</button>
</li>
);
})}
</ul>
</fieldset>
<div className="space-y-3">
<label className="block">
Sector
@@ -123,6 +202,30 @@ export default function Demography({
</div>
</form>
<DemographicEvidence evidence={evidence} />
{evidence.territories.length > 0 && (
<section className="space-y-3 rounded border p-4">
<h2 className="text-xl font-semibold">
Transformar a análise numa ideia
</h2>
<p>
Prepare uma ideia nesta localização e confronte-a com a
oferta existente. Não é necessário haver uma
oportunidade publicada para iniciar a análise.
</p>
{evidence.territories.map((t) => (
<a
key={t.id}
className="block py-2 underline"
href={
'/investimentos/iniciar?source=' +
encodeURIComponent('territory:' + t.id)
}
>
Preparar ideia em {t.name}
</a>
))}
</section>
)}
</Frame>
);
}
+21
View File
@@ -34,6 +34,7 @@ const labels: Record<string, string> = {
investment_capacity: 'Capacidade de investimento declarada',
name: 'Nome da empresa',
registration: 'Referência de registo / NUIT',
legal_form: 'Forma jurídica declarada',
role: 'Função ou relação com a empresa',
description: 'Actividade e observações',
};
@@ -45,9 +46,13 @@ export default function Profile({
countries,
organizations = [],
organizationCountryAvailable = false,
continuation = null,
legalForms = [],
}: {
account: RecordData;
actorId: number;
continuation?: { id: string; title: string; href: string } | null;
legalForms?: { value: string; label: string }[];
companies: Company[];
countries: Country[];
organizations?: Organization[];
@@ -69,6 +74,17 @@ export default function Profile({
);
return (
<Frame title="Perfil de investimento e empresas">
{continuation && (
<aside className={card}>
<p>
Preparação de {continuation.title}. O cadastro no portal
não comprova a constituição legal.
</p>
<Link className="underline" href={continuation.href}>
Voltar ao dossier e associar esta empresa
</Link>
</aside>
)}
<Link className="underline" href="/formas-juridicas">
Comparar formas jurídicas antes de constituir uma entidade
</Link>
@@ -88,6 +104,7 @@ export default function Profile({
actorId={actorId}
editorId="account"
labels={labels}
legalForms={legalForms}
reportDirty={reportDirty}
record={account}
countries={countries}
@@ -132,6 +149,7 @@ export default function Profile({
actorId={actorId}
editorId={company.id}
labels={labels}
legalForms={legalForms}
reportDirty={reportDirty}
record={company}
organizations={organizations}
@@ -140,6 +158,7 @@ export default function Profile({
'name',
'incorporation_country_code',
'registration',
'legal_form',
'sector',
'role',
'description',
@@ -172,6 +191,7 @@ export default function Profile({
actorId={actorId}
editorId="new-company"
labels={labels}
legalForms={legalForms}
reportDirty={reportDirty}
record={{ version: 0, payload: {} }}
company
@@ -180,6 +200,7 @@ export default function Profile({
'name',
'incorporation_country_code',
'registration',
'legal_form',
'sector',
'role',
'description',
@@ -12,6 +12,7 @@ import {
type OpportunityChoice,
} from '@/lib/investor-context';
import { createOperationKey } from '@/lib/operation-key';
import InvestmentBudgetRange from '@/components/investment-budget-range';
export default function ContextStart({
contexts,
source,
@@ -36,7 +37,10 @@ export default function ContextStart({
0,
200,
)
: (source?.title ?? opportunityChoices[0]?.opportunity.title ?? ''),
: (entryQuery.project_title ??
source?.title ??
opportunityChoices[0]?.opportunity.title ??
''),
);
const [consent, setConsent] = useState(false);
const [busy, setBusy] = useState(false);
@@ -80,6 +84,14 @@ export default function ContextStart({
};
return (
<Frame title="Iniciar ou continuar um investimento">
{!source && !opportunityChoices.length && (
<p>
Prepare a sua ideia no mesmo dossier, mesmo sem anúncios
publicados. Corredores, parques e zonas são associações
opcionais.
</p>
)}
<InvestmentBudgetRange values={entryQuery} />
<SelectedComplements items={entryComplements} />
{!!opportunityChoices.length && (
<section className={card}>
+445 -281
View File
@@ -29,14 +29,30 @@ import OpportunityChoices from '@/components/investment-opportunity-choices';
import InvestmentRequirements from '@/components/investment-requirements';
import type { OpportunityChoice } from '@/lib/investor-context';
import type { CorridorOption } from '@/components/investment-opportunity-choices';
import CountrySelect, { type Country } from '@/components/country-select';
import CurrencySelect from '@/components/currency-select';
import InvestmentBudgetRange from '@/components/investment-budget-range';
import DemographicContext from '@/components/demographic-context';
import { preparationSearch } from '@/lib/preparation-intent';
type Options = {
opportunities: { key: string; title: string; kind: string }[];
opportunities: {
key: string;
title: string;
kind: string;
relevance?: string;
}[];
countries?: Country[];
sectors: { id: number; name: string }[];
parks: { id: string; name: string; version_no: number }[];
search_limited: boolean;
};
type Slot = 'portfolio' | 'opportunity' | 'sector' | 'territory' | 'park';
export default function ContextEditor({
export default function ContextEditor(
props: Parameters<typeof ScopedContextEditor>[0],
) {
return <ScopedContextEditor key={props.initial.case.id} {...props} />;
}
function ScopedContextEditor({
initial,
options: initialOptions,
source,
@@ -47,6 +63,7 @@ export default function ContextEditor({
entryLocationDifferences = [],
entryComplements = [],
entryTerritory = null,
entryIdea = {},
}: {
initial: ContextView;
options: Options;
@@ -56,6 +73,7 @@ export default function ContextEditor({
entrySources?: string[];
entryComplements?: Complement[];
entryTerritory?: ContextReference | null;
entryIdea?: Record<string, string>;
entryLocationDifferences?: {
title: string;
saved: string;
@@ -78,7 +96,21 @@ export default function ContextEditor({
>([]);
const [complementError, setComplementError] = useState('');
const [choices, setChoices] = useState<OpportunityChoice[]>(
requestedChoices ?? initial.context.opportunity_choices ?? [],
requestedChoices ??
(initial.context.opportunity_choices?.length
? initial.context.opportunity_choices
: initial.context.selection.opportunity?.kind === 'opportunity'
? [
{
opportunity: initial.context.selection.opportunity,
territory:
initial.context.selection.territory ?? null,
territory_path: territorySelection,
location_reason: '',
location_state: 'undetermined',
},
]
: []),
);
const [manageChoices, setManageChoices] = useState(
requestedChoices !== null ||
@@ -149,8 +181,17 @@ export default function ContextEditor({
const [preparation, setPreparation] = useState(initial.private_investment);
const [options, setOptions] = useState(initialOptions);
const [query, setQuery] = useState('');
const [relatedOpen, setRelatedOpen] = useState(false);
const [relatedSearch, setRelatedSearch] = useState<string | null>(null);
const [consultationPath, setConsultationPath] =
useState(territorySelection);
const [changes, setChanges] = useState<Partial<Record<Slot, string>>>(
() => ({
...(entryIdea.sector_id &&
!initial.context.selection.sector &&
!draft?.selection?.sector
? { sector: 'sector:' + entryIdea.sector_id }
: {}),
...draft?.selection,
...(entryTerritory &&
!draft?.selection?.territory &&
@@ -159,7 +200,7 @@ export default function ContextEditor({
: {}),
...(source?.kind === 'portfolio'
? { portfolio: source.key }
: draft?.selection
: draft?.selection || source?.kind === 'territory'
? {}
: source
? {
@@ -171,7 +212,20 @@ export default function ContextEditor({
}),
);
const [declarations, setDeclarations] = useState<Record<string, string>>(
draft?.declarations ?? {},
() => ({
...Object.fromEntries(
Object.entries(entryIdea).filter(
([key]) =>
[
'project_title',
'investment_budget_min',
'investment_budget_max',
'currency',
].includes(key) && !initial.context.fields[key],
),
),
...draft?.declarations,
}),
);
const [documentLinks, setDocumentLinks] = useState<
Record<string, string | null>
@@ -188,21 +242,32 @@ export default function ContextEditor({
const [message, setMessage] = useState('');
const [corridors, setCorridors] = useState<CorridorOption[]>([]);
const [parks, setParks] = useState<Options['parks']>([]);
const [corridorLoading, setCorridorLoading] = useState(true);
const [corridorLoading, setCorridorLoading] = useState(
choices.length > 0 || consultationPath.length > 0,
);
const [corridorError, setCorridorError] = useState('');
const [corridorRetry, setCorridorRetry] = useState(0);
const [draftStatus, setDraftStatus] = useState('');
const [draftRetry, setDraftRetry] = useState(0);
const queue = useRef<Promise<unknown>>(Promise.resolve());
const firstCorridor =
choices[0]?.corridor_key ??
corridors.find((c) => c.name === choices[0]?.coverage)?.key;
const firstTerritory = choices[0]?.territory?.id;
choices[0]?.corridor_key !== undefined
? choices[0].corridor_key
: corridors.find((c) => c.name === choices[0]?.coverage)?.key;
const firstTerritory =
choices[0]?.territory?.id ?? consultationPath.at(-1)?.id;
useEffect(() => {
let active = true;
if (!choices.length && !firstTerritory) {
setCorridorLoading(false);
setCorridorError('');
setParks([]);
return;
}
setCorridorLoading(true);
setCorridorError('');
const params = new URLSearchParams();
if (!choices.length) params.set('include_corridors', '0');
if (firstCorridor) params.set('corridor', firstCorridor);
if (firstTerritory) params.set('territory', firstTerritory);
void contextApi<{
@@ -222,10 +287,9 @@ export default function ContextEditor({
park &&
!data.parks.some((p) => 'park:' + p.id === park)
) {
setChanges((old) => ({ ...old, park: '' }));
setPlan(null);
// Keep the previous association until the investor reviews it.
setMessage(
'A zona ou parque anterior foi retirado porque não tem enquadramento compatível com a localização escolhida.',
'Reveja a zona ou parque anterior: a compatibilidade com esta escolha ainda nao foi confirmada.',
);
}
})
@@ -238,7 +302,7 @@ export default function ContextEditor({
return () => {
active = false;
};
}, [firstCorridor, firstTerritory, corridorRetry]);
}, [firstCorridor, firstTerritory, corridorRetry, choices.length]);
const draftBody = JSON.stringify({
complements: complements.map(complementInput),
entry_sources: entrySources,
@@ -512,8 +576,8 @@ export default function ContextEditor({
</Link>
<p>{view.case.title}</p>
<p>
Confirme as oportunidades e a localização, complete os dados
disponíveis e reveja antes de guardar.
Confirme a sua ideia, o sector e a localização. Complete
apenas o que falta; associar anúncios é opcional.
</p>
<SelectedComplements
items={complements}
@@ -616,7 +680,9 @@ export default function ContextEditor({
</p>
)}
{corridorLoading && (
<p role="status">A carregar opções do corredor…</p>
<p role="status">
A consultar associações documentadas…
</p>
)}
<p role="status">{draftStatus}</p>
{draft?.needs_review && (
@@ -635,16 +701,20 @@ export default function ContextEditor({
Tentar guardar novamente
</button>
)}
<OpportunityChoices
corridors={corridors}
choices={choices}
disabled={busy || corridorLoading || !!corridorError}
onChange={(next) => {
setChoices(next);
setManageChoices(true);
setPlan(null);
}}
/>
{!!choices.length && (
<OpportunityChoices
corridors={corridors}
choices={choices}
disabled={
busy || corridorLoading || !!corridorError
}
onChange={(next) => {
setChoices(next);
setManageChoices(true);
setPlan(null);
}}
/>
)}
{(changes.portfolio ||
view.context.selection.portfolio) && (
<p className="rounded border p-3">
@@ -694,145 +764,165 @@ export default function ContextEditor({
contextId={view.case.id}
/>
)}
<label className="block">
Acrescentar uma oportunidade à escolha
<select
className={input}
value=""
disabled={busy}
onChange={(e) => {
const o = options.opportunities.find(
(o) => o.key === e.target.value,
);
if (
o &&
!choices.some(
(c) => c.opportunity.key === o.key,
<details
open={relatedOpen}
onToggle={(e) => setRelatedOpen(e.currentTarget.open)}
className="rounded border p-3"
>
<summary className="cursor-pointer font-semibold">
Oportunidades relacionadas (opcional)
</summary>
<p>
Pode preparar a sua ideia sem associar um anuncio ou
corredor. Pesquise apenas se uma oportunidade puder
apoiar este investimento.
</p>
<div className="flex flex-wrap gap-2">
<label className="min-w-0 flex-1">
Pesquisar oportunidades
<input
className={input}
value={query}
onChange={(e) => setQuery(e.target.value)}
/>
</label>
<button
type="button"
className={button}
disabled={busy}
onClick={() => {
setBusy(true);
void contextApi<Options>(
'/investimentos/fontes-contexto?' +
preparationSearch(
query,
selected('sector'),
consultationPath,
),
)
) {
setChoices([
...choices,
{
opportunity: {
...o,
id: o.key.split(':')[1],
href: '/oportunidades',
version: null,
sha256: '',
fields: {},
},
territory: null,
location_reason: '',
location_state: 'undetermined',
},
]);
setManageChoices(true);
setPlan(null);
}
}}
>
<option value="">Seleccionar ficha</option>
{options.opportunities
.filter(
(o) =>
o.kind === 'opportunity' &&
.then((data) => {
setOptions(data);
setRelatedSearch(
preparationSearch(
query,
selected('sector'),
consultationPath,
),
);
})
.catch((e) => setError(e.message))
.finally(() => setBusy(false));
}}
>
Pesquisar
</button>
</div>
<label className="block">
Acrescentar uma oportunidade à escolha
<select
className={input}
value=""
disabled={busy}
onChange={(e) => {
const o = options.opportunities.find(
(o) => o.key === e.target.value,
);
if (o?.kind === 'business') {
change('opportunity', o.key);
setManageChoices(false);
setPlan(null);
return;
}
if (
o &&
!selected('opportunity').startsWith(
'business:',
) &&
!choices.some(
(c) => c.opportunity.key === o.key,
),
)
) {
setChoices([
...choices,
{
opportunity: {
...o,
id: o.key.split(':')[1],
href: '/oportunidades',
version: null,
sha256: '',
fields: {},
},
territory: null,
location_reason: '',
location_state: 'undetermined',
},
]);
setManageChoices(true);
setPlan(null);
}
}}
>
<option value="">Seleccionar ficha</option>
{(relatedSearch ===
preparationSearch(
query,
selected('sector'),
consultationPath,
)
.map((o) => (
<option key={o.key} value={o.key}>
{o.title}
</option>
))}
</select>
</label>
<h2 className="text-xl font-bold">Dados do investimento</h2>
<div className="flex flex-wrap gap-2">
<label className="min-w-0 flex-1">
Pesquisar oportunidades
<input
className={input}
value={query}
onChange={(e) => setQuery(e.target.value)}
/>
? options.opportunities
: []
)
.filter(
(o) =>
!choices.some(
(c) =>
c.opportunity.key === o.key,
),
)
.map((o) => (
<option
key={o.key}
value={o.key}
disabled={
o.kind === 'business'
? choices.length > 0
: selected(
'opportunity',
).startsWith('business:')
}
>
{o.title} —{' '}
{o.relevance ??
'Correspondência pelo título; confirme o sector e a localização.'}
</option>
))}
</select>
</label>
<button
type="button"
className={button}
disabled={busy}
onClick={() => {
setBusy(true);
void contextApi<Options>(
'/investimentos/fontes-contexto?q=' +
encodeURIComponent(query),
)
.then(setOptions)
.catch((e) => setError(e.message))
.finally(() => setBusy(false));
}}
>
Pesquisar
</button>
</div>
<label className="grid min-w-0 gap-1">
Referência individual (sem selecção múltipla)
<select
className={input + ' max-w-full min-w-0'}
value={selected('opportunity')}
disabled={busy || manageChoices}
onChange={(e) =>
change('opportunity', e.target.value)
}
>
<option value="">Sem oportunidade associada</option>
{source &&
['opportunity', 'business'].includes(
source.kind,
) &&
!options.opportunities.some(
(x) => x.key === source.key,
) && (
<option value={source.key}>
{source.title}
</option>
)}
{view.context.selection.opportunity &&
!options.opportunities.some(
(x) =>
x.key ===
view.context.selection.opportunity!.key,
) && (
<option
value={
view.context.selection.opportunity
.key
}
>
{
view.context.selection.opportunity
.title
}{' '}
— referência guardada
</option>
)}
{options.opportunities.map((o) => (
<option key={o.key} value={o.key}>
{o.title} ·{' '}
{o.kind === 'business'
? 'Negócios'
: 'Catálogo'}
</option>
))}
</select>
</label>
{options.search_limited && (
<p>
Resultados limitados por página de pesquisa;
especifique o título para encontrar outras
oportunidades.
</p>
)}
{selected('opportunity').startsWith('business:') && (
<p>
{options.opportunities.find(
(o) => o.key === selected('opportunity'),
)?.title ??
view.context.selection.opportunity?.title}
<button
type="button"
className="ml-3 underline"
disabled={busy}
onClick={() => change('opportunity', '')}
>
Retirar esta referencia
</button>
</p>
)}
{options.search_limited && (
<p>
Resultados limitados por página de pesquisa;
especifique o título para encontrar outras
oportunidades.
</p>
)}
</details>
<label className="grid min-w-0 gap-1">
Sector
<select
@@ -866,7 +956,8 @@ export default function ContextEditor({
</select>
</label>
{!manageChoices && (
<>
<details className="rounded border p-3">
<summary>Zonas e parques (opcional)</summary>
<label className="grid min-w-0 gap-1">
{choices.length > 1
? 'Zona ou parque da primeira oportunidade'
@@ -877,7 +968,7 @@ export default function ContextEditor({
busy ||
corridorLoading ||
!!corridorError ||
(!!firstCorridor && !firstTerritory)
!firstTerritory
}
value={selected('park')}
onChange={(e) =>
@@ -887,10 +978,7 @@ export default function ContextEditor({
<option value="">
Sem ZEE, ZFI ou parque seleccionado
</option>
{(firstCorridor
? parks
: options.parks
).map((p) => (
{parks.map((p) => (
<option
key={p.id}
value={'park:' + p.id}
@@ -911,7 +999,7 @@ export default function ContextEditor({
: 'A consulta não confirma disponibilidade de lotes, admissão ou incentivos.'}
</p>
)}
</>
</details>
)}
{!manageChoices && (
<>
@@ -922,15 +1010,16 @@ export default function ContextEditor({
initial={territorySelection}
disabled={busy || manageChoices}
endpoint="/api/v1/investment/territory-options"
onChange={(path) =>
onChange={(path) => {
setConsultationPath(path);
change(
'territory',
path.length
? 'territory:' +
path[path.length - 1].id
: '',
)
}
);
}}
/>
{view.context.selection.territory && (
<p>
@@ -942,117 +1031,11 @@ export default function ContextEditor({
)}
</section>
<section className={card + ' space-y-3'}>
<h2 className="text-xl font-bold">
Declarações deste investimento
</h2>
<p>
Estes campos pertencem ao processo. Alterá-los não muda
o cadastro da oportunidade nem o perfil da organização.
</p>
<p>
Origem do investidor, residência fiscal e constituição
da entidade são declarações distintas. A localização não
confirma benefícios. A prévia identifica o impacto antes
de guardar.
</p>
{[
['currency', 'Moeda do projecto', null],
[
'expected_start_date',
'Data prevista de início',
null,
],
[
'investor_origin',
'Origem do investidor',
[
['national', 'Nacional'],
['foreign', 'Estrangeiro'],
['mixed', 'Misto'],
],
],
[
'person_type',
'Tipo de entidade',
[
['singular', 'Pessoa singular'],
['collective', 'Pessoa colectiva'],
['consortium', 'Consórcio'],
],
],
[
'entity_stage',
'Situação da entidade',
[
['existing', 'Existente'],
['being_formed', 'Em constituição'],
],
],
[
'tax_residency_country',
'País de residência fiscal declarado (ISO de duas letras)',
null,
],
].map(([key, label, choices]) => (
<label className="grid gap-1" key={String(key)}>
{String(label)}
{Array.isArray(choices) ? (
<select
className={input}
disabled={busy}
value={
declarations[String(key)] ??
view.context.fields[String(key)] ??
''
}
onChange={(e) => {
setDeclarations({
...declarations,
[String(key)]: e.target.value,
});
setPlan(null);
}}
>
<option value="">Por indicar</option>
{choices.map(([value, text]) => (
<option key={value} value={value}>
{text}
</option>
))}
</select>
) : (
<input
className={input}
disabled={busy}
type={
key === 'expected_start_date'
? 'date'
: 'text'
}
maxLength={
key === 'currency'
? 3
: key === 'tax_residency_country'
? 2
: 10
}
value={
declarations[String(key)] ??
view.context.fields[String(key)] ??
''
}
onChange={(e) => {
setDeclarations({
...declarations,
[String(key)]: e.target.value,
});
setPlan(null);
}}
/>
)}
</label>
))}
{['project_title', 'project_summary'].map((k) => (
'project_title',
'products_services',
'project_summary',
].map((k) => (
<label className="grid gap-1" key={k}>
{contextFieldNames[k]}
<textarea
@@ -1063,7 +1046,13 @@ export default function ContextEditor({
''
}
disabled={busy}
maxLength={k === 'project_title' ? 200 : 5000}
maxLength={
k === 'project_title'
? 200
: k === 'products_services'
? 2000
: 5000
}
onChange={(e) => {
setDeclarations({
...declarations,
@@ -1074,6 +1063,181 @@ export default function ContextEditor({
/>
</label>
))}
</section>
<InvestmentBudgetRange
values={{ ...view.context.fields, ...declarations }}
onChange={(field, value) => {
setDeclarations((old) => ({ ...old, [field]: value }));
setPlan(null);
}}
/>
<DemographicContext territoryId={consultationPath.at(-1)?.id} />
<section className={card + ' space-y-3'}>
<h2 className="text-xl font-bold">
Declarações deste investimento
</h2>
<details className="rounded border p-3">
<summary>
Enquadramento da entidade e fiscal, quando
necessário
</summary>
<p>
Estes campos pertencem ao processo. Alterá-los não
muda o cadastro da oportunidade nem o perfil da
organização.
</p>
<p>
Origem do investidor, residência fiscal e
constituição da entidade são declarações distintas.
A localização não confirma benefícios. A prévia
identifica o impacto antes de guardar.
</p>
{[
[
'expected_start_date',
'Data prevista de início',
null,
],
[
'investor_origin',
'Origem do investidor',
[
['national', 'Nacional'],
['foreign', 'Estrangeiro'],
['mixed', 'Misto'],
],
],
[
'person_type',
'Tipo de entidade',
[
['singular', 'Pessoa singular'],
['collective', 'Pessoa colectiva'],
['consortium', 'Consórcio'],
],
],
[
'entity_stage',
'Situação da entidade',
[
['existing', 'Existente'],
['being_formed', 'Em constituição'],
],
],
[
'tax_residency_country',
'País de residência fiscal',
null,
],
].map(([key, label, choices]) => (
<label className="grid gap-1" key={String(key)}>
{String(label)}
{key === 'currency' ? (
<CurrencySelect
label="Moeda do projecto"
disabled={busy}
value={
declarations.currency ??
view.context.fields.currency ??
''
}
error={
(declarations.currency ??
view.context.fields.currency) &&
!/^[A-Z]{3}$/.test(
declarations.currency ??
view.context.fields
.currency ??
'',
)
? 'Seleccione a moeda na lista para confirmar este valor anterior.'
: undefined
}
onChange={(value) => {
setDeclarations({
...declarations,
currency: value,
});
setPlan(null);
}}
/>
) : key === 'tax_residency_country' ? (
<CountrySelect
label="País de residência fiscal"
countries={options.countries ?? []}
disabled={busy}
value={
declarations.tax_residency_country ??
view.context.fields
.tax_residency_country ??
''
}
onChange={(value) => {
setDeclarations({
...declarations,
tax_residency_country: value,
});
setPlan(null);
}}
/>
) : Array.isArray(choices) ? (
<select
className={input}
disabled={busy}
value={
declarations[String(key)] ??
view.context.fields[String(key)] ??
''
}
onChange={(e) => {
setDeclarations({
...declarations,
[String(key)]: e.target.value,
});
setPlan(null);
}}
>
<option value="">Por indicar</option>
{choices.map(([value, text]) => (
<option key={value} value={value}>
{text}
</option>
))}
</select>
) : (
<input
className={input}
disabled={busy}
type={
key === 'expected_start_date'
? 'date'
: 'text'
}
maxLength={
key === 'currency'
? 3
: key ===
'tax_residency_country'
? 2
: 10
}
value={
declarations[String(key)] ??
view.context.fields[String(key)] ??
''
}
onChange={(e) => {
setDeclarations({
...declarations,
[String(key)]: e.target.value,
});
setPlan(null);
}}
/>
)}
</label>
))}
</details>
<details>
<summary>
Substituições explícitas de declarações
+42 -2
View File
@@ -15,6 +15,11 @@ import {
type Preparation,
} from '@/components/private-investment-preparation';
import ContextDocuments from '@/components/context-documents';
import InvestmentBudgetRange from '@/components/investment-budget-range';
import DemographicContext from '@/components/demographic-context';
import InvestmentSupplyAggregate from '@/components/investment-supply-aggregate';
import InvestmentPromoter from '@/components/investment-promoter';
import type { SupplyAggregate } from '@/lib/investor-context';
import { SelectedComplements } from '@/components/investment-complements';
import InvestmentRequirements from '@/components/investment-requirements';
import OpportunityChoices from '@/components/investment-opportunity-choices';
@@ -91,6 +96,9 @@ type Path = {
private_investment?: Preparation | null;
fintech: FintechView | null;
investment_context: DossierContext | null;
can_set_promoter?: boolean;
supply_aggregate_enabled?: boolean;
supply_aggregates?: SupplyAggregate[];
zone_contexts?: {
zone_id: string;
consulted_public_version: number;
@@ -652,11 +660,16 @@ export default function InvestmentPath(path: Path) {
)}
{!!path.sector_references?.length && (
<section className="space-y-3 rounded border p-4">
<h2 className="text-lg font-semibold">Sectores e cadeias de valor</h2>
<h2 className="text-lg font-semibold">
Sectores e cadeias de valor
</h2>
{path.sector_references.map((reference) => (
<article key={reference.key}>
<h3>{reference.title}</h3>
<p>{reference.location_label ?? reference.locations_text}</p>
<p>
{reference.location_label ??
reference.locations_text}
</p>
<p>{reference.value_chain}</p>
<Link className="underline" href={reference.href}>
Consultar a referência mineral
@@ -668,12 +681,39 @@ export default function InvestmentPath(path: Path) {
<ContextDocuments
source={path.investment_context?.selection.opportunity}
/>
{path.supply_aggregate_enabled && (
<InvestmentSupplyAggregate
key={path.case.id}
caseId={path.case.id}
version={path.case.version}
revision={path.investment_context?.revision ?? 0}
history={path.supply_aggregates ?? []}
disabled={!path.canWrite}
/>
)}
<InvestmentPromoter
key={path.case.id}
caseId={path.case.id}
selected={path.investment_context?.promoter_entity}
canEdit={path.can_set_promoter ?? false}
/>
<PreparationSummary
data={path.private_investment}
caseId={path.case.id}
/>
{path.investment_context && (
<section className="space-y-2 rounded border border-emerald-300 bg-emerald-50 p-4">
<InvestmentBudgetRange
values={path.investment_context.fields}
/>
<DemographicContext
territoryId={
path.investment_context.fields.locality_id ||
path.investment_context.fields.admin_post_id ||
path.investment_context.fields.district_id ||
path.investment_context.fields.province_id
}
/>
<h2 className="font-semibold">As suas escolhas</h2>
{Object.values(path.investment_context.selection).map(
(ref) => (
+6
View File
@@ -459,6 +459,12 @@ export default function Search({
Experimente outras palavras ou uma expressão
mais curta.
</p>
<p className="mt-2 text-sm text-slate-600">
A pesquisa consulta informação disponível no
portal. Não encontrar anúncios não comprova
ausência de empresas, recursos ou potencial
no território.
</p>
<div className="mt-5">
<QuickLinks />
</div>
+4 -1
View File
@@ -1,6 +1,7 @@
import { Link, useForm, router, usePage } from '@inertiajs/react';
import { useState } from 'react';
import { catalogueReturnHref } from '@/lib/catalogue-context';
import PublishedOpportunitiesEmpty from '@/components/published-opportunities-empty';
import {
searchTerritoryHref,
portfolioPreparationHref,
@@ -366,7 +367,9 @@ function Editor({
</article>
))}
{!opportunities.length && (
<p>Sem oportunidades publicadas associadas a esta ficha.</p>
<PublishedOpportunitiesEmpty
href={searchTerritoryHref('/oportunidades', pageUrl)}
/>
)}
</section>
{management ? (
+7 -8
View File
@@ -1,3 +1,4 @@
import CurrencySelect from '@/components/currency-select';
import { Link, router, useForm } from '@inertiajs/react';
import InvestmentTerritory, {
TerritoryFields,
@@ -287,19 +288,17 @@ export default function Editor({
/>
</Field>
<Field
label="Moeda (código de três letras)"
label="Moeda do orçamento"
error={form.errors.budget_currency}
>
<input
maxLength={3}
<CurrencySelect
label="Moeda do orçamento"
className={control}
value={form.data.budget_currency}
onChange={(e) =>
form.setData(
'budget_currency',
e.target.value.toUpperCase(),
)
onChange={(value) =>
form.setData('budget_currency', value)
}
error={form.errors.budget_currency}
/>
</Field>
<Field