+ 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) => { const getExceptionCode = (id: number) => {
// console.log(mExceptionCode) // console.log(mExceptionCode)
let code = mExceptionCode.filter((a) => { let code = mExceptionCode.filter((a) => {
if (a.id == id) { if (a.id == id) {
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
} }
@ -428,7 +440,7 @@ export default function RptPendingAnswerFromAmazon(
{existsExeptions(MasterData.id) > 0 ? ( {existsExeptions(MasterData.id) > 0 ? (
<div <div
onClick={() => { onClick={() => {
/* downloadExceptionsFile( /* downloadExceptionsFile(
MasterData.id, MasterData.id,
MasterData.invoiceNumber MasterData.invoiceNumber
) */ ) */
@ -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
@ -947,7 +958,7 @@ export default function RptPendingAnswerFromAmazon(
<Modal.Title></Modal.Title> <Modal.Title></Modal.Title>
</Modal.Header> </Modal.Header>
<Modal.Body> <Modal.Body>
{/* <img {/* <img
src={loadingImg} src={loadingImg}
style={{ style={{
height: WaitingMessage === 'Generando...' ? '150px' : '0px', height: WaitingMessage === 'Generando...' ? '150px' : '0px',
@ -961,8 +972,14 @@ export default function RptPendingAnswerFromAmazon(
{DistinctExceptionCode {DistinctExceptionCode
? 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