Cambiar el campo clave de pedimento por un select

feature/ConsolidarPedimentos_20231229
Felix Morales 1 year ago
parent 83a72b0809
commit 651e2e9cab
  1. 39
      src/Components/Corresponsales/TraficoCorresponsales.tsx
  2. 5
      src/Interfaces/Catalogos/ICatClavesPedimentos.ts
  3. 10
      src/Services/Catalogos/ClavesPedimentos.Service.ts

@ -115,6 +115,8 @@ import { ITiposMercancias } from '../../Interfaces/Catalogos/ICatTiposMercancias
import axios from 'axios' import axios from 'axios'
import { TargetURL } from '../../Constants/TargetURL' import { TargetURL } from '../../Constants/TargetURL'
import CentrosCostosService from '../../Services/Catalogos/CentrosCostos.Service' import CentrosCostosService from '../../Services/Catalogos/CentrosCostos.Service'
import ClavesPedimentosService from '../../Services/Catalogos/ClavesPedimentos.Service'
import { ICatClavesPedimentos } from '../../Interfaces/Catalogos/ICatClavesPedimentos'
interface IProps { interface IProps {
IDTrafico: number IDTrafico: number
@ -310,7 +312,7 @@ export default function TraficoCorresponsales (props:IProps) {
const [EncabezadoPedimento1, setEncabezadoPedimento1] = useState("Pedimento"); const [EncabezadoPedimento1, setEncabezadoPedimento1] = useState("Pedimento");
const [EncabezadoPedimento2, setEncabezadoPedimento2] = useState("."); const [EncabezadoPedimento2, setEncabezadoPedimento2] = useState(".");
const [CentroCostos, setCentroCostos] = useState<string>(''); const [CentroCostos, setCentroCostos] = useState<string>('');
const [ClavesPedimentos, setClavesPedimentos] = useState<ICatClavesPedimentos[]>([])
const FechaRegistro = currentDate() const FechaRegistro = currentDate()
const msgColor = 'primary' const msgColor = 'primary'
@ -522,6 +524,14 @@ export default function TraficoCorresponsales (props:IProps) {
} }
const LoadEverything = () => { const LoadEverything = () => {
ClavesPedimentosService.getAllClavesPedimentos()
.then(response => setClavesPedimentos(response.data))
.catch((e: Error) => {
setHeader('Error')
setMsg('Ocurrio un error: ' + e)
setShowMsg(true)
return
})
CorresponsalesDataService.getAll() CorresponsalesDataService.getAll()
.then((response) => { .then((response) => {
dispatch(populateCatCorresponsales(response.data)) dispatch(populateCatCorresponsales(response.data))
@ -1921,15 +1931,26 @@ export default function TraficoCorresponsales (props:IProps) {
<Form.Label> <Form.Label>
Clave Clave
<Form.Control <Form.Control
type="text" as="select"
id="Clave" id="CmbClavePedimento"
size="sm" onChange={(e) => {
setClavePedimento(e.target.value)
}}
className="form-select form-select-sm"
value={ClavePedimento} value={ClavePedimento}
disabled={ disabled={(Depto !== 'Corresponsalias')}
Depto !== 'Corresponsalias' ? true : false >
} <option value="-Seleccione-">-Seleccione-</option>
onChange={(e) => {if(e.target.value.length <= 2) setClavePedimento(e.target.value)}} {ClavesPedimentos
/> ? ClavesPedimentos.map((item, index) => {
return (
<option key={item.id} value={item.clave}>
{item.clave}
</option>
)
})
: ''}
</Form.Control>
</Form.Label> </Form.Label>
</Col> </Col>
<Col sm={3} md={3}> <Col sm={3} md={3}>

@ -0,0 +1,5 @@
export interface ICatClavesPedimentos{
id: number;
clave: string;
descripcion: string;
}

@ -0,0 +1,10 @@
import http from "../common/http-common";
import { ICatClavesPedimentos } from "../../Interfaces/Catalogos/ICatClavesPedimentos";
class ClavesPedimentosService{
getAllClavesPedimentos(){
return http.get<ICatClavesPedimentos[]>('/Catalogos/CatClavesPedimentos/GetAll');
}
}
export default new ClavesPedimentosService();
Loading…
Cancel
Save