65 lines
2.4 KiB
TypeScript
65 lines
2.4 KiB
TypeScript
import { Panel } from '@/components/procurement';
|
|
|
|
export type FrozenOperationalOrder = {
|
|
id: number;
|
|
snapshot: {
|
|
item: { description: string };
|
|
source: {
|
|
data: {
|
|
type: string;
|
|
reference: string;
|
|
utilisation_location: string;
|
|
description: string;
|
|
};
|
|
snapshot: {
|
|
author: { name: string };
|
|
department: { name: string };
|
|
policy: { data: { mode: string } };
|
|
};
|
|
};
|
|
};
|
|
};
|
|
export default function OperationalOrderSummary({
|
|
records,
|
|
}: {
|
|
records?: Record<number, FrozenOperationalOrder>;
|
|
}) {
|
|
const rows = Object.values(records ?? {});
|
|
if (rows.length === 0) return null;
|
|
return (
|
|
<Panel
|
|
title="Ordens de origem"
|
|
description="Produção e manutenção: documentos preservados na emissão desta ordem de compra."
|
|
>
|
|
<ul className="space-y-4">
|
|
{rows.map((record) => {
|
|
const source = record.snapshot.source;
|
|
return (
|
|
<li key={record.id}>
|
|
<p className="font-semibold">
|
|
{record.snapshot.item.description} ·{' '}
|
|
{source.data.reference} ·{' '}
|
|
{source.data.type === 'production'
|
|
? 'Produção'
|
|
: 'Manutenção'}
|
|
</p>
|
|
<p className="text-sm">
|
|
{source.snapshot.department.name} ·{' '}
|
|
{source.data.utilisation_location} ·{' '}
|
|
{source.snapshot.author.name} ·{' '}
|
|
{source.snapshot.policy.data.mode ===
|
|
'utilisation'
|
|
? 'Origem no local de utilização'
|
|
: 'Registada pelo procurement'}
|
|
</p>
|
|
<p className="mt-2 text-sm whitespace-pre-wrap">
|
|
{source.data.description}
|
|
</p>
|
|
</li>
|
|
);
|
|
})}
|
|
</ul>
|
|
</Panel>
|
|
);
|
|
}
|