diff --git a/src/Components/Clientes/Amazon/Catalogos/CatConceptosConsulta.tsx b/src/Components/Clientes/Amazon/Catalogos/CatConceptosConsulta.tsx index d1990b9..4a94acb 100644 --- a/src/Components/Clientes/Amazon/Catalogos/CatConceptosConsulta.tsx +++ b/src/Components/Clientes/Amazon/Catalogos/CatConceptosConsulta.tsx @@ -2,16 +2,9 @@ import React, { FC, useEffect, useState } from 'react' import ITabulador from '../../../../Interfaces/Catalogos/ITabulador' import ITabuladorConceptos from '../../../../Interfaces/Catalogos/ITabuladorConceptos' -import DTOConceptos from '../../../../DTO/Utils/DTOConceptos' - import CTabDataService from '../../../../Services/Corresponsalias/Corresponsales.Tabuladores.Services' -//import CTabDetDataService from '../../../../Services/Corresponsalias/Corresponsales.Tabuladores.Detalle.Sevices' import AmazonSrvDataService from '../Services/Amazon.Services' - -import ClientesDataService from '../../../../Services/Catalogos/Clientes.Services' - import { MsgInformativo } from '../../../Utils/Toast/msgInformativo' -import { ControlledInput } from '../../../Utils/ControlledInput/ControlledInput' import DataTable from 'react-data-table-component' import { Alert, @@ -28,14 +21,11 @@ import { IconContext } from 'react-icons' import 'react-data-table-component-extensions/dist/index.css' import { BsCheckCircleFill, - BsPlusSquareFill, BsXCircleFill } from 'react-icons/bs' -import IClientes from '../../../../Interfaces/Catalogos/IClientes' -import { FcTimeline } from 'react-icons/fc' -import { FaEraser, FaTimesCircle } from 'react-icons/fa' +import { FaEraser } from 'react-icons/fa' import ICat2096CatConceptosConsulta from '../Interfaces/I2096CatConceptosConsulta' -import { populateCatConcetosConsultas, updateCatConcetosConsulta } from '../../../../store/features/Clientes/2096/AmazonCatConceptosConsulta' +import { populateCatConcetosConsultas } from '../../../../store/features/Clientes/2096/AmazonCatConceptosConsulta' import { useDispatch } from 'react-redux' export interface ICatConceptosConsultaProps {} @@ -50,10 +40,10 @@ export default function CatConceptosConsulta( const dispatch = useDispatch() const [Tabulador, setTabulador] = useState(0) const [Id, setId] = useState(0) - const [Concepto, setConcepto] = useState(0) + /* const [Concepto, setConcepto] = useState(0) */ const [Cliente, setCliente] = useState(0) const [Activo, setActivo] = useState(0) - const [Clientes, setClientes] = useState>() +/* const [Clientes, setClientes] = useState>() */ const [Siglas, setSiglas] = useState('') const [ShortDescription, setShortDescription] = useState('') const [SpanishDescription, setSpanishDescription] = useState('') @@ -151,7 +141,7 @@ export default function CatConceptosConsulta( }) } - const loadCatalog = () => { + const loadCatalogoConceptosConsulta = () => { AmazonSrvDataService.CatConceptosConsultaGET() .then((response) => { dispatch(populateCatConcetosConsultas(response.data)) @@ -166,7 +156,7 @@ export default function CatConceptosConsulta( } useEffect(() => { - loadCatalog() + loadCatalogoConceptosConsulta() }, []) useEffect(() => { @@ -213,7 +203,7 @@ export default function CatConceptosConsulta( AmazonSrvDataService.CatConceptosConsultaAppend(data) .then((response) => { if (response.status === 200) { - loadCatalog() + loadCatalogoConceptosConsulta() setHeader('Informativo') setMsg('La informacion se guardo correctamente') setShowMsg(true) @@ -280,8 +270,12 @@ export default function CatConceptosConsulta( paddingLeft: '0px' }} onClick={() => { - setTabulador(0) + setId(0) setSiglas('') + setShortDescription('') + setSpanishDescription('') + setSpanishDescriptionWide('') + setActivo(1) }} > ([]) const [Data, setData] = useState([]) - const [CatGrupoRegulario, setCatGrupoRegulatorio] = useState([]) + const [CatGrupoRegulario, setCatGrupoRegulatorio] = useState< + I2096CatGrupoRegulatorio[] + >([]) const msgColor = 'primary' const loadReport = () => { @@ -71,6 +75,16 @@ export default function RptConsultaTrafico(props: IRptConsultaTraficoProps) { .catch((e: Error) => { alert('Ocurrio un error' + e.message.toString()) }) + DSAmazon.CatConceptosConsultaGET() + .then((response) => { + dispatch(populateCatConcetosConsultas(response.data)) + }) + .catch((e: Error) => { + setHeader('Error') + setMsg('Ocurrio un error: ' + e) + setShowMsg(true) + return + }) } const downloadExcel = (id: number, Invoice: string) => { @@ -80,7 +94,7 @@ export default function RptConsultaTrafico(props: IRptConsultaTraficoProps) { const url = window.URL.createObjectURL(new Blob([response.data])) const link = document.createElement('a') link.href = url - link.setAttribute('download', 'Broker File '+Invoice+'.xls') + link.setAttribute('download', 'Broker File ' + Invoice + '.xls') document.body.appendChild(link) link.click() } @@ -235,7 +249,14 @@ export default function RptConsultaTrafico(props: IRptConsultaTraficoProps) { )} {MasterData.id} - {downloadExcel(MasterData.id, MasterData.invoiceNumber)}}> + { + downloadExcel( + MasterData.id, + MasterData.invoiceNumber + ) + }} + > @@ -494,7 +515,11 @@ export default function RptConsultaTrafico(props: IRptConsultaTraficoProps) { /* MasterData.estatus <= 1 */ 1 == 1 } - Catalogo = {CatGrupoRegulario ? CatGrupoRegulario : []} + Catalogo={ + CatGrupoRegulario + ? CatGrupoRegulario + : [] + } onDataChange={function ( IDMaster: number ): void { diff --git a/src/Components/Clientes/Amazon/Reportes/ConsultaTrafico/RptConsultaTraficoDetalle.tsx b/src/Components/Clientes/Amazon/Reportes/ConsultaTrafico/RptConsultaTraficoDetalle.tsx index f2dea64..dfb81ef 100644 --- a/src/Components/Clientes/Amazon/Reportes/ConsultaTrafico/RptConsultaTraficoDetalle.tsx +++ b/src/Components/Clientes/Amazon/Reportes/ConsultaTrafico/RptConsultaTraficoDetalle.tsx @@ -37,6 +37,10 @@ export default function RptConsultaTraficoDetalle( const mInvoices = useSelector( (state: RootState) => state.AmazonInvoices.Invoice ) + const mConceptosConsulta = useSelector( + (state: RootState) => state.AmazonCatConceptosConsulta.CatConcetosConsulta + ) + const [IDConceptoConsulta, setIDConceptoConsulta] = useState(1) const [ShowModal, setShowModal] = useState(false) const [EstatusSwith, setEstatusSwitch] = useState(props.detail.swConsulta) const [UserChanged, setUserChanged] = useState(false) @@ -49,6 +53,7 @@ export default function RptConsultaTraficoDetalle( const [ComentariosConsulta, setComentariosConsulta] = useState( props.detail.comentariosConsulta ? props.detail.comentariosConsulta : '' ) + const [ConceptoConsulta, setConceptoConsulta] = useState('') const [ShowModalEdit, setShowModalEdit] = useState(false) const [IDGrupoRegulatorio, setIDGrupoRegulatorio] = useState( props.detail.grupoRegulatorio @@ -59,6 +64,7 @@ export default function RptConsultaTraficoDetalle( const data: DTODataTraficoConsulta = { id: props.detail.id, swConsulta: EstatusSwith, + conceptoConsulta: IDConceptoConsulta, grupoRegulatorio: IDGrupoRegulatorio, regulacionConsulta: RegulacionConsulta, comentariosConsulta: ComentariosConsulta @@ -82,6 +88,11 @@ export default function RptConsultaTraficoDetalle( } }, [EstatusSwith, UserChanged]) + useEffect(() => { + let selected = mConceptosConsulta.filter((a)=>{if(a.id==IDConceptoConsulta){return a}}); + if (selected.length) setConceptoConsulta(selected[0].spanishDescription) + }, [IDConceptoConsulta]) + return ( <> @@ -245,61 +256,7 @@ export default function RptConsultaTraficoDetalle( }} /> - {/* - {CumplimientoNormativo} - } - > - {({ ref, ...triggerHandler }) => ( - - )} - - - - {Comentarios}} - > - {({ ref, ...triggerHandler }) => ( - - )} - - - - */} - + { @@ -309,10 +266,10 @@ export default function RptConsultaTraficoDetalle( dialogClassName={'modal-50w'} > - Consulta Amazon {IDGrupoRegulatorio} + Consulta Amazon {/* {IDGrupoRegulatorio} */} -
+
Grupo Regulatorio @@ -334,6 +291,36 @@ export default function RptConsultaTraficoDetalle(   + + + + { + setIDConceptoConsulta(parseInt(e.target.value)) + }} + className="form-select form-select-sm" + > + {mConceptosConsulta + ? mConceptosConsulta.map((c) => { + return + }) + : null} + + + + + +   + Regulacion