@@ -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