diff --git a/src/Components/Operaciones/OpMonitor.tsx b/src/Components/Operaciones/OpMonitor.tsx index 99ca95a..e65af30 100644 --- a/src/Components/Operaciones/OpMonitor.tsx +++ b/src/Components/Operaciones/OpMonitor.tsx @@ -1,12 +1,12 @@ import React, { FC, useEffect, useState } from 'react' import { Alert, Button, Card, Col, Form, Modal, Row, Table } from 'react-bootstrap' import { IconContext } from 'react-icons' -import { BsChevronDown, BsChevronUp, BsFillPencilFill, BsPlusSquareFill } from 'react-icons/bs' +import { BsChevronDown, BsChevronRight, BsChevronUp, BsFillPencilFill, BsPlusSquareFill } from 'react-icons/bs' import { useDispatch, useSelector } from 'react-redux' import { RootState } from '../../store/store' import DTOOpViajes from '../../DTOs/Operaciones/DTOViajes' import DSOpViajes from '../../Services/Operaciones/OpViajes.Services' -import { ViajesServicios } from './ViajesServicios/ViajesServicios' +import { Servicios } from './Viaje/Servicios/Servicios' import { populateOpViajes, updateOpViajes } from '../../store/features/Operaciones/OpViajesSlice' import { Viaje } from './Viaje/Viaje' import '../../css/masterDetail.css' @@ -49,8 +49,6 @@ export const OpMonitor: FC = (props) => { setIDViaje(row.id) setRefAA(row.refAgenciaAduanal) setIDCliente(row.cliente) - setIDServicio(row.servicio) - setIDProveedor(row.proveedor) setIDTipoUnidad(row.tipoUnidad) setNoCaja(row.noCaja) setIDOrigen(row.origen) @@ -80,37 +78,6 @@ export const OpMonitor: FC = (props) => { setShowTripDialog(true) } - const saveInfo = () => { - const data: DTOOpViajes = { - id: IDViaje, - fAlta: '', - usuario: UserID, - fCruce: '', - refAgenciaAduanal: RefAA, - cliente: IDCliente, - sCliente: '', - proveedor: IDProveedor, - sProveedor: '', - tipoUnidad: IDTipoUnidad, - sTipoUnidad: '', - servicio: IDServicio, - sServicio: '', - origen: IDOrigen, - sOrigen: '', - destino: IDDestino, - sDestino: '', - hazmat: Hazmat, - noCaja: NoCaja, - pickUpNumber: PickUpNumber, - max: true, - } - DSOpViajes.Append(data) - .then((response) => { - loadTrips() - }) - .catch((e: Error) => {}) - } - useEffect(() => { loadTrips() }, []) @@ -152,9 +119,11 @@ export const OpMonitor: FC = (props) => { - AOL : Monitor de viajes + Monitor de Viajes - + + +
{ newTrip() @@ -166,7 +135,6 @@ export const OpMonitor: FC = (props) => {
-
@@ -191,11 +159,9 @@ export const OpMonitor: FC = (props) => { - + - - @@ -235,7 +201,7 @@ export const OpMonitor: FC = (props) => { ) : ( - + )} @@ -245,18 +211,6 @@ export const OpMonitor: FC = (props) => { > {MasterData.sCliente} - - {MasterData.max === true ? ( - + ) : ( diff --git a/src/Components/Operaciones/Viaje/Servicios/Servicios.tsx b/src/Components/Operaciones/Viaje/Servicios/Servicios.tsx new file mode 100644 index 0000000..68e5698 --- /dev/null +++ b/src/Components/Operaciones/Viaje/Servicios/Servicios.tsx @@ -0,0 +1,140 @@ +import React, { FC, useState } from 'react' +import { Button } from 'react-bootstrap' +import { IconContext } from 'react-icons' +import { BsFillPencilFill, BsXSquareFill } from 'react-icons/bs' +import { useDispatch, useSelector } from 'react-redux' +/* import DTOOpViajes from '../../../DTOs/Operaciones/DTOViajes' +import DTOViajesServicios from '../../../DTOs/Operaciones/DTOViajesServicios' */ +import { RootState } from '../../../../store/store' +import DSOpViajes from '../../../../Services/Operaciones/OpViajes.Services' +import { deleteOpViajesServicios } from '../../../../store/features/Operaciones/OpViajesServiciosSlice' +import DTOViajesServicios from '../../../../DTOs/Operaciones/DTOViajesServicios' + +interface IProps { + IDMaster: number + actionButtons: boolean + onLoadDetail: (id: number) => void +} + +export const Servicios: FC = (props) => { + const dispatch = useDispatch() + const mAllTripServices = useSelector((state: RootState) => state.OpViajesServicios.OpViajesServicios) + const mAduanas = useSelector((state: RootState) => state.CatAduanas.CatAduanas) + const [DisplayTable, setDisplayTable] = useState(true) + + const deleteService = (id: number) => { + DSOpViajes.DeleteService(id) + .then((responsed) => { + dispatch(deleteOpViajesServicios(id)) + }) + .catch((e: Error) => {}) + } + + const getAduana = (id: number) => { + let found = mAduanas.filter((a) => { + if (a.id === id) { + return a + } + }) + // console.log(found) + if (found.length) { + if (found[0].Aduana === 'Aduana') return '' + else return found[0].Aduana + } + return '' + } + + const editService = (service: DTOViajesServicios) => {} + + return ( +
+
idAOL   ClienteServicioProveedor Origen Destino Tipo Unidad - {MasterData.sServicio} - - {MasterData.sProveedor} - = (props) => {
- +
+ + + {/* */} + {props.actionButtons ? ( + <> + + + ) : ( + '' + )} + + + + + + {props.actionButtons ? ( + <> + + + ) : ( + '' + )} + + + + {mAllTripServices + ? mAllTripServices + .filter(function (service) { + return service.idViaje === props.IDMaster + }) + .map(function (service) { + return ( + + {/* */} + {props.actionButtons ? ( + <> + + + ) : ( + '' + )} + + + + + + {props.actionButtons ? ( + <> + + + ) : ( + '' + )} + + ) + }) + : ''} + +
idServicioCajaAduanaProveedorComentarios
{service.id} + + {service.sServicio}{service.noCaja}{getAduana(service.aduana)}{service.sProveedor}{service.comentarios} + +
+ + ) +} diff --git a/src/Components/Operaciones/Viaje/Viaje.tsx b/src/Components/Operaciones/Viaje/Viaje.tsx index 14df006..79d8424 100644 --- a/src/Components/Operaciones/Viaje/Viaje.tsx +++ b/src/Components/Operaciones/Viaje/Viaje.tsx @@ -5,9 +5,12 @@ import DTOOpViajes from '../../../DTOs/Operaciones/DTOViajes' import DSOpViajes from '../../../Services/Operaciones/OpViajes.Services' import { updateOpViajes } from '../../../store/features/Operaciones/OpViajesSlice' import { RootState } from '../../../store/store' -import { populateOpViajesServicios } from '../../../store/features/Operaciones/OpViajesServiciosSlice' +import { + populateOpViajesServicios, + updateOpViajesServicios, +} from '../../../store/features/Operaciones/OpViajesServiciosSlice' import DTOViajesServicios from '../../../DTOs/Operaciones/DTOViajesServicios' -import { ViajesServicios } from '../ViajesServicios/ViajesServicios' +import { Servicios } from '../Viaje/Servicios/Servicios' interface IProps { IDViaje: number @@ -16,6 +19,7 @@ interface IProps { export const Viaje: FC = (props) => { const dispatch = useDispatch() const mAllTrips = useSelector((state: RootState) => state.OpViajes.OpViajes) + const mAllTripServices = useSelector((state: RootState) => state.OpViajesServicios.OpViajesServicios) const Info = JSON.parse(localStorage.getItem('tokenInfo') || '[]') const UserID = Info.UserId const CatClientes = useSelector((state: RootState) => state.CatClientes.CatClientes) @@ -23,11 +27,14 @@ export const Viaje: FC = (props) => { const CatTipoUnidades = useSelector((state: RootState) => state.CatTipoUnidades.CatTipoUnidades) const CatUbicaciones = useSelector((state: RootState) => state.CatUbicaciones.CatUbicaciones) const CatServicios = useSelector((state: RootState) => state.CatServicios.CatServicios) + const CatAduanas = useSelector((state: RootState) => state.CatAduanas.CatAduanas) const [OpViajes, setOpViajes] = useState([]) const [showTripDialog, setShowTripDialog] = useState(false) const [Switch, setSwitch] = useState(false) const [NoCaja, setNoCaja] = useState('') + const [UltimaCaja, setUltimaCaja] = useState('') const [IDViaje, setIDViaje] = useState(0) + const [IDDetail, setIDDetail] = useState(0) const [IDCliente, setIDCliente] = useState(0) const [IDProveedor, setIDProveedor] = useState(0) const [IDServicio, setIDServicio] = useState(0) @@ -50,14 +57,14 @@ export const Viaje: FC = (props) => { setIDViaje(row.id) setRefAA(row.refAgenciaAduanal) setIDCliente(row.cliente) - setIDServicio(row.servicio) - setIDProveedor(row.proveedor) setIDTipoUnidad(row.tipoUnidad) setNoCaja(row.noCaja) setIDOrigen(row.origen) setIDDestino(row.destino) setHazmat(row.hazmat) setPickUpNumber(row.pickUpNumber) + setTipoOperacion(row.tipoOperacion) + setPedimento(row.pedimento) return row } }) @@ -66,44 +73,104 @@ export const Viaje: FC = (props) => { }, [props.IDViaje]) useEffect(() => { - if (IDNuevoServicio === 1 || IDNuevoServicio === 2 || IDNuevoServicio === 22) setDisableAduana(false) + if (IDServicio === 1 || IDServicio === 2 || IDServicio === 22) setDisableAduana(false) else setDisableAduana(true) - }, [IDNuevoServicio]) + }, [IDServicio]) - const addService = () => { + useEffect(() => { + DSOpViajes.GetLastTrailerBox(IDViaje) + .then((response) => { + const LastTrailerBox = response.data.ultimaCaja + // console.log('lasttrailerbox=' + LastTrailerBox) + if (LastTrailerBox.length === 0) setUltimaCaja(NoCaja) + else setUltimaCaja(LastTrailerBox) + }) + .catch((e: Error) => { + // console.log('currio un error') + }) + //console.log('nocaja=' + NoCaja) + }, [NoCaja]) + + useEffect(() => { + if (Hazmat === 1) setAduana(180) + else setAduana(0) + }, [Hazmat]) + + const saveDetail = () => { + if (IDServicio === 0) { + alert('Para continuar, primero seleccione un servicio') + return false + } + if (IDProveedor === 0) { + alert('Para continuar, primero seleccione un proveedor') + return false + } const data: DTOViajesServicios = { - id: 0, - idViaje: props.IDViaje, - idServicio: IDNuevoServicio, + id: IDDetail, + idViaje: IDViaje, + idServicio: IDServicio, sServicio: '', aduana: Aduana, comentarios: Comentarios, idProveedor: IDProveedor, sProveedor: '', + noCaja: UltimaCaja, } DSOpViajes.AppendServices(data) .then((responsed) => { - console.log('Item regresado del post=' + JSON.stringify(responsed.data)) - dispatch(populateOpViajesServicios(responsed.data)) + // console.log('Item regresado del post=' + JSON.stringify(responsed.data)) + if (IDDetail === 0) { + dispatch(populateOpViajesServicios(responsed.data)) + setIDDetail(responsed.data[0].id) + } else { + dispatch(updateOpViajesServicios(responsed.data)) + } + clearDetailForm() }) .catch((e: Error) => {}) } - const saveInfo = () => { + const loadService = (id: number) => { + let found = mAllTripServices.filter((a) => { + if (a.id === id) { + return a + } + }) + if (found) { + setIDDetail(id) + setAduana(found[0].aduana) + setIDServicio(found[0].idServicio) + setComentarios(found[0].comentarios) + setIDProveedor(found[0].idProveedor) + } + } + + const saveMaster = () => { + let totalServicios = mAllTripServices.filter((a) => { + if (a.idViaje === IDViaje) { + return a + } + }) + if (totalServicios.length === 0) { + if (IDServicio === 0) { + alert('Para continuar, primero seleccione un servicio') + return false + } + if (IDProveedor === 0) { + alert('Para continuar, primero seleccione un proveedor') + return false + } + } + /* */ const data: DTOOpViajes = { id: IDViaje, fAlta: '', usuario: UserID, - fCruce: '', refAgenciaAduanal: RefAA, cliente: IDCliente, sCliente: '', - proveedor: IDProveedor, - sProveedor: '', tipoUnidad: IDTipoUnidad, sTipoUnidad: '', - servicio: IDServicio, - sServicio: '', origen: IDOrigen, sOrigen: '', destino: IDDestino, @@ -111,6 +178,8 @@ export const Viaje: FC = (props) => { hazmat: Hazmat, noCaja: NoCaja, pickUpNumber: PickUpNumber, + tipoOperacion: TipoOperacion, + pedimento: Pedimento, max: true, } DSOpViajes.Append(data) @@ -118,10 +187,21 @@ export const Viaje: FC = (props) => { const data = response.data data['max'] = false dispatch(updateOpViajes(data)) + setIDViaje(data.id) + saveDetail() }) .catch((e: Error) => {}) } + const clearDetailForm = () => { + setIDDetail(0) + setAduana(0) + setIDServicio(0) + setComentarios('') + setIDProveedor(0) + setDisableAduana(true) + } + return (
@@ -131,7 +211,9 @@ export const Viaje: FC = (props) => { - Ref AA + + Ref AA + = (props) => { }} /> - - - + Cliente @@ -202,7 +275,9 @@ export const Viaje: FC = (props) => { : null} - Caja + + Caja + = (props) => { : null} - Destino + + Destino + = (props) => { - HAZMAT + HazMat = (props) => { - T. operacion + + Tipo operacion + = (props) => { }} /> - + PickUp No + + { + setPickUpNumber(e.target.value) + }} + /> + + + + @@ -336,14 +437,14 @@ export const Viaje: FC = (props) => { - Servicio + Servicio { - setIDNuevoServicio(parseInt(e.target.value)) + setIDServicio(parseInt(e.target.value)) }} - value={IDNuevoServicio} + value={IDServicio} className='form-select form-select-sm dialogLabel' > @@ -358,7 +459,10 @@ export const Viaje: FC = (props) => { : null} - + + Aduana + + { @@ -368,15 +472,21 @@ export const Viaje: FC = (props) => { disabled={DisableAduana} className='form-select form-select-sm dialogLabel' > - - - + {CatAduanas + ? CatAduanas.map((c) => { + return ( + + ) + }) + : null} - Comentarios - + Comentarios + = (props) => { - Proveedor - + Proveedor + { @@ -412,12 +522,25 @@ export const Viaje: FC = (props) => { - - + Caja + + { + setUltimaCaja(e.target.value) + }} + /> + + +
) } diff --git a/src/Components/Operaciones/ViajesServicios/ViajesServicios.tsx b/src/Components/Operaciones/ViajesServicios/ViajesServicios.tsx deleted file mode 100644 index a26f9b2..0000000 --- a/src/Components/Operaciones/ViajesServicios/ViajesServicios.tsx +++ /dev/null @@ -1,83 +0,0 @@ -import React, { FC, useState } from 'react' -import { Button } from 'react-bootstrap' -import { IconContext } from 'react-icons' -import { BsFillPencilFill, BsXSquareFill } from 'react-icons/bs' -import { useDispatch, useSelector } from 'react-redux' -import DTOOpViajes from '../../../DTOs/Operaciones/DTOViajes' -import DTOViajesServicios from '../../../DTOs/Operaciones/DTOViajesServicios' -import { RootState } from '../../../store/store' -import DSOpViajes from '../../../Services/Operaciones/OpViajes.Services' -import { deleteOpViajesServicios } from '../../../store/features/Operaciones/OpViajesServiciosSlice' - -interface IProps { - IDMaster: number -} - -export const ViajesServicios: FC = (props) => { - const dispatch = useDispatch() - const AllTripsServices = useSelector((state: RootState) => state.OpViajesServicios.OpViajesServicios) - const [DisplayTable, setDisplayTable] = useState(true) - - const deleteService = (id: number) => { - DSOpViajes.DeleteService(id) - .then((responsed) => { - dispatch(deleteOpViajesServicios(id)) - }) - .catch((e: Error) => {}) - } - - return ( -
- - - - - - - - - - - - - {AllTripsServices - ? AllTripsServices.filter(function (service) { - return service.idViaje === props.IDMaster - }).map(function (service) { - return ( - { - // changeToggle(MasterData) - }} - style={{ cursor: 'pointer' }} - > - - - - - - - - ) - }) - : ''} - -
idServicioAduanaProveedorComentarios
{service.id}{service.sServicio}{service.aduana}{service.sProveedor}{service.comentarios} - -
-
- ) -} diff --git a/src/DTOs/Operaciones/DTOUltimaCaja.ts b/src/DTOs/Operaciones/DTOUltimaCaja.ts new file mode 100644 index 0000000..f213e8a --- /dev/null +++ b/src/DTOs/Operaciones/DTOUltimaCaja.ts @@ -0,0 +1,3 @@ +export default interface UltimaCaja { + ultimaCaja: string +} \ No newline at end of file diff --git a/src/DTOs/Operaciones/DTOViajes.ts b/src/DTOs/Operaciones/DTOViajes.ts index 3bec312..50ac129 100644 --- a/src/DTOs/Operaciones/DTOViajes.ts +++ b/src/DTOs/Operaciones/DTOViajes.ts @@ -2,12 +2,9 @@ export default interface DTOOpViajes { id: number, fAlta: string, usuario: number, - fCruce: string, refAgenciaAduanal: string, cliente: number, sCliente: string, - proveedor: number, - sProveedor: string, hazmat: number, tipoUnidad: number, sTipoUnidad: string, @@ -17,7 +14,7 @@ export default interface DTOOpViajes { sOrigen: string, destino: number sDestino: string, - servicio: number, - sServicio: string, + tipoOperacion: number, + pedimento: string, max: boolean } \ No newline at end of file diff --git a/src/DTOs/Operaciones/DTOViajesServicios.ts b/src/DTOs/Operaciones/DTOViajesServicios.ts index 21d0330..705271d 100644 --- a/src/DTOs/Operaciones/DTOViajesServicios.ts +++ b/src/DTOs/Operaciones/DTOViajesServicios.ts @@ -6,5 +6,6 @@ export default interface DTOViajesServicios { aduana: number, comentarios: string, idProveedor: number, - sProveedor: string + sProveedor: string, + noCaja: string } \ No newline at end of file diff --git a/src/Interfaces/Catalogos/ICatAduanas.ts b/src/Interfaces/Catalogos/ICatAduanas.ts new file mode 100644 index 0000000..2dda182 --- /dev/null +++ b/src/Interfaces/Catalogos/ICatAduanas.ts @@ -0,0 +1,4 @@ +export default interface ICatAduanas { + id: number, + Aduana: string +} \ No newline at end of file diff --git a/src/Services/Operaciones/OpViajes.Services.ts b/src/Services/Operaciones/OpViajes.Services.ts index 0856347..62fdd02 100644 --- a/src/Services/Operaciones/OpViajes.Services.ts +++ b/src/Services/Operaciones/OpViajes.Services.ts @@ -2,6 +2,7 @@ import http from "../../Services/Auth/config/http-common"; import DTOViajes from "../../DTOs/Operaciones/DTOViajes"; import IRespuesta from "../../Interfaces/Respuestas/IRespuesta"; import DTOViajesServicios from "../../DTOs/Operaciones/DTOViajesServicios"; +import DTOUltimaCaja from "../../DTOs/Operaciones/DTOUltimaCaja"; class OpViajesDataService { Get() { @@ -10,6 +11,9 @@ class OpViajesDataService { GetAllServices() { return http.get("Operaciones/OpViajes/GetAllServices"); } + GetLastTrailerBox(idViaje: number) { + return http.get(`Operaciones/OpViajes/GetLastTrailerBox?idViaje=${idViaje}`); + } Append(data: DTOViajes) { return http.post(`Operaciones/OpViajes/Append`,data); } diff --git a/src/css/masterDetail.css b/src/css/masterDetail.css index c49bfb0..a33718b 100644 --- a/src/css/masterDetail.css +++ b/src/css/masterDetail.css @@ -28,7 +28,7 @@ background-color: #255dde; color: #FFFFFF; height: 25px; - text-align: left !important; + text-align: center !important; } .MDTable tbody tr td { @@ -63,32 +63,39 @@ } .masterSelected { -/* background-color: #dbe5f3 !important; */ -/* font-weight: bold; */ color: #000000; - /* border-top: solid 2px #f40505;*/ - border-bottom: solid 2px #f4a005; - /* text-shadow: 1px 1px 1px #fff; */ - /* background-color: #72a9a9 !important; - font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif; */ + border-top: solid 4px #f4a005; + border-right: solid 1px #f4a005; + border-left: solid 1px #f4a005; + text-align: center !important; } -.notmalSelected { - /* background-color: #6695db !important; */ - /* font-weight: bold; */ +.normalSelected { color: #000000; border-top: none; border-bottom: none; - text-align: center; - /* text-shadow: 1px 1px 1px #fff; */ - /* background-color: #72a9a9 !important; - font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif; */ + text-align: center !important; +} + +.masterSelected2 { + color: #000000; + border-bottom: solid 3px #f4a005; + border-right: solid 1px #f4a005; + border-left: solid 1px #f4a005; + text-align: center !important; +} + +.normalSelected2 { + color: #000000; + border-top: none; + border-bottom: none; + text-align: center !important; } .zui-table { border: solid 1px #DDEEEE; border-collapse: collapse; - border-spacing: 0; + border-spacing: 5px; font: normal 11px Arial, sans-serif; } @@ -96,8 +103,8 @@ background-color: #DDEFEF; border: solid 1px #DDEEEE; color: #336B6B; - padding: 5px; - text-align: left; + padding: 5px 5px 5px 15px; + text-align: center; text-shadow: 1px 1px 1px #fff; } @@ -106,6 +113,7 @@ color: #333; padding: 0px; text-shadow: 1px 1px 1px #fff; + padding: 0px 0px 0px 15px; border-bottom: none; border-top: none; } diff --git a/src/store/features/Catalogos/CatAduanasSlice.ts b/src/store/features/Catalogos/CatAduanasSlice.ts new file mode 100644 index 0000000..955a279 --- /dev/null +++ b/src/store/features/Catalogos/CatAduanasSlice.ts @@ -0,0 +1,32 @@ +import { createSlice, PayloadAction } from '@reduxjs/toolkit' +import ICatAduanas from '../../../Interfaces/Catalogos/ICatAduanas' +const CatAduanas: ICatAduanas[] = [{id:0, Aduana: 'Aduana'}, {id:240, Aduana: 'Nuevo Laredo, Tamps.'}, {id:180, Aduana: 'Colombia, N. L.'}] +const initialState = { CatAduanas } + +export const CatAduanasSlice = createSlice({ + name: 'CatAduanas', + initialState: initialState, + reducers: { + resetCatAduanas : (state, action: PayloadAction) => { + state.CatAduanas = [] + }, + populateCatAduanas : (state, action: PayloadAction) => { + action.payload.forEach(element => { + const index = state.CatAduanas.findIndex(object => object.id === element.id) + if (index<0) state.CatAduanas.push(element) + }) + }, + updateCatAduanas : (state, action: PayloadAction) => { + const i = state.CatAduanas.findIndex(_element => _element.id === action.payload.id); + if (i > -1) state.CatAduanas[i] = action.payload; + else state.CatAduanas.push(action.payload); + }, + deleteCatAduanas : (state, action: PayloadAction) => { + const newArr = state.CatAduanas.filter(data => data.id != action.payload); + state.CatAduanas=newArr + }, + }, +}) + +export const { resetCatAduanas, populateCatAduanas, updateCatAduanas, deleteCatAduanas } = CatAduanasSlice.actions; +export default CatAduanasSlice.reducer; \ No newline at end of file diff --git a/src/store/features/Operaciones/OpViajesServiciosSlice.ts b/src/store/features/Operaciones/OpViajesServiciosSlice.ts index c0ed212..0ffe851 100644 --- a/src/store/features/Operaciones/OpViajesServiciosSlice.ts +++ b/src/store/features/Operaciones/OpViajesServiciosSlice.ts @@ -16,10 +16,12 @@ export const OpViajesServiciosSlice = createSlice({ if (index<0) state.OpViajesServicios.push(element) }) }, - updateOpViajesServicios : (state, action: PayloadAction) => { - const i = state.OpViajesServicios.findIndex(_element => _element.id === action.payload.id); - if (i > -1) state.OpViajesServicios[i] = action.payload; - else state.OpViajesServicios.push(action.payload); + updateOpViajesServicios : (state, action: PayloadAction) => { + action.payload.forEach(row => { + const i = state.OpViajesServicios.findIndex(_element => _element.id === row.id); + if (i > -1) state.OpViajesServicios[i] = row; + else state.OpViajesServicios.push(row); + }) }, deleteOpViajesServicios : (state, action: PayloadAction) => { const newArr = state.OpViajesServicios.filter(data => data.id != action.payload); diff --git a/src/store/store.ts b/src/store/store.ts index 4a72d03..c75e60c 100644 --- a/src/store/store.ts +++ b/src/store/store.ts @@ -7,6 +7,7 @@ import { CatProveedoresSlice } from './features/Catalogos/CatProveedoresSlice' import { CatServiciosSlice } from './features/Catalogos/CatServiciosSlice' import { CatTipoUnidadesSlice } from './features/Catalogos/CatTipoUnidadesSlice' import { CatUbicacionesSlice } from './features/Catalogos/CatUbicacionesSlice' +import { CatAduanasSlice } from './features/Catalogos/CatAduanasSlice' import { OpViajesSlice } from './features/Operaciones/OpViajesSlice' import { OpViajesServiciosSlice } from './features/Operaciones/OpViajesServiciosSlice' @@ -19,6 +20,7 @@ export const store = configureStore({ CatTipoUnidades: CatTipoUnidadesSlice.reducer, CatUbicaciones: CatUbicacionesSlice.reducer, CatServicios: CatServiciosSlice.reducer, + CatAduanas : CatAduanasSlice.reducer, OpViajes: OpViajesSlice.reducer, OpViajesServicios: OpViajesServiciosSlice.reducer }