From d7e920a7297679a6380da303579c474105be02d2 Mon Sep 17 00:00:00 2001 From: Marcos Reifonas Date: Wed, 23 Sep 2026 21:41:42 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=80=20Auto-deploy:=20TrackSteelAPP=20a?= =?UTF-8?q?tualizado=20em=2023/09/2026=2021:41:42?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SmartConsultaRelatoriosFlow.tsx | 58 +++++++++++++------ 1 file changed, 39 insertions(+), 19 deletions(-) diff --git a/src/pages/smart/components/SmartConsultaRelatoriosFlow.tsx b/src/pages/smart/components/SmartConsultaRelatoriosFlow.tsx index 619cd1f..29a392e 100644 --- a/src/pages/smart/components/SmartConsultaRelatoriosFlow.tsx +++ b/src/pages/smart/components/SmartConsultaRelatoriosFlow.tsx @@ -96,15 +96,17 @@ export const SmartConsultaRelatoriosFlow: React.FC(); (resExpedidos.data || []).forEach((item: any) => { - const marca = item.marca; - mapaExp.set(marca, (mapaExp.get(marca) || 0) + Number(item.quantidade_expedida || 0)); + const id = item.peca_id; + if (id) { + mapaExp.set(id, (mapaExp.get(id) || 0) + Number(item.quantidade_expedida || 0)); + } }); // Mapear montagem por marca @@ -195,16 +199,18 @@ export const SmartConsultaRelatoriosFlow: React.FC - a.marca.localeCompare(b.marca, undefined, { numeric: true, sensitivity: 'base' }) - ); + // ORDENAÇÃO NATURAL: Primeiro por Fase, depois por Marca + lista.sort((a, b) => { + const cmpFase = (a.etapa_fase || '1').localeCompare(b.etapa_fase || '1', undefined, { numeric: true, sensitivity: 'base' }); + if (cmpFase !== 0) return cmpFase; + return a.marca.localeCompare(b.marca, undefined, { numeric: true, sensitivity: 'base' }); + }); setPecasStatus(lista); } catch (e) { @@ -1194,13 +1200,26 @@ export const SmartConsultaRelatoriosFlow: React.FC ) : ( - pecasFiltradas.map((peca) => ( -
- {/* Linha Superior: Marca, Perfil, Fase e Quantidade */} -
+ pecasFiltradas.map((peca, index) => { + // Lógica do Divisor de Fase + const mostrarDivisor = index === 0 || pecasFiltradas[index - 1].etapa_fase !== peca.etapa_fase; + + return ( + + {mostrarDivisor && ( +
+
+ + FASE {peca.etapa_fase || '1'} + +
+
+ )} +
+ {/* Linha Superior: Marca, Perfil, Fase e Quantidade */} +
@@ -1287,7 +1306,8 @@ export const SmartConsultaRelatoriosFlow: React.FC
- )) + + )}) )}