Fixed form: AmazonNoPartes Fraccion + subdivision also validated with public web service

featureBotClasifcacion
alfonso 1 year ago
parent d4a7d92473
commit 8f4bcf1df9
  1. 130
      src/Components/Clientes/Amazon/Reportes/AmazonNoPartes.tsx
  2. 4
      src/Components/Utils/Toast/msgInformativo.tsx

@ -35,10 +35,13 @@ export default function AmazonNoPartes(props: IAmazonNoPartesProps) {
const [NoParteLOG, setNoParteLOG] = useState<I2096NoParteLog[]>([])
const [PaisClaves, setPaisClaves] = useState<I2096PaisClave[]>([])
const [Data, setData] = useState<DTO2096PerfilesParecidos[]>([])
const [DataNoParteVerificacion, setDataNoParteVeriifcacion] = useState<DTO2096NoParteVerificacion[]>([])
const [DataNoParteVerificacion, setDataNoParteVeriifcacion] = useState<
DTO2096NoParteVerificacion[]
>([])
const [ShowModal, setShowModal] = useState(false)
const [ShowModalLog, setShowModalLog] = useState(false)
const [ShowModalNoParteVerificacion, setShowModalNoParteVerificacion] = useState(false)
const [ShowModalNoParteVerificacion, setShowModalNoParteVerificacion] =
useState(false)
const [header, setHeader] = useState('')
const [msgColor, setMsgColor] = useState('primary')
const [show, setShowMsg] = useState(false)
@ -81,12 +84,11 @@ export default function AmazonNoPartes(props: IAmazonNoPartesProps) {
<Col>
<div
style={{
cursor: 'pointer',
cursor: 'pointer'
}}
onClick={() => {
loadDataNoParteVerificacion(row)
setShowModalNoParteVerificacion(true)
}}
>
<IconContext.Provider value={{ color: '#60DD0E', size: '30px' }}>
@ -166,13 +168,15 @@ export default function AmazonNoPartes(props: IAmazonNoPartesProps) {
{
name: 'UMF',
width: '80px',
selector: (row: I2096NoParte) => row.unidadMedidaFactura ? row.unidadMedidaFactura : '',
selector: (row: I2096NoParte) =>
row.unidadMedidaFactura ? row.unidadMedidaFactura : '',
sortable: true
},
{
name: 'UMC',
width: '80px',
selector: (row: I2096NoParte) => row.unidadMedidaCOVE ? row.unidadMedidaCOVE : '',
selector: (row: I2096NoParte) =>
row.unidadMedidaCOVE ? row.unidadMedidaCOVE : '',
sortable: true
},
{
@ -215,7 +219,8 @@ export default function AmazonNoPartes(props: IAmazonNoPartesProps) {
{
name: 'Fracc Original',
width: '130px',
cell: (row: I2096NoParteLog) => row.fraccionOriginal ? row.fraccionOriginal : '',
cell: (row: I2096NoParteLog) =>
row.fraccionOriginal ? row.fraccionOriginal : '',
sortable: true
},
{
@ -228,7 +233,8 @@ export default function AmazonNoPartes(props: IAmazonNoPartesProps) {
{
name: 'NICO Original',
width: '130px',
cell: (row: I2096NoParteLog) => row.subdivisionOriginal ? row.subdivisionOriginal : '',
cell: (row: I2096NoParteLog) =>
row.subdivisionOriginal ? row.subdivisionOriginal : '',
sortable: true,
center: true
},
@ -237,7 +243,7 @@ export default function AmazonNoPartes(props: IAmazonNoPartesProps) {
width: '250px',
cell: (row: I2096NoParteLog) => row.descripcionAgenteAduanal,
wrap: true,
sortable: true,
sortable: true
},
{
name: 'Desc Original',
@ -246,7 +252,7 @@ export default function AmazonNoPartes(props: IAmazonNoPartesProps) {
wrap: true,
sorteable: true
},
{
name: 'Fecha / Hora',
width: '200px',
@ -256,7 +262,7 @@ export default function AmazonNoPartes(props: IAmazonNoPartesProps) {
{
name: 'Usuario',
width: '300px',
cell: (row: I2096NoParteLog) => row.sUsuario ? row.sUsuario : '',
cell: (row: I2096NoParteLog) => (row.sUsuario ? row.sUsuario : ''),
wrap: true,
sortable: true
}
@ -294,7 +300,7 @@ export default function AmazonNoPartes(props: IAmazonNoPartesProps) {
width: '100px',
cell: (row: DTO2096NoParteVerificacion) => row.aduana,
wrap: true,
sortable: true,
sortable: true
},
{
name: 'Pedimento',
@ -305,7 +311,6 @@ export default function AmazonNoPartes(props: IAmazonNoPartesProps) {
}
]
const openLink = (item: string) => {
window.open('https://www.amazon.com/dp/' + item)
}
@ -315,7 +320,7 @@ export default function AmazonNoPartes(props: IAmazonNoPartesProps) {
if (Id === 0) return NoAsignado
else if (Data.length) {
const Usuario = Data.filter((item) => item.idUsuario === Id)
return Usuario ? Usuario[0].nombre : NoAsignado
return Usuario.length ? Usuario[0].nombre : NoAsignado
}
return NoAsignado
}
@ -396,6 +401,7 @@ export default function AmazonNoPartes(props: IAmazonNoPartesProps) {
}
AmazonDS.NoPartesGet(Search)
.then((response) => {
console.log(response.data)
dispatch(populateNoPartes(response.data))
})
.catch((e: Error) => {
@ -417,11 +423,23 @@ export default function AmazonNoPartes(props: IAmazonNoPartesProps) {
AmazonDS.NoPartesUpdate(data)
.then((response) => {
dispatch(updateNoPartes(response.data))
setHeader('Informativo')
setMsg('La informacion se guardo correctamente')
setShowMsg(true)
})
.catch((e: Error) => {
.catch(function(error) {
console.log(error.toJSON())
if (error.message == 'Request failed with status code 400') {
setHeader('Error')
setMsg('Fraccion no valida!')
setShowMsg(true)
}
/* console.log(error.toJSON())
const errorMessage = error?.response?.data?.message
const message = errorMessage
setHeader('Error')
setMsg('Ocurrio un error: ' + e)
setShowMsg(true)
setMsg(message)
setShowMsg(true) */
return
})
}
@ -616,26 +634,26 @@ export default function AmazonNoPartes(props: IAmazonNoPartesProps) {
<Modal.Title>No Parte: {Parte}</Modal.Title>
</Modal.Header>
<Modal.Body>
{/* <div style={{ height: '400px', overflow: 'scroll' }}> */}
<Row style={{ paddingTop: '15px' }}>
<Col xs={12}>
<DataTable
noHeader
fixedHeaderScrollHeight="400px"
defaultSortFieldId={'id'}
defaultSortAsc={true}
pagination
highlightOnHover
striped={true}
dense={true}
columns={colsNoPartesLOG}
data={NoParteLOG.filter(function (el) {
return el.id > 0
})}
/>
</Col>
</Row>
{/* </div> */}
{/* <div style={{ height: '400px', overflow: 'scroll' }}> */}
<Row style={{ paddingTop: '15px' }}>
<Col xs={12}>
<DataTable
noHeader
fixedHeaderScrollHeight="400px"
defaultSortFieldId={'id'}
defaultSortAsc={true}
pagination
highlightOnHover
striped={true}
dense={true}
columns={colsNoPartesLOG}
data={NoParteLOG.filter(function (el) {
return el.id > 0
})}
/>
</Col>
</Row>
{/* </div> */}
</Modal.Body>
</Modal>
@ -651,25 +669,25 @@ export default function AmazonNoPartes(props: IAmazonNoPartesProps) {
<Modal.Title>No Parte: {Search}</Modal.Title>
</Modal.Header>
<Modal.Body>
<Row style={{ paddingTop: '15px' }}>
<Col xs={12}>
<DataTable
noHeader
fixedHeaderScrollHeight="400px"
defaultSortFieldId={'id'}
defaultSortAsc={true}
pagination
highlightOnHover
striped={true}
dense={true}
columns={colsNoPartesVerificacion}
data={DataNoParteVerificacion.filter(function (el) {
return el
})}
/>
</Col>
</Row>
{/* </div> */}
<Row style={{ paddingTop: '15px' }}>
<Col xs={12}>
<DataTable
noHeader
fixedHeaderScrollHeight="400px"
defaultSortFieldId={'id'}
defaultSortAsc={true}
pagination
highlightOnHover
striped={true}
dense={true}
columns={colsNoPartesVerificacion}
data={DataNoParteVerificacion.filter(function (el) {
return el
})}
/>
</Col>
</Row>
{/* </div> */}
</Modal.Body>
</Modal>
<MsgInformativo

@ -15,8 +15,8 @@ interface IProps {
export const MsgInformativo: FC<IProps> = (props) => {
return (
<div>
<ToastContainer position={'middle-center'}>
<Toast
<ToastContainer position={'middle-center'} style={{zIndex:'9999 !important'}} >
<Toast
show={props.show}
delay={props.time}
bg={props.msgColor}

Loading…
Cancel
Save