+ filter RptPendingAnswerFromAmazon to only show XML download file after all items were checked by user

CatRelacionesPrecuenta
alfonso 8 months ago
parent 00184d2400
commit a138fc80e0
  1. 31
      src/Components/Clientes/Amazon/Reportes/Clasification/WaitingAnswerFromAmazon/RptPendingAnswerFromAmazon.tsx

@ -116,7 +116,7 @@ export default function RptPendingAnswerFromAmazon(
return a return a
} }
}) })
return (code.length) ? code[0].siglas : '' return code.length ? code[0].siglas : ''
} }
const loadExceptionCodeCatalog = () => { 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) //setWaitingDialog(true)
/* loadDistinctExceptionCode(id) /* loadDistinctExceptionCode(id)
generateResume(id) */ generateResume(id) */
@ -156,7 +160,14 @@ export default function RptPendingAnswerFromAmazon(
const url = window.URL.createObjectURL(new Blob([response.data])) const url = window.URL.createObjectURL(new Blob([response.data]))
const link = document.createElement('a') const link = document.createElement('a')
link.href = url link.href = url
link.setAttribute('download', 'Excepciones ' + Factura + '_'+getExceptionCode(ExceptionCode) + '.xlsx') link.setAttribute(
'download',
'Excepciones ' +
Factura +
'_' +
getExceptionCode(ExceptionCode) +
'.xlsx'
)
document.body.appendChild(link) document.body.appendChild(link)
link.click() link.click()
} }
@ -237,9 +248,10 @@ export default function RptPendingAnswerFromAmazon(
.map((element) => { .map((element) => {
let newElt = Object.assign({}, element) // copies element let newElt = Object.assign({}, element) // copies element
return newElt.detail.filter( return newElt.detail.filter(
(child) => child.idHeader === IDMaster && !child.autorizado (child) => child.idHeader === IDMaster && child.autorizado
) )
}) })
return Exceptions.length ? Exceptions[0].length : 0 return Exceptions.length ? Exceptions[0].length : 0
} }
@ -436,8 +448,7 @@ export default function RptPendingAnswerFromAmazon(
setFactura(MasterData.invoiceNumber) setFactura(MasterData.invoiceNumber)
loadInvoiceData(MasterData.id) loadInvoiceData(MasterData.id)
//setWaitingDialog(true) //setWaitingDialog(true)
} }}
}
title="Archivo de excepciones" title="Archivo de excepciones"
> >
<IconContext.Provider <IconContext.Provider
@ -962,7 +973,13 @@ export default function RptPendingAnswerFromAmazon(
? DistinctExceptionCode.map((code) => { ? DistinctExceptionCode.map((code) => {
return ( return (
<Col style={{ textAlign: 'center' }}> <Col style={{ textAlign: 'center' }}>
<Badge bg="primary" style={{cursor:'pointer'}} onClick={()=>{downloadExceptionsFile(IDFactura, Factura, code)}}> <Badge
bg="primary"
style={{ cursor: 'pointer' }}
onClick={() => {
downloadExceptionsFile(IDFactura, Factura, code)
}}
>
<h6>{getExceptionCode(code)}</h6> <h6>{getExceptionCode(code)}</h6>
</Badge> </Badge>
</Col> </Col>

Loading…
Cancel
Save