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

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

@ -35,10 +35,13 @@ export default function AmazonNoPartes(props: IAmazonNoPartesProps) {
const [NoParteLOG, setNoParteLOG] = useState<I2096NoParteLog[]>([]) const [NoParteLOG, setNoParteLOG] = useState<I2096NoParteLog[]>([])
const [PaisClaves, setPaisClaves] = useState<I2096PaisClave[]>([]) const [PaisClaves, setPaisClaves] = useState<I2096PaisClave[]>([])
const [Data, setData] = useState<DTO2096PerfilesParecidos[]>([]) const [Data, setData] = useState<DTO2096PerfilesParecidos[]>([])
const [DataNoParteVerificacion, setDataNoParteVeriifcacion] = useState<DTO2096NoParteVerificacion[]>([]) const [DataNoParteVerificacion, setDataNoParteVeriifcacion] = useState<
DTO2096NoParteVerificacion[]
>([])
const [ShowModal, setShowModal] = useState(false) const [ShowModal, setShowModal] = useState(false)
const [ShowModalLog, setShowModalLog] = useState(false) const [ShowModalLog, setShowModalLog] = useState(false)
const [ShowModalNoParteVerificacion, setShowModalNoParteVerificacion] = useState(false) const [ShowModalNoParteVerificacion, setShowModalNoParteVerificacion] =
useState(false)
const [header, setHeader] = useState('') const [header, setHeader] = useState('')
const [msgColor, setMsgColor] = useState('primary') const [msgColor, setMsgColor] = useState('primary')
const [show, setShowMsg] = useState(false) const [show, setShowMsg] = useState(false)
@ -81,12 +84,11 @@ export default function AmazonNoPartes(props: IAmazonNoPartesProps) {
<Col> <Col>
<div <div
style={{ style={{
cursor: 'pointer', cursor: 'pointer'
}} }}
onClick={() => { onClick={() => {
loadDataNoParteVerificacion(row) loadDataNoParteVerificacion(row)
setShowModalNoParteVerificacion(true) setShowModalNoParteVerificacion(true)
}} }}
> >
<IconContext.Provider value={{ color: '#60DD0E', size: '30px' }}> <IconContext.Provider value={{ color: '#60DD0E', size: '30px' }}>
@ -166,13 +168,15 @@ export default function AmazonNoPartes(props: IAmazonNoPartesProps) {
{ {
name: 'UMF', name: 'UMF',
width: '80px', width: '80px',
selector: (row: I2096NoParte) => row.unidadMedidaFactura ? row.unidadMedidaFactura : '', selector: (row: I2096NoParte) =>
row.unidadMedidaFactura ? row.unidadMedidaFactura : '',
sortable: true sortable: true
}, },
{ {
name: 'UMC', name: 'UMC',
width: '80px', width: '80px',
selector: (row: I2096NoParte) => row.unidadMedidaCOVE ? row.unidadMedidaCOVE : '', selector: (row: I2096NoParte) =>
row.unidadMedidaCOVE ? row.unidadMedidaCOVE : '',
sortable: true sortable: true
}, },
{ {
@ -215,7 +219,8 @@ export default function AmazonNoPartes(props: IAmazonNoPartesProps) {
{ {
name: 'Fracc Original', name: 'Fracc Original',
width: '130px', width: '130px',
cell: (row: I2096NoParteLog) => row.fraccionOriginal ? row.fraccionOriginal : '', cell: (row: I2096NoParteLog) =>
row.fraccionOriginal ? row.fraccionOriginal : '',
sortable: true sortable: true
}, },
{ {
@ -228,7 +233,8 @@ export default function AmazonNoPartes(props: IAmazonNoPartesProps) {
{ {
name: 'NICO Original', name: 'NICO Original',
width: '130px', width: '130px',
cell: (row: I2096NoParteLog) => row.subdivisionOriginal ? row.subdivisionOriginal : '', cell: (row: I2096NoParteLog) =>
row.subdivisionOriginal ? row.subdivisionOriginal : '',
sortable: true, sortable: true,
center: true center: true
}, },
@ -237,7 +243,7 @@ export default function AmazonNoPartes(props: IAmazonNoPartesProps) {
width: '250px', width: '250px',
cell: (row: I2096NoParteLog) => row.descripcionAgenteAduanal, cell: (row: I2096NoParteLog) => row.descripcionAgenteAduanal,
wrap: true, wrap: true,
sortable: true, sortable: true
}, },
{ {
name: 'Desc Original', name: 'Desc Original',
@ -256,7 +262,7 @@ export default function AmazonNoPartes(props: IAmazonNoPartesProps) {
{ {
name: 'Usuario', name: 'Usuario',
width: '300px', width: '300px',
cell: (row: I2096NoParteLog) => row.sUsuario ? row.sUsuario : '', cell: (row: I2096NoParteLog) => (row.sUsuario ? row.sUsuario : ''),
wrap: true, wrap: true,
sortable: true sortable: true
} }
@ -294,7 +300,7 @@ export default function AmazonNoPartes(props: IAmazonNoPartesProps) {
width: '100px', width: '100px',
cell: (row: DTO2096NoParteVerificacion) => row.aduana, cell: (row: DTO2096NoParteVerificacion) => row.aduana,
wrap: true, wrap: true,
sortable: true, sortable: true
}, },
{ {
name: 'Pedimento', name: 'Pedimento',
@ -305,7 +311,6 @@ export default function AmazonNoPartes(props: IAmazonNoPartesProps) {
} }
] ]
const openLink = (item: string) => { const openLink = (item: string) => {
window.open('https://www.amazon.com/dp/' + item) window.open('https://www.amazon.com/dp/' + item)
} }
@ -315,7 +320,7 @@ export default function AmazonNoPartes(props: IAmazonNoPartesProps) {
if (Id === 0) return NoAsignado if (Id === 0) return NoAsignado
else if (Data.length) { else if (Data.length) {
const Usuario = Data.filter((item) => item.idUsuario === Id) const Usuario = Data.filter((item) => item.idUsuario === Id)
return Usuario ? Usuario[0].nombre : NoAsignado return Usuario.length ? Usuario[0].nombre : NoAsignado
} }
return NoAsignado return NoAsignado
} }
@ -396,6 +401,7 @@ export default function AmazonNoPartes(props: IAmazonNoPartesProps) {
} }
AmazonDS.NoPartesGet(Search) AmazonDS.NoPartesGet(Search)
.then((response) => { .then((response) => {
console.log(response.data)
dispatch(populateNoPartes(response.data)) dispatch(populateNoPartes(response.data))
}) })
.catch((e: Error) => { .catch((e: Error) => {
@ -417,11 +423,23 @@ export default function AmazonNoPartes(props: IAmazonNoPartesProps) {
AmazonDS.NoPartesUpdate(data) AmazonDS.NoPartesUpdate(data)
.then((response) => { .then((response) => {
dispatch(updateNoPartes(response.data)) 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') setHeader('Error')
setMsg('Ocurrio un error: ' + e) setMsg('Fraccion no valida!')
setShowMsg(true) setShowMsg(true)
}
/* console.log(error.toJSON())
const errorMessage = error?.response?.data?.message
const message = errorMessage
setHeader('Error')
setMsg(message)
setShowMsg(true) */
return return
}) })
} }

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

Loading…
Cancel
Save