merge: retain installed funding correction alongside isolated sector QA
This commit is contained in:
@@ -1,19 +1,10 @@
|
||||
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} />;
|
||||
@@ -63,33 +54,35 @@ function Index({
|
||||
territorySelection?: TerritoryOption[];
|
||||
criteriaErrors?: Record<string, string[]>;
|
||||
}) {
|
||||
const [notice, setNotice] = useState('');
|
||||
const [notice, setNotice] = useState("");
|
||||
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 ?? '',
|
||||
certainty: filters.certainty ?? 'include_unknown',
|
||||
state: filters.state ?? '',
|
||||
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 ?? "",
|
||||
});
|
||||
const applied = useRef(JSON.stringify(form.data));
|
||||
const criteriaChanged = JSON.stringify(form.data) !== applied.current;
|
||||
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">
|
||||
@@ -102,33 +95,25 @@ 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');
|
||||
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>
|
||||
)}
|
||||
@@ -143,16 +128,15 @@ 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"
|
||||
@@ -160,17 +144,16 @@ 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>
|
||||
)}
|
||||
@@ -181,31 +164,24 @@ 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>
|
||||
@@ -213,9 +189,7 @@ 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)
|
||||
@@ -228,48 +202,27 @@ function Index({
|
||||
<option key={id} value={id}>
|
||||
{typeAllowed(form.data.category, id)
|
||||
? label
|
||||
: 'Incompatível: ' + label}
|
||||
: "Incompatível: " + label}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
<label>
|
||||
Localização a pesquisar
|
||||
<select
|
||||
className="block rounded border p-2"
|
||||
value={form.data.location_mode}
|
||||
onChange={(e) =>
|
||||
form.setData('location_mode', e.target.value)
|
||||
}
|
||||
>
|
||||
<option value="physical">
|
||||
Sede, balcão ou presença física
|
||||
</option>
|
||||
<option value="coverage">
|
||||
Cobertura do financiamento/produto
|
||||
</option>
|
||||
</select>
|
||||
</label>
|
||||
<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]) => (
|
||||
@@ -285,7 +238,7 @@ function Index({
|
||||
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)}
|
||||
/>
|
||||
</label>
|
||||
<label>
|
||||
@@ -293,7 +246,7 @@ function Index({
|
||||
<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]) => (
|
||||
@@ -303,15 +256,12 @@ function Index({
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
<button className={button} disabled={form.processing}>
|
||||
Pesquisar
|
||||
</button>
|
||||
<label>
|
||||
Sector
|
||||
<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) => (
|
||||
@@ -322,36 +272,51 @@ 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
|
||||
className="block rounded border p-2"
|
||||
value={form.data.location_mode}
|
||||
onChange={(e) =>
|
||||
form.setData({
|
||||
...form.data,
|
||||
location_mode: e.target.value,
|
||||
certainty:
|
||||
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>
|
||||
</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.
|
||||
</p>
|
||||
<TerritoryFields
|
||||
initial={territorySelection}
|
||||
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 ??
|
||||
"",
|
||||
})
|
||||
}
|
||||
/>
|
||||
@@ -361,13 +326,9 @@ 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>
|
||||
@@ -378,7 +339,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]) => (
|
||||
@@ -388,52 +349,55 @@ function Index({
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
<button className={button} disabled={form.processing}>
|
||||
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 && (
|
||||
<p>
|
||||
Não foram encontradas instituições, fundos ou programas publicados que
|
||||
correspondam a todos os critérios desta pesquisa.
|
||||
</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'))}`}
|
||||
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.territory
|
||||
: undefined
|
||||
}
|
||||
value={
|
||||
item.payload as InstitutionDetails & {
|
||||
title: string;
|
||||
@@ -444,30 +408,25 @@ 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>
|
||||
@@ -480,12 +439,10 @@ 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,
|
||||
)}
|
||||
|
||||
@@ -1,16 +1,10 @@
|
||||
import { fundingPublicPresentation } from '@/lib/funding-public-presentation';
|
||||
import {
|
||||
InstitutionView,
|
||||
type InstitutionDetails,
|
||||
} from '@/components/funding-institution';
|
||||
import {
|
||||
FundingDossierChoice,
|
||||
type FundingDossier,
|
||||
} from '@/components/funding-dossier-choice';
|
||||
import { Link, router } from '@inertiajs/react';
|
||||
import FundingCriteriaAssessment from '@/components/funding-criteria-assessment';
|
||||
import { Frame, card, button } from '@/pages/investment/shared';
|
||||
import { type Programme, windowLabels } from './shared';
|
||||
import { fundingPublicPresentation } from "@/lib/funding-public-presentation";
|
||||
import { InstitutionView, type InstitutionDetails } from "@/components/funding-institution";
|
||||
import { FundingDossierChoice, type FundingDossier } from "@/components/funding-dossier-choice";
|
||||
import { Link, router } from "@inertiajs/react";
|
||||
import FundingCriteriaAssessment from "@/components/funding-criteria-assessment";
|
||||
import { Frame, card, button } from "@/pages/investment/shared";
|
||||
import { type Programme, windowLabels } from "./shared";
|
||||
|
||||
export default function Show({
|
||||
record,
|
||||
@@ -35,14 +29,14 @@ export default function Show({
|
||||
<Link className="underline" href="/fundos/guardados">
|
||||
A minha selecção
|
||||
</Link>
|
||||
<Link
|
||||
className="underline"
|
||||
href={`/fundos?${new URLSearchParams(selection)}`}
|
||||
>
|
||||
<Link className="underline" href={`/fundos?${new URLSearchParams(selection)}`}>
|
||||
Voltar aos fundos e programas
|
||||
</Link>
|
||||
{payload.kind === 'institution' ? (
|
||||
{payload.kind === "institution" ? (
|
||||
<InstitutionView
|
||||
physicalTerritory={
|
||||
selection.location_mode === "physical" ? selection.territory : undefined
|
||||
}
|
||||
value={
|
||||
payload as InstitutionDetails & {
|
||||
title: string;
|
||||
@@ -58,7 +52,7 @@ export default function Show({
|
||||
)}
|
||||
{authenticated && (
|
||||
<FundingDossierChoice
|
||||
key={`${record.id}:${record.version_id}:${dossier?.id ?? ''}:${dossier?.opportunity ?? ''}:${selection.territory ?? ''}`}
|
||||
key={`${record.id}:${record.version_id}:${dossier?.id ?? ""}:${dossier?.opportunity ?? ""}:${selection.territory ?? ""}`}
|
||||
record={record}
|
||||
dossier={dossier}
|
||||
selection={selection}
|
||||
@@ -66,36 +60,33 @@ export default function Show({
|
||||
destinations={destinations}
|
||||
/>
|
||||
)}
|
||||
{payload.kind !== 'institution' && (
|
||||
{payload.kind !== "institution" && (
|
||||
<>
|
||||
{' '}
|
||||
{" "}
|
||||
<p>Entidade responsável: {payload.manager_name}.</p>
|
||||
{(payload.territory_paths ?? []).map((path, index) => (
|
||||
<p key={index}>
|
||||
Local abrangido:{' '}
|
||||
{path.map((node) => node.name).join(' / ')}
|
||||
Local abrangido: {path.map((node) => node.name).join(" / ")}
|
||||
</p>
|
||||
))}
|
||||
<p>
|
||||
Sectores:{' '}
|
||||
Sectores:{" "}
|
||||
{payload.sectors_text ||
|
||||
(payload.sectors_scope === 'all'
|
||||
? 'Todos, segundo a fonte'
|
||||
: payload.sectors_scope === 'unknown'
|
||||
? 'Por confirmar'
|
||||
(payload.sectors_scope === "all"
|
||||
? "Todos, segundo a fonte"
|
||||
: payload.sectors_scope === "unknown"
|
||||
? "Por confirmar"
|
||||
: (payload.sector_snapshots ?? [])
|
||||
.map((sector) => sector.name)
|
||||
.join(', '))}
|
||||
.join(", "))}
|
||||
</p>
|
||||
<p>
|
||||
{payload.coverage === 'national'
|
||||
? 'Cobertura nacional'
|
||||
: payload.coverage === 'territorial'
|
||||
? 'Cobertura territorial'
|
||||
: 'Cobertura por confirmar'}
|
||||
{payload.coverage_text
|
||||
? ` — ${payload.coverage_text}`
|
||||
: ''}
|
||||
{payload.coverage === "national"
|
||||
? "Cobertura nacional"
|
||||
: payload.coverage === "territorial"
|
||||
? "Cobertura territorial"
|
||||
: "Cobertura por confirmar"}
|
||||
{payload.coverage_text ? ` — ${payload.coverage_text}` : ""}
|
||||
</p>
|
||||
{payload.source_url && (
|
||||
<details>
|
||||
@@ -108,24 +99,16 @@ export default function Show({
|
||||
>
|
||||
Consultar informação da entidade
|
||||
</a>
|
||||
<p>
|
||||
Actualização consultada em{' '}
|
||||
{payload.source_checked_on}.
|
||||
</p>
|
||||
<p>Actualização consultada em {payload.source_checked_on}.</p>
|
||||
</details>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
{(payload.kind !== 'institution' || payload.windows.length > 0) && (
|
||||
{(payload.kind !== "institution" || payload.windows.length > 0) && (
|
||||
<section className={card}>
|
||||
<h2 className="text-xl font-semibold">
|
||||
Janelas de candidatura
|
||||
</h2>
|
||||
<h2 className="text-xl font-semibold">Janelas de candidatura</h2>
|
||||
{payload.windows.length === 0 && (
|
||||
<p>
|
||||
Não há uma janela de candidatura confirmada para
|
||||
este programa.
|
||||
</p>
|
||||
<p>Não há uma janela de candidatura confirmada para este programa.</p>
|
||||
)}
|
||||
{payload.windows.map((item) => (
|
||||
<article key={item.code} className="my-4">
|
||||
@@ -135,18 +118,16 @@ export default function Show({
|
||||
{item.end_on && <p>Data-limite: {item.end_on}</p>}
|
||||
{item.coverage_text && <p>{item.coverage_text}</p>}
|
||||
<p>
|
||||
{item.coverage === 'programme'
|
||||
? 'Mesma cobertura do programa'
|
||||
: item.coverage === 'national'
|
||||
? 'Chamada nacional'
|
||||
: item.coverage === 'unknown'
|
||||
? 'Cobertura da chamada por confirmar'
|
||||
: 'Chamada territorial'}
|
||||
{item.coverage === "programme"
|
||||
? "Mesma cobertura do programa"
|
||||
: item.coverage === "national"
|
||||
? "Chamada nacional"
|
||||
: item.coverage === "unknown"
|
||||
? "Cobertura da chamada por confirmar"
|
||||
: "Chamada territorial"}
|
||||
</p>
|
||||
{(item.territory_paths ?? []).map((path, index) => (
|
||||
<p key={index}>
|
||||
{path.map((node) => node.name).join(' / ')}
|
||||
</p>
|
||||
<p key={index}>{path.map((node) => node.name).join(" / ")}</p>
|
||||
))}
|
||||
<a
|
||||
className="underline"
|
||||
@@ -171,13 +152,11 @@ export default function Show({
|
||||
))}
|
||||
</section>
|
||||
)}
|
||||
{(payload.kind !== 'institution' ||
|
||||
{(payload.kind !== "institution" ||
|
||||
payload.criteria.length > 0 ||
|
||||
payload.windows.some(
|
||||
(window) => window.criteria.length > 0,
|
||||
)) && (
|
||||
payload.windows.some((window) => window.criteria.length > 0)) && (
|
||||
<FundingCriteriaAssessment
|
||||
key={record.id + ':' + record.version_id}
|
||||
key={record.id + ":" + record.version_id}
|
||||
record={record}
|
||||
/>
|
||||
)}
|
||||
@@ -210,15 +189,13 @@ export default function Show({
|
||||
<p>
|
||||
Guardado na versão {saved.version}
|
||||
{saved.version !== record.version
|
||||
? '; existe uma versão pública mais recente'
|
||||
: ''}
|
||||
? "; existe uma versão pública mais recente"
|
||||
: ""}
|
||||
.
|
||||
</p>
|
||||
<button
|
||||
className={button}
|
||||
onClick={() =>
|
||||
router.delete(`/fundos/${record.id}/interesse`)
|
||||
}
|
||||
onClick={() => router.delete(`/fundos/${record.id}/interesse`)}
|
||||
>
|
||||
Remover da minha lista
|
||||
</button>
|
||||
|
||||
Reference in New Issue
Block a user