commit5
tests / ci (push) Canceled after 0s

This commit is contained in:
2026-10-30 10:55:18 +02:00
parent 0235c7609e
commit 48347e2d3a
161 changed files with 11814 additions and 265 deletions
+5 -4
View File
@@ -28,7 +28,7 @@ type Review = {
verdict: string;
reason: string;
created_at: string;
snapshot: { name: string; purchasing_role: string };
snapshot: { name: string; purchasing_role: string; profile_label?: string };
};
type Decision = {
id: number;
@@ -373,9 +373,10 @@ export default function Admission({
>
<p>
{r.snapshot.name} ·{' '}
{roleLabels[
r.snapshot.purchasing_role
] ??
{r.snapshot.profile_label ??
roleLabels[
r.snapshot.purchasing_role
] ??
r.snapshot.purchasing_role}{' '}
·{' '}
{r.verdict === 'approved'
+10 -3
View File
@@ -38,7 +38,13 @@ type Assessment = {
answers: Answer[];
reason: string;
created_at: string;
snapshot: { analyst: { name: string; purchasing_role: string } };
snapshot: {
analyst: {
name: string;
purchasing_role: string;
profile_label?: string;
};
};
};
type Props = {
requisition: { id: number; number: string; justification: string };
@@ -465,8 +471,9 @@ function AssessmentDetails({
· {record.snapshot.analyst.name} · Análise v{record.revision}
</summary>
<p className="mt-3 text-xs text-muted-foreground">
{roleLabels[record.snapshot.analyst.purchasing_role]} ·{' '}
{date(record.created_at)}
{record.snapshot.analyst.profile_label ??
roleLabels[record.snapshot.analyst.purchasing_role]}{' '}
· {date(record.created_at)}
</p>
<p className="mt-3 text-sm whitespace-pre-wrap">{record.reason}</p>
<p className="mt-3 text-xs text-muted-foreground">
@@ -36,7 +36,7 @@ type Review = {
verdict: string;
reason: string;
created_at: string;
snapshot: { name: string; purchasing_role: string };
snapshot: { name: string; purchasing_role: string; profile_label?: string };
};
type Attempt = {
id: number;
@@ -456,9 +456,11 @@ export default function Recommendation(props: Props) {
>
<p>
{review.snapshot.name} ·{' '}
{roleLabels[
review.snapshot.purchasing_role
] ??
{review.snapshot.profile_label ??
roleLabels[
review.snapshot
.purchasing_role
] ??
review.snapshot
.purchasing_role}{' '}
·{' '}
+167 -5
View File
@@ -19,7 +19,7 @@ type Answer = {
type Analysis = {
id: number;
revision: number;
analyst: { name: string; purchasing_role: string };
analyst: { name: string; purchasing_role: string; profile_label?: string };
created_at: string;
reason: string;
answers: Answer[];
@@ -93,6 +93,38 @@ type Report = {
currency: string;
total_minor: number;
} | null;
fulfilment: {
receipts: {
id: number;
received_on: string | null;
delivery_note: string;
}[];
finance_visible: boolean;
invoices:
| {
id: number;
number: string;
status: string;
issued_on: string;
total_minor: string;
currency: string | null;
}[]
| null;
payments:
| {
id: number;
invoice_id: number;
status: string;
paid_on: string;
amount_minor: string;
currency: string;
}[]
| null;
};
};
const exactMoney = (minor: string, currency: string | null) => {
const digits = minor.padStart(3, '0');
return `${digits.slice(0, -2)},${digits.slice(-2)} ${currency ?? '(moeda não documentada)'}`;
};
const money = (minor: number, currency: string) =>
`${(minor / 100).toLocaleString('pt-PT', { minimumFractionDigits: 2, maximumFractionDigits: 2 })} ${currency}`;
@@ -139,7 +171,12 @@ export default function ReviewReport({ report }: { report: Report }) {
title="Relatório de conferência"
description={`${report.company} · ${r.department} · Solicitante: ${r.requester}`}
action={
<div className="flex gap-3 print:hidden">
<div className="flex flex-wrap gap-3 print:hidden">
<Button asChild variant="outline">
<Link href="/relatorios">
Relatórios de compras
</Link>
</Button>
<Button asChild variant="outline">
<Link href={`/requisicoes/${r.id}/processo`}>
Ver processo
@@ -415,13 +452,13 @@ export default function ReviewReport({ report }: { report: Report }) {
.name
}{' '}
·{' '}
{
{analysis.analyst
.profile_label ??
roleLabels[
analysis
.analyst
.purchasing_role
]
}{' '}
]}{' '}
· Análise v
{analysis.revision}
</h4>
@@ -611,6 +648,131 @@ export default function ReviewReport({ report }: { report: Report }) {
</p>
</div>
</Panel>
<Panel
title="Recepção, facturas e registos de pagamento"
description="Factos registados em cada etapa. A presença destes documentos não confirma entrega integral, liquidação ou execução bancária."
>
<div className="space-y-4">
<section aria-label="Recepções do processo">
<h3 className="font-medium">Recepções</h3>
{report.fulfilment.receipts.length === 0 ? (
<p>Sem recepções registadas.</p>
) : (
<ul className="mt-2 space-y-2">
{report.fulfilment.receipts.map(
(receipt) => (
<li key={receipt.id}>
Recepção #{receipt.id} ·{' '}
{receipt.received_on
? date(receipt.received_on)
: 'Data por indicar'}{' '}
· Guia: {receipt.delivery_note}.{' '}
<Link
className="underline print:hidden"
href={`/recepcoes/${receipt.id}`}
>
Consultar recepção
</Link>
</li>
),
)}
</ul>
)}
</section>
{!report.fulfilment.finance_visible ? (
<p>
Facturas e pagamentos estão disponíveis aos
perfis autorizados de Finanças e Administração.
</p>
) : (
<>
<section aria-label="Facturas do processo">
<h3 className="font-medium">Facturas</h3>
{!report.fulfilment.invoices?.length ? (
<p>Sem facturas registadas.</p>
) : (
<ul className="mt-2 space-y-2">
{report.fulfilment.invoices.map(
(invoice) => (
<li key={invoice.id}>
Factura {invoice.number}{' '}
·{' '}
{date(
invoice.issued_on,
)}{' '}
·{' '}
{statusLabels[
invoice.status
] ??
invoice.status}{' '}
· Total documental:{' '}
{exactMoney(
invoice.total_minor,
invoice.currency,
)}
.
</li>
),
)}
</ul>
)}
</section>
<section aria-label="Pagamentos externos do processo">
<h3 className="font-medium">
Registos de pagamentos externos
</h3>
{!report.fulfilment.payments?.length ? (
<p>
Sem registos de pagamentos externos.
</p>
) : (
<ul className="mt-2 space-y-2">
{report.fulfilment.payments.map(
(payment) => (
<li key={payment.id}>
Registo #{payment.id} ·
Factura{' '}
{report.fulfilment.invoices?.find(
(invoice) =>
invoice.id ===
payment.invoice_id,
)?.number ??
`#${payment.invoice_id}`}{' '}
·{' '}
{date(payment.paid_on)}{' '}
·{' '}
{{
pending:
'Por conferir',
confirmed:
'Confirmado',
rejected:
'Rejeitado',
}[payment.status] ??
payment.status}{' '}
·{' '}
{exactMoney(
payment.amount_minor,
payment.currency,
)}
.
</li>
),
)}
</ul>
)}
<p className="mt-2 text-sm text-muted-foreground">
Os montantes são os registos
preservados, sem cálculo de saldo neste
relatório. Obrigações e afectações do
núcleo comum têm o seu próprio
histórico.
</p>
</section>
</>
)}
</div>
</Panel>
<footer className="border-t pt-4 text-xs text-muted-foreground">
SGC · Sistema de Gestão de Compras · {r.number} · Consulta
de {generated}, Africa/Johannesburg (UTC+2). Decisão formal