40 lines
1.2 KiB
TypeScript
40 lines
1.2 KiB
TypeScript
import { money } from '@/types/procurement';
|
|
|
|
export type CommercialTerms = {
|
|
lines: {
|
|
requisition_item_id: number;
|
|
gross_unit_minor: number;
|
|
discount_type: string;
|
|
discount_value: string;
|
|
net_unit_minor: number;
|
|
}[];
|
|
};
|
|
|
|
export function QuotationCommercialTerms({
|
|
terms,
|
|
}: {
|
|
terms?: CommercialTerms | null;
|
|
}) {
|
|
if (!terms) return null;
|
|
return (
|
|
<div className="my-3 space-y-2 text-sm">
|
|
<p>
|
|
Desconto por unidade, antes do IVA. Preço líquido arredondado ao
|
|
centavo.
|
|
</p>
|
|
{terms.lines.map((line) => (
|
|
<p key={line.requisition_item_id}>
|
|
Linha #{line.requisition_item_id}: preço inicial{' '}
|
|
{money(line.gross_unit_minor)} · desconto{' '}
|
|
{line.discount_type === 'none'
|
|
? 'sem desconto'
|
|
: line.discount_type === 'percent'
|
|
? `${line.discount_value}%`
|
|
: `${line.discount_value} MZN/unidade`}{' '}
|
|
· preço líquido {money(line.net_unit_minor)}
|
|
</p>
|
|
))}
|
|
</div>
|
|
);
|
|
}
|