@@ -127,6 +127,7 @@ export default function BusinessInterest({
|
||||
<CountrySelect
|
||||
countries={countries}
|
||||
value={form.declared_origin_country_code}
|
||||
label="País de origem declarado desta solicitação"
|
||||
onChange={(value) =>
|
||||
update('declared_origin_country_code', value)
|
||||
}
|
||||
@@ -186,6 +187,7 @@ export default function BusinessInterest({
|
||||
<CountrySelect
|
||||
countries={countries}
|
||||
required
|
||||
label="País do requerente"
|
||||
allowLegacyValue
|
||||
value={form.country}
|
||||
onChange={(value) => update('country', value)}
|
||||
|
||||
@@ -614,6 +614,10 @@ export default function BusinessWizard({
|
||||
<select
|
||||
className={input}
|
||||
value={sectorId ?? ''}
|
||||
aria-label={t(
|
||||
'Sector de actividade',
|
||||
'Sector of activity',
|
||||
)}
|
||||
onChange={(e) =>
|
||||
setSectorId(
|
||||
e.target.value
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
import { Link, router, usePage } from "@inertiajs/react";
|
||||
import { useState } from "react";
|
||||
import InvestmentMapPanel from "@/components/investment-map-panel";
|
||||
import { Link, router, usePage } from '@inertiajs/react';
|
||||
import { useState } from 'react';
|
||||
import InvestmentMapPanel from '@/components/investment-map-panel';
|
||||
import StructureGeographyPanel, {
|
||||
LocationList,
|
||||
} from "@/components/structure-geography";
|
||||
import PartnershipSourceLinks from "@/components/partnership-source-links";
|
||||
import TerritorialSources from "@/components/territorial-source-evidence";
|
||||
import { Frame, card, button, money, groupLabels } from "./shared";
|
||||
import type { Opportunity, Context } from "./shared";
|
||||
} from '@/components/structure-geography';
|
||||
import PartnershipSourceLinks from '@/components/partnership-source-links';
|
||||
import TerritorialSources from '@/components/territorial-source-evidence';
|
||||
import { Frame, card, button, money, groupLabels } from './shared';
|
||||
import type { Opportunity, Context } from './shared';
|
||||
export default function Detail({
|
||||
record: r,
|
||||
context: c,
|
||||
zone_origin,
|
||||
returnUrl = "/oportunidades",
|
||||
returnUrl = '/oportunidades',
|
||||
dossierOrigin,
|
||||
}: {
|
||||
record: Opportunity;
|
||||
@@ -22,7 +22,7 @@ export default function Detail({
|
||||
dossierOrigin?: { id: string; title: string } | null;
|
||||
}) {
|
||||
const { auth } = usePage<{ auth: { user: unknown } }>().props;
|
||||
const [sharing, setSharing] = useState("");
|
||||
const [sharing, setSharing] = useState('');
|
||||
return (
|
||||
<Frame title={r.title}>
|
||||
<PartnershipSourceLinks type="investment" id={r.id} />
|
||||
@@ -52,7 +52,7 @@ export default function Detail({
|
||||
)}
|
||||
<p className="text-xl">{r.summary}</p>
|
||||
<TerritorialSources sources={c.source_evidence} />
|
||||
<section className={card + " space-y-3"}>
|
||||
<section className={card + ' space-y-3'}>
|
||||
<h2 className="text-xl font-bold">
|
||||
Implantação declarada da oportunidade
|
||||
</h2>
|
||||
@@ -78,10 +78,10 @@ export default function Detail({
|
||||
c.primary_territory_path.length > 0 && (
|
||||
<p>
|
||||
Território principal cadastrado (implantação por
|
||||
confirmar):{" "}
|
||||
confirmar):{' '}
|
||||
{c.primary_territory_path
|
||||
.map((node) => node.name)
|
||||
.join(" → ")}
|
||||
.join(' → ')}
|
||||
</p>
|
||||
)}
|
||||
<div className="flex flex-wrap gap-4">
|
||||
@@ -89,12 +89,12 @@ export default function Detail({
|
||||
<button
|
||||
className={button}
|
||||
onClick={() =>
|
||||
router.post("/investidor/manifestacoes", {
|
||||
router.post('/investidor/manifestacoes', {
|
||||
opportunity_id: r.id,
|
||||
...(zone_origin
|
||||
? {
|
||||
zone_id: zone_origin.id,
|
||||
intent: "interest",
|
||||
intent: 'interest',
|
||||
}
|
||||
: {}),
|
||||
})
|
||||
@@ -118,16 +118,16 @@ export default function Detail({
|
||||
onClick={() => {
|
||||
if (!navigator.clipboard) {
|
||||
setSharing(
|
||||
"Copie a ligação na barra de endereço do navegador.",
|
||||
'Copie a ligação na barra de endereço do navegador.',
|
||||
);
|
||||
return;
|
||||
}
|
||||
navigator.clipboard
|
||||
.writeText(window.location.href)
|
||||
.then(() => setSharing("Ligação copiada."))
|
||||
.then(() => setSharing('Ligação copiada.'))
|
||||
.catch(() =>
|
||||
setSharing(
|
||||
"Copie a ligação na barra de endereço do navegador.",
|
||||
'Copie a ligação na barra de endereço do navegador.',
|
||||
),
|
||||
);
|
||||
}}
|
||||
@@ -148,11 +148,11 @@ export default function Detail({
|
||||
href={`/zonas?category=${z.category}&q=${encodeURIComponent(z.name)}`}
|
||||
>
|
||||
{z.name}
|
||||
</Link>{" "}
|
||||
·{" "}
|
||||
{z.association_type === "official"
|
||||
? "Associação documental validada"
|
||||
: "Relação " + z.association_type}{" "}
|
||||
</Link>{' '}
|
||||
·{' '}
|
||||
{z.association_type === 'official'
|
||||
? 'Associação documental validada'
|
||||
: 'Relação ' + z.association_type}{' '}
|
||||
· Fonte: {z.source_reference}
|
||||
</p>
|
||||
))}
|
||||
@@ -164,42 +164,42 @@ export default function Detail({
|
||||
)}
|
||||
<div className="grid gap-6 lg:grid-cols-3">
|
||||
<section
|
||||
className={card + " whitespace-pre-line lg:col-span-2"}
|
||||
className={card + ' whitespace-pre-line lg:col-span-2'}
|
||||
>
|
||||
<h2 className="mb-3 text-xl font-bold">O investimento</h2>
|
||||
{r.description || "Descrição por completar."}
|
||||
{r.description || 'Descrição por completar.'}
|
||||
</section>
|
||||
<dl className={card + " space-y-4"}>
|
||||
<dl className={card + ' space-y-4'}>
|
||||
{[
|
||||
["Promotor", r.promoter_name],
|
||||
["Investimento", money(r)],
|
||||
["Maturidade", r.maturity_label],
|
||||
["Parceria", r.financing_modality],
|
||||
["Impacto", r.expected_impact],
|
||||
["Calendário", c.profile?.target_date],
|
||||
['Promotor', r.promoter_name],
|
||||
['Investimento', money(r)],
|
||||
['Maturidade', r.maturity_label],
|
||||
['Parceria', r.financing_modality],
|
||||
['Impacto', r.expected_impact],
|
||||
['Calendário', c.profile?.target_date],
|
||||
].map(([key, value]) => (
|
||||
<div key={key}>
|
||||
<dt className="font-bold">{key}</dt>
|
||||
<dd>{value || "Não indicado"}</dd>
|
||||
<dd>{value || 'Não indicado'}</dd>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
</div>
|
||||
{c.profile && (
|
||||
<section className={card + " space-y-4"}>
|
||||
<section className={card + ' space-y-4'}>
|
||||
<h2 className="text-xl font-bold">
|
||||
Viabilidade e preparação
|
||||
</h2>
|
||||
{[
|
||||
["Modelo de negócio", c.profile.business_model],
|
||||
["Requisitos", c.profile.requirements],
|
||||
["Riscos", c.profile.risks],
|
||||
["Fonte", c.profile.source_reference],
|
||||
['Modelo de negócio', c.profile.business_model],
|
||||
['Requisitos', c.profile.requirements],
|
||||
['Riscos', c.profile.risks],
|
||||
['Fonte', c.profile.source_reference],
|
||||
].map(([label, text]) => (
|
||||
<div key={label}>
|
||||
<h3 className="font-bold">{label}</h3>
|
||||
<p className="whitespace-pre-line">
|
||||
{text || "Não indicado"}
|
||||
{text || 'Não indicado'}
|
||||
</p>
|
||||
</div>
|
||||
))}
|
||||
@@ -212,16 +212,16 @@ export default function Detail({
|
||||
)}
|
||||
<section className="grid gap-4 md:grid-cols-4">
|
||||
{(
|
||||
["clusters", "corridors", "projects", "locations"] as const
|
||||
['clusters', 'corridors', 'projects', 'locations'] as const
|
||||
).map((key, i) => (
|
||||
<div className={card} key={key}>
|
||||
<h2 className="font-bold">
|
||||
{
|
||||
[
|
||||
"Clusters",
|
||||
"Corredores",
|
||||
"Projectos âncora",
|
||||
"Territórios",
|
||||
'Clusters',
|
||||
'Corredores',
|
||||
'Projectos âncora',
|
||||
'Territórios',
|
||||
][i]
|
||||
}
|
||||
</h2>
|
||||
@@ -241,14 +241,14 @@ export default function Detail({
|
||||
<Link
|
||||
className="underline"
|
||||
href={
|
||||
"/oportunidades?" +
|
||||
'/oportunidades?' +
|
||||
[
|
||||
"cluster_id",
|
||||
"corridor_id",
|
||||
"project_id",
|
||||
"geo_location_id",
|
||||
'cluster_id',
|
||||
'corridor_id',
|
||||
'project_id',
|
||||
'geo_location_id',
|
||||
][i] +
|
||||
"=" +
|
||||
'=' +
|
||||
entity.id
|
||||
}
|
||||
>
|
||||
@@ -260,7 +260,7 @@ export default function Detail({
|
||||
</div>
|
||||
))}
|
||||
</section>
|
||||
{(["projects", "clusters"] as const).flatMap((key) =>
|
||||
{(['projects', 'clusters'] as const).flatMap((key) =>
|
||||
c[key]
|
||||
.filter(
|
||||
(entity) => entity.geography && entity.dossiers?.length,
|
||||
@@ -269,7 +269,7 @@ export default function Detail({
|
||||
<StructureGeographyPanel
|
||||
key={`${key}-${entity.id}`}
|
||||
geography={entity.geography!}
|
||||
cluster={key === "clusters"}
|
||||
cluster={key === 'clusters'}
|
||||
dossierId={entity.dossiers![0].id}
|
||||
/>
|
||||
)),
|
||||
|
||||
@@ -2,9 +2,25 @@ import { Link, router, useForm } from '@inertiajs/react';
|
||||
import { Frame, Field, input, button, card } from './shared';
|
||||
import PartnershipSourceLinks from '@/components/partnership-source-links';
|
||||
import CountrySelect, { type Country } from '@/components/country-select';
|
||||
import { useEffect, useId } from 'react';
|
||||
|
||||
type RecordData = { version: number; payload: Record<string, string> };
|
||||
type Company = RecordData & { id: string };
|
||||
type Company = RecordData & {
|
||||
id: string;
|
||||
countrySource?: {
|
||||
organization_id: string;
|
||||
organization_version: number;
|
||||
country: string;
|
||||
} | null;
|
||||
};
|
||||
type Organization = {
|
||||
id: string;
|
||||
name: string;
|
||||
version: number;
|
||||
country: string | null;
|
||||
canEdit: boolean;
|
||||
provenance: { reference: string; kind: string } | null;
|
||||
};
|
||||
const labels: Record<string, string> = {
|
||||
phone: 'Telefone',
|
||||
country: 'País anteriormente registado',
|
||||
@@ -23,10 +39,14 @@ export default function Profile({
|
||||
account,
|
||||
companies,
|
||||
countries,
|
||||
organizations = [],
|
||||
organizationCountryAvailable = false,
|
||||
}: {
|
||||
account: RecordData;
|
||||
companies: Company[];
|
||||
countries: Country[];
|
||||
organizations?: Organization[];
|
||||
organizationCountryAvailable?: boolean;
|
||||
}) {
|
||||
return (
|
||||
<Frame title="Perfil de investimento e empresas">
|
||||
@@ -65,6 +85,21 @@ export default function Profile({
|
||||
<h3 className="text-xl font-bold">
|
||||
{company.payload.name}
|
||||
</h3>
|
||||
{company.countrySource && (
|
||||
<p>
|
||||
País reutilizado: {company.countrySource.country};
|
||||
organização{' '}
|
||||
{organizations.find(
|
||||
(o) =>
|
||||
o.id ===
|
||||
company.countrySource?.organization_id,
|
||||
)?.name ?? company.countrySource.organization_id}
|
||||
, versão{' '}
|
||||
{company.countrySource.organization_version}. O
|
||||
valor é uma cópia identificada; não é atualizado
|
||||
automaticamente quando o cadastro mestre muda.
|
||||
</p>
|
||||
)}
|
||||
<Editor
|
||||
key={company.version}
|
||||
record={company}
|
||||
@@ -78,6 +113,35 @@ export default function Profile({
|
||||
'description',
|
||||
]}
|
||||
/>
|
||||
{organizations
|
||||
.filter((o) => o.country)
|
||||
.map((org) => (
|
||||
<div key={org.id} className="mt-3 space-y-2">
|
||||
<p>
|
||||
País mestre de {org.name}: {org.country}. A
|
||||
reutilização altera somente esta declaração;
|
||||
manifestações anteriores conservam o seu
|
||||
valor.
|
||||
</p>
|
||||
<button
|
||||
className={button}
|
||||
onClick={() =>
|
||||
router.post(
|
||||
`/investidor/companies/${company.id}/organization-country`,
|
||||
{
|
||||
version: company.version,
|
||||
organization_id: org.id,
|
||||
organization_version:
|
||||
org.version,
|
||||
},
|
||||
{ preserveScroll: true },
|
||||
)
|
||||
}
|
||||
>
|
||||
Reutilizar país de {org.name}
|
||||
</button>
|
||||
</div>
|
||||
))}
|
||||
<button
|
||||
className={button + ' mt-4'}
|
||||
onClick={() =>
|
||||
@@ -109,9 +173,129 @@ export default function Profile({
|
||||
/>
|
||||
</section>
|
||||
)}
|
||||
<h2 className="text-2xl font-bold">
|
||||
Organizações representadas — cadastro mestre
|
||||
</h2>
|
||||
<p>
|
||||
O país de constituição é independente da residência e da origem
|
||||
da solicitação. Não se associa uma empresa privada a uma
|
||||
organização por semelhança de nome. A declaração do
|
||||
representante não é uma decisão externa nem comprova por si a
|
||||
representação legal.
|
||||
</p>
|
||||
{!organizationCountryAvailable && (
|
||||
<p role="status">
|
||||
Extensão do país de constituição ainda não instalada neste
|
||||
ambiente.
|
||||
</p>
|
||||
)}
|
||||
{organizationCountryAvailable && organizations.length === 0 && (
|
||||
<p>
|
||||
Sem representação organizacional registada para esta conta.
|
||||
</p>
|
||||
)}
|
||||
{organizations.map((org) => (
|
||||
<OrganizationEditor
|
||||
key={org.id + org.version}
|
||||
organization={org}
|
||||
countries={countries}
|
||||
/>
|
||||
))}
|
||||
</Frame>
|
||||
);
|
||||
}
|
||||
function OrganizationEditor({
|
||||
organization,
|
||||
countries,
|
||||
}: {
|
||||
organization: Organization;
|
||||
countries: Country[];
|
||||
}) {
|
||||
const form = useForm({
|
||||
version: organization.version,
|
||||
country: organization.country ?? '',
|
||||
source_reference: organization.provenance?.reference ?? '',
|
||||
});
|
||||
const id = useId();
|
||||
useEffect(() => {
|
||||
if (Object.keys(form.errors).length)
|
||||
document
|
||||
.getElementById(id)
|
||||
?.querySelector<HTMLElement>('[aria-invalid="true"]')
|
||||
?.focus();
|
||||
}, [form.errors, id]);
|
||||
return (
|
||||
<section
|
||||
className={card}
|
||||
aria-label={`Cadastro mestre: ${organization.name}`}
|
||||
>
|
||||
<h3 className="text-xl font-bold">{organization.name}</h3>
|
||||
<p>
|
||||
Versão {organization.version}; origem do país:{' '}
|
||||
{organization.provenance?.kind === 'representative_declaration'
|
||||
? 'declaração do representante'
|
||||
: 'não informada'}
|
||||
.
|
||||
</p>
|
||||
<form
|
||||
className="mt-4 space-y-4"
|
||||
id={id}
|
||||
onSubmit={(event) => {
|
||||
event.preventDefault();
|
||||
form.put(
|
||||
`/investidor/organizations/${organization.id}/country`,
|
||||
{ preserveScroll: true },
|
||||
);
|
||||
}}
|
||||
>
|
||||
<Field label="País de constituição da organização">
|
||||
<CountrySelect
|
||||
id={id + '-country'}
|
||||
label="País de constituição da organização"
|
||||
countries={countries}
|
||||
value={form.data.country}
|
||||
disabled={!organization.canEdit}
|
||||
error={form.errors.country}
|
||||
onChange={(country) => form.setData('country', country)}
|
||||
/>
|
||||
</Field>
|
||||
<label className="block" htmlFor={id + '-source'}>
|
||||
Fonte ou referência deste país
|
||||
</label>
|
||||
<textarea
|
||||
id={id + '-source'}
|
||||
className={input}
|
||||
value={form.data.source_reference}
|
||||
disabled={!organization.canEdit}
|
||||
maxLength={2000}
|
||||
aria-invalid={!!form.errors.source_reference}
|
||||
aria-describedby={
|
||||
form.errors.source_reference
|
||||
? id + '-source-error'
|
||||
: undefined
|
||||
}
|
||||
onChange={(event) =>
|
||||
form.setData('source_reference', event.target.value)
|
||||
}
|
||||
/>
|
||||
{form.errors.source_reference && (
|
||||
<p id={id + '-source-error'} role="alert">
|
||||
{form.errors.source_reference}
|
||||
</p>
|
||||
)}
|
||||
{form.errors.version && (
|
||||
<p role="alert">{form.errors.version}</p>
|
||||
)}
|
||||
<button
|
||||
className={button}
|
||||
disabled={!organization.canEdit || form.processing}
|
||||
>
|
||||
Guardar país no cadastro mestre
|
||||
</button>
|
||||
</form>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
function Editor({
|
||||
record,
|
||||
fields,
|
||||
@@ -162,6 +346,8 @@ function Editor({
|
||||
<CountrySelect
|
||||
id={key + (record.id ?? 'account')}
|
||||
countries={countries}
|
||||
label={labels[key]}
|
||||
error={form.errors[`payload.${key}`]}
|
||||
value={form.data.payload[key]}
|
||||
onChange={(value) =>
|
||||
form.setData('payload', {
|
||||
@@ -194,11 +380,12 @@ function Editor({
|
||||
}
|
||||
/>
|
||||
)}
|
||||
{form.errors[`payload.${key}`] && (
|
||||
<p role="alert" className="text-red-700">
|
||||
{form.errors[`payload.${key}`]}
|
||||
</p>
|
||||
)}
|
||||
{!key.endsWith('_country_code') &&
|
||||
form.errors[`payload.${key}`] && (
|
||||
<p role="alert" className="text-red-700">
|
||||
{form.errors[`payload.${key}`]}
|
||||
</p>
|
||||
)}
|
||||
</Field>
|
||||
))}
|
||||
</div>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { valueText } from '@/lib/value-text';
|
||||
import { Link, useForm } from '@inertiajs/react';
|
||||
import { useState } from 'react';
|
||||
import { Frame, Field, input, button, card } from './shared';
|
||||
@@ -12,6 +13,11 @@ type Payload = {
|
||||
country: string;
|
||||
residence_country_code: string;
|
||||
incorporation_country_code: string;
|
||||
organization_country_snapshot?: {
|
||||
organization_id: string;
|
||||
organization_version: number;
|
||||
country: string;
|
||||
};
|
||||
declared_origin_country_code: string;
|
||||
organisation: string;
|
||||
representative_role: string;
|
||||
@@ -212,7 +218,7 @@ function Editor({
|
||||
);
|
||||
else setNote('');
|
||||
}}
|
||||
value={String(form.data.payload[key] ?? '')}
|
||||
value={valueText(form.data.payload[key] ?? '')}
|
||||
onChange={(e) => update(key, e.target.value as never)}
|
||||
maxLength={key === 'objective' ? 5000 : 2000}
|
||||
/>
|
||||
@@ -236,8 +242,8 @@ function Editor({
|
||||
(o) =>
|
||||
o.group === group &&
|
||||
(o.active ||
|
||||
String(o.id) ===
|
||||
String(form.data.payload[key])),
|
||||
valueText(o.id) ===
|
||||
valueText(form.data.payload[key])),
|
||||
)
|
||||
.map((o) => (
|
||||
<option value={o.id} key={o.id} disabled={!o.active}>
|
||||
@@ -388,6 +394,17 @@ function Editor({
|
||||
<CountrySelect
|
||||
disabled={readonly}
|
||||
id={key}
|
||||
label={
|
||||
{
|
||||
residence_country_code:
|
||||
'País de residência',
|
||||
incorporation_country_code:
|
||||
'País de constituição da entidade',
|
||||
declared_origin_country_code:
|
||||
'País de origem declarado desta solicitação',
|
||||
}[key]
|
||||
}
|
||||
error={form.errors[`payload.${key}`]}
|
||||
countries={countries}
|
||||
value={form.data.payload[key] ?? ''}
|
||||
onChange={(value) =>
|
||||
@@ -397,13 +414,32 @@ function Editor({
|
||||
})
|
||||
}
|
||||
/>
|
||||
{form.errors[`payload.${key}`] && (
|
||||
<p role="alert">
|
||||
{form.errors[`payload.${key}`]}
|
||||
</p>
|
||||
)}
|
||||
</Field>
|
||||
))}
|
||||
{s.payload.organization_country_snapshot && (
|
||||
<p className="md:col-span-2">
|
||||
País copiado do{' '}
|
||||
<Link
|
||||
href="/investidor/profile"
|
||||
className="underline"
|
||||
>
|
||||
cadastro mestre da organização
|
||||
</Link>
|
||||
, versão{' '}
|
||||
{
|
||||
s.payload.organization_country_snapshot
|
||||
.organization_version
|
||||
}
|
||||
:{' '}
|
||||
{
|
||||
s.payload.organization_country_snapshot
|
||||
.country
|
||||
}
|
||||
. Esta cópia conserva a origem; alterações
|
||||
posteriores do cadastro não alteram esta
|
||||
manifestação.
|
||||
</p>
|
||||
)}
|
||||
<p>
|
||||
A origem da solicitação é uma declaração sua; não é
|
||||
deduzida da residência, da entidade ou do endereço
|
||||
@@ -535,8 +571,8 @@ function Editor({
|
||||
const category =
|
||||
r.options.find(
|
||||
(o) =>
|
||||
String(o.id) ===
|
||||
String(need.category_id),
|
||||
valueText(o.id) ===
|
||||
valueText(need.category_id),
|
||||
)?.code ?? '';
|
||||
const group = category.startsWith('labour')
|
||||
? 'labour'
|
||||
@@ -575,8 +611,8 @@ function Editor({
|
||||
(o) =>
|
||||
o.group === optionGroup &&
|
||||
(o.active ||
|
||||
String(o.id) ===
|
||||
String(
|
||||
valueText(o.id) ===
|
||||
valueText(
|
||||
need[field],
|
||||
)),
|
||||
)
|
||||
@@ -776,9 +812,9 @@ function Editor({
|
||||
['Prazo', form.data.payload.horizon],
|
||||
[
|
||||
'Necessidades',
|
||||
String(form.data.needs.length),
|
||||
valueText(form.data.needs.length),
|
||||
],
|
||||
['Anexos', String(attachments.length)],
|
||||
['Anexos', valueText(attachments.length)],
|
||||
].map(([label, value]) => (
|
||||
<div key={label}>
|
||||
<dt className="font-semibold">{label}</dt>
|
||||
@@ -813,7 +849,7 @@ function Editor({
|
||||
form.data.payload.partnership_id,
|
||||
]
|
||||
.map(String)
|
||||
.includes(String(o.id)),
|
||||
.includes(valueText(o.id)),
|
||||
) &&
|
||||
text(
|
||||
'other_details',
|
||||
|
||||
Reference in New Issue
Block a user