feat(expedicao): adicionar badge de maior comprimento nas pecas do romaneio
This commit is contained in:
@@ -560,6 +560,10 @@ export const ItensRomaneioModal: React.FC<ItensRomaneioModalProps> = ({
|
|||||||
|
|
||||||
const qtdTotalPecas = itensPeca.reduce((total, item) => total + item.quantidade, 0);
|
const qtdTotalPecas = itensPeca.reduce((total, item) => total + item.quantidade, 0);
|
||||||
const pesoTotalPecas = itensPeca.reduce((total, item) => total + item.peso_total, 0);
|
const pesoTotalPecas = itensPeca.reduce((total, item) => total + item.peso_total, 0);
|
||||||
|
const maiorComprimentoPecas = itensPeca.reduce(
|
||||||
|
(max, item) => Math.max(max, Number(item.comprimento) || 0),
|
||||||
|
0
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -820,6 +824,9 @@ export const ItensRomaneioModal: React.FC<ItensRomaneioModalProps> = ({
|
|||||||
<Badge variant="outline" className={isMobile ? 'text-xs px-2 py-1' : ''}>
|
<Badge variant="outline" className={isMobile ? 'text-xs px-2 py-1' : ''}>
|
||||||
Peso Total: {pesoTotalPecas.toFixed(2)} kg
|
Peso Total: {pesoTotalPecas.toFixed(2)} kg
|
||||||
</Badge>
|
</Badge>
|
||||||
|
<Badge variant="outline" className={isMobile ? 'text-xs px-2 py-1' : ''}>
|
||||||
|
Maior Comprimento: {maiorComprimentoPecas > 0 ? `${maiorComprimentoPecas} mm` : '-'}
|
||||||
|
</Badge>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -165,6 +165,10 @@ export const PecasRomaneioExpandido: React.FC<PecasRomaneioExpandidoProps> = ({
|
|||||||
|
|
||||||
const qtdTotal = itensPeca.reduce((total, item) => total + item.quantidade_expedida, 0);
|
const qtdTotal = itensPeca.reduce((total, item) => total + item.quantidade_expedida, 0);
|
||||||
const pesoTotal = itensPeca.reduce((total, item) => total + item.peso_total, 0);
|
const pesoTotal = itensPeca.reduce((total, item) => total + item.peso_total, 0);
|
||||||
|
const maiorComprimento = itensPeca.reduce(
|
||||||
|
(max, item) => Math.max(max, Number(item.comprimento) || 0),
|
||||||
|
0
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog open={isOpen} onOpenChange={onClose}>
|
<Dialog open={isOpen} onOpenChange={onClose}>
|
||||||
@@ -204,6 +208,14 @@ export const PecasRomaneioExpandido: React.FC<PecasRomaneioExpandidoProps> = ({
|
|||||||
>
|
>
|
||||||
Peso Total: {pesoTotal.toFixed(2)} kg
|
Peso Total: {pesoTotal.toFixed(2)} kg
|
||||||
</Badge>
|
</Badge>
|
||||||
|
<Badge
|
||||||
|
variant="outline"
|
||||||
|
className={`border-amber-500/40 bg-amber-500/10 text-amber-700 dark:text-amber-400 dark:border-amber-500/50 font-semibold ${
|
||||||
|
isMobile ? 'text-xs px-2.5 py-1' : 'px-3 py-1'
|
||||||
|
}`}
|
||||||
|
>
|
||||||
|
Maior Comprimento: {maiorComprimento > 0 ? `${maiorComprimento} mm` : '-'}
|
||||||
|
</Badge>
|
||||||
</div>
|
</div>
|
||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user