From dfe741a194be693770ab5eebe9f24be6432d0b63 Mon Sep 17 00:00:00 2001 From: alfonso Date: Tue, 1 Aug 2023 10:58:56 -0500 Subject: [PATCH] Fixed strange behaviour on opening and closing the Invoice detail on the clasification report from --- .../RptAmazonPendingClasificationInvoices.tsx | 83 +++++++++++-------- 1 file changed, 47 insertions(+), 36 deletions(-) diff --git a/src/Components/Clientes/Amazon/Reportes/Clasification/Pending/RptAmazonPendingClasificationInvoices.tsx b/src/Components/Clientes/Amazon/Reportes/Clasification/Pending/RptAmazonPendingClasificationInvoices.tsx index 522b519..8b44c02 100644 --- a/src/Components/Clientes/Amazon/Reportes/Clasification/Pending/RptAmazonPendingClasificationInvoices.tsx +++ b/src/Components/Clientes/Amazon/Reportes/Clasification/Pending/RptAmazonPendingClasificationInvoices.tsx @@ -114,8 +114,7 @@ export default function RtpAmazonPendingInvoices( } const toggleExpandRow = (row: I2096Headers) => { - //if (!row.max) - check4Updates(row.id) + if (!row.max) check4Updates(row.id) let Invoice: I2096Headers[] = mInvoices.filter((item) => item.id === row.id) const Obj = { ...Invoice[0] } Obj.max = !Obj.max @@ -309,31 +308,33 @@ export default function RtpAmazonPendingInvoices( } const RunBOT = (row: I2096Headers) => { - if (!BOTEnabled) { - toggleExpandRow(row) - return false + if (!BOTEnabled || row.max) { + toggleExpandRow(row) + return false } - setWaitingMessage('BOT trabajando...') - setWaitingDialog(true) - DSAmazon.ClasificacionBOT(row.id) - .then((response) => { - if (response.data) { - setIDFactura(0) - setFactura('') - setShowModalInvoiceFile(false) + if (BOTEnabled && !row.max) { + setWaitingMessage('BOT trabajando...') + setWaitingDialog(true) + DSAmazon.ClasificacionBOT(row.id) + .then((response) => { + if (response.data) { + setIDFactura(0) + setFactura('') + setShowModalInvoiceFile(false) + setWaitingDialog(false) + //loadReport() + toggleExpandRow(row) + return + } + }) + .catch((e: Error) => { + setHeader('Error') + setMsg('Ocurrio un error') + setShowModalDeleteInvoice(false) setWaitingDialog(false) - //loadReport() - toggleExpandRow(row) return - } - }) - .catch((e: Error) => { - setHeader('Error') - setMsg('Ocurrio un error') - setShowModalDeleteInvoice(false) - setWaitingDialog(false) - return - }) + }) + } } return ( @@ -350,18 +351,28 @@ export default function RtpAmazonPendingInvoices( - -
- { - setBOTEnabled(!BOTEnabled) - }} - /> - + + + + + + + + + { + setBOTEnabled(!BOTEnabled) + }} + /> + + +