Fixed strange behaviour on opening and closing the Invoice detail on the clasification report from

featureBotClasifcacion
alfonso 1 year ago
parent 18b1428632
commit dfe741a194
  1. 83
      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(
</Card.Title>
</Col>
<Col xs={3}></Col>
<Col xs={2} style={{ paddingTop: '20px' }}>
<Form>
<Form.Check // prettier-ignore
type="switch"
id="custom-switch"
label="¿Aplica BOT?"
checked={BOTEnabled}
onChange={() => {
setBOTEnabled(!BOTEnabled)
}}
/>
</Form>
<Col xs={2}>
<Row style={{}}>
<Col xs={4} style={{ textAlign: 'right' }}>
<IconContext.Provider
value={{ color: 'green', size: '65px' }}
>
<VscHubot />
</IconContext.Provider>
</Col>
<Col xs={8} style={{ textAlign: 'left', paddingTop: '25px' }}>
<Form.Check
type="switch"
id="custom-switch"
label="¿Aplica BOT?"
checked={BOTEnabled}
onChange={() => {
setBOTEnabled(!BOTEnabled)
}}
/>
</Col>
</Row>
<Form></Form>
</Col>
<Col xs={2}>
<Alert

Loading…
Cancel
Save