@@ -23,6 +23,7 @@ type Interest = {
|
||||
reviewed_at: string | null;
|
||||
reviewed_by: number | null;
|
||||
created_at: string;
|
||||
source_page: string | null;
|
||||
metadata?: {
|
||||
submission_id?: string;
|
||||
journey_id?: string;
|
||||
@@ -83,6 +84,7 @@ export default function InterestDetail({
|
||||
['Telefone', interest.phone],
|
||||
['Tipo de investidor', interest.investor_type],
|
||||
['País', interest.country],
|
||||
['Página de entrada registada', interest.source_page],
|
||||
[
|
||||
'Origem declarada da solicitação',
|
||||
declaredOrigin.code
|
||||
|
||||
@@ -81,10 +81,14 @@ export default function Opportunities({
|
||||
{[
|
||||
'draft',
|
||||
'submitted',
|
||||
'needs_information',
|
||||
'in_review',
|
||||
'information_pending',
|
||||
'returned',
|
||||
'approved',
|
||||
'published',
|
||||
'suspended',
|
||||
'rejected',
|
||||
'archived',
|
||||
].map((s) => (
|
||||
<Link
|
||||
@@ -100,6 +104,10 @@ export default function Opportunities({
|
||||
className="flex flex-wrap gap-3"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
form.transform((data) => ({
|
||||
...data,
|
||||
deleted: data.deleted ? '1' : '0',
|
||||
}));
|
||||
form.get(basePath);
|
||||
}}
|
||||
>
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
import { createOperationKey } from '@/lib/operation-key';
|
||||
import { valueText } from '@/lib/value-text';
|
||||
import OpportunityProfileActions from '@/components/opportunity-profile-actions';
|
||||
import OpportunityContactForm from '@/components/opportunity-contact-form';
|
||||
import OpportunityCanonicalFields, {
|
||||
type CanonicalOptions,
|
||||
} from '@/components/opportunity-canonical-fields';
|
||||
@@ -64,6 +67,7 @@ export default function OpportunityDraft({
|
||||
profileActions = [],
|
||||
canonicalOptions,
|
||||
workflowState,
|
||||
canonicalResponse,
|
||||
workflowTasks = [],
|
||||
workflowParticipants,
|
||||
publicationPreview,
|
||||
@@ -77,7 +81,12 @@ export default function OpportunityDraft({
|
||||
profileActions?: string[];
|
||||
profileContext?: Record<string, unknown> | null;
|
||||
profileAccess?: {
|
||||
contexts: { organization_id: string | null; type: string }[];
|
||||
internalPromoter?: boolean;
|
||||
contexts: {
|
||||
organization_id: string | null;
|
||||
organization_name?: string;
|
||||
type: string;
|
||||
}[];
|
||||
} | null;
|
||||
publicationPreview?: {
|
||||
title: string;
|
||||
@@ -85,6 +94,7 @@ export default function OpportunityDraft({
|
||||
description: string;
|
||||
};
|
||||
workflowParticipants?: {
|
||||
condition_responsibles?: { id: number; name: string }[];
|
||||
publishers: { id: number; name: string }[];
|
||||
validators: {
|
||||
id: number;
|
||||
@@ -95,6 +105,15 @@ export default function OpportunityDraft({
|
||||
};
|
||||
canonicalOptions?: CanonicalOptions;
|
||||
workflowState?: string;
|
||||
canonicalResponse?: {
|
||||
completion: {
|
||||
percentage: number;
|
||||
filled: number;
|
||||
applicable: number;
|
||||
missing_paths: string[];
|
||||
};
|
||||
materiality?: { reopened: string[]; retained: string[] } | null;
|
||||
};
|
||||
publicationState?: {
|
||||
scope: string;
|
||||
label: string;
|
||||
@@ -116,14 +135,16 @@ export default function OpportunityDraft({
|
||||
? {
|
||||
organization_id: record
|
||||
? (profileOrganization ?? null)
|
||||
: (profileAccess?.contexts[0]?.organization_id ?? null),
|
||||
: profileAccess?.internalPromoter
|
||||
? null
|
||||
: (profileAccess?.contexts[0]?.organization_id ?? null),
|
||||
opportunity_category:
|
||||
values.opportunity_category ??
|
||||
profileAccess?.contexts[0]?.type ??
|
||||
'',
|
||||
}
|
||||
: {}),
|
||||
creation_key: crypto.randomUUID(),
|
||||
creation_key: createOperationKey(),
|
||||
});
|
||||
const [busy, setBusy] = useState(false),
|
||||
[errors, setErrors] = useState<Record<string, string>>({}),
|
||||
@@ -132,6 +153,9 @@ export default function OpportunityDraft({
|
||||
[confirm, setConfirm] = useState(false),
|
||||
[token, setToken] = useState(etag);
|
||||
useEffect(() => setToken(etag), [etag]);
|
||||
const [savedContacts, setSavedContacts] = useState<
|
||||
{ id: string; full_name: string }[]
|
||||
>([]);
|
||||
const [path, setPath] = useState(territoryPath);
|
||||
const unavailable = Boolean(
|
||||
record?.deleted_at || record?.status === 'archived',
|
||||
@@ -175,7 +199,7 @@ export default function OpportunityDraft({
|
||||
Object.fromEntries(
|
||||
Object.entries(result.errors ?? {}).map(([k, v]) => [
|
||||
k,
|
||||
Array.isArray(v) ? v.join(' ') : String(v),
|
||||
Array.isArray(v) ? v.join(' ') : valueText(v),
|
||||
]),
|
||||
),
|
||||
);
|
||||
@@ -211,6 +235,42 @@ export default function OpportunityDraft({
|
||||
<Link href={basePath}>
|
||||
{profileMode ? 'Minhas oportunidades' : 'Voltar à gestão'}
|
||||
</Link>
|
||||
{profileMode && (
|
||||
<section
|
||||
aria-label="Âmbito desta entrega"
|
||||
className="rounded border p-3"
|
||||
>
|
||||
<h2>Âmbito desta entrega</h2>
|
||||
<p>
|
||||
Seis categorias base: projeto de investimento,
|
||||
imobiliário, fundiário, venda de negócio, parceria e
|
||||
franquia. Rascunho, correção, revisão independente e
|
||||
publicação são ações distintas; uma aprovação interna
|
||||
não atribui direitos nem substitui uma decisão externa.
|
||||
</p>
|
||||
<p>
|
||||
No imobiliário, a submissão inclui venda e arrendamento
|
||||
de imóvel concluído, desocupado e sem encargos ou
|
||||
limitações urbanísticas adicionais. Pode guardar e
|
||||
recuperar as outras variantes em preparação; a sua
|
||||
submissão permanece indisponível.
|
||||
</p>
|
||||
<p>
|
||||
Concessão, financiamento, fornecimento e outros,
|
||||
partilha individual de anexos, restauração de
|
||||
oportunidades e exportação normativa integral
|
||||
Response/§27 não estão incluídos. O Response disponível
|
||||
conserva o contrato de compatibilidade e o histórico.
|
||||
</p>
|
||||
<p>
|
||||
As restantes variantes económicas, societárias,
|
||||
territoriais, de contribuições e licenças exigem
|
||||
documentação e revisão aplicáveis. Esta entrega não
|
||||
certifica a viabilidade, a titularidade ou a decisão
|
||||
externa de cada caso.
|
||||
</p>
|
||||
</section>
|
||||
)}
|
||||
{profileMode && record && readOnly && canEditDraft && (
|
||||
<Link
|
||||
className="block underline"
|
||||
@@ -221,10 +281,11 @@ export default function OpportunityDraft({
|
||||
)}
|
||||
{profileMode && !record && (
|
||||
<label className="block">
|
||||
Organização e tipo autorizados
|
||||
Promotor real e categoria autorizada
|
||||
<select
|
||||
aria-label="Promotor real e categoria autorizada"
|
||||
className={control}
|
||||
value={`${String(data.organization_id ?? '')}|${String(data.opportunity_category ?? '')}`}
|
||||
value={`${valueText(data.organization_id ?? '')}|${valueText(data.opportunity_category ?? '')}`}
|
||||
onChange={(e) => {
|
||||
const [organization, type] =
|
||||
e.target.value.split('|');
|
||||
@@ -235,27 +296,57 @@ export default function OpportunityDraft({
|
||||
}));
|
||||
}}
|
||||
>
|
||||
{profileAccess?.internalPromoter && (
|
||||
<option value="">
|
||||
Selecionar o promotor real da oportunidade
|
||||
</option>
|
||||
)}
|
||||
{(profileAccess?.contexts ?? []).map((c) => (
|
||||
<option
|
||||
key={`${c.organization_id}|${c.type}`}
|
||||
value={`${c.organization_id ?? ''}|${c.type}`}
|
||||
>
|
||||
{c.organization_id ?? 'Âmbito individual'} —{' '}
|
||||
{c.type}
|
||||
{c.organization_name ??
|
||||
c.organization_id ??
|
||||
'Âmbito individual'}{' '}
|
||||
— {c.type}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
)}
|
||||
{profileMode && record && (
|
||||
<p>
|
||||
<p
|
||||
role="status"
|
||||
aria-live="polite"
|
||||
aria-label="Estado da oportunidade"
|
||||
>
|
||||
Estado da preparação:{' '}
|
||||
{(workflowState ?? record.status) === 'published'
|
||||
? 'Versão disponibilizada'
|
||||
: (states[workflowState ?? record.status] ??
|
||||
: ((
|
||||
{
|
||||
draft: 'Rascunho',
|
||||
submitted: 'Submetida para validação',
|
||||
needs_information: 'Correções solicitadas',
|
||||
information_pending: 'Aguarda parecer',
|
||||
in_review: 'Em validação interna',
|
||||
approved: 'Aprovada internamente',
|
||||
rejected: 'Rejeitada',
|
||||
suspended: 'Suspensa',
|
||||
archived: 'Arquivada',
|
||||
} as Record<string, string>
|
||||
)[workflowState ?? record.status] ??
|
||||
states[workflowState ?? record.status] ??
|
||||
workflowState ??
|
||||
record.status)}
|
||||
. {publicationState?.label}.{' '}
|
||||
{profileContext?.review_cycle != null && (
|
||||
<>
|
||||
Ciclo de revisão interna:{' '}
|
||||
{valueText(profileContext.review_cycle)}.{' '}
|
||||
</>
|
||||
)}
|
||||
{profileContext?.request_archive
|
||||
? 'Pedido de arquivo registado; aguarda decisão independente.'
|
||||
: ''}{' '}
|
||||
@@ -264,8 +355,15 @@ export default function OpportunityDraft({
|
||||
</p>
|
||||
)}
|
||||
<p>
|
||||
Classificação de origem: {classification}. Esta classificação
|
||||
não cria associações territoriais.
|
||||
Classificação de origem:{' '}
|
||||
{(
|
||||
{
|
||||
real: 'Oportunidade real',
|
||||
example: 'Exemplo demonstrativo',
|
||||
undetermined: 'Origem ainda indeterminada',
|
||||
} as Record<string, string>
|
||||
)[classification] ?? classification}
|
||||
. Esta classificação não cria associações territoriais.
|
||||
</p>
|
||||
{closedVersion && (
|
||||
<p>
|
||||
@@ -275,6 +373,47 @@ export default function OpportunityDraft({
|
||||
revisão, aprovação e publicação independentes.
|
||||
</p>
|
||||
)}
|
||||
{profileMode && record && canonicalResponse && (
|
||||
<section
|
||||
aria-label="Preenchimento e revisões"
|
||||
aria-live="polite"
|
||||
className="rounded border p-3"
|
||||
>
|
||||
<p>
|
||||
Preenchimento gravado:{' '}
|
||||
{canonicalResponse.completion.percentage}% (
|
||||
{canonicalResponse.completion.filled}/
|
||||
{canonicalResponse.completion.applicable} campos
|
||||
aplicáveis). Não equivale a validação ou aprovação.
|
||||
</p>
|
||||
{canonicalResponse.materiality && (
|
||||
<>
|
||||
<p>
|
||||
Revisões reabertas:{' '}
|
||||
{canonicalResponse.materiality.reopened.join(
|
||||
', ',
|
||||
) || 'Nenhuma'}
|
||||
.
|
||||
</p>
|
||||
<p>
|
||||
Revisões conservadas:{' '}
|
||||
{canonicalResponse.materiality.retained.join(
|
||||
', ',
|
||||
) || 'Nenhuma'}
|
||||
.
|
||||
</p>
|
||||
<p>
|
||||
A versão alterada exige nova aprovação
|
||||
independente; as assinaturas dos pareceres
|
||||
conservados permanecem no histórico.
|
||||
</p>
|
||||
</>
|
||||
)}
|
||||
<a href={`${basePath}/${record.id}/response`}>
|
||||
Abrir resposta canónica gravada
|
||||
</a>
|
||||
</section>
|
||||
)}
|
||||
<div
|
||||
id="opportunity-result"
|
||||
tabIndex={-1}
|
||||
@@ -364,7 +503,9 @@ export default function OpportunityDraft({
|
||||
>
|
||||
<select
|
||||
className={control}
|
||||
value={String(data.opportunity_category ?? '')}
|
||||
value={valueText(
|
||||
data.opportunity_category ?? '',
|
||||
)}
|
||||
onChange={(e) =>
|
||||
set('opportunity_category', e.target.value)
|
||||
}
|
||||
@@ -385,7 +526,7 @@ export default function OpportunityDraft({
|
||||
{key === 'description' || key === 'summary' ? (
|
||||
<textarea
|
||||
className={control}
|
||||
value={String(data[key] ?? '')}
|
||||
value={valueText(data[key] ?? '')}
|
||||
onChange={(e) =>
|
||||
set(key, e.target.value)
|
||||
}
|
||||
@@ -393,7 +534,7 @@ export default function OpportunityDraft({
|
||||
) : (
|
||||
<input
|
||||
className={control}
|
||||
value={String(data[key] ?? '')}
|
||||
value={valueText(data[key] ?? '')}
|
||||
onChange={(e) =>
|
||||
set(key, e.target.value)
|
||||
}
|
||||
@@ -404,7 +545,7 @@ export default function OpportunityDraft({
|
||||
<Field label="Sector" error={errors.sector_id}>
|
||||
<select
|
||||
className={control}
|
||||
value={String(data.sector_id ?? '')}
|
||||
value={valueText(data.sector_id ?? '')}
|
||||
onChange={(e) =>
|
||||
set('sector_id', e.target.value)
|
||||
}
|
||||
@@ -423,7 +564,7 @@ export default function OpportunityDraft({
|
||||
>
|
||||
<select
|
||||
className={control}
|
||||
value={String(data.promoter_type ?? '')}
|
||||
value={valueText(data.promoter_type ?? '')}
|
||||
onChange={(e) =>
|
||||
set('promoter_type', e.target.value)
|
||||
}
|
||||
@@ -439,12 +580,14 @@ export default function OpportunityDraft({
|
||||
'community',
|
||||
'other',
|
||||
].includes(
|
||||
String(values.promoter_type),
|
||||
valueText(values.promoter_type),
|
||||
) && (
|
||||
<option
|
||||
value={String(values.promoter_type)}
|
||||
value={valueText(
|
||||
values.promoter_type,
|
||||
)}
|
||||
>
|
||||
{String(values.promoter_type)}{' '}
|
||||
{valueText(values.promoter_type)}{' '}
|
||||
(valor existente)
|
||||
</option>
|
||||
)}
|
||||
@@ -472,9 +615,9 @@ export default function OpportunityDraft({
|
||||
value={
|
||||
data.maturity_catalogue_version ===
|
||||
maturityCatalogue.version
|
||||
? String(data.maturity_stage ?? '')
|
||||
? valueText(data.maturity_stage ?? '')
|
||||
: data.maturity_level
|
||||
? `legacy:${data.maturity_level}`
|
||||
? `legacy:${valueText(data.maturity_level)}`
|
||||
: ''
|
||||
}
|
||||
onChange={(e) => {
|
||||
@@ -509,11 +652,11 @@ export default function OpportunityDraft({
|
||||
values.maturity_catalogue_version !==
|
||||
maturityCatalogue.version && (
|
||||
<option
|
||||
value={`legacy:${values.maturity_level}`}
|
||||
value={`legacy:${valueText(values.maturity_level)}`}
|
||||
>
|
||||
{
|
||||
maturityCatalogue.legacyLabels[
|
||||
String(
|
||||
valueText(
|
||||
values.maturity_level,
|
||||
)
|
||||
]
|
||||
@@ -541,7 +684,7 @@ export default function OpportunityDraft({
|
||||
>
|
||||
<input
|
||||
className={control}
|
||||
value={String(data.financing_modality ?? '')}
|
||||
value={valueText(data.financing_modality ?? '')}
|
||||
onChange={(e) =>
|
||||
set('financing_modality', e.target.value)
|
||||
}
|
||||
@@ -553,7 +696,7 @@ export default function OpportunityDraft({
|
||||
>
|
||||
<textarea
|
||||
className={control}
|
||||
value={String(data.expected_impact ?? '')}
|
||||
value={valueText(data.expected_impact ?? '')}
|
||||
onChange={(e) =>
|
||||
set('expected_impact', e.target.value)
|
||||
}
|
||||
@@ -569,7 +712,7 @@ export default function OpportunityDraft({
|
||||
>
|
||||
<input
|
||||
className={control}
|
||||
value={String(
|
||||
value={valueText(
|
||||
data.estimated_investment_amount ??
|
||||
'',
|
||||
)}
|
||||
@@ -587,7 +730,7 @@ export default function OpportunityDraft({
|
||||
>
|
||||
<select
|
||||
className={control}
|
||||
value={String(
|
||||
value={valueText(
|
||||
data.estimated_investment_currency ??
|
||||
'',
|
||||
)}
|
||||
@@ -712,6 +855,35 @@ export default function OpportunityDraft({
|
||||
)}
|
||||
{profileMode && canonicalOptions && (
|
||||
<section>
|
||||
{record && !readOnly && !unavailable && (
|
||||
<OpportunityContactForm
|
||||
id={record.id}
|
||||
etag={token ?? ''}
|
||||
organization={
|
||||
(data.organization_id ?? null) as string | null
|
||||
}
|
||||
investors={canonicalOptions.contactInvestors ?? []}
|
||||
disabled={busy || !token}
|
||||
onSaved={(contact) => {
|
||||
setSavedContacts((prior) => [
|
||||
...prior.filter(
|
||||
(row) => row.id !== contact.id,
|
||||
),
|
||||
contact,
|
||||
]);
|
||||
setData((prior) => ({
|
||||
...prior,
|
||||
canonical: {
|
||||
...((prior.canonical as Record<
|
||||
string,
|
||||
unknown
|
||||
>) ?? {}),
|
||||
internal_contact_id: contact.id,
|
||||
},
|
||||
}));
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
<OpportunityCanonicalFields
|
||||
value={
|
||||
(data.canonical ?? {}) as Record<string, unknown>
|
||||
@@ -719,9 +891,20 @@ export default function OpportunityDraft({
|
||||
onChange={(v) =>
|
||||
setData((d) => ({ ...d, canonical: v }))
|
||||
}
|
||||
options={canonicalOptions}
|
||||
options={{
|
||||
...canonicalOptions,
|
||||
contacts: [
|
||||
...canonicalOptions.contacts.filter(
|
||||
(row) =>
|
||||
!savedContacts.some(
|
||||
(saved) => saved.id === row.id,
|
||||
),
|
||||
),
|
||||
...savedContacts,
|
||||
],
|
||||
}}
|
||||
errors={errors}
|
||||
category={String(data.opportunity_category ?? '')}
|
||||
category={valueText(data.opportunity_category ?? '')}
|
||||
organization={
|
||||
(data.organization_id ?? null) as string | null
|
||||
}
|
||||
@@ -770,6 +953,20 @@ export default function OpportunityDraft({
|
||||
)}
|
||||
{profileMode && record && etag && (
|
||||
<OpportunityProfileActions
|
||||
conditions={
|
||||
Object.values(profileContext?.conditions ?? {}) as {
|
||||
id: string;
|
||||
gate: string;
|
||||
description: string;
|
||||
responsible_name: string;
|
||||
due_on: string | null;
|
||||
blocking_action: string;
|
||||
status: string;
|
||||
}[]
|
||||
}
|
||||
conditionResponsibles={
|
||||
workflowParticipants?.condition_responsibles
|
||||
}
|
||||
participants={workflowParticipants?.validators}
|
||||
publishers={workflowParticipants?.publishers}
|
||||
opinions={Object.values(
|
||||
@@ -787,7 +984,7 @@ export default function OpportunityDraft({
|
||||
id={record.id}
|
||||
etag={token ?? etag}
|
||||
actions={profileActions}
|
||||
publicationVisibility={String(
|
||||
publicationVisibility={valueText(
|
||||
(data.canonical as Record<string, unknown> | undefined)
|
||||
?.visibility ?? 'internal',
|
||||
)}
|
||||
|
||||
@@ -11,6 +11,8 @@ export default function Install({
|
||||
rollback,
|
||||
actionUrl = '/management/opportunity-management-install',
|
||||
imageProcessingAvailable,
|
||||
extension = false,
|
||||
operationKey,
|
||||
}: {
|
||||
installed: boolean;
|
||||
ready: boolean;
|
||||
@@ -22,10 +24,23 @@ export default function Install({
|
||||
rollback: string;
|
||||
actionUrl?: string;
|
||||
imageProcessingAvailable?: boolean;
|
||||
extension?: boolean;
|
||||
operationKey?: string;
|
||||
}) {
|
||||
const form = useForm({ hash, confirm: false });
|
||||
const form = useForm({
|
||||
hash,
|
||||
confirm: false,
|
||||
idempotency_key: operationKey ?? '',
|
||||
reason: '',
|
||||
});
|
||||
return (
|
||||
<Management title="Ativação da Gestão de Oportunidades">
|
||||
<Management
|
||||
title={
|
||||
migration.endsWith('extend_organization_country')
|
||||
? 'Instalação do país de constituição'
|
||||
: 'Ativação da Gestão de Oportunidades'
|
||||
}
|
||||
>
|
||||
<p>
|
||||
Base: {target.database}:{target.port} ·{' '}
|
||||
{installed ? 'Instalado' : 'Ainda não aplicado'}
|
||||
@@ -77,17 +92,40 @@ export default function Install({
|
||||
/>{' '}
|
||||
Confirmo a aplicação deste plano
|
||||
</label>
|
||||
{extension && (
|
||||
<div>
|
||||
<label htmlFor="installation-reason" className="block">
|
||||
Fundamentação da instalação
|
||||
</label>
|
||||
<textarea
|
||||
id="installation-reason"
|
||||
value={form.data.reason}
|
||||
minLength={20}
|
||||
maxLength={1000}
|
||||
required
|
||||
onChange={(event) =>
|
||||
form.setData('reason', event.target.value)
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
<button
|
||||
className={button}
|
||||
disabled={
|
||||
installed ||
|
||||
!ready ||
|
||||
!form.data.confirm ||
|
||||
(extension && !operationKey) ||
|
||||
form.processing
|
||||
}
|
||||
>
|
||||
Aplicar plano de gestão
|
||||
{migration.endsWith('extend_organization_country')
|
||||
? 'Aplicar extensão do país'
|
||||
: 'Aplicar plano de gestão'}
|
||||
</button>
|
||||
{extension && !operationKey && (
|
||||
<p role="alert">Atualize a prévia para obter a chave desta operação.</p>
|
||||
)}
|
||||
{!ready && (
|
||||
<p>
|
||||
Aplicação indisponível até comprovar QA,
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { createOperationKey } from '@/lib/operation-key';
|
||||
import { valueText } from '@/lib/value-text';
|
||||
import { Link, router, usePage } from '@inertiajs/react';
|
||||
import TerritoryGeometryPreview from '@/components/territory-geometry-preview';
|
||||
import { useState } from 'react';
|
||||
@@ -144,26 +146,39 @@ export default function OpportunityResources({
|
||||
assessment: string[];
|
||||
imageProcessingAvailable: boolean;
|
||||
}) {
|
||||
const { basePath = '/management/opportunities', readOnly = false, countries = [] } = usePage<{basePath?: string; readOnly?: boolean; countries?: {code:string;name:string}[]}>().props;
|
||||
const {
|
||||
basePath = '/management/opportunities',
|
||||
readOnly = false,
|
||||
countries = [],
|
||||
} = usePage<{
|
||||
basePath?: string;
|
||||
readOnly?: boolean;
|
||||
countries?: { code: string; name: string }[];
|
||||
}>().props;
|
||||
const [kind, setKind] = useState<Kind>('locations');
|
||||
const [editing, setEditing] = useState<Resource | null>(null);
|
||||
const [payload, setPayload] = useState<Payload>({country_code:'MZ'});
|
||||
const [payload, setPayload] = useState<Payload>({ country_code: 'MZ' });
|
||||
const [path, setPath] = useState<TerritoryOption[]>([]);
|
||||
const [geometry, setGeometry] = useState('');
|
||||
const [file, setFile] = useState<File | null>(null);
|
||||
const [reason, setReason] = useState('');
|
||||
const [confirm, setConfirm] = useState(false);
|
||||
const [key, setKey] = useState(() => crypto.randomUUID());
|
||||
const [key, setKey] = useState(() => createOperationKey());
|
||||
const [busy, setBusy] = useState(false);
|
||||
const [message, setMessage] = useState('');
|
||||
const [errors, setErrors] = useState<Record<string, string>>({});
|
||||
const foreignCountry = Boolean(payload.country_code && payload.country_code !== 'MZ');
|
||||
const foreignCountry = Boolean(
|
||||
payload.country_code && payload.country_code !== 'MZ',
|
||||
);
|
||||
const set = (name: string, value: Payload[string]) =>
|
||||
setPayload((previous) => ({ ...previous, [name]: value }));
|
||||
function select(nextKind: Kind, record: Resource | null = null) {
|
||||
setKind(nextKind);
|
||||
setEditing(record);
|
||||
setPayload(record?.payload ?? (nextKind === 'locations' ? {country_code:'MZ'} : {}));
|
||||
setPayload(
|
||||
record?.payload ??
|
||||
(nextKind === 'locations' ? { country_code: 'MZ' } : {}),
|
||||
);
|
||||
setPath(record?.territoryPath ?? []);
|
||||
setGeometry(
|
||||
record?.payload.geometry
|
||||
@@ -171,7 +186,7 @@ export default function OpportunityResources({
|
||||
: '',
|
||||
);
|
||||
setFile(null);
|
||||
setKey(crypto.randomUUID());
|
||||
setKey(createOperationKey());
|
||||
setConfirm(false);
|
||||
setErrors({});
|
||||
}
|
||||
@@ -185,7 +200,7 @@ export default function OpportunityResources({
|
||||
form.set('etag', etag);
|
||||
form.set('reason', reason);
|
||||
form.set('creation_key', key);
|
||||
if (editing) form.set('version', String(editing.version));
|
||||
if (editing) form.set('version', valueText(editing.version));
|
||||
if (action === 'save') {
|
||||
const values = { ...payload };
|
||||
if (kind === 'locations') {
|
||||
@@ -231,7 +246,7 @@ export default function OpportunityResources({
|
||||
name,
|
||||
Array.isArray(value)
|
||||
? value.join(' ')
|
||||
: String(value),
|
||||
: valueText(value),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -240,11 +255,11 @@ export default function OpportunityResources({
|
||||
}
|
||||
setMessage(data.message);
|
||||
setEditing(null);
|
||||
setPayload(kind === 'locations' ? {country_code:'MZ'} : {});
|
||||
setPayload(kind === 'locations' ? { country_code: 'MZ' } : {});
|
||||
setPath([]);
|
||||
setGeometry('');
|
||||
setFile(null);
|
||||
setKey(crypto.randomUUID());
|
||||
setKey(createOperationKey());
|
||||
setConfirm(false);
|
||||
router.reload({
|
||||
onFinish: () =>
|
||||
@@ -273,9 +288,9 @@ export default function OpportunityResources({
|
||||
</Link>
|
||||
<p>
|
||||
Recursos de preparação. Não alteram automaticamente a ficha
|
||||
pública ou relações territoriais aceites. O estado e o motor
|
||||
do scan são apresentados por ficheiro e versão; um scan
|
||||
simulado nunca verifica ficheiros reais.
|
||||
pública ou relações territoriais aceites. O estado e o motor do
|
||||
scan são apresentados por ficheiro e versão; um scan simulado
|
||||
nunca verifica ficheiros reais.
|
||||
</p>
|
||||
<div
|
||||
id="resource-result"
|
||||
@@ -302,10 +317,18 @@ export default function OpportunityResources({
|
||||
<p className="rounded border p-3">
|
||||
Pode guardar anexos para preparação. Cada ficheiro permanece
|
||||
sem download ou pré-visualização enquanto o seu scan não
|
||||
estiver concluído. Guardar metadados, locais ou rascunhos
|
||||
é independente do scan e não publica ficheiros.
|
||||
estiver concluído. Guardar metadados, locais ou rascunhos é
|
||||
independente do scan e não publica ficheiros.
|
||||
</p>
|
||||
)}
|
||||
{kind !== 'locations' && (
|
||||
<section aria-label="Privacidade dos anexos" className="rounded border p-3">
|
||||
<h2>Privacidade dos anexos</h2>
|
||||
<p>Os anexos pertencem à oportunidade. Podem ser consultados pelos Promotores autorizados da organização, pelos Validadores e Publicadores com acesso ao tipo e âmbito e pelos Auditores autorizados. O Superutilizador precisa também de perfil operacional no âmbito e de elevação temporária para consulta, aprovada por outro titular. O gestor da biblioteca, por si só, não obtém esse acesso.</p>
|
||||
<p>Classificação e âmbito de consulta são metadados; escolher «public» ou «authenticated» não divulga o ficheiro. Publicar o anúncio não publica os anexos. A retirada lógica impede a entrega do ficheiro; a revogação do perfil impede acessos futuros.</p>
|
||||
<p>Partilhar um anexo com um destinatário individual ou restringi-lo a alguns membros da organização permanece indisponível. Não guarde neste fluxo um ficheiro que exija essa restrição individual. Não é possível retirar cópias já descarregadas.</p>
|
||||
</section>
|
||||
)}
|
||||
<section>
|
||||
<h2>Conferência e pendências</h2>
|
||||
<ul>
|
||||
@@ -329,7 +352,7 @@ export default function OpportunityResources({
|
||||
<button
|
||||
className={button}
|
||||
key={k}
|
||||
disabled={busy || readOnly}
|
||||
disabled={busy}
|
||||
onClick={() => select(k)}
|
||||
>
|
||||
{k === 'locations'
|
||||
@@ -344,7 +367,7 @@ export default function OpportunityResources({
|
||||
{resources[kind].map((r) => (
|
||||
<article key={r.id} className="my-3 rounded border p-3">
|
||||
<p>
|
||||
{String(
|
||||
{valueText(
|
||||
r.payload.title ??
|
||||
r.file?.file_name ??
|
||||
'Recurso incompleto',
|
||||
@@ -370,7 +393,7 @@ export default function OpportunityResources({
|
||||
srcSet={r.derivativePreviews
|
||||
.map((p) => `${p.url} ${p.width}w`)
|
||||
.join(', ')}
|
||||
alt={String(
|
||||
alt={valueText(
|
||||
r.payload.alt_text ??
|
||||
'Pré-visualização interna pendente de descrição',
|
||||
)}
|
||||
@@ -385,7 +408,9 @@ export default function OpportunityResources({
|
||||
className={button}
|
||||
onClick={() => select(kind, r)}
|
||||
>
|
||||
Ver / editar / restaurar
|
||||
{readOnly
|
||||
? 'Ver recurso'
|
||||
: 'Ver / editar / restaurar'}
|
||||
</button>
|
||||
{r.file?.malware_scan_status === 'clean' &&
|
||||
!r.deleted_at && (
|
||||
@@ -412,39 +437,72 @@ export default function OpportunityResources({
|
||||
</h2>
|
||||
{kind === 'locations' && (
|
||||
<div>
|
||||
<Field label="País da localização" error={errors.country_code}>
|
||||
<Field
|
||||
label="País da localização"
|
||||
error={errors.country_code}
|
||||
>
|
||||
<select
|
||||
className={control}
|
||||
disabled={readOnly}
|
||||
value={String(payload.country_code ?? '')}
|
||||
value={valueText(payload.country_code ?? '')}
|
||||
onChange={(event) => {
|
||||
const country = event.target.value;
|
||||
set('country_code', country || null);
|
||||
if (country && country !== 'MZ' && path.length) {
|
||||
if (
|
||||
country &&
|
||||
country !== 'MZ' &&
|
||||
path.length
|
||||
) {
|
||||
setPath([]);
|
||||
setMessage('A seleção territorial de Moçambique foi retirada do preenchimento ao mudar de país. Guarde para registar a alteração; a geometria própria foi preservada.');
|
||||
setMessage(
|
||||
'A seleção territorial de Moçambique foi retirada do preenchimento ao mudar de país. Guarde para registar a alteração; a geometria própria foi preservada.',
|
||||
);
|
||||
}
|
||||
}}
|
||||
>
|
||||
<option value="">Por indicar</option>
|
||||
{countries.map(c=><option key={c.code} value={c.code}>{c.name}</option>)}
|
||||
{countries.map((c) => (
|
||||
<option key={c.code} value={c.code}>
|
||||
{c.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</Field>
|
||||
{foreignCountry && (
|
||||
<p>A hierarquia abaixo corresponde a Moçambique e não é aplicável ao país escolhido. Pode guardar uma localização incompleta noutro país sem esta hierarquia.</p>
|
||||
<p>
|
||||
A hierarquia abaixo corresponde a Moçambique e
|
||||
não é aplicável ao país escolhido. Pode guardar
|
||||
uma localização incompleta noutro país sem esta
|
||||
hierarquia.
|
||||
</p>
|
||||
)}
|
||||
{foreignCountry && path.length > 0 && (
|
||||
<p role="alert">
|
||||
Este registo conserva uma seleção territorial de Moçambique incompatível com o país. Escolha Moçambique ou{' '}
|
||||
<button type="button" className="underline" disabled={readOnly} onClick={() => setPath([])}>
|
||||
retirar a seleção territorial deste preenchimento
|
||||
</button>. O registo guardado só muda quando guardar.
|
||||
Este registo conserva uma seleção territorial de
|
||||
Moçambique incompatível com o país. Escolha
|
||||
Moçambique ou{' '}
|
||||
<button
|
||||
type="button"
|
||||
className="underline"
|
||||
disabled={readOnly}
|
||||
onClick={() => setPath([])}
|
||||
>
|
||||
retirar a seleção territorial deste
|
||||
preenchimento
|
||||
</button>
|
||||
. O registo guardado só muda quando guardar.
|
||||
</p>
|
||||
)}
|
||||
<TerritoryGeometryPreview
|
||||
territoryId={foreignCountry ? undefined : path.at(-1)?.id}
|
||||
territoryId={
|
||||
foreignCountry ? undefined : path.at(-1)?.id
|
||||
}
|
||||
management
|
||||
endpoint={basePath === '/minhas-oportunidades' ? '/minhas-oportunidades/territory-geometries' : undefined}
|
||||
endpoint={
|
||||
basePath === '/minhas-oportunidades'
|
||||
? '/minhas-oportunidades/territory-geometries'
|
||||
: undefined
|
||||
}
|
||||
/>
|
||||
{[0, 1, 2, 3].map((index) => (
|
||||
<TerritoryLevel
|
||||
@@ -453,7 +511,11 @@ export default function OpportunityResources({
|
||||
parent={path[index - 1]?.id ?? ''}
|
||||
selected={path[index]}
|
||||
disabled={readOnly || foreignCountry}
|
||||
endpoint={basePath === '/minhas-oportunidades' ? '/minhas-oportunidades/territory-options' : '/management/territory-options'}
|
||||
endpoint={
|
||||
basePath === '/minhas-oportunidades'
|
||||
? '/minhas-oportunidades/territory-options'
|
||||
: '/management/territory-options'
|
||||
}
|
||||
onChange={(value) =>
|
||||
setPath((previous) =>
|
||||
value
|
||||
@@ -511,7 +573,7 @@ export default function OpportunityResources({
|
||||
<input
|
||||
aria-label={labels[name]}
|
||||
className={control}
|
||||
value={String(payload[name] ?? '')}
|
||||
value={valueText(payload[name] ?? '')}
|
||||
type={
|
||||
name.includes('date') ||
|
||||
name.endsWith('_at') ||
|
||||
@@ -544,7 +606,7 @@ export default function OpportunityResources({
|
||||
<select
|
||||
className={control}
|
||||
aria-label={labels[name] ?? name}
|
||||
value={String(
|
||||
value={valueText(
|
||||
payload[name === 'imageRole' ? 'role' : name] ??
|
||||
'',
|
||||
)}
|
||||
@@ -592,7 +654,7 @@ export default function OpportunityResources({
|
||||
>
|
||||
<select
|
||||
className={control}
|
||||
value={String(payload[name] ?? '')}
|
||||
value={valueText(payload[name] ?? '')}
|
||||
onChange={(event) =>
|
||||
set(name, event.target.value || null)
|
||||
}
|
||||
@@ -606,7 +668,7 @@ export default function OpportunityResources({
|
||||
.filter((r) => !r.deleted_at)
|
||||
.map((r) => (
|
||||
<option value={r.id} key={r.id}>
|
||||
{String(
|
||||
{valueText(
|
||||
r.payload.title ??
|
||||
r.file?.file_name ??
|
||||
r.id,
|
||||
@@ -672,7 +734,10 @@ export default function OpportunityResources({
|
||||
type="button"
|
||||
className={button}
|
||||
disabled={
|
||||
busy || readOnly || unavailable || !imageProcessingAvailable
|
||||
busy ||
|
||||
readOnly ||
|
||||
unavailable ||
|
||||
!imageProcessingAvailable
|
||||
}
|
||||
onClick={() => void execute('prepare')}
|
||||
>
|
||||
@@ -681,7 +746,12 @@ export default function OpportunityResources({
|
||||
)}
|
||||
<button
|
||||
className={button}
|
||||
disabled={busy || readOnly || unavailable || !!editing?.deleted_at}
|
||||
disabled={
|
||||
busy ||
|
||||
readOnly ||
|
||||
unavailable ||
|
||||
!!editing?.deleted_at
|
||||
}
|
||||
>
|
||||
Guardar recurso
|
||||
</button>
|
||||
|
||||
@@ -38,6 +38,9 @@ export const states: Record<string, string> = {
|
||||
returned: 'Devolvida',
|
||||
approved: 'Aprovada internamente',
|
||||
suspended: 'Suspensa',
|
||||
needs_information: 'Correções solicitadas',
|
||||
information_pending: 'Aguarda parecer',
|
||||
rejected: 'Rejeitada',
|
||||
};
|
||||
|
||||
export function Management({
|
||||
@@ -48,7 +51,7 @@ export function Management({
|
||||
children: ReactNode;
|
||||
}) {
|
||||
const { flash, educationEnabled, aiEnabled, auth, basePath } = usePage<{
|
||||
auth?: {canManagePortal?: boolean};
|
||||
auth?: { canManagePortal?: boolean };
|
||||
basePath?: string;
|
||||
flash?: { success?: string };
|
||||
educationEnabled?: boolean;
|
||||
@@ -57,55 +60,61 @@ export function Management({
|
||||
return (
|
||||
<div className="space-y-6 p-4 md:p-8">
|
||||
<Head title={title} />
|
||||
{auth?.canManagePortal && basePath !== '/minhas-oportunidades' ? <nav
|
||||
className="flex flex-wrap gap-4 text-sm underline"
|
||||
aria-label="Gestão do portal"
|
||||
>
|
||||
<Link href="/management/interests">Pedidos de interesse</Link>
|
||||
<Link href="/management/sectors">Sectores</Link>
|
||||
<Link href="/management/opportunities">
|
||||
Gestão de Oportunidades
|
||||
</Link>
|
||||
<Link href="/management/opportunity-origin">
|
||||
Revisão da origem das oportunidades
|
||||
</Link>
|
||||
<Link href="/management/history">Histórico</Link>
|
||||
<Link href="/management/crm/leads">CRM</Link>
|
||||
<Link href="/management/crm/investors">Investidores</Link>
|
||||
<Link href="/management/projects">Projectos</Link>
|
||||
<Link href="/management/clusters">Clusters</Link>
|
||||
<Link href="/management/relationship-repair">
|
||||
Revisão das associações documentadas
|
||||
</Link>
|
||||
<Link href="/management/partnerships-install">
|
||||
Aplicação da Bolsa de Parcerias
|
||||
</Link>
|
||||
<Link href="/management/corridors">Corredores</Link>
|
||||
<Link href="/management/territory-associations">
|
||||
Localizações dos investimentos
|
||||
</Link>
|
||||
<Link href="/management/investment/zones">
|
||||
ZEE, ZFI e parques
|
||||
</Link>
|
||||
{educationEnabled && (
|
||||
<Link href="/management/education">
|
||||
Competências e formação
|
||||
{auth?.canManagePortal && basePath !== '/minhas-oportunidades' ? (
|
||||
<nav
|
||||
className="flex flex-wrap gap-4 text-sm underline"
|
||||
aria-label="Gestão do portal"
|
||||
>
|
||||
<Link href="/management/interests">
|
||||
Pedidos de interesse
|
||||
</Link>
|
||||
)}
|
||||
{aiEnabled && (
|
||||
<Link href="/management/ai">Assistência e fontes</Link>
|
||||
)}
|
||||
<Link href="/management/portfolio">
|
||||
Corredores e matriz de investimento
|
||||
</Link>
|
||||
<Link href="/management/portal-services">
|
||||
Documentos e parcerias
|
||||
</Link>
|
||||
<Link href="/management/investment/references">
|
||||
Referências e formulários
|
||||
</Link>
|
||||
<a href="/">Portal público</a>
|
||||
</nav> : <ProfileNavigation />}
|
||||
<Link href="/management/sectors">Sectores</Link>
|
||||
<Link href="/management/opportunities">
|
||||
Gestão de Oportunidades
|
||||
</Link>
|
||||
<Link href="/management/opportunity-origin">
|
||||
Revisão da origem das oportunidades
|
||||
</Link>
|
||||
<Link href="/management/history">Histórico</Link>
|
||||
<Link href="/management/crm/leads">CRM</Link>
|
||||
<Link href="/management/crm/investors">Investidores</Link>
|
||||
<Link href="/management/projects">Projectos</Link>
|
||||
<Link href="/management/clusters">Clusters</Link>
|
||||
<Link href="/management/relationship-repair">
|
||||
Revisão das associações documentadas
|
||||
</Link>
|
||||
<Link href="/management/partnerships-install">
|
||||
Aplicação da Bolsa de Parcerias
|
||||
</Link>
|
||||
<Link href="/management/corridors">Corredores</Link>
|
||||
<Link href="/management/territory-associations">
|
||||
Localizações dos investimentos
|
||||
</Link>
|
||||
<Link href="/management/investment/zones">
|
||||
ZEE, ZFI e parques
|
||||
</Link>
|
||||
{educationEnabled && (
|
||||
<Link href="/management/education">
|
||||
Competências e formação
|
||||
</Link>
|
||||
)}
|
||||
{aiEnabled && (
|
||||
<Link href="/management/ai">Assistência e fontes</Link>
|
||||
)}
|
||||
<Link href="/management/portfolio">
|
||||
Corredores e matriz de investimento
|
||||
</Link>
|
||||
<Link href="/management/portal-services">
|
||||
Documentos e parcerias
|
||||
</Link>
|
||||
<Link href="/management/investment/references">
|
||||
Referências e formulários
|
||||
</Link>
|
||||
<a href="/">Portal público</a>
|
||||
</nav>
|
||||
) : (
|
||||
<ProfileNavigation />
|
||||
)}
|
||||
<h1 className="text-2xl font-semibold break-words">{title}</h1>
|
||||
{flash?.success && (
|
||||
<p
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { router } from "@inertiajs/react";
|
||||
import { useState } from "react";
|
||||
import { Management, Field, control, button } from "./shared";
|
||||
import { createOperationKey } from '@/lib/operation-key';
|
||||
import { router } from '@inertiajs/react';
|
||||
import { useState } from 'react';
|
||||
import { Management, Field, control, button } from './shared';
|
||||
|
||||
type Plan = {
|
||||
level: number;
|
||||
@@ -17,32 +18,36 @@ type Plan = {
|
||||
parent_name: string | null;
|
||||
location_id: string | null;
|
||||
status: string;
|
||||
correspondence: { target_name: string; target_source_code: string; basis: string } | null;
|
||||
correspondence: {
|
||||
target_name: string;
|
||||
target_source_code: string;
|
||||
basis: string;
|
||||
} | null;
|
||||
}[];
|
||||
};
|
||||
export default function GeometryImport({ plan }: { plan: Plan }) {
|
||||
const [reason, setReason] = useState("");
|
||||
const [reason, setReason] = useState('');
|
||||
const [confirmed, setConfirmed] = useState(false);
|
||||
const [busy, setBusy] = useState(false);
|
||||
const [message, setMessage] = useState("");
|
||||
const [batch, setBatch] = useState("");
|
||||
const [applyKey, setApplyKey] = useState(() => crypto.randomUUID());
|
||||
const [reverseKey, setReverseKey] = useState(() => crypto.randomUUID());
|
||||
const [message, setMessage] = useState('');
|
||||
const [batch, setBatch] = useState('');
|
||||
const [applyKey, setApplyKey] = useState(() => createOperationKey());
|
||||
const [reverseKey, setReverseKey] = useState(() => createOperationKey());
|
||||
const execute = async (reverse: boolean) => {
|
||||
setBusy(true);
|
||||
try {
|
||||
const cookie = document.cookie
|
||||
.split("; ")
|
||||
.find((v) => v.startsWith("XSRF-TOKEN="))
|
||||
.split('; ')
|
||||
.find((v) => v.startsWith('XSRF-TOKEN='))
|
||||
?.slice(11);
|
||||
const response = await fetch(
|
||||
`/management/territory-geometry-import${reverse ? `/${batch}/reverse` : ""}`,
|
||||
`/management/territory-geometry-import${reverse ? `/${batch}/reverse` : ''}`,
|
||||
{
|
||||
method: "POST",
|
||||
method: 'POST',
|
||||
headers: {
|
||||
Accept: "application/json",
|
||||
"Content-Type": "application/json",
|
||||
"X-XSRF-TOKEN": decodeURIComponent(cookie ?? ""),
|
||||
Accept: 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
'X-XSRF-TOKEN': decodeURIComponent(cookie ?? ''),
|
||||
},
|
||||
body: JSON.stringify({
|
||||
level: plan.level,
|
||||
@@ -57,7 +62,7 @@ export default function GeometryImport({ plan }: { plan: Plan }) {
|
||||
if (!response.ok)
|
||||
throw new Error(
|
||||
result.message ??
|
||||
"Operação recusada. Reveja o plano e a autenticação.",
|
||||
'Operação recusada. Reveja o plano e a autenticação.',
|
||||
);
|
||||
if (!reverse) setBatch(result.batch_id);
|
||||
setMessage(
|
||||
@@ -66,7 +71,7 @@ export default function GeometryImport({ plan }: { plan: Plan }) {
|
||||
: `Criadas ${result.inserted}; reutilizadas ${result.reused}; pendentes ${result.pending}. Lote ${result.batch_id}. Nenhuma camada publicada.`,
|
||||
);
|
||||
} catch (e) {
|
||||
setMessage(e instanceof Error ? e.message : "Erro de ligação.");
|
||||
setMessage(e instanceof Error ? e.message : 'Erro de ligação.');
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
@@ -75,21 +80,21 @@ export default function GeometryImport({ plan }: { plan: Plan }) {
|
||||
<Management title="Importação cartográfica">
|
||||
<p>
|
||||
Exemplar INE de 07/06/2019 aceite. Correspondência exata de nome
|
||||
e pai, ou correspondência explícita fundamentada abaixo;
|
||||
sem alterações de classificações territoriais,
|
||||
disponibilidade fundiária ou cálculos.
|
||||
e pai, ou correspondência explícita fundamentada abaixo; sem
|
||||
alterações de classificações territoriais, disponibilidade
|
||||
fundiária ou cálculos.
|
||||
</p>
|
||||
<Field label="Nível">
|
||||
<select
|
||||
className={control}
|
||||
value={plan.level}
|
||||
onChange={(e) => {
|
||||
setBatch("");
|
||||
setMessage("");
|
||||
setBatch('');
|
||||
setMessage('');
|
||||
setConfirmed(false);
|
||||
setApplyKey(crypto.randomUUID());
|
||||
setReverseKey(crypto.randomUUID());
|
||||
router.get("/management/territory-geometry-import", {
|
||||
setApplyKey(createOperationKey());
|
||||
setReverseKey(createOperationKey());
|
||||
router.get('/management/territory-geometry-import', {
|
||||
level: Number(e.target.value),
|
||||
});
|
||||
}}
|
||||
@@ -100,20 +105,26 @@ export default function GeometryImport({ plan }: { plan: Plan }) {
|
||||
</select>
|
||||
</Field>
|
||||
<p>
|
||||
Esperado: {plan.expected}; resolvido: {plan.resolved}; pendente:{" "}
|
||||
{plan.pending}. Scan:{" "}
|
||||
{plan.scan_ready ? "limpo e atual" : "pendente ou inconclusivo"}
|
||||
Esperado: {plan.expected}; resolvido: {plan.resolved}; pendente:{' '}
|
||||
{plan.pending}. Scan:{' '}
|
||||
{plan.scan_ready ? 'limpo e atual' : 'pendente ou inconclusivo'}
|
||||
.
|
||||
</p>
|
||||
<p className="break-all">
|
||||
SHA-256 do original: {plan.source_sha256}
|
||||
</p>
|
||||
<p>Versão das correspondências: {plan.correspondence_version}.</p>
|
||||
<button className={button} disabled={busy} onClick={() => {
|
||||
setApplyKey(crypto.randomUUID());
|
||||
setConfirmed(false);
|
||||
router.reload({ only: ["plan"] });
|
||||
}}>Atualizar pré-visualização</button>
|
||||
<button
|
||||
className={button}
|
||||
disabled={busy}
|
||||
onClick={() => {
|
||||
setApplyKey(createOperationKey());
|
||||
setConfirmed(false);
|
||||
router.reload({ only: ['plan'] });
|
||||
}}
|
||||
>
|
||||
Atualizar pré-visualização
|
||||
</button>
|
||||
<div className="overflow-x-auto">
|
||||
<table>
|
||||
<thead>
|
||||
@@ -131,12 +142,23 @@ export default function GeometryImport({ plan }: { plan: Plan }) {
|
||||
<tr key={r.external_id}>
|
||||
<td>{r.external_id}</td>
|
||||
<td>{r.name}</td>
|
||||
<td>{r.parent_name ?? "—"}</td>
|
||||
<td>{r.location_id ?? "Pendente"}</td>
|
||||
<td>{r.correspondence ? <>
|
||||
{r.correspondence.target_name} (código {r.correspondence.target_source_code})
|
||||
<p>{r.correspondence.basis}</p>
|
||||
</> : "Nome único sob o pai correspondido"}</td>
|
||||
<td>{r.parent_name ?? '—'}</td>
|
||||
<td>{r.location_id ?? 'Pendente'}</td>
|
||||
<td>
|
||||
{r.correspondence ? (
|
||||
<>
|
||||
{r.correspondence.target_name}{' '}
|
||||
(código{' '}
|
||||
{
|
||||
r.correspondence
|
||||
.target_source_code
|
||||
}
|
||||
)<p>{r.correspondence.basis}</p>
|
||||
</>
|
||||
) : (
|
||||
'Nome único sob o pai correspondido'
|
||||
)}
|
||||
</td>
|
||||
<td>{r.status}</td>
|
||||
</tr>
|
||||
))}
|
||||
@@ -157,7 +179,7 @@ export default function GeometryImport({ plan }: { plan: Plan }) {
|
||||
type="checkbox"
|
||||
checked={confirmed}
|
||||
onChange={(e) => setConfirmed(e.target.checked)}
|
||||
/>{" "}
|
||||
/>{' '}
|
||||
Confirmei as correspondências. A aplicação mantém geometrias
|
||||
privadas e publicação separada.
|
||||
</label>
|
||||
@@ -176,7 +198,7 @@ export default function GeometryImport({ plan }: { plan: Plan }) {
|
||||
value={batch}
|
||||
onChange={(e) => {
|
||||
setBatch(e.target.value);
|
||||
setReverseKey(crypto.randomUUID());
|
||||
setReverseKey(createOperationKey());
|
||||
}}
|
||||
/>
|
||||
</Field>
|
||||
|
||||
Reference in New Issue
Block a user