@@ -1,5 +1,5 @@
|
||||
import { Link, useForm } from "@inertiajs/react";
|
||||
import { Management } from "./shared";
|
||||
import { Link, useForm } from '@inertiajs/react';
|
||||
import { Management } from './shared';
|
||||
|
||||
type Plan = {
|
||||
target: { database: string; port: number };
|
||||
@@ -35,7 +35,7 @@ type Plan = {
|
||||
type Territory = {
|
||||
row_id: string;
|
||||
validation_hash: string;
|
||||
status: "grounded" | "pending" | "contradictory";
|
||||
status: 'grounded' | 'pending' | 'contradictory';
|
||||
applied: boolean;
|
||||
issues: string[];
|
||||
warnings: string[];
|
||||
@@ -71,23 +71,23 @@ type History = {
|
||||
};
|
||||
};
|
||||
const roles: Record<string, string> = {
|
||||
primary: "Principal",
|
||||
secondary: "Secundária",
|
||||
impact: "Área de impacto",
|
||||
primary: 'Principal',
|
||||
secondary: 'Secundária',
|
||||
impact: 'Área de impacto',
|
||||
};
|
||||
const levels: Record<string, string> = {
|
||||
country: "País",
|
||||
province: "Província",
|
||||
district: "Distrito",
|
||||
admin_post: "Posto administrativo",
|
||||
locality: "Localidade",
|
||||
site: "Implantação",
|
||||
country: 'País',
|
||||
province: 'Província',
|
||||
district: 'Distrito',
|
||||
admin_post: 'Posto administrativo',
|
||||
locality: 'Localidade',
|
||||
site: 'Implantação',
|
||||
};
|
||||
function pathText(path: { name: string; type: string }[]) {
|
||||
return (
|
||||
path
|
||||
.map((node) => `${levels[node.type] ?? node.type}: ${node.name}`)
|
||||
.join(" → ") || "Hierarquia não indicada"
|
||||
.join(' → ') || 'Hierarquia não indicada'
|
||||
);
|
||||
}
|
||||
function IndividualAssociation({
|
||||
@@ -111,7 +111,7 @@ function IndividualAssociation({
|
||||
row_id: item.row_id,
|
||||
validation_hash: item.validation_hash,
|
||||
}));
|
||||
form.post("/management/relationship-repair", {
|
||||
form.post('/management/relationship-repair', {
|
||||
preserveScroll: true,
|
||||
});
|
||||
}}
|
||||
@@ -121,12 +121,12 @@ function IndividualAssociation({
|
||||
disabled={
|
||||
form.processing ||
|
||||
item.applied ||
|
||||
item.status !== "grounded"
|
||||
item.status !== 'grounded'
|
||||
}
|
||||
>
|
||||
{item.applied
|
||||
? "Associação aplicada"
|
||||
: "Aplicar esta associação"}
|
||||
? 'Associação aplicada'
|
||||
: 'Aplicar esta associação'}
|
||||
</button>
|
||||
{Object.values(form.errors).map((error) => (
|
||||
<p key={error} role="alert">
|
||||
@@ -172,7 +172,7 @@ export default function RelationshipRepair({
|
||||
<form
|
||||
onSubmit={(event) => {
|
||||
event.preventDefault();
|
||||
form.post("/management/relationship-repair");
|
||||
form.post('/management/relationship-repair');
|
||||
}}
|
||||
>
|
||||
<button
|
||||
@@ -198,34 +198,34 @@ export default function RelationshipRepair({
|
||||
localização não é deduzida de clusters ou da proximidade a
|
||||
zonas.
|
||||
</p>
|
||||
{(["grounded", "pending", "contradictory"] as const).map(
|
||||
{(['grounded', 'pending', 'contradictory'] as const).map(
|
||||
(status) => (
|
||||
<section
|
||||
key={status}
|
||||
className="space-y-4"
|
||||
aria-label={
|
||||
status === "grounded"
|
||||
? "Associações fundamentadas"
|
||||
: status === "pending"
|
||||
? "Associações pendentes"
|
||||
: "Associações contraditórias"
|
||||
status === 'grounded'
|
||||
? 'Associações fundamentadas'
|
||||
: status === 'pending'
|
||||
? 'Associações pendentes'
|
||||
: 'Associações contraditórias'
|
||||
}
|
||||
>
|
||||
<h3 className="text-lg font-bold">
|
||||
{status === "grounded"
|
||||
? "Fundamentadas"
|
||||
: status === "pending"
|
||||
? "Pendentes"
|
||||
: "Contraditórias"}
|
||||
:{" "}
|
||||
{status === 'grounded'
|
||||
? 'Fundamentadas'
|
||||
: status === 'pending'
|
||||
? 'Pendentes'
|
||||
: 'Contraditórias'}
|
||||
:{' '}
|
||||
{territorial.filter(
|
||||
(item) => item.status === status,
|
||||
).length +
|
||||
(status === "pending"
|
||||
(status === 'pending'
|
||||
? unproposed.length
|
||||
: 0)}
|
||||
</h3>
|
||||
{status === "pending" &&
|
||||
{status === 'pending' &&
|
||||
unproposed.map((item) => (
|
||||
<article
|
||||
key={item.code}
|
||||
@@ -236,23 +236,23 @@ export default function RelationshipRepair({
|
||||
territorial individualizada
|
||||
</h4>
|
||||
<p>
|
||||
Localização atual:{" "}
|
||||
Localização atual:{' '}
|
||||
{item.current
|
||||
.map(
|
||||
(location) =>
|
||||
`${location.name} · ${roles[location.role]}`,
|
||||
)
|
||||
.join("; ") ||
|
||||
"Sem localização cadastrada"}
|
||||
.join('; ') ||
|
||||
'Sem localização cadastrada'}
|
||||
</p>
|
||||
<p>
|
||||
Localização documental proposta:{" "}
|
||||
Localização documental proposta:{' '}
|
||||
{item.location_text ??
|
||||
"Não indicada"}
|
||||
'Não indicada'}
|
||||
</p>
|
||||
<p>
|
||||
Documento de origem:{" "}
|
||||
{item.source ?? "Não indicado"}
|
||||
Documento de origem:{' '}
|
||||
{item.source ?? 'Não indicado'}
|
||||
</p>
|
||||
{item.reasons.map((reason) => (
|
||||
<p key={reason}>{reason}</p>
|
||||
@@ -267,8 +267,8 @@ export default function RelationshipRepair({
|
||||
className="space-y-3 rounded border p-4"
|
||||
>
|
||||
<h4 className="font-bold">
|
||||
{plan.locations[index].code} →{" "}
|
||||
{validation.proposed.name} ·{" "}
|
||||
{plan.locations[index].code} →{' '}
|
||||
{validation.proposed.name} ·{' '}
|
||||
{roles[validation.proposed.role] ??
|
||||
validation.proposed.role}
|
||||
</h4>
|
||||
@@ -279,12 +279,12 @@ export default function RelationshipRepair({
|
||||
{validation.current.map(
|
||||
(current, i) => (
|
||||
<li key={i}>
|
||||
{current.name} ·{" "}
|
||||
{current.name} ·{' '}
|
||||
{roles[
|
||||
current.role
|
||||
] ??
|
||||
current.role}{" "}
|
||||
—{" "}
|
||||
current.role}{' '}
|
||||
—{' '}
|
||||
{pathText(
|
||||
current.path,
|
||||
)}
|
||||
@@ -301,12 +301,12 @@ export default function RelationshipRepair({
|
||||
<p>
|
||||
<strong>
|
||||
Localização proposta:
|
||||
</strong>{" "}
|
||||
{pathText(validation.proposed.path)}{" "}
|
||||
</strong>{' '}
|
||||
{pathText(validation.proposed.path)}{' '}
|
||||
· {roles[validation.proposed.role]}
|
||||
</p>
|
||||
<p>
|
||||
Documento de origem:{" "}
|
||||
Documento de origem:{' '}
|
||||
{
|
||||
plan.locations[index]
|
||||
.source_reference
|
||||
@@ -316,18 +316,18 @@ export default function RelationshipRepair({
|
||||
{plan.locations[index].source_quote}
|
||||
</blockquote>
|
||||
<p>
|
||||
Motivo:{" "}
|
||||
Motivo:{' '}
|
||||
{plan.locations[index].reason}
|
||||
</p>
|
||||
{validation.coordinates.map(
|
||||
(point, i) => (
|
||||
<p key={i}>
|
||||
Coordenadas (longitude,
|
||||
latitude):{" "}
|
||||
latitude):{' '}
|
||||
{point.coordinates.join(
|
||||
", ",
|
||||
)}{" "}
|
||||
· SRID {point.srid} · Fonte:{" "}
|
||||
', ',
|
||||
)}{' '}
|
||||
· SRID {point.srid} · Fonte:{' '}
|
||||
{point.source}
|
||||
</p>
|
||||
),
|
||||
@@ -336,9 +336,9 @@ export default function RelationshipRepair({
|
||||
(check, i) => (
|
||||
<p key={i}>
|
||||
{check.compatible
|
||||
? "Coordenadas compatíveis com o limite territorial"
|
||||
: "Coordenadas incompatíveis com o limite territorial"}{" "}
|
||||
· Fonte cartográfica:{" "}
|
||||
? 'Coordenadas compatíveis com o limite territorial'
|
||||
: 'Coordenadas incompatíveis com o limite territorial'}{' '}
|
||||
· Fonte cartográfica:{' '}
|
||||
{check.source}
|
||||
</p>
|
||||
),
|
||||
@@ -371,12 +371,12 @@ export default function RelationshipRepair({
|
||||
history.map((event) => (
|
||||
<article key={event.id} className="rounded border p-4">
|
||||
<p>
|
||||
Autor: {event.actor ?? "Utilizador"} (ID{" "}
|
||||
Autor: {event.actor ?? 'Utilizador'} (ID{' '}
|
||||
{event.actor_id}) · Data: {event.date}
|
||||
</p>
|
||||
{event.data.sources?.map((source) => (
|
||||
<p key={source.row_id}>
|
||||
Fonte: {source.source_reference} · Motivo:{" "}
|
||||
Fonte: {source.source_reference} · Motivo:{' '}
|
||||
{source.reason}
|
||||
</p>
|
||||
))}
|
||||
@@ -396,9 +396,9 @@ export default function RelationshipRepair({
|
||||
{item.cluster_code} ↔ {item.project_code}
|
||||
</h3>
|
||||
<p>
|
||||
{item.action === "present_existing"
|
||||
? "Relação existente, agora apresentada como proposta documental pendente"
|
||||
: "Relação ausente"}
|
||||
{item.action === 'present_existing'
|
||||
? 'Relação existente, agora apresentada como proposta documental pendente'
|
||||
: 'Relação ausente'}
|
||||
</p>
|
||||
<p>Fonte: {item.source_reference}</p>
|
||||
<blockquote>{item.source_quote}</blockquote>
|
||||
@@ -407,7 +407,7 @@ export default function RelationshipRepair({
|
||||
</section>
|
||||
<section className="space-y-4">
|
||||
<h2 className="text-xl font-bold">
|
||||
Registos de oportunidades preparados:{" "}
|
||||
Registos de oportunidades preparados:{' '}
|
||||
{plan.prepared_opportunities.length}
|
||||
</h2>
|
||||
{plan.prepared_opportunities.map((item, index) => (
|
||||
@@ -416,14 +416,14 @@ export default function RelationshipRepair({
|
||||
{item.reference} · {item.title}
|
||||
</summary>
|
||||
<p>
|
||||
Projecto:{" "}
|
||||
Projecto:{' '}
|
||||
{item.project_code ??
|
||||
"Identidade em conflito; associação pendente"}
|
||||
'Identidade em conflito; associação pendente'}
|
||||
</p>
|
||||
<p>{item.location_text}</p>
|
||||
<p>Fonte: {item.source_reference}</p>
|
||||
<p>{item.reason}</p>
|
||||
<p>Dados por completar: {item.unknown.join(", ")}.</p>
|
||||
<p>Dados por completar: {item.unknown.join(', ')}.</p>
|
||||
</details>
|
||||
))}
|
||||
</section>
|
||||
|
||||
Reference in New Issue
Block a user