87 lines
3.8 KiB
TypeScript
87 lines
3.8 KiB
TypeScript
import { agreementParties, readAgreement } from '@/lib/partnership-agreement';
|
|
|
|
export default function AgreementInstrument({ value }: { value: unknown }) {
|
|
const instrument = readAgreement(value);
|
|
if (instrument.kind === 'absent')
|
|
return <p>Não ficou registado um instrumento nesta versão.</p>;
|
|
if (instrument.kind === 'malformed')
|
|
return (
|
|
<p role="alert">
|
|
O instrumento guardado não tem uma estrutura reconhecida. O
|
|
registo foi conservado.
|
|
</p>
|
|
);
|
|
return (
|
|
<div className="space-y-3">
|
|
<h3 className="font-bold">
|
|
{instrument.title === null
|
|
? 'Título não registado'
|
|
: instrument.title || 'Título não indicado'}
|
|
</h3>
|
|
<p className="whitespace-pre-wrap">
|
|
{instrument.terms === null
|
|
? 'Condições não registadas'
|
|
: instrument.terms || 'Condições não indicadas'}
|
|
</p>
|
|
{instrument.confirmationsState === 'absent' ? (
|
|
<p>As confirmações não ficaram registadas neste instrumento.</p>
|
|
) : instrument.confirmationsState === 'malformed' ? (
|
|
<p role="alert">
|
|
As confirmações guardadas não têm uma estrutura reconhecida.
|
|
O registo foi conservado.
|
|
</p>
|
|
) : (
|
|
<>
|
|
{!Object.keys(instrument.confirmations).length && (
|
|
<p>Confirmações: Pendentes</p>
|
|
)}
|
|
{agreementParties.map((party) => {
|
|
const stamp = instrument.confirmations[party];
|
|
if (!stamp)
|
|
return (
|
|
<p key={party}>
|
|
{party === 'proponent'
|
|
? 'Proponente'
|
|
: 'Candidata'}
|
|
: sem confirmação registada.
|
|
</p>
|
|
);
|
|
return (
|
|
<div key={party}>
|
|
<p>
|
|
{party === 'proponent'
|
|
? 'Proponente'
|
|
: 'Candidata'}
|
|
:{' '}
|
|
{stamp.actorId === null
|
|
? 'Registo de confirmação incompleto'
|
|
: `autor ${stamp.actorName ?? stamp.actorId}`}{' '}
|
|
· {stamp.date ?? 'Data não registada'}
|
|
</p>
|
|
{stamp.reason !== null && (
|
|
<p className="whitespace-pre-wrap">
|
|
Motivo: {stamp.reason || 'Não indicado'}
|
|
</p>
|
|
)}
|
|
</div>
|
|
);
|
|
})}
|
|
{instrument.extraConfirmations && (
|
|
<p>
|
|
Existem referências adicionais no registo; não
|
|
substituem a confirmação de cada parte.
|
|
</p>
|
|
)}
|
|
</>
|
|
)}
|
|
<p>
|
|
Estado de assinatura guardado:{' '}
|
|
{instrument.legalStatus === 'not_verified'
|
|
? 'não verificada'
|
|
: (instrument.legalStatus ?? 'não registado')}
|
|
. Esta consulta não certifica assinatura jurídica.
|
|
</p>
|
|
</div>
|
|
);
|
|
}
|