|
|
@ -4,7 +4,8 @@ import DataTable from 'react-data-table-component' |
|
|
|
import I2096NoParte from '../Interfaces/I2096NoParte' |
|
|
|
import I2096NoParte from '../Interfaces/I2096NoParte' |
|
|
|
import AmazonDS from '../Services/Amazon.Services' |
|
|
|
import AmazonDS from '../Services/Amazon.Services' |
|
|
|
import { |
|
|
|
import { |
|
|
|
populateNoPartes |
|
|
|
populateNoPartes, |
|
|
|
|
|
|
|
updateNoPartes |
|
|
|
} from '../../../../store/features/Clientes/2096/AmazonNoPartes' |
|
|
|
} from '../../../../store/features/Clientes/2096/AmazonNoPartes' |
|
|
|
import { RootState } from '../../../../store/store' |
|
|
|
import { RootState } from '../../../../store/store' |
|
|
|
import { useDispatch, useSelector } from 'react-redux' |
|
|
|
import { useDispatch, useSelector } from 'react-redux' |
|
|
@ -13,7 +14,9 @@ import { MsgInformativo } from '../../../Utils/Toast/msgInformativo' |
|
|
|
import { IconContext } from 'react-icons' |
|
|
|
import { IconContext } from 'react-icons' |
|
|
|
import { BsFillPencilFill, BsFillTrashFill } from 'react-icons/bs' |
|
|
|
import { BsFillPencilFill, BsFillTrashFill } from 'react-icons/bs' |
|
|
|
import I2096PaisClave from '../Interfaces/I2096PaisClave' |
|
|
|
import I2096PaisClave from '../Interfaces/I2096PaisClave' |
|
|
|
|
|
|
|
import DTO2096PerfilesParecidos from '../DTO/DTO2096PerfilesParecidos' |
|
|
|
|
|
|
|
import DSAmazon from '../Services/Amazon.Services' |
|
|
|
|
|
|
|
import DTO2096NoParte from '../DTO/DTO2096NoParte' |
|
|
|
export interface IAmazonNoPartesProps {} |
|
|
|
export interface IAmazonNoPartesProps {} |
|
|
|
|
|
|
|
|
|
|
|
export function AmazonNoPartes(props: IAmazonNoPartesProps) { |
|
|
|
export function AmazonNoPartes(props: IAmazonNoPartesProps) { |
|
|
@ -21,7 +24,12 @@ export function AmazonNoPartes(props: IAmazonNoPartesProps) { |
|
|
|
const mNoPartes = useSelector( |
|
|
|
const mNoPartes = useSelector( |
|
|
|
(state: RootState) => state.AmazonNoPartes.NoPartes |
|
|
|
(state: RootState) => state.AmazonNoPartes.NoPartes |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
const [UserId, setUserId] = useState(() => { |
|
|
|
|
|
|
|
const stickyValue = window.localStorage.getItem('UserId') |
|
|
|
|
|
|
|
return stickyValue !== null ? JSON.parse(stickyValue) : 0 |
|
|
|
|
|
|
|
}) |
|
|
|
const [PaisClaves, setPaisClaves] = useState<I2096PaisClave[]>([]) |
|
|
|
const [PaisClaves, setPaisClaves] = useState<I2096PaisClave[]>([]) |
|
|
|
|
|
|
|
const [Data, setData] = useState<DTO2096PerfilesParecidos[]>([]) |
|
|
|
const [ShowModal, setShowModal] = useState(false) |
|
|
|
const [ShowModal, setShowModal] = useState(false) |
|
|
|
const [header, setHeader] = useState('') |
|
|
|
const [header, setHeader] = useState('') |
|
|
|
const [msgColor, setMsgColor] = useState('primary') |
|
|
|
const [msgColor, setMsgColor] = useState('primary') |
|
|
@ -29,6 +37,7 @@ export function AmazonNoPartes(props: IAmazonNoPartesProps) { |
|
|
|
const [msg, setMsg] = useState('') |
|
|
|
const [msg, setMsg] = useState('') |
|
|
|
const [MsgTime, setMsgTime] = useState(3000) |
|
|
|
const [MsgTime, setMsgTime] = useState(3000) |
|
|
|
const [IDParte, setIDParte] = useState(0) |
|
|
|
const [IDParte, setIDParte] = useState(0) |
|
|
|
|
|
|
|
const [Parte, setParte] = useState('') |
|
|
|
const [TipoOperacion, setTipoOperacion] = useState(0) |
|
|
|
const [TipoOperacion, setTipoOperacion] = useState(0) |
|
|
|
const [Fraccion, setFraccion] = useState('') |
|
|
|
const [Fraccion, setFraccion] = useState('') |
|
|
|
const [Subdivision, setSubdivision] = useState('') |
|
|
|
const [Subdivision, setSubdivision] = useState('') |
|
|
@ -37,6 +46,9 @@ export function AmazonNoPartes(props: IAmazonNoPartesProps) { |
|
|
|
const [PaisOrigen, setPaisOrigen] = useState('') |
|
|
|
const [PaisOrigen, setPaisOrigen] = useState('') |
|
|
|
const [UMF, setUMF] = useState('') |
|
|
|
const [UMF, setUMF] = useState('') |
|
|
|
const [Search, setSearch] = useState('') |
|
|
|
const [Search, setSearch] = useState('') |
|
|
|
|
|
|
|
const [FechaInsercion, setFechaInsercion] = useState('') |
|
|
|
|
|
|
|
const [Clasificador, setClasificador] = useState('') |
|
|
|
|
|
|
|
|
|
|
|
const openLink = (item: string) => { |
|
|
|
const openLink = (item: string) => { |
|
|
|
window.open('https://www.amazon.com/dp/' + item) |
|
|
|
window.open('https://www.amazon.com/dp/' + item) |
|
|
|
} |
|
|
|
} |
|
|
@ -81,7 +93,9 @@ export function AmazonNoPartes(props: IAmazonNoPartesProps) { |
|
|
|
name: 'Parte', |
|
|
|
name: 'Parte', |
|
|
|
width: '110px', |
|
|
|
width: '110px', |
|
|
|
cell: (row: I2096NoParte) => ( |
|
|
|
cell: (row: I2096NoParte) => ( |
|
|
|
<div style={{cursor: 'pointer'}} onClick={() => openLink(row.parte)}>{row.parte}</div> |
|
|
|
<div style={{ cursor: 'pointer' }} onClick={() => openLink(row.parte)}> |
|
|
|
|
|
|
|
{row.parte} |
|
|
|
|
|
|
|
</div> |
|
|
|
), |
|
|
|
), |
|
|
|
sortable: true |
|
|
|
sortable: true |
|
|
|
}, |
|
|
|
}, |
|
|
@ -135,22 +149,59 @@ export function AmazonNoPartes(props: IAmazonNoPartesProps) { |
|
|
|
selector: (row: I2096NoParte) => row.descripcionAgenteAduanal, |
|
|
|
selector: (row: I2096NoParte) => row.descripcionAgenteAduanal, |
|
|
|
wrap: true, |
|
|
|
wrap: true, |
|
|
|
sortable: true |
|
|
|
sortable: true |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
name: 'Fecha / Hora', |
|
|
|
|
|
|
|
width: '200px', |
|
|
|
|
|
|
|
selector: (row: I2096NoParte) => row.fechaConfirmacion, |
|
|
|
|
|
|
|
wrap: true, |
|
|
|
|
|
|
|
sortable: true |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
name: 'Usuario', |
|
|
|
|
|
|
|
width: '300px', |
|
|
|
|
|
|
|
selector: (row: I2096NoParte) => getUser(row.usuarioActualizacion), |
|
|
|
|
|
|
|
wrap: true, |
|
|
|
|
|
|
|
sortable: true |
|
|
|
} |
|
|
|
} |
|
|
|
] |
|
|
|
] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const getUser = (Id: number) => { |
|
|
|
|
|
|
|
const NoAsignado = 'NO ASIGNADO' |
|
|
|
|
|
|
|
if (Id === 0) return NoAsignado |
|
|
|
|
|
|
|
else if (Data.length) { |
|
|
|
|
|
|
|
const Usuario = Data.filter((item) => item.idUsuario === Id) |
|
|
|
|
|
|
|
return Usuario ? Usuario[0].nombre : NoAsignado |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return NoAsignado |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const loadProfiles = () => { |
|
|
|
|
|
|
|
DSAmazon.PerfilesParecidosGet('_') |
|
|
|
|
|
|
|
.then((response) => { |
|
|
|
|
|
|
|
setData(response.data) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
.catch((e: Error) => { |
|
|
|
|
|
|
|
alert('Ocurrio un error' + e.message.toString()) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const loadData = (row: I2096NoParte) => { |
|
|
|
const loadData = (row: I2096NoParte) => { |
|
|
|
setIDParte(row.id) |
|
|
|
setIDParte(row.id) |
|
|
|
|
|
|
|
setParte(row.parte) |
|
|
|
setTipoOperacion(row.tipoOperacion) |
|
|
|
setTipoOperacion(row.tipoOperacion) |
|
|
|
setFraccion(row.fraccion.substring(0, 8)) |
|
|
|
setFraccion(row.fraccion.substring(0, 8)) |
|
|
|
setSubdivision(row.fraccion.slice(-2)) |
|
|
|
setSubdivision(row.subdivision) |
|
|
|
setPaisOrigen(row.paisOrigen) |
|
|
|
setPaisOrigen(row.paisOrigen) |
|
|
|
setDescripcionFactura(row.descripcionFactura) |
|
|
|
setDescripcionFactura(row.descripcionFactura) |
|
|
|
setDescripcionAgenteAduanal(row.descripcionAgenteAduanal) |
|
|
|
setDescripcionAgenteAduanal(row.descripcionAgenteAduanal) |
|
|
|
setUMF(row.unidadMedidaFactura) |
|
|
|
setUMF(row.unidadMedidaFactura) |
|
|
|
|
|
|
|
setFechaInsercion(row.FHActualizacion) |
|
|
|
|
|
|
|
setClasificador(getUser(row.usuarioActualizacion)) |
|
|
|
setShowModal(true) |
|
|
|
setShowModal(true) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
const loadPaisesClaves = () => { |
|
|
|
AmazonDS.PaisClavesGET() |
|
|
|
AmazonDS.PaisClavesGET() |
|
|
|
.then((response) => { |
|
|
|
.then((response) => { |
|
|
|
setPaisClaves(response.data) |
|
|
|
setPaisClaves(response.data) |
|
|
@ -161,6 +212,11 @@ export function AmazonNoPartes(props: IAmazonNoPartesProps) { |
|
|
|
setShowMsg(true) |
|
|
|
setShowMsg(true) |
|
|
|
return |
|
|
|
return |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
|
|
|
loadPaisesClaves() |
|
|
|
|
|
|
|
loadProfiles() |
|
|
|
}, []) |
|
|
|
}, []) |
|
|
|
|
|
|
|
|
|
|
|
const loadInfo = () => { |
|
|
|
const loadInfo = () => { |
|
|
@ -172,6 +228,7 @@ export function AmazonNoPartes(props: IAmazonNoPartesProps) { |
|
|
|
} |
|
|
|
} |
|
|
|
AmazonDS.NoPartesGet(Search) |
|
|
|
AmazonDS.NoPartesGet(Search) |
|
|
|
.then((response) => { |
|
|
|
.then((response) => { |
|
|
|
|
|
|
|
//console.log(JSON.stringify(response.data))
|
|
|
|
dispatch(populateNoPartes(response.data)) |
|
|
|
dispatch(populateNoPartes(response.data)) |
|
|
|
}) |
|
|
|
}) |
|
|
|
.catch((e: Error) => { |
|
|
|
.catch((e: Error) => { |
|
|
@ -182,6 +239,26 @@ export function AmazonNoPartes(props: IAmazonNoPartesProps) { |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const saveInfo = () => { |
|
|
|
|
|
|
|
const data: DTO2096NoParte = { |
|
|
|
|
|
|
|
id: IDParte, |
|
|
|
|
|
|
|
fraccionGEMCO: Fraccion, |
|
|
|
|
|
|
|
subdivisionGEMCO: Subdivision, |
|
|
|
|
|
|
|
descripcionAgenteAduanal: DescripcionAgenteAduanal, |
|
|
|
|
|
|
|
usuario: UserId |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
AmazonDS.NoPartesUpdate(data) |
|
|
|
|
|
|
|
.then((response) => { |
|
|
|
|
|
|
|
dispatch(updateNoPartes(response.data)) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
.catch((e: Error) => { |
|
|
|
|
|
|
|
setHeader('Error') |
|
|
|
|
|
|
|
setMsg('Ocurrio un error: ' + e) |
|
|
|
|
|
|
|
setShowMsg(true) |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<div> |
|
|
|
<div> |
|
|
|
<Card> |
|
|
|
<Card> |
|
|
@ -235,12 +312,18 @@ export function AmazonNoPartes(props: IAmazonNoPartesProps) { |
|
|
|
size={'sm'} |
|
|
|
size={'sm'} |
|
|
|
dialogClassName={'modal-50w'} |
|
|
|
dialogClassName={'modal-50w'} |
|
|
|
> |
|
|
|
> |
|
|
|
|
|
|
|
<Modal.Header closeButton> |
|
|
|
|
|
|
|
<Modal.Title> |
|
|
|
|
|
|
|
No Parte: {Parte} ................ insertado : [ {FechaInsercion} ] |
|
|
|
|
|
|
|
</Modal.Title> |
|
|
|
|
|
|
|
</Modal.Header> |
|
|
|
<Modal.Body> |
|
|
|
<Modal.Body> |
|
|
|
<div style={{ height: '400px', overflow: 'scroll' }}> |
|
|
|
<div style={{ height: '400px', overflow: 'scroll' }}> |
|
|
|
<Row style={{ paddingTop: '15px' }}> |
|
|
|
<Row style={{ paddingTop: '15px' }}> |
|
|
|
<Col xs={2}>T. Operacion</Col> |
|
|
|
<Col xs={2}>T. Operacion</Col> |
|
|
|
<Col xs={3}> |
|
|
|
<Col xs={3}> |
|
|
|
<Form.Control |
|
|
|
<Form.Control |
|
|
|
|
|
|
|
disabled={true} |
|
|
|
as="select" |
|
|
|
as="select" |
|
|
|
onChange={(e) => setTipoOperacion(parseInt(e.target.value))} |
|
|
|
onChange={(e) => setTipoOperacion(parseInt(e.target.value))} |
|
|
|
className="form-select form-select-sm" |
|
|
|
className="form-select form-select-sm" |
|
|
@ -277,6 +360,7 @@ export function AmazonNoPartes(props: IAmazonNoPartesProps) { |
|
|
|
<Col xs={10}> |
|
|
|
<Col xs={10}> |
|
|
|
<Form.Group className="mb-3"> |
|
|
|
<Form.Group className="mb-3"> |
|
|
|
<Form.Control |
|
|
|
<Form.Control |
|
|
|
|
|
|
|
disabled={true} |
|
|
|
as="textarea" |
|
|
|
as="textarea" |
|
|
|
rows={3} |
|
|
|
rows={3} |
|
|
|
value={DescripcionFactura} |
|
|
|
value={DescripcionFactura} |
|
|
@ -294,6 +378,9 @@ export function AmazonNoPartes(props: IAmazonNoPartesProps) { |
|
|
|
as="textarea" |
|
|
|
as="textarea" |
|
|
|
rows={3} |
|
|
|
rows={3} |
|
|
|
value={DescripcionAgenteAduanal} |
|
|
|
value={DescripcionAgenteAduanal} |
|
|
|
|
|
|
|
onChange={(e) => |
|
|
|
|
|
|
|
setDescripcionAgenteAduanal(e.target.value) |
|
|
|
|
|
|
|
} |
|
|
|
/> |
|
|
|
/> |
|
|
|
</Form.Group> |
|
|
|
</Form.Group> |
|
|
|
</Col> |
|
|
|
</Col> |
|
|
@ -304,6 +391,7 @@ export function AmazonNoPartes(props: IAmazonNoPartesProps) { |
|
|
|
<Form.Control |
|
|
|
<Form.Control |
|
|
|
as="select" |
|
|
|
as="select" |
|
|
|
value={PaisOrigen} |
|
|
|
value={PaisOrigen} |
|
|
|
|
|
|
|
disabled={true} |
|
|
|
onChange={(e) => setPaisOrigen(e.target.value)} |
|
|
|
onChange={(e) => setPaisOrigen(e.target.value)} |
|
|
|
className="form-select form-select-sm" |
|
|
|
className="form-select form-select-sm" |
|
|
|
> |
|
|
|
> |
|
|
@ -320,6 +408,7 @@ export function AmazonNoPartes(props: IAmazonNoPartesProps) { |
|
|
|
<Col xs={4}>Unidad medida factura</Col> |
|
|
|
<Col xs={4}>Unidad medida factura</Col> |
|
|
|
<Col xs={1}> |
|
|
|
<Col xs={1}> |
|
|
|
<Form.Control |
|
|
|
<Form.Control |
|
|
|
|
|
|
|
disabled={true} |
|
|
|
defaultValue={UMF} |
|
|
|
defaultValue={UMF} |
|
|
|
type="text" |
|
|
|
type="text" |
|
|
|
placeholder="Unidad de medida factura" |
|
|
|
placeholder="Unidad de medida factura" |
|
|
@ -329,9 +418,19 @@ export function AmazonNoPartes(props: IAmazonNoPartesProps) { |
|
|
|
</Col> |
|
|
|
</Col> |
|
|
|
</Row> |
|
|
|
</Row> |
|
|
|
<Row style={{ paddingTop: '15px' }}> |
|
|
|
<Row style={{ paddingTop: '15px' }}> |
|
|
|
<Col xs={10}></Col> |
|
|
|
<Col xs={2}>Clasificador</Col> |
|
|
|
|
|
|
|
<Col xs={4} style={{ textAlign: 'left' }}> |
|
|
|
|
|
|
|
<Form.Control |
|
|
|
|
|
|
|
defaultValue={Clasificador} |
|
|
|
|
|
|
|
disabled={true} |
|
|
|
|
|
|
|
type="text" |
|
|
|
|
|
|
|
placeholder="Clasificador" |
|
|
|
|
|
|
|
size="sm" |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
</Col> |
|
|
|
|
|
|
|
<Col xs={4}></Col> |
|
|
|
<Col xs={1}> |
|
|
|
<Col xs={1}> |
|
|
|
<Button>Guarda</Button> |
|
|
|
<Button onClick={() => saveInfo()}>Guarda</Button> |
|
|
|
</Col> |
|
|
|
</Col> |
|
|
|
</Row> |
|
|
|
</Row> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|