Merge branch 'main' of https://git.tempo.co.mz/nala/Investidor-V2 into front
This commit is contained in:
@@ -1,10 +1,19 @@
|
||||
import { InstitutionView, type InstitutionDetails } from "@/components/funding-institution";
|
||||
import { financialCategories, financialTypes } from "@/components/funding-classification";
|
||||
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";
|
||||
import {
|
||||
InstitutionView,
|
||||
type InstitutionDetails,
|
||||
} from '@/components/funding-institution';
|
||||
import {
|
||||
financialCategories,
|
||||
financialTypes,
|
||||
} from '@/components/funding-classification';
|
||||
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 FundingIndex(props: Parameters<typeof Index>[0]) {
|
||||
return <Index key={JSON.stringify(props.filters)} {...props} />;
|
||||
@@ -54,35 +63,41 @@ function Index({
|
||||
territorySelection?: TerritoryOption[];
|
||||
criteriaErrors?: Record<string, string[]>;
|
||||
}) {
|
||||
const [notice, setNotice] = useState("");
|
||||
const [notice, setNotice] = useState('');
|
||||
const [searchTerritory, setSearchTerritory] = useState(territorySelection);
|
||||
const form = useForm({
|
||||
category: filters.category ?? "",
|
||||
institution_type: filters.institution_type ?? "",
|
||||
location_mode: filters.location_mode ?? "coverage",
|
||||
include_historical: filters.include_historical ?? "0",
|
||||
context: filters.context ?? "",
|
||||
opportunity: filters.opportunity ?? "",
|
||||
need: filters.need ?? "",
|
||||
q: filters.q ?? "",
|
||||
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 ?? "",
|
||||
category: filters.category ?? '',
|
||||
institution_type: filters.institution_type ?? '',
|
||||
location_mode: filters.location_mode ?? 'coverage',
|
||||
include_historical: filters.include_historical ?? '0',
|
||||
context: filters.context ?? '',
|
||||
opportunity: filters.opportunity ?? '',
|
||||
need: filters.need ?? '',
|
||||
q: filters.q ?? '',
|
||||
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 ??
|
||||
(filters.location_mode === "physical" ? "documented" : "include_unknown"),
|
||||
state: filters.state ?? "",
|
||||
(filters.location_mode === 'physical'
|
||||
? 'documented'
|
||||
: 'include_unknown'),
|
||||
state: filters.state ?? '',
|
||||
});
|
||||
const applied = useRef(JSON.stringify(form.data));
|
||||
const criteriaChanged = JSON.stringify(form.data) !== applied.current;
|
||||
const searchReady = Boolean(
|
||||
form.data.need && (form.data.territory || form.data.province_id),
|
||||
);
|
||||
const typeAllowed = (category: string, type: string) =>
|
||||
!category ||
|
||||
category === "other" ||
|
||||
category === 'other' ||
|
||||
!type ||
|
||||
type === "other" ||
|
||||
type === 'other' ||
|
||||
(categoryTypes[category] ?? []).includes(type);
|
||||
return (
|
||||
<Frame title="Instituições financeiras, fundos e programas de apoio">
|
||||
@@ -95,25 +110,34 @@ function Index({
|
||||
A minha selecção
|
||||
</Link>
|
||||
<p>
|
||||
Encontre bancos, seguradoras, fundos e outros parceiros financeiros. Explore as
|
||||
soluções e os contactos adequados ao seu investimento.
|
||||
Encontre bancos, seguradoras, fundos e outros parceiros
|
||||
financeiros. Explore as soluções e os contactos adequados ao seu
|
||||
investimento.
|
||||
</p>
|
||||
<form
|
||||
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");
|
||||
if (!searchReady) return;
|
||||
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>
|
||||
))}
|
||||
<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.
|
||||
A pesquisa não foi executada. Corrija os critérios
|
||||
indicados e volte a pesquisar.
|
||||
</p>
|
||||
</aside>
|
||||
)}
|
||||
@@ -128,15 +152,16 @@ function Index({
|
||||
</p>
|
||||
))}
|
||||
{form.data.kind &&
|
||||
form.data.kind !== "institution" &&
|
||||
form.data.kind !== 'institution' &&
|
||||
(form.data.category ||
|
||||
form.data.institution_type ||
|
||||
form.data.location_mode === "physical") && (
|
||||
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.
|
||||
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"
|
||||
@@ -144,16 +169,17 @@ function Index({
|
||||
onClick={() => {
|
||||
form.setData({
|
||||
...form.data,
|
||||
category: "",
|
||||
institution_type: "",
|
||||
location_mode: "coverage",
|
||||
category: '',
|
||||
institution_type: '',
|
||||
location_mode: 'coverage',
|
||||
});
|
||||
setNotice(
|
||||
"Critérios de instituição retirados por sua escolha. Local, sector, necessidade e janela foram preservados.",
|
||||
'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
|
||||
Manter o fundo/programa e rever os critérios de
|
||||
instituição
|
||||
</button>
|
||||
</aside>
|
||||
)}
|
||||
@@ -164,24 +190,31 @@ function Index({
|
||||
value={form.data.category}
|
||||
onChange={(e) => {
|
||||
const category = e.target.value;
|
||||
const valid = typeAllowed(category, form.data.institution_type);
|
||||
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.",
|
||||
'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 : "",
|
||||
institution_type: valid
|
||||
? form.data.institution_type
|
||||
: '',
|
||||
});
|
||||
}}
|
||||
>
|
||||
<option value="">Todas</option>
|
||||
{Object.entries(financialCategories).map(([id, label]) => (
|
||||
<option key={id} value={id}>
|
||||
{label}
|
||||
</option>
|
||||
))}
|
||||
{Object.entries(financialCategories).map(
|
||||
([id, label]) => (
|
||||
<option key={id} value={id}>
|
||||
{label}
|
||||
</option>
|
||||
),
|
||||
)}
|
||||
</select>
|
||||
</label>
|
||||
<label>
|
||||
@@ -189,7 +222,9 @@ function Index({
|
||||
<select
|
||||
className="block rounded border p-2"
|
||||
value={form.data.institution_type}
|
||||
onChange={(e) => form.setData("institution_type", e.target.value)}
|
||||
onChange={(e) =>
|
||||
form.setData('institution_type', e.target.value)
|
||||
}
|
||||
>
|
||||
<option value="">Todos</option>
|
||||
{Object.entries(financialTypes)
|
||||
@@ -202,7 +237,7 @@ function Index({
|
||||
<option key={id} value={id}>
|
||||
{typeAllowed(form.data.category, id)
|
||||
? label
|
||||
: "Incompatível: " + label}
|
||||
: 'Incompatível: ' + label}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
@@ -210,19 +245,23 @@ function Index({
|
||||
<label>
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={form.data.include_historical === "1"}
|
||||
checked={form.data.include_historical === '1'}
|
||||
onChange={(e) =>
|
||||
form.setData("include_historical", e.target.checked ? "1" : "0")
|
||||
form.setData(
|
||||
'include_historical',
|
||||
e.target.checked ? '1' : '0',
|
||||
)
|
||||
}
|
||||
/>
|
||||
Incluir instituições históricas/fundidas, identificadas como tal
|
||||
Incluir instituições históricas/fundidas, identificadas como
|
||||
tal
|
||||
</label>
|
||||
<label>
|
||||
Necessidade do processo
|
||||
<select
|
||||
className="block rounded border p-2"
|
||||
value={form.data.need}
|
||||
onChange={(e) => form.setData("need", e.target.value)}
|
||||
onChange={(e) => form.setData('need', e.target.value)}
|
||||
>
|
||||
<option value="">Todas / por identificar</option>
|
||||
{Object.entries(needs).map(([id, label]) => (
|
||||
@@ -233,20 +272,24 @@ function Index({
|
||||
</select>
|
||||
</label>
|
||||
<label>
|
||||
Palavras-chave
|
||||
Palavras-chave (opcional)
|
||||
<input
|
||||
className="block rounded border p-2"
|
||||
value={form.data.q}
|
||||
maxLength={150}
|
||||
onChange={(e) => form.setData("q", e.target.value)}
|
||||
onChange={(e) => form.setData('q', e.target.value)}
|
||||
/>
|
||||
<span className="block text-sm">
|
||||
Refine pelo nome ou descrição; este campo não substitui
|
||||
a localização, categoria ou finalidade.
|
||||
</span>
|
||||
</label>
|
||||
<label>
|
||||
Tipo de registo a consultar
|
||||
<select
|
||||
className="block rounded border p-2"
|
||||
value={form.data.kind}
|
||||
onChange={(e) => form.setData("kind", e.target.value)}
|
||||
onChange={(e) => form.setData('kind', e.target.value)}
|
||||
>
|
||||
<option value="">Todos</option>
|
||||
{Object.entries(kinds).map(([key, name]) => (
|
||||
@@ -261,7 +304,7 @@ function Index({
|
||||
<select
|
||||
className="block rounded border p-2"
|
||||
value={form.data.sector}
|
||||
onChange={(e) => form.setData("sector", e.target.value)}
|
||||
onChange={(e) => form.setData('sector', e.target.value)}
|
||||
>
|
||||
<option value="">Todos</option>
|
||||
{options.sectors.map((item) => (
|
||||
@@ -272,7 +315,9 @@ function Index({
|
||||
</select>
|
||||
</label>
|
||||
<fieldset className="min-w-0 basis-full">
|
||||
<legend>Local de interesse — seleccione até ao nível conhecido</legend>
|
||||
<legend>
|
||||
Local de interesse — seleccione até ao nível conhecido
|
||||
</legend>
|
||||
<label>
|
||||
Localização a pesquisar
|
||||
<select
|
||||
@@ -283,40 +328,52 @@ function Index({
|
||||
...form.data,
|
||||
location_mode: e.target.value,
|
||||
certainty:
|
||||
e.target.value === "physical"
|
||||
? "documented"
|
||||
e.target.value === 'physical'
|
||||
? 'documented'
|
||||
: form.data.certainty,
|
||||
})
|
||||
}
|
||||
>
|
||||
<option value="physical">Sede, balcão ou presença física</option>
|
||||
<option value="coverage">Cobertura do financiamento/produto</option>
|
||||
<option value="physical">
|
||||
Sede, balcão ou presença física
|
||||
</option>
|
||||
<option value="coverage">
|
||||
Cobertura do financiamento/produto
|
||||
</option>
|
||||
</select>
|
||||
</label>
|
||||
<p className="mb-3 text-sm">
|
||||
Escolha a província e, se necessário, o distrito. Sede e balcões identificam
|
||||
onde pode contactar a instituição; a cobertura indica onde o financiamento
|
||||
se aplica.
|
||||
Escolha a província e, se necessário, o distrito. Sede e
|
||||
balcões identificam onde pode contactar a instituição; a
|
||||
cobertura indica onde o financiamento se aplica.
|
||||
</p>
|
||||
<TerritoryFields
|
||||
initial={territorySelection}
|
||||
initial={searchTerritory}
|
||||
showMap={false}
|
||||
onChange={(path) =>
|
||||
form.setData({
|
||||
...form.data,
|
||||
territory: path.at(-1)?.id ?? "",
|
||||
territory: path.at(-1)?.id ?? '',
|
||||
province_id:
|
||||
path.find((node) => node.location_type === "province")?.id ??
|
||||
"",
|
||||
path.find(
|
||||
(node) =>
|
||||
node.location_type === 'province',
|
||||
)?.id ?? '',
|
||||
district_id:
|
||||
path.find((node) => node.location_type === "district")?.id ??
|
||||
"",
|
||||
path.find(
|
||||
(node) =>
|
||||
node.location_type === 'district',
|
||||
)?.id ?? '',
|
||||
admin_post_id:
|
||||
path.find((node) => node.location_type === "admin_post")?.id ??
|
||||
"",
|
||||
path.find(
|
||||
(node) =>
|
||||
node.location_type === 'admin_post',
|
||||
)?.id ?? '',
|
||||
locality_id:
|
||||
path.find((node) => node.location_type === "locality")?.id ??
|
||||
"",
|
||||
path.find(
|
||||
(node) =>
|
||||
node.location_type === 'locality',
|
||||
)?.id ?? '',
|
||||
})
|
||||
}
|
||||
/>
|
||||
@@ -326,9 +383,13 @@ function Index({
|
||||
<select
|
||||
className="block rounded border p-2"
|
||||
value={form.data.certainty}
|
||||
onChange={(e) => form.setData("certainty", e.target.value)}
|
||||
onChange={(e) =>
|
||||
form.setData('certainty', e.target.value)
|
||||
}
|
||||
>
|
||||
<option value="include_unknown">Incluir e assinalar</option>
|
||||
<option value="include_unknown">
|
||||
Incluir e assinalar
|
||||
</option>
|
||||
<option value="documented">
|
||||
Apenas âmbito documentado para os filtros escolhidos
|
||||
</option>
|
||||
@@ -339,7 +400,7 @@ function Index({
|
||||
<select
|
||||
className="block rounded border p-2"
|
||||
value={form.data.state}
|
||||
onChange={(e) => form.setData("state", e.target.value)}
|
||||
onChange={(e) => form.setData('state', e.target.value)}
|
||||
>
|
||||
<option value="">Qualquer estado</option>
|
||||
{Object.entries(windowLabels).map(([key, label]) => (
|
||||
@@ -349,52 +410,95 @@ function Index({
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
<button className={button} disabled={form.processing}>
|
||||
{!searchReady && (
|
||||
<p id="funding-search-minimum" role="status">
|
||||
Escolha a localização a pesquisar e a necessidade do
|
||||
processo antes de pesquisar.
|
||||
</p>
|
||||
)}
|
||||
<button
|
||||
className={button}
|
||||
disabled={form.processing || !searchReady}
|
||||
aria-describedby={
|
||||
!searchReady ? 'funding-search-minimum' : undefined
|
||||
}
|
||||
>
|
||||
Pesquisar
|
||||
</button>
|
||||
</form>
|
||||
{criteriaChanged && (
|
||||
<p role="status">
|
||||
Alterou os critérios. Clique em Pesquisar para os aplicar. Os resultados
|
||||
anteriores ficam separados abaixo.
|
||||
Alterou os critérios. Clique em Pesquisar para os aplicar.
|
||||
Os resultados anteriores ficam separados abaixo.
|
||||
</p>
|
||||
)}
|
||||
<details
|
||||
open={!criteriaChanged && Object.keys(criteriaErrors).length === 0}
|
||||
open={
|
||||
!criteriaChanged && Object.keys(criteriaErrors).length === 0
|
||||
}
|
||||
className="space-y-3"
|
||||
>
|
||||
<summary>
|
||||
{Object.keys(criteriaErrors).length
|
||||
? "Pesquisa não executada — critérios inválidos"
|
||||
? 'Pesquisa não executada — critérios inválidos'
|
||||
: criteriaChanged
|
||||
? "Resultados da pesquisa anterior — não correspondem aos critérios por aplicar"
|
||||
: "Resultados correspondentes à pesquisa"}
|
||||
? '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.
|
||||
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 foram encontradas instituições, fundos ou programas publicados que
|
||||
correspondam a todos os critérios desta pesquisa.
|
||||
</p>
|
||||
)}
|
||||
{items.data.length === 0 &&
|
||||
Object.keys(criteriaErrors).length === 0 && (
|
||||
<div className="grid gap-3">
|
||||
<p>
|
||||
Não foram encontradas instituições, fundos ou
|
||||
programas publicados que correspondam a todos os
|
||||
critérios desta pesquisa.
|
||||
</p>
|
||||
{!criteriaChanged &&
|
||||
filters.location_mode === 'physical' &&
|
||||
filters.province_id && (
|
||||
<button
|
||||
type="button"
|
||||
className={button}
|
||||
onClick={() => {
|
||||
form.setData({
|
||||
...form.data,
|
||||
territory: '',
|
||||
province_id: '',
|
||||
district_id: '',
|
||||
admin_post_id: '',
|
||||
locality_id: '',
|
||||
});
|
||||
setSearchTerritory([]);
|
||||
setNotice(
|
||||
'Escolha outra província no local a pesquisar. Categoria, tipo e finalidade foram conservados; a localização do investimento no dossier mantém-se.',
|
||||
);
|
||||
}}
|
||||
>
|
||||
Procurar instituição noutra província
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
{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"))}`}
|
||||
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" ? (
|
||||
{item.payload.kind === 'institution' ? (
|
||||
<InstitutionView
|
||||
compact
|
||||
physicalTerritory={
|
||||
filters.location_mode === "physical"
|
||||
filters.location_mode === 'physical'
|
||||
? filters.territory
|
||||
: undefined
|
||||
}
|
||||
@@ -408,25 +512,30 @@ function Index({
|
||||
) : (
|
||||
<>
|
||||
<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>
|
||||
),
|
||||
)}
|
||||
<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 ? (
|
||||
{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.
|
||||
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]}
|
||||
{window.title}:{' '}
|
||||
{windowLabels[window.state]}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
@@ -439,10 +548,12 @@ function Index({
|
||||
<Link
|
||||
key={index}
|
||||
href={link.url}
|
||||
aria-current={link.active ? "page" : undefined}
|
||||
aria-current={link.active ? 'page' : undefined}
|
||||
className="underline"
|
||||
>
|
||||
{link.label.replace(/«/g, "«").replace(/»/g, "»")}
|
||||
{link.label
|
||||
.replace(/«/g, '«')
|
||||
.replace(/»/g, '»')}
|
||||
</Link>
|
||||
) : null,
|
||||
)}
|
||||
|
||||
@@ -272,7 +272,7 @@ export default function BusinessMarketplace({
|
||||
zone: 'Regime de zona',
|
||||
sector: 'Setor associado',
|
||||
activity:
|
||||
'Subsector ou atividade',
|
||||
'Subsector ou actividade',
|
||||
} as Record<string, string>
|
||||
)[id] ?? id,
|
||||
})),
|
||||
@@ -299,7 +299,7 @@ export default function BusinessMarketplace({
|
||||
],
|
||||
[
|
||||
'subsector_id',
|
||||
'Subsector ou atividade',
|
||||
'Subsector ou actividade',
|
||||
classificationOptions.targets
|
||||
.activity ?? [],
|
||||
],
|
||||
@@ -361,7 +361,10 @@ export default function BusinessMarketplace({
|
||||
)}
|
||||
<ul className="grid gap-4 md:grid-cols-2">
|
||||
{results.data.map((record) => (
|
||||
<li className={card} key={record.id}>
|
||||
<li
|
||||
className={`${card} flex min-w-0 flex-col gap-3 [overflow-wrap:anywhere]`}
|
||||
key={record.id}
|
||||
>
|
||||
<p>
|
||||
{businessModalities[record.modality] ??
|
||||
'Modalidade por indicar'}
|
||||
@@ -400,6 +403,17 @@ export default function BusinessMarketplace({
|
||||
{record.objective}
|
||||
</p>
|
||||
)}
|
||||
<nav
|
||||
aria-label={`Acções de ${record.title}`}
|
||||
className="mt-auto flex flex-wrap gap-3"
|
||||
>
|
||||
<Link
|
||||
className="underline"
|
||||
href={`/negocios/${record.slug}${returnQuery ? `?${returnQuery}` : ''}`}
|
||||
>
|
||||
Consultar ficha
|
||||
</Link>
|
||||
</nav>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
|
||||
@@ -1175,7 +1175,6 @@ export default function Catalogue({
|
||||
className="catalogue-territorial-link"
|
||||
>
|
||||
<span className="text-sm">
|
||||
{d.content.code} ·{' '}
|
||||
{d.cluster_id
|
||||
? 'Cluster'
|
||||
: d.corridor_id
|
||||
|
||||
@@ -8,7 +8,20 @@ import {
|
||||
type CompanyAnswers,
|
||||
} from '@/lib/company-comparison';
|
||||
|
||||
const comparisonIntroduction =
|
||||
'Compare alternativas para discutir a constituição; não existe uma forma universalmente preferível.';
|
||||
type Question = { label: string; options: Record<string, string> };
|
||||
const questionThemes: Record<string, string> = {
|
||||
purpose: 'Organização do pedido',
|
||||
participants: 'Titulares, sócios e accionistas',
|
||||
participation: 'Participações',
|
||||
capital: 'Capital e contribuições',
|
||||
management: 'Gestão',
|
||||
responsibility: 'Responsabilidade limitada',
|
||||
listing: 'Negociação em Bolsa',
|
||||
regulated: 'Regras profissionais ou sectoriais',
|
||||
preferred: 'Alternativa a aprofundar',
|
||||
};
|
||||
type Result = {
|
||||
engine_version: string;
|
||||
source: {
|
||||
@@ -134,10 +147,7 @@ function Comparator(props: Props) {
|
||||
</Link>
|
||||
</p>
|
||||
)}
|
||||
<p>
|
||||
Compare a estrutura pretendida e os pontos a esclarecer antes de
|
||||
preparar o acto constitutivo.
|
||||
</p>
|
||||
<p>{comparisonIntroduction}</p>
|
||||
{saved && (
|
||||
<p>
|
||||
{historical
|
||||
@@ -178,32 +188,46 @@ function Comparator(props: Props) {
|
||||
{Object.entries(definition.questions).map(
|
||||
([key, question]) =>
|
||||
active.includes(key) ? (
|
||||
<label key={key} className="grid gap-1">
|
||||
{question.label}
|
||||
<select
|
||||
className={input}
|
||||
name={`answers[${key}]`}
|
||||
value={answers[key] ?? 'unknown'}
|
||||
disabled={busy}
|
||||
onChange={(e) => {
|
||||
setAnswers({
|
||||
...answers,
|
||||
[key]: e.target.value,
|
||||
});
|
||||
setDirty(true);
|
||||
operation.current =
|
||||
createOperationKey();
|
||||
}}
|
||||
>
|
||||
{Object.entries(
|
||||
question.options,
|
||||
).map(([code, label]) => (
|
||||
<option key={code} value={code}>
|
||||
{label}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
<fieldset
|
||||
key={key}
|
||||
className="min-w-0 rounded border p-3"
|
||||
>
|
||||
<legend className="px-1 font-semibold">
|
||||
{questionThemes[key] ??
|
||||
question.label}
|
||||
</legend>
|
||||
<label className="grid gap-1">
|
||||
{question.label}
|
||||
<select
|
||||
className={input}
|
||||
name={`answers[${key}]`}
|
||||
value={
|
||||
answers[key] ?? 'unknown'
|
||||
}
|
||||
disabled={busy}
|
||||
onChange={(e) => {
|
||||
setAnswers({
|
||||
...answers,
|
||||
[key]: e.target.value,
|
||||
});
|
||||
setDirty(true);
|
||||
operation.current =
|
||||
createOperationKey();
|
||||
}}
|
||||
>
|
||||
{Object.entries(
|
||||
question.options,
|
||||
).map(([code, label]) => (
|
||||
<option
|
||||
key={code}
|
||||
value={code}
|
||||
>
|
||||
{label}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
</fieldset>
|
||||
) : (
|
||||
<input
|
||||
key={key}
|
||||
@@ -282,13 +306,14 @@ function Comparator(props: Props) {
|
||||
<h2 className="text-lg font-semibold">
|
||||
Alternativas e pontos a conferir
|
||||
</h2>
|
||||
<p>{result.route}</p>
|
||||
{result.route.trim() !== comparisonIntroduction && (
|
||||
<p>{result.route}</p>
|
||||
)}
|
||||
{result.pending.length > 0 && (
|
||||
<p>
|
||||
Por esclarecer:{' '}
|
||||
{result.pending
|
||||
.map((key) => result.questions[key]?.label ?? key)
|
||||
.join(' · ')}
|
||||
Há {result.pending.length} temas por esclarecer nas
|
||||
respostas. Pode completar os campos acima para
|
||||
aprofundar a comparação.
|
||||
</p>
|
||||
)}
|
||||
<div className="grid gap-4 md:grid-cols-2">
|
||||
|
||||
@@ -24,6 +24,7 @@ function DemographySelection({
|
||||
territories,
|
||||
sectors,
|
||||
sectorReadings = [],
|
||||
entrySector,
|
||||
}: {
|
||||
evidence: DemographicAnalysis;
|
||||
filters: {
|
||||
@@ -44,6 +45,7 @@ function DemographySelection({
|
||||
href: string;
|
||||
analysis: SectorAnalysis;
|
||||
}[];
|
||||
entrySector?: string | null;
|
||||
}) {
|
||||
const [selected, setSelected] = useState(filters.territories ?? []);
|
||||
const [province, setProvince] = useState('');
|
||||
@@ -211,6 +213,13 @@ function DemographySelection({
|
||||
</div>
|
||||
</form>
|
||||
<DemographicEvidence evidence={evidence} />
|
||||
{filters.sector === 'tourism' && (
|
||||
<p>
|
||||
Os dados de população constituem contexto territorial. Não
|
||||
há nesta consulta estatísticas sectoriais de Turismo que
|
||||
permitam avaliar a procura turística por distrito.
|
||||
</p>
|
||||
)}
|
||||
{evidence.territories.length > 0 && (
|
||||
<section className="space-y-3 rounded border p-4">
|
||||
<h2 className="text-xl font-semibold">
|
||||
@@ -227,7 +236,11 @@ function DemographySelection({
|
||||
className="block py-2 underline"
|
||||
href={
|
||||
'/investimentos/iniciar?source=' +
|
||||
encodeURIComponent('territory:' + t.id)
|
||||
encodeURIComponent('territory:' + t.id) +
|
||||
(entrySector
|
||||
? '§or=' +
|
||||
encodeURIComponent(entrySector)
|
||||
: '')
|
||||
}
|
||||
>
|
||||
Preparar ideia em {t.name}
|
||||
@@ -235,6 +248,15 @@ function DemographySelection({
|
||||
))}
|
||||
</section>
|
||||
)}
|
||||
{filters.sector &&
|
||||
filters.sector !== 'general' &&
|
||||
sectorReadings.length === 0 && (
|
||||
<p>
|
||||
Não há ideias documentadas compatíveis com o sector
|
||||
seleccionado nesta consulta. Pode preparar a sua própria
|
||||
ideia, sem substituir o sector escolhido.
|
||||
</p>
|
||||
)}
|
||||
{sectorReadings.map((reading) => (
|
||||
<section key={reading.href} className="space-y-3">
|
||||
<h2 className="text-xl font-semibold">{reading.title}</h2>
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import PublicReference from '@/components/public-reference';
|
||||
import { publicReference } from '@/lib/public-presentation';
|
||||
import { ProactiveSummary } from '@/components/proactive-investment';
|
||||
import DemographicContext from '@/components/demographic-context';
|
||||
import EducationalGuides from '@/components/educational-guides';
|
||||
@@ -186,9 +188,13 @@ export default function Detail({
|
||||
/>
|
||||
<DemographicContext
|
||||
key={c.primary_territory_path?.at(-1)?.id}
|
||||
territoryId={c.primary_territory_path
|
||||
?.filter((t) => ['province', 'district'].includes(t.location_type))
|
||||
.at(-1)?.id}
|
||||
territoryId={
|
||||
c.primary_territory_path
|
||||
?.filter((t) =>
|
||||
['province', 'district'].includes(t.location_type),
|
||||
)
|
||||
.at(-1)?.id
|
||||
}
|
||||
/>
|
||||
{c.primary_territory_path &&
|
||||
c.primary_territory_path.length > 0 && (
|
||||
@@ -282,7 +288,15 @@ export default function Detail({
|
||||
{z.association_type === 'official'
|
||||
? 'Associação documental validada'
|
||||
: 'Relação ' + z.association_type}{' '}
|
||||
· Fonte: {z.source_reference}
|
||||
{publicReference(z.source_reference) && (
|
||||
<>
|
||||
{' '}
|
||||
· Fonte:{' '}
|
||||
<PublicReference
|
||||
value={z.source_reference}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</p>
|
||||
))}
|
||||
<p>
|
||||
@@ -335,7 +349,7 @@ export default function Detail({
|
||||
['Modelo de negócio', c.profile.business_model],
|
||||
['Requisitos', c.profile.requirements],
|
||||
['Riscos', c.profile.risks],
|
||||
['Fonte', c.profile.source_reference],
|
||||
['Fonte', publicReference(c.profile.source_reference)],
|
||||
].map(([label, text]) => (
|
||||
<div key={label}>
|
||||
<h3 className="font-bold">{label}</h3>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { publicReference } from '@/lib/public-presentation';
|
||||
import { useState } from 'react';
|
||||
import { api, button, card } from './shared';
|
||||
|
||||
@@ -81,7 +82,7 @@ export default function ZoneMap({ id }: { id: string }) {
|
||||
<g key={f.id}>
|
||||
<title>
|
||||
{f.properties.purpose} ·{' '}
|
||||
{f.properties.source}
|
||||
{publicReference(f.properties.source)}
|
||||
</title>
|
||||
{rings(f.geometry.coordinates).map((ring, i) =>
|
||||
ring.length === 1 ? (
|
||||
@@ -113,7 +114,7 @@ export default function ZoneMap({ id }: { id: string }) {
|
||||
{features.map((f) => (
|
||||
<li key={f.id}>
|
||||
{f.properties.purpose} · Fonte:{' '}
|
||||
{f.properties.source} · Data:{' '}
|
||||
{publicReference(f.properties.source)} · Data:{' '}
|
||||
{f.properties.observed_at}
|
||||
</li>
|
||||
))}
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
import PublicSourceList from '@/components/public-source-list';
|
||||
import PublicReference from '@/components/public-reference';
|
||||
import { publicReference } from '@/lib/public-presentation';
|
||||
import ParkDetailsEditor, {
|
||||
ParkDetailsPublic,
|
||||
emptyParkDetails,
|
||||
@@ -585,7 +588,7 @@ function Editor({
|
||||
)}
|
||||
{!management && <PartnershipSourceLinks type="zone" id={z.id} />}
|
||||
<p>
|
||||
{z.code} ·{' '}
|
||||
{management && <>{z.code} · </>}
|
||||
{z.category === 'industrial_park'
|
||||
? 'Parque industrial'
|
||||
: z.category.toUpperCase()}{' '}
|
||||
@@ -1792,8 +1795,15 @@ function Editor({
|
||||
{area.value ?? 'Não informado'}{' '}
|
||||
{area.value == null ? '' : area.unit} ·{' '}
|
||||
{label(area.status)} · Fonte:{' '}
|
||||
{area.source_reference ||
|
||||
'Não informada'}{' '}
|
||||
{publicReference(
|
||||
area.source_reference,
|
||||
) ? (
|
||||
<PublicReference
|
||||
value={area.source_reference}
|
||||
/>
|
||||
) : (
|
||||
'Referência pública não disponível'
|
||||
)}{' '}
|
||||
·{' '}
|
||||
{area.source_date ??
|
||||
'Data não informada'}
|
||||
@@ -1802,37 +1812,8 @@ function Editor({
|
||||
</ul>
|
||||
</section>
|
||||
)}
|
||||
{zoneExtensionsAvailable && !!z.source_evidence?.length && (
|
||||
<section className={card}>
|
||||
<h2 className="font-bold">
|
||||
Fontes e o que comprovam
|
||||
</h2>
|
||||
<ul>
|
||||
{z.source_evidence.map((evidence) => (
|
||||
<li key={evidence.url}>
|
||||
<a
|
||||
className="underline"
|
||||
href={evidence.url}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
>
|
||||
{evidence.title}
|
||||
</a>
|
||||
{evidence.source_date
|
||||
? ` · ${evidence.source_date}`
|
||||
: ' · data não indicada'}{' '}
|
||||
· {evidence.source_type} ·{' '}
|
||||
{evidence.supports}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
<p>
|
||||
Esta informação descreve o que a fonte declara;
|
||||
não confirma vigência legal, benefícios, estado
|
||||
operacional ou disponibilidade para
|
||||
investimento.
|
||||
</p>
|
||||
</section>
|
||||
{zoneExtensionsAvailable && (
|
||||
<PublicSourceList sources={z.source_evidence} />
|
||||
)}
|
||||
{z.historical_territory?.name && (
|
||||
<p>
|
||||
@@ -1868,16 +1849,26 @@ function Editor({
|
||||
{label(activity.focus)} ·{' '}
|
||||
{activity.source_date ??
|
||||
'Data não informada'}
|
||||
{activity.source_reference
|
||||
? ` · ${activity.source_reference}`
|
||||
: ''}
|
||||
{publicReference(
|
||||
activity.source_reference,
|
||||
) && (
|
||||
<>
|
||||
{' '}
|
||||
·{' '}
|
||||
<PublicReference
|
||||
value={
|
||||
activity.source_reference
|
||||
}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</section>
|
||||
) : null}
|
||||
{!z.activities?.length && (
|
||||
<p>Atividades: não informadas.</p>
|
||||
<p>Actividades: não informadas.</p>
|
||||
)}
|
||||
{!z.resources?.length && (
|
||||
<p>
|
||||
@@ -1908,9 +1899,19 @@ function Editor({
|
||||
·{' '}
|
||||
{resource.source_date ??
|
||||
'Data não informada'}
|
||||
{resource.source_reference
|
||||
? ` · ${resource.source_reference}`
|
||||
: ''}
|
||||
{publicReference(
|
||||
resource.source_reference,
|
||||
) && (
|
||||
<>
|
||||
{' '}
|
||||
·{' '}
|
||||
<PublicReference
|
||||
value={
|
||||
resource.source_reference
|
||||
}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</p>
|
||||
))}
|
||||
</section>
|
||||
@@ -2217,7 +2218,7 @@ function DetailFields({
|
||||
)}
|
||||
{kind === 'activities' && (
|
||||
<label className="grid gap-1">
|
||||
Atividade económica documentada
|
||||
Actividade económica documentada
|
||||
<select
|
||||
className={input}
|
||||
value={detail.economic_activity_id ?? ''}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import PublicSourceList from '@/components/public-source-list';
|
||||
import { publicLocation } from '@/lib/public-presentation';
|
||||
import InvestmentZoneInstallation, {
|
||||
type ParkInstallationPlan,
|
||||
} from '@/components/investment-zone-installation';
|
||||
@@ -68,6 +70,7 @@ export default function Zones({
|
||||
detailsInstallation,
|
||||
records,
|
||||
filters,
|
||||
groupAvailability = {},
|
||||
management,
|
||||
zoneExtensionsAvailable = false,
|
||||
territorySelection = [],
|
||||
@@ -94,6 +97,9 @@ export default function Zones({
|
||||
activity?: string;
|
||||
};
|
||||
management: boolean;
|
||||
groupAvailability?: Partial<
|
||||
Record<'zee' | 'zfi' | 'industrial_park', number>
|
||||
>;
|
||||
zoneExtensionsAvailable?: boolean;
|
||||
territorySelection?: TerritoryOption[];
|
||||
}) {
|
||||
@@ -282,6 +288,14 @@ export default function Zones({
|
||||
maxLength={120}
|
||||
/>
|
||||
</Field>
|
||||
{!records.total && (
|
||||
<p role="status" className="md:col-span-3">
|
||||
Não há resultados publicados para este grupo e os
|
||||
filtros seleccionados. Pode alterar o grupo ou remover
|
||||
filtros; isto não demonstra ausência de actividade no
|
||||
território.
|
||||
</p>
|
||||
)}
|
||||
<Field label="Grupo">
|
||||
<select
|
||||
className={input}
|
||||
@@ -289,10 +303,20 @@ export default function Zones({
|
||||
defaultValue={filters.category ?? ''}
|
||||
>
|
||||
<option value="">Todas</option>
|
||||
<option value="zee">ZEE</option>
|
||||
<option value="zfi">ZFI</option>
|
||||
<option value="zee">
|
||||
ZEE
|
||||
{groupAvailability.zee != null &&
|
||||
` — ${groupAvailability.zee} registos`}
|
||||
</option>
|
||||
<option value="zfi">
|
||||
ZFI
|
||||
{groupAvailability.zfi != null &&
|
||||
` — ${groupAvailability.zfi} registos`}
|
||||
</option>
|
||||
<option value="industrial_park">
|
||||
Parque industrial
|
||||
{groupAvailability.industrial_park != null &&
|
||||
` — ${groupAvailability.industrial_park} registos`}
|
||||
</option>
|
||||
</select>
|
||||
</Field>
|
||||
@@ -460,36 +484,42 @@ export default function Zones({
|
||||
{zone.name}
|
||||
</Link>
|
||||
</h2>
|
||||
<Link
|
||||
className="underline"
|
||||
href={catalogueDetailHref(
|
||||
`${management ? '/management/investment/zones' : '/zonas'}/${zone.id}`,
|
||||
exportParams.toString(),
|
||||
pageUrl,
|
||||
)}
|
||||
<nav
|
||||
aria-label={`Acções de ${zone.name}`}
|
||||
className="flex flex-wrap items-center gap-3"
|
||||
>
|
||||
Consultar ficha
|
||||
</Link>
|
||||
{!management && (
|
||||
<Link
|
||||
className="ml-4 underline"
|
||||
href={searchTerritoryHref(
|
||||
`/oportunidades?${new URLSearchParams({ [zone.category === 'zee' ? 'zee_id' : zone.category === 'zfi' ? 'zfi_id' : 'park_id']: zone.id })}`,
|
||||
className="underline"
|
||||
href={catalogueDetailHref(
|
||||
`${management ? '/management/investment/zones' : '/zonas'}/${zone.id}`,
|
||||
exportParams.toString(),
|
||||
pageUrl,
|
||||
)}
|
||||
>
|
||||
Ver oportunidades associadas
|
||||
Consultar ficha
|
||||
</Link>
|
||||
)}
|
||||
{!management && (
|
||||
<Link
|
||||
className="underline"
|
||||
href={searchTerritoryHref(
|
||||
`/oportunidades?${new URLSearchParams({ [zone.category === 'zee' ? 'zee_id' : zone.category === 'zfi' ? 'zfi_id' : 'park_id']: zone.id })}`,
|
||||
pageUrl,
|
||||
)}
|
||||
>
|
||||
Ver oportunidades associadas
|
||||
</Link>
|
||||
)}
|
||||
</nav>
|
||||
<p>
|
||||
{zone.code} ·{' '}
|
||||
{management && <>{zone.code} · </>}
|
||||
{zone.category === 'industrial_park'
|
||||
? 'Parque industrial'
|
||||
: zone.category.toUpperCase()}{' '}
|
||||
·{' '}
|
||||
{[zone.district, zone.province]
|
||||
.filter(Boolean)
|
||||
.join(', ') || 'Localização por confirmar'}
|
||||
{publicLocation(zone.territory_path, [
|
||||
zone.province,
|
||||
zone.district,
|
||||
])}
|
||||
</p>
|
||||
{zone.legal_regime && (
|
||||
<p>
|
||||
@@ -540,35 +570,14 @@ export default function Zones({
|
||||
.join(' · ')}
|
||||
</p>
|
||||
) : null}
|
||||
{!!zone.source_evidence?.length && (
|
||||
<p>
|
||||
Fonte:{' '}
|
||||
{zone.source_evidence.map((source, index) => (
|
||||
<span key={source.url}>
|
||||
{index > 0 ? ' · ' : ''}
|
||||
<a
|
||||
className="underline"
|
||||
href={source.url}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
>
|
||||
{source.title}
|
||||
</a>
|
||||
{source.source_date
|
||||
? ` (${source.source_date})`
|
||||
: ' (data da fonte não informada)'}{' '}
|
||||
— {source.supports}
|
||||
</span>
|
||||
))}
|
||||
</p>
|
||||
)}
|
||||
<PublicSourceList sources={zone.source_evidence} />
|
||||
{zone.category === 'industrial_park' && (
|
||||
<p>
|
||||
{zone.resources?.length
|
||||
? `${zone.resources.length} recursos descritos; consulte o âmbito e a fonte na ficha.`
|
||||
: 'Infraestruturas, serviços, acessos e capacidades: não informados.'}{' '}
|
||||
{!zone.activities?.length &&
|
||||
'Atividades: não informadas.'}
|
||||
'Actividades: não informadas.'}
|
||||
</p>
|
||||
)}
|
||||
<p>{zone.description}</p>
|
||||
|
||||
@@ -1,7 +1,15 @@
|
||||
import { Head, Link, router } from '@inertiajs/react';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { PortalMenu } from '@/components/portal-menu';
|
||||
import { fiscalForms, fiscalFormFields, fiscalPreparationIssues, newFiscalPreparation, readFiscalPreparation, type FiscalFormKind, type FiscalPreparation } from '@/lib/fiscal-form-preparation';
|
||||
import {
|
||||
fiscalForms,
|
||||
fiscalFormFields,
|
||||
fiscalPreparationIssues,
|
||||
newFiscalPreparation,
|
||||
readFiscalPreparation,
|
||||
type FiscalFormKind,
|
||||
type FiscalPreparation,
|
||||
} from '@/lib/fiscal-form-preparation';
|
||||
|
||||
const input =
|
||||
'mt-1 block w-full rounded border border-slate-400 bg-white p-3 text-slate-900';
|
||||
@@ -112,7 +120,6 @@ export default function FiscalForms({
|
||||
</select>
|
||||
</label>
|
||||
<h2 className="text-xl font-bold">{source.title}</h2>
|
||||
<p>{source.coverage}</p>
|
||||
<nav
|
||||
aria-label="Etapas de preenchimento"
|
||||
className="flex flex-wrap gap-2 print:hidden"
|
||||
@@ -426,20 +433,6 @@ export default function FiscalForms({
|
||||
{notice}
|
||||
</p>
|
||||
)}
|
||||
<details className="rounded border p-4">
|
||||
<summary className="cursor-pointer font-semibold">
|
||||
Exemplar e cobertura
|
||||
</summary>
|
||||
<p>{source.source}</p>
|
||||
<p className="text-sm break-all">SHA256: {source.hash}</p>
|
||||
<p>{source.coverage}</p>
|
||||
<p>
|
||||
Os cálculos e correspondências já disponíveis no
|
||||
simulador permanecem separados desta introdução manual.
|
||||
Não se executam fórmulas nem se transportam valores
|
||||
entre edições automaticamente.
|
||||
</p>
|
||||
</details>
|
||||
<div className="flex flex-wrap gap-4 print:hidden">
|
||||
<Link href="/simulador-fiscal" className="underline">
|
||||
Consultar cálculos e preparação M20/M22 no simulador
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Link, useForm, usePage } from '@inertiajs/react';
|
||||
import { publicPortfolioText } from '@/lib/public-presentation';
|
||||
import { searchTerritoryHref } from '@/lib/search-territory';
|
||||
import { catalogueDetailHref } from '@/lib/catalogue-context';
|
||||
import { Management } from '../management/shared';
|
||||
@@ -12,13 +13,23 @@ import {
|
||||
export default function Index({
|
||||
records,
|
||||
management,
|
||||
publicReferenceNames = {},
|
||||
filters,
|
||||
territorySelection = [],
|
||||
sectors = [],
|
||||
publishedOpportunities = null,
|
||||
}: {
|
||||
records: Paginated<Dossier>;
|
||||
management: boolean;
|
||||
publicReferenceNames?: Record<string, string>;
|
||||
sectors?: string[];
|
||||
publishedOpportunities?: Paginated<{
|
||||
id: number;
|
||||
title: string;
|
||||
slug: string;
|
||||
summary: string | null;
|
||||
location: string;
|
||||
}> | null;
|
||||
filters: {
|
||||
q?: string;
|
||||
kind?: string;
|
||||
@@ -113,10 +124,11 @@ export default function Index({
|
||||
{records.data.map((r) => (
|
||||
<article
|
||||
key={r.id}
|
||||
className="space-y-3 rounded-xl border p-5"
|
||||
className="flex min-w-0 flex-col gap-3 rounded-xl border p-5 [overflow-wrap:anywhere]"
|
||||
>
|
||||
<p className="text-sm">
|
||||
{kind(r)} · {r.content.code}
|
||||
{kind(r)}
|
||||
{management && ` · ${r.content.code}`}
|
||||
{management &&
|
||||
` · ${r.publication_status === 'published' ? 'Publicado' : 'Rascunho'}`}
|
||||
</p>
|
||||
@@ -137,9 +149,13 @@ export default function Index({
|
||||
</Link>
|
||||
</h2>
|
||||
<p>
|
||||
{r.content.description ??
|
||||
r.content.focus ??
|
||||
r.content.anchors}
|
||||
{publicPortfolioText(
|
||||
r.content.description ??
|
||||
r.content.focus ??
|
||||
r.content.anchors ??
|
||||
'',
|
||||
publicReferenceNames,
|
||||
)}
|
||||
</p>
|
||||
{(r.content.location || r.content.region) && (
|
||||
<p>
|
||||
@@ -155,37 +171,47 @@ export default function Index({
|
||||
</span>
|
||||
</p>
|
||||
)}
|
||||
<Link
|
||||
className="underline"
|
||||
href={catalogueDetailHref(
|
||||
`${base}/${r.id}`,
|
||||
new URLSearchParams(
|
||||
Object.entries(filters).filter(
|
||||
([, value]) => Boolean(value),
|
||||
) as [string, string][],
|
||||
).toString(),
|
||||
url,
|
||||
)}
|
||||
<nav
|
||||
aria-label={`Acções de ${r.title}`}
|
||||
className="mt-auto flex flex-wrap items-center gap-3"
|
||||
>
|
||||
Consultar ficha
|
||||
</Link>
|
||||
{!management &&
|
||||
(r.corridor_id || r.cluster_id || r.project_id) && (
|
||||
<Link
|
||||
className="ml-4 underline"
|
||||
href={searchTerritoryHref(
|
||||
`/oportunidades?${new URLSearchParams(r.corridor_id ? { corridor_id: r.corridor_id } : r.cluster_id ? { cluster_id: r.cluster_id } : { project_id: r.project_id! })}`,
|
||||
url,
|
||||
)}
|
||||
>
|
||||
Ver oportunidades associadas
|
||||
</Link>
|
||||
)}
|
||||
<Link
|
||||
className="underline"
|
||||
href={catalogueDetailHref(
|
||||
`${base}/${r.id}`,
|
||||
new URLSearchParams(
|
||||
Object.entries(filters).filter(
|
||||
([, value]) => Boolean(value),
|
||||
) as [string, string][],
|
||||
).toString(),
|
||||
url,
|
||||
)}
|
||||
>
|
||||
Consultar ficha
|
||||
</Link>
|
||||
{!management &&
|
||||
(r.corridor_id ||
|
||||
r.cluster_id ||
|
||||
r.project_id) && (
|
||||
<Link
|
||||
className="underline"
|
||||
href={searchTerritoryHref(
|
||||
`/oportunidades?${new URLSearchParams(r.corridor_id ? { corridor_id: r.corridor_id } : r.cluster_id ? { cluster_id: r.cluster_id } : { project_id: r.project_id! })}`,
|
||||
url,
|
||||
)}
|
||||
>
|
||||
Ver oportunidades associadas
|
||||
</Link>
|
||||
)}
|
||||
</nav>
|
||||
</article>
|
||||
))}
|
||||
</div>
|
||||
{!records.data.length && (
|
||||
<div className="space-y-3 rounded-xl border p-5" role="status">
|
||||
<div
|
||||
className="flex min-w-0 flex-col gap-3 rounded-xl border p-5 [overflow-wrap:anywhere]"
|
||||
role="status"
|
||||
>
|
||||
<p>
|
||||
Ainda não existem fichas publicadas para esta pesquisa.
|
||||
Os filtros activos foram mantidos.
|
||||
@@ -218,6 +244,62 @@ export default function Index({
|
||||
</div>
|
||||
)}
|
||||
<Pagination page={records} />
|
||||
{!management && publishedOpportunities && (
|
||||
<section
|
||||
className="space-y-4"
|
||||
aria-label="Oportunidades publicadas nesta consulta"
|
||||
>
|
||||
<h2 className="text-2xl font-semibold">
|
||||
Oportunidades publicadas nesta consulta
|
||||
</h2>
|
||||
<p>
|
||||
Consulte as oportunidades sem repetir a pesquisa. São
|
||||
respeitados os filtros de texto, sector e localização; a
|
||||
selecção de corredores, clusters ou projectos limita
|
||||
esta lista às associações documentadas.
|
||||
</p>
|
||||
{publishedOpportunities.data.length === 0 && (
|
||||
<p role="status">
|
||||
Não há oportunidades publicadas com correspondência
|
||||
documentada para os filtros desta consulta. Isto não
|
||||
demonstra inexistência de oportunidades: rascunhos e
|
||||
localizações não documentadas não são incluídos por
|
||||
inferência.
|
||||
</p>
|
||||
)}
|
||||
<div className="grid gap-4 md:grid-cols-2">
|
||||
{publishedOpportunities.data.map((opportunity) => (
|
||||
<article
|
||||
key={opportunity.id}
|
||||
className="flex min-w-0 flex-col gap-3 rounded-xl border p-5 [overflow-wrap:anywhere]"
|
||||
>
|
||||
<h3 className="text-xl font-semibold">
|
||||
<Link
|
||||
className="underline"
|
||||
href={catalogueDetailHref(
|
||||
`/oportunidades/${opportunity.slug}`,
|
||||
new URLSearchParams(
|
||||
Object.entries(filters).filter(
|
||||
([, value]) =>
|
||||
Boolean(value),
|
||||
) as [string, string][],
|
||||
).toString(),
|
||||
url,
|
||||
)}
|
||||
>
|
||||
{opportunity.title}
|
||||
</Link>
|
||||
</h3>
|
||||
{opportunity.summary && (
|
||||
<p>{opportunity.summary}</p>
|
||||
)}
|
||||
<p>{opportunity.location}</p>
|
||||
</article>
|
||||
))}
|
||||
</div>
|
||||
<Pagination page={publishedOpportunities} />
|
||||
</section>
|
||||
)}
|
||||
</Frame>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
import PublicReference from '@/components/public-reference';
|
||||
import {
|
||||
publicReference,
|
||||
publicPortfolioText,
|
||||
} from '@/lib/public-presentation';
|
||||
import { Link, useForm, router, usePage } from '@inertiajs/react';
|
||||
import { useState } from 'react';
|
||||
import { catalogueReturnHref } from '@/lib/catalogue-context';
|
||||
@@ -30,6 +35,7 @@ export default function Show(props: Props) {
|
||||
}
|
||||
|
||||
type Props = {
|
||||
publicReferenceNames?: Record<string, string>;
|
||||
editorialEnabled?: boolean;
|
||||
competitiveness?: ApprovedCompetitiveness | null;
|
||||
complements?: ComplementOption[];
|
||||
@@ -65,6 +71,7 @@ type Props = {
|
||||
};
|
||||
|
||||
function Editor({
|
||||
publicReferenceNames = {},
|
||||
editorialEnabled = false,
|
||||
competitiveness,
|
||||
complements = [],
|
||||
@@ -104,9 +111,19 @@ function Editor({
|
||||
Voltar à pesquisa
|
||||
</Link>
|
||||
<p>
|
||||
{kind(record)} · {record.content.code}
|
||||
{kind(record)}
|
||||
{management && ` · ${record.content.code}`}
|
||||
</p>
|
||||
<p className="text-sm">Fonte: {record.source}</p>
|
||||
{(management || publicReference(record.source)) && (
|
||||
<p className="text-sm">
|
||||
Fonte:{' '}
|
||||
{management ? (
|
||||
record.source
|
||||
) : (
|
||||
<PublicReference value={record.source} />
|
||||
)}
|
||||
</p>
|
||||
)}
|
||||
{competitiveness && (
|
||||
<ClusterCompetitivenessPublic analysis={competitiveness} />
|
||||
)}
|
||||
@@ -150,7 +167,8 @@ function Editor({
|
||||
Referência de projecto âncora
|
||||
</h2>
|
||||
<p>
|
||||
{anchorProject.code} · {anchorProject.name}
|
||||
{management && `${anchorProject.code} · `}
|
||||
{anchorProject.name}
|
||||
</p>
|
||||
<p>
|
||||
Estado registado:{' '}
|
||||
@@ -234,7 +252,16 @@ function Editor({
|
||||
>
|
||||
{z.name}
|
||||
</Link>{' '}
|
||||
· {z.association_type} · Fonte: {z.source_reference}
|
||||
· {z.association_type}
|
||||
{publicReference(z.source_reference) && (
|
||||
<>
|
||||
{' '}
|
||||
· Fonte:{' '}
|
||||
<PublicReference
|
||||
value={z.source_reference}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</p>
|
||||
))}
|
||||
</section>
|
||||
@@ -491,7 +518,10 @@ function Editor({
|
||||
{labels[key] ?? key}
|
||||
</dt>
|
||||
<dd className="mt-1 whitespace-pre-line">
|
||||
{value}
|
||||
{publicPortfolioText(
|
||||
value,
|
||||
publicReferenceNames,
|
||||
)}
|
||||
</dd>
|
||||
</div>
|
||||
))}
|
||||
|
||||
Reference in New Issue
Block a user