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) => { const toggleExpandRow = (row: I2096Headers) => {
//if (!row.max) if (!row.max) check4Updates(row.id)
check4Updates(row.id)
let Invoice: I2096Headers[] = mInvoices.filter((item) => item.id === row.id) let Invoice: I2096Headers[] = mInvoices.filter((item) => item.id === row.id)
const Obj = { ...Invoice[0] } const Obj = { ...Invoice[0] }
Obj.max = !Obj.max Obj.max = !Obj.max
@ -309,31 +308,33 @@ export default function RtpAmazonPendingInvoices(
} }
const RunBOT = (row: I2096Headers) => { const RunBOT = (row: I2096Headers) => {
if (!BOTEnabled) { if (!BOTEnabled || row.max) {
toggleExpandRow(row) toggleExpandRow(row)
return false return false
} }
setWaitingMessage('BOT trabajando...') if (BOTEnabled && !row.max) {
setWaitingDialog(true) setWaitingMessage('BOT trabajando...')
DSAmazon.ClasificacionBOT(row.id) setWaitingDialog(true)
.then((response) => { DSAmazon.ClasificacionBOT(row.id)
if (response.data) { .then((response) => {
setIDFactura(0) if (response.data) {
setFactura('') setIDFactura(0)
setShowModalInvoiceFile(false) setFactura('')
setShowModalInvoiceFile(false)
setWaitingDialog(false)
//loadReport()
toggleExpandRow(row)
return
}
})
.catch((e: Error) => {
setHeader('Error')
setMsg('Ocurrio un error')
setShowModalDeleteInvoice(false)
setWaitingDialog(false) setWaitingDialog(false)
//loadReport()
toggleExpandRow(row)
return return
} })
}) }
.catch((e: Error) => {
setHeader('Error')
setMsg('Ocurrio un error')
setShowModalDeleteInvoice(false)
setWaitingDialog(false)
return
})
} }
return ( return (
@ -350,18 +351,28 @@ export default function RtpAmazonPendingInvoices(
</Card.Title> </Card.Title>
</Col> </Col>
<Col xs={3}></Col> <Col xs={3}></Col>
<Col xs={2} style={{ paddingTop: '20px' }}> <Col xs={2}>
<Form> <Row style={{}}>
<Form.Check // prettier-ignore <Col xs={4} style={{ textAlign: 'right' }}>
type="switch" <IconContext.Provider
id="custom-switch" value={{ color: 'green', size: '65px' }}
label="¿Aplica BOT?" >
checked={BOTEnabled} <VscHubot />
onChange={() => { </IconContext.Provider>
setBOTEnabled(!BOTEnabled) </Col>
}} <Col xs={8} style={{ textAlign: 'left', paddingTop: '25px' }}>
/> <Form.Check
</Form> type="switch"
id="custom-switch"
label="¿Aplica BOT?"
checked={BOTEnabled}
onChange={() => {
setBOTEnabled(!BOTEnabled)
}}
/>
</Col>
</Row>
<Form></Form>
</Col> </Col>
<Col xs={2}> <Col xs={2}>
<Alert <Alert

Loading…
Cancel
Save