+ 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. 39
      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 ? (
<div
onClick={() => {
/* 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"
>
<IconContext.Provider
@ -947,7 +958,7 @@ export default function RptPendingAnswerFromAmazon(
<Modal.Title></Modal.Title>
</Modal.Header>
<Modal.Body>
{/* <img
{/* <img
src={loadingImg}
style={{
height: WaitingMessage === 'Generando...' ? '150px' : '0px',
@ -961,8 +972,14 @@ export default function RptPendingAnswerFromAmazon(
{DistinctExceptionCode
? DistinctExceptionCode.map((code) => {
return (
<Col style={{textAlign:'center'}}>
<Badge bg="primary" style={{cursor:'pointer'}} onClick={()=>{downloadExceptionsFile(IDFactura, Factura, code)}}>
<Col style={{ textAlign: 'center' }}>
<Badge
bg="primary"
style={{ cursor: 'pointer' }}
onClick={() => {
downloadExceptionsFile(IDFactura, Factura, code)
}}
>
<h6>{getExceptionCode(code)}</h6>
</Badge>
</Col>

Loading…
Cancel
Save