fix: correct V13 and public presentation patterns in isolated QA
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import PublicReference from './public-reference';
|
||||
import { publicReference, uniquePresentation } from '@/lib/public-presentation';
|
||||
import { Link } from '@inertiajs/react';
|
||||
import DemographicContext from './demographic-context';
|
||||
import TerritorialSources, {
|
||||
@@ -98,38 +100,97 @@ export function LocationList({
|
||||
</dl>
|
||||
<DemographicContext
|
||||
key={location.id}
|
||||
territoryId={location.path
|
||||
.filter((t) => ['province', 'district'].includes(t.location_type))
|
||||
.at(-1)?.id}
|
||||
territoryId={
|
||||
location.path
|
||||
.filter((t) =>
|
||||
['province', 'district'].includes(
|
||||
t.location_type,
|
||||
),
|
||||
)
|
||||
.at(-1)?.id
|
||||
}
|
||||
/>
|
||||
{location.coordinates.map((point) => (
|
||||
<p key={point.geometry_id}>
|
||||
{uniquePresentation(location.coordinates, (p) =>
|
||||
JSON.stringify([
|
||||
p.geometry_id,
|
||||
p.source_reference,
|
||||
p.source_date,
|
||||
]),
|
||||
).map((point) => (
|
||||
<p
|
||||
key={JSON.stringify([
|
||||
point.geometry_id,
|
||||
point.source_reference,
|
||||
point.source_date,
|
||||
])}
|
||||
>
|
||||
Coordenadas documentadas (
|
||||
{location.location_type === 'site'
|
||||
? 'local cadastrado; não confirma a implantação da oportunidade'
|
||||
: 'referência territorial; não representa a implantação'}
|
||||
): {point.geometry.coordinates[1]},{' '}
|
||||
{point.geometry.coordinates[0]} · Fonte:{' '}
|
||||
{point.source_reference ?? 'Não indicada'}
|
||||
{' · Data da fonte: '}
|
||||
{point.source_date ?? 'Não documentada'}
|
||||
{point.geometry.coordinates[0]}
|
||||
{publicReference(point.source_reference) && (
|
||||
<>
|
||||
{' '}
|
||||
· Fonte:{' '}
|
||||
<PublicReference
|
||||
value={point.source_reference}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
{point.source_date && (
|
||||
<> · Data: {point.source_date}</>
|
||||
)}
|
||||
</p>
|
||||
))}
|
||||
{!location.coordinates.length && (
|
||||
<p>Coordenadas não documentadas.</p>
|
||||
)}
|
||||
<p className="text-sm">
|
||||
Fonte da relação:{' '}
|
||||
{location.source_reference ?? 'Não indicada'}
|
||||
{' · Data da fonte: '}
|
||||
{location.source_date ?? 'Não documentada'}
|
||||
</p>
|
||||
{location.boundaries?.map((boundary) => (
|
||||
<p key={boundary.geometry_id}>
|
||||
Polígono cadastrado · Fonte:{' '}
|
||||
{boundary.source_reference ?? 'Não indicada'} ·
|
||||
Data: {boundary.source_date ?? 'Não documentada'}. O
|
||||
cadastro não certifica limites oficiais.
|
||||
{(publicReference(location.source_reference) ||
|
||||
location.source_date) && (
|
||||
<p className="text-sm">
|
||||
{publicReference(location.source_reference) && (
|
||||
<>
|
||||
Fonte da relação:{' '}
|
||||
<PublicReference
|
||||
value={location.source_reference}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
{location.source_date && (
|
||||
<> · Data: {location.source_date}</>
|
||||
)}
|
||||
</p>
|
||||
)}
|
||||
{uniquePresentation(location.boundaries ?? [], (b) =>
|
||||
JSON.stringify([
|
||||
b.geometry_id,
|
||||
b.source_reference,
|
||||
b.source_date,
|
||||
]),
|
||||
).map((boundary) => (
|
||||
<p
|
||||
key={JSON.stringify([
|
||||
boundary.geometry_id,
|
||||
boundary.source_reference,
|
||||
boundary.source_date,
|
||||
])}
|
||||
>
|
||||
Polígono cadastrado
|
||||
{publicReference(boundary.source_reference) && (
|
||||
<>
|
||||
{' '}
|
||||
· Fonte:{' '}
|
||||
<PublicReference
|
||||
value={boundary.source_reference}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
{boundary.source_date && (
|
||||
<> · Data: {boundary.source_date}</>
|
||||
)}
|
||||
. O cadastro não certifica limites oficiais.
|
||||
</p>
|
||||
))}
|
||||
{!location.boundaries?.length && (
|
||||
@@ -251,7 +312,7 @@ export default function StructureGeographyPanel({
|
||||
className="underline"
|
||||
href={`/carteira/${member.dossier_id}?from=${dossierId}`}
|
||||
>
|
||||
{member.code} · {member.title}
|
||||
{member.title}
|
||||
</Link>
|
||||
</h3>
|
||||
<p>
|
||||
@@ -259,7 +320,15 @@ export default function StructureGeographyPanel({
|
||||
{member.validation_status === 'validated'
|
||||
? 'validada no cadastro'
|
||||
: 'documental de planeamento; validação pendente'}{' '}
|
||||
· Fonte: {member.source_reference}
|
||||
{publicReference(member.source_reference) && (
|
||||
<>
|
||||
{' '}
|
||||
· Fonte:{' '}
|
||||
<PublicReference
|
||||
value={member.source_reference}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</p>
|
||||
<LocationList locations={member.locations} />
|
||||
{!member.locations.length && (
|
||||
@@ -282,7 +351,13 @@ export default function StructureGeographyPanel({
|
||||
{item.validation_status === 'validated'
|
||||
? 'validada no cadastro'
|
||||
: 'relação documental de planeamento; validação pendente'}{' '}
|
||||
· Fonte: {item.source_reference}
|
||||
{publicReference(item.source_reference) && (
|
||||
<>
|
||||
{' '}
|
||||
· Fonte:{' '}
|
||||
<PublicReference value={item.source_reference} />
|
||||
</>
|
||||
)}
|
||||
</p>
|
||||
))}
|
||||
{cluster && (
|
||||
@@ -292,7 +367,7 @@ export default function StructureGeographyPanel({
|
||||
</h3>
|
||||
{geography.chains?.map((chain) => (
|
||||
<p key={chain.id}>
|
||||
{chain.code} · {chain.name} ·{' '}
|
||||
{chain.name} ·{' '}
|
||||
{(
|
||||
{
|
||||
input: 'Insumos',
|
||||
|
||||
Reference in New Issue
Block a user