From a138fc80e0d1d1a41c84d8ef6eae1d7b143c024e Mon Sep 17 00:00:00 2001 From: alfonso Date: Tue, 23 Jan 2024 14:59:51 -0600 Subject: [PATCH] + filter RptPendingAnswerFromAmazon to only show XML download file after all items were checked by user --- .../RptPendingAnswerFromAmazon.tsx | 39 +++++++++++++------ 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/src/Components/Clientes/Amazon/Reportes/Clasification/WaitingAnswerFromAmazon/RptPendingAnswerFromAmazon.tsx b/src/Components/Clientes/Amazon/Reportes/Clasification/WaitingAnswerFromAmazon/RptPendingAnswerFromAmazon.tsx index 6de052d..3f4915c 100644 --- a/src/Components/Clientes/Amazon/Reportes/Clasification/WaitingAnswerFromAmazon/RptPendingAnswerFromAmazon.tsx +++ b/src/Components/Clientes/Amazon/Reportes/Clasification/WaitingAnswerFromAmazon/RptPendingAnswerFromAmazon.tsx @@ -110,13 +110,13 @@ export default function RptPendingAnswerFromAmazon( } const getExceptionCode = (id: number) => { - // console.log(mExceptionCode) + // console.log(mExceptionCode) let code = mExceptionCode.filter((a) => { if (a.id == id) { return a } }) - return (code.length) ? code[0].siglas : '' + return code.length ? code[0].siglas : '' } const loadExceptionCodeCatalog = () => { @@ -145,7 +145,11 @@ export default function RptPendingAnswerFromAmazon( }) } - const downloadExceptionsFile = (id: number, Factura: string, ExceptionCode: number) => { + const downloadExceptionsFile = ( + id: number, + Factura: string, + ExceptionCode: number + ) => { //setWaitingDialog(true) /* loadDistinctExceptionCode(id) generateResume(id) */ @@ -156,7 +160,14 @@ export default function RptPendingAnswerFromAmazon( const url = window.URL.createObjectURL(new Blob([response.data])) const link = document.createElement('a') link.href = url - link.setAttribute('download', 'Excepciones ' + Factura + '_'+getExceptionCode(ExceptionCode) + '.xlsx') + link.setAttribute( + 'download', + 'Excepciones ' + + Factura + + '_' + + getExceptionCode(ExceptionCode) + + '.xlsx' + ) document.body.appendChild(link) link.click() } @@ -237,9 +248,10 @@ export default function RptPendingAnswerFromAmazon( .map((element) => { let newElt = Object.assign({}, element) // copies element return newElt.detail.filter( - (child) => child.idHeader === IDMaster && !child.autorizado + (child) => child.idHeader === IDMaster && child.autorizado ) }) + return Exceptions.length ? Exceptions[0].length : 0 } @@ -428,7 +440,7 @@ export default function RptPendingAnswerFromAmazon( {existsExeptions(MasterData.id) > 0 ? (
{ - /* downloadExceptionsFile( + /* downloadExceptionsFile( MasterData.id, MasterData.invoiceNumber ) */ @@ -436,8 +448,7 @@ export default function RptPendingAnswerFromAmazon( setFactura(MasterData.invoiceNumber) loadInvoiceData(MasterData.id) //setWaitingDialog(true) - } - } + }} title="Archivo de excepciones" > - {/* { return ( - - {downloadExceptionsFile(IDFactura, Factura, code)}}> + + { + downloadExceptionsFile(IDFactura, Factura, code) + }} + >
{getExceptionCode(code)}