diff options
| author | gabrhr <[email protected]> | 2022-05-27 12:50:13 -0500 |
|---|---|---|
| committer | gabrhr <[email protected]> | 2022-05-27 12:50:13 -0500 |
| commit | 9c396976bb42a9d41407358ce1a1d37242230f21 (patch) | |
| tree | 41b5fdf7d321f70c7e39bb788ef6ce0db6b4a6e3 | |
| parent | 55c0f57d42d82f1f1f5809e9c7d6845b6e0b68af (diff) | |
| download | DP1_project-9c396976bb42a9d41407358ce1a1d37242230f21.tar.gz DP1_project-9c396976bb42a9d41407358ce1a1d37242230f21.tar.bz2 DP1_project-9c396976bb42a9d41407358ce1a1d37242230f21.zip | |
Add redux, dispatch and etiquetas
- estetica de etiquetas (ok)
- add message, pedido Reducer
- add dispatch en Componentes con connect
- add api reducer que obtienen el JSON todo ok
#TODO
- FIX logica de añadiir
- FIX axios y dispatch fuera de un componente
24 files changed, 481 insertions, 57 deletions
diff --git a/front/odiparpack/app/actions/actionTypes.js b/front/odiparpack/app/actions/actionTypes.js index 08986f2..5aaa47a 100644 --- a/front/odiparpack/app/actions/actionTypes.js +++ b/front/odiparpack/app/actions/actionTypes.js @@ -82,3 +82,10 @@ export const DELETE_EVENT = 'DELETE_EVENT'; // Notification Form export const CLOSE_NOTIF = 'CLOSE_NOTIF'; + + +//Odi Message +export const CLOSE_MESSAGE = 'CLOSE_MESSAGE'; +export const OPEN_MESSAGE = 'OPEN_MESSAGE'; + +export const LISTA_PEDIDO = 'SAVE_PEDIDO';
\ No newline at end of file diff --git a/front/odiparpack/app/actions/message.js b/front/odiparpack/app/actions/message.js new file mode 100644 index 0000000..881a41f --- /dev/null +++ b/front/odiparpack/app/actions/message.js @@ -0,0 +1,17 @@ +import * as types from './actionTypes'; +import { partial } from 'odi-utils/constants'; + + +export const closeMessage = () => ({ + type: types.CLOSE_MESSAGE, +}) + +export const setMessage = (type, message) => ({ + type: types.OPEN_MESSAGE, + payload: { + type, message + } +}) + +export const openSuccessMessage = partial(setMessage, 'success'); +export const openErrorMessage = partial(setMessage, 'error');
\ No newline at end of file diff --git a/front/odiparpack/app/actions/pedido.js b/front/odiparpack/app/actions/pedido.js new file mode 100644 index 0000000..15382fe --- /dev/null +++ b/front/odiparpack/app/actions/pedido.js @@ -0,0 +1,26 @@ +import { + getPedidosAPI +} from 'ba-api/pedido'; +import { addMessageCurry } from 'odi-utils/api'; +import * as types from './actionTypes' + +export const setPedidos = (payload) => ({ + type: types.LISTA_PEDIDO, + payload +}); + +export const getPedidos = () => { + return dispatch => { + return new Promise( + (resolve, reject) => { + console.log("entreeeeeeeeee") + addMessageCurry(getPedidosAPI(), dispatch, '',"aaaaaaaaa") + .then(pedidos => { + dispatch(setPedidos({pedidos})); + resolve(pedidos) + console.log(pedidos) + }) + } + ) + } +}
\ No newline at end of file diff --git a/front/odiparpack/app/api/pedido.js b/front/odiparpack/app/api/pedido.js new file mode 100644 index 0000000..7cfb3f7 --- /dev/null +++ b/front/odiparpack/app/api/pedido.js @@ -0,0 +1,6 @@ +import { apiPost, apiGet, apiDelete, apiPut } from "odi-utils/api"; + +//GET APIS +export const getPedidosAPI = () => { + return apiGet('ayuda/') +}
\ No newline at end of file diff --git a/front/odiparpack/app/components/Odipar/EtiquetaData.js b/front/odiparpack/app/components/Odipar/EtiquetaData.js index 4a2a37c..a2f262d 100644 --- a/front/odiparpack/app/components/Odipar/EtiquetaData.js +++ b/front/odiparpack/app/components/Odipar/EtiquetaData.js @@ -1,10 +1,5 @@ //Pedido export const pedido = { - entregado: { - text: "Entregado", - color: "#81C784", - icon: false - }, pendiente:{ text: "Pendiente", color: "#FFB74D", @@ -15,59 +10,71 @@ export const pedido = { color: "#64B5F6", icon: false }, + entregado: { + text: "Entregado", + color: "#81C784", + icon: false + }, cancelado: { text: "Cancelado", color: "#E57373", icon: false - } + }, + pendienteAveria:{ + text: "Pendiente por Averia", + color: "#FFB74D", + icon: false + } } //Camion export const camion = { - entregado: { - text: "Entregado", + disponible : { + text: "Disponible", color: "#81C784", icon: false }, - pendiente:{ - text: "Pendiente", - color: "#FFB74D", + enReparto: { + text: "En Reparto", + color: "#64B5F6", icon: false }, - enCamino: { - text: "En Camino", - color: "#64B5F6", + mantenimiento:{ + text: "Mantenimiento", + color: "#FFB74D", icon: false }, cancelado: { - text: "Cancelado", + text: "Inhabilitado", color: "#E57373", icon: false } } + //Bloqueos export const bloqueo = { desbloqueado: { - text: "Entregado", + text: "Disponible", color: "#81C784", icon: false }, bloqueado:{ - text: "Pendiente", - color: "#FFB74D", + text: "Bloqueado", + color: "#E57373", icon: false } } - + + //Almacen export const almacen = { noPrincipal: { text: "Pequeño", - color: "#81C784", - icon: false + color: "#DED8D8", + icon: 10 }, principal:{ text: "Principal", - color: "#FFB74D", - icon: false + color: "#DED8D8", + icon: 16 } }
\ No newline at end of file diff --git a/front/odiparpack/app/components/Odipar/common.js b/front/odiparpack/app/components/Odipar/common.js index c66b792..39ba76a 100644 --- a/front/odiparpack/app/components/Odipar/common.js +++ b/front/odiparpack/app/components/Odipar/common.js @@ -1,6 +1,7 @@ import React from "react" import { Chip } from "@material-ui/core"; -import {pedido, camion, bloqueo, almacen} from './EtiquetaData' +import { pedido, camion, bloqueo, almacen } from './EtiquetaData' +import Brightness1Icon from '@material-ui/icons/Brightness1'; const etiquetaStyle = color => ({ fontWeight: 'bold', @@ -11,7 +12,7 @@ const etiquetaStyle = color => ({ //Etiquetas export function etiqueta(tipo , estado) { // eslint-disable-line - let {color, text} = "" + let {color, text, icon} = "" switch(tipo){ case 'etiq_pedido': text = pedido[Object.keys(pedido)[estado]].text @@ -29,10 +30,13 @@ export function etiqueta(tipo , estado) { // eslint-disable-line console.log("entre?") text = almacen[Object.keys(almacen)[estado]].text color = almacen[Object.keys(almacen)[estado]].color + icon = almacen[Object.keys(almacen)[estado]].icon break; } return ( - <Chip label={text} style={etiquetaStyle(color)}/> + tipo == "etiq_alma" ? + <Chip label={text} icon = {<Brightness1Icon style={{ fontSize: icon, color: "#B1ABAB" }}/>} style={{fontWeight: 'bold', backgroundColor: color}}/> : + <Chip label={text} style={etiquetaStyle(color)}/> ) }
\ No newline at end of file diff --git a/front/odiparpack/app/components/Sidebar/MainMenuSimple.js b/front/odiparpack/app/components/Sidebar/MainMenuSimple.js index f7634ca..18ac8fd 100644 --- a/front/odiparpack/app/components/Sidebar/MainMenuSimple.js +++ b/front/odiparpack/app/components/Sidebar/MainMenuSimple.js @@ -5,10 +5,8 @@ import classNames from 'classnames'; import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; import { NavLink } from 'react-router-dom'; -import ExpandLess from '@material-ui/icons/ExpandLess'; -import ExpandMore from '@material-ui/icons/ExpandMore'; // Menu Object -import MenuContent from 'ba-api/menu'; +import MenuContent from 'odi-utils/menu'; import { List, ListItem, ListItemIcon, ListItemText, Collapse, Icon } from '@material-ui/core'; import styles from './sidebar-jss'; diff --git a/front/odiparpack/app/components/Tables/CrudTableForm.js b/front/odiparpack/app/components/Tables/CrudTableForm.js index d2d2ea8..219fcd2 100644 --- a/front/odiparpack/app/components/Tables/CrudTableForm.js +++ b/front/odiparpack/app/components/Tables/CrudTableForm.js @@ -6,6 +6,7 @@ import FloatingPanel from './../Panel/FloatingPanel'; class CrudTableForm extends React.Component { componentDidMount() { + console.log("en el FORM",this.props.dataInit) this.props.fetchData(this.props.dataInit, this.props.branch); } @@ -31,6 +32,7 @@ class CrudTableForm extends React.Component { } = this.props; return ( <div> + <FloatingPanel openForm={openForm} branch={branch} closeForm={closeForm}> <Form onSubmit={this.sendValues} initValues={initValues} branch={branch}> {children} diff --git a/front/odiparpack/app/containers/App/index.js b/front/odiparpack/app/containers/App/index.js index a7313fe..ea78618 100644 --- a/front/odiparpack/app/containers/App/index.js +++ b/front/odiparpack/app/containers/App/index.js @@ -5,11 +5,51 @@ import Auth from './Auth'; import Application from './Application'; import LoginDedicated from '../Pages/Standalone/LoginDedicated'; import ThemeWrapper from './ThemeWrapper'; +import { Snackbar, Button, Icon } from '@material-ui/core'; +import { connect } from 'react-redux'; window.__MUI_USE_NEXT_TYPOGRAPHY_VARIANTS__ = true; -function App() { +function App(props) { + + const handleMessageClose = () => { + props.dispatch(closeMessage()) + } + + const { + openMessage = false, + message = '', + type = 'error' + } = props + return ( <ThemeWrapper> + <Snackbar + anchorOrigin={{ + vertical: 'top', + horizontal: 'right', + }} + open={openMessage} + autoHideDuration={6000} + onClose={handleMessageClose} + message={ + <div className="center-aligned-child"> + <Icon style={{ + fontSize: 20, + marginRight: 15 + }} > + {type === 'success' ? 'check_circle' : 'report_problem'} + </Icon> + {message} + </div> + } + action={[ + <Button key="undo" color="secondary" size="small" onClick={handleMessageClose}> + <Icon> + {'close'} + </Icon> + </Button> + ]} + /> <Switch> <Route path="/" exact component={LoginDedicated} /> <Route path="/app" component={Application} /> @@ -20,4 +60,20 @@ function App() { ); } -export default App; +const reducer = 'message'; +const mapStateToProps = state => ({ + force: state, // force state from reducer + message: state.getIn([reducer, 'message']), + type: state.getIn([reducer, 'type']), + openMessage: state.getIn([reducer, 'openMessage']) +}); + +const mapDispatchToProps = dispatch => ({ + dispatch: dispatch +}); +const AppMapped = connect( + mapStateToProps, + mapDispatchToProps +)(App); + +export default AppMapped; diff --git a/front/odiparpack/app/containers/Odipar/Pedidos/Pedidos.js b/front/odiparpack/app/containers/Odipar/Pedidos/Pedidos.js index c1539e0..a9baab8 100644 --- a/front/odiparpack/app/containers/Odipar/Pedidos/Pedidos.js +++ b/front/odiparpack/app/containers/Odipar/Pedidos/Pedidos.js @@ -3,7 +3,7 @@ import { withStyles } from '@material-ui/core/styles'; import PropTypes from 'prop-types'; import { CrudPedido } from './table' import { Paper, Typography } from '@material-ui/core'; -import { etiqueta } from 'ba-components/Odipar/common'; + const styles = ({ root: { flexGrow: 1, @@ -19,9 +19,6 @@ class Pedidos extends Component { <Typography variant="h4"> {`Pedidos`} </Typography> - <div> - {etiqueta("etiq_pedido", 1)} - </div> <div> <Paper className={classes.root}> <CrudPedido title = "Historial de Pedidos"/> diff --git a/front/odiparpack/app/containers/Odipar/Pedidos/table/CrudPedido.js b/front/odiparpack/app/containers/Odipar/Pedidos/table/CrudPedido.js index b11881f..d1fd553 100644 --- a/front/odiparpack/app/containers/Odipar/Pedidos/table/CrudPedido.js +++ b/front/odiparpack/app/containers/Odipar/Pedidos/table/CrudPedido.js @@ -19,7 +19,8 @@ import { } from '@material-ui/core'; import { anchorTable, dataApi } from './sampleData'; import FormPedido from './FormPedido'; - +//actions +import { setPedidos, getPedidos } from '../../../../actions/pedido'; const branch = 'crudPedido'; @@ -40,7 +41,25 @@ const styles = ({ }); class CrudPedido extends Component { + constructor (props) { + super(props) + this.state = { + dataReal: [] + }; + + this.props.dispatch(getPedidos()) + .then( res => { + console.log("aqui en el then ps", res) + this.setState({ + dataReal: res + }) + }) + console.log("aqui en el then ps 2", this.props.pedidosLista) + + } + render() { + console.log("render ps") const { classes, fetchData, @@ -56,6 +75,11 @@ class CrudPedido extends Component { messageNotif, title, } = this.props; + + const {dataReal} = this.state; + //console.log("render ps DATA", dataReal) + //console.log("original", dataApi) + return ( <div> <Notification close={() => closeNotif(branch)} message={messageNotif} /> @@ -63,7 +87,7 @@ class CrudPedido extends Component { <CrudTableForm dataTable={dataTable} openForm={openForm} - dataInit={dataApi} + dataInit={dataReal} anchor={anchorTable} title={title} fetchData={fetchData} @@ -112,6 +136,7 @@ const mapStateToProps = state => ({ dataTable: state.getIn([branch, 'dataTable']), openForm: state.getIn([branch, 'showFrm']), messageNotif: state.getIn([branch, 'notifMsg']), + pedidosLista : state.getIn(['pedido','pedidos']), }); const mapDispatchToProps = dispatch => ({ @@ -122,6 +147,7 @@ const mapDispatchToProps = dispatch => ({ removeRow: bindActionCreators(removeAction, dispatch), editRow: bindActionCreators(editAction, dispatch), closeNotif: bindActionCreators(closeNotifAction, dispatch), + dispatch }); const CrudPedidoMapped = connect( diff --git a/front/odiparpack/app/containers/Odipar/Pedidos/table/sampleData.js b/front/odiparpack/app/containers/Odipar/Pedidos/table/sampleData.js index 2e2b003..e16f7cc 100644 --- a/front/odiparpack/app/containers/Odipar/Pedidos/table/sampleData.js +++ b/front/odiparpack/app/containers/Odipar/Pedidos/table/sampleData.js @@ -4,10 +4,10 @@ export const anchorTable = [ label: 'Id', initialValue: '', hidden: true, - type: 'texto' }, { name: 'cantidad', label: 'Cantidad', + initialValue: 0, width: 'auto', hidden: false, type: 'texto' @@ -21,28 +21,28 @@ export const anchorTable = [ }, { name: 'origen', label: 'Origen', - initialValue: 'option1', + initialValue: 'Lima', width: 'auto', hidden: false, type: 'texto' }, { name: 'destino', label: 'Destino', - initialValue: 'option1', + initialValue: 'Lima', width: 'auto', hidden: false, type: 'texto' }, { name: 'plazo_entrega', label: 'Plazo de entrega', - initialValue: true, + initialValue: 'aja', width: 'auto', hidden: false, type: 'texto' }, { name: 'nombre', label: 'Cliente', - initialValue: true, + initialValue: null, width: 'auto', hidden: false, type: 'texto' @@ -53,7 +53,8 @@ export const anchorTable = [ width: 'auto', hidden: false, type: 'etiq_pedido' - }, { + }, + { name: 'action', label: 'Action', initialValue: '', @@ -65,8 +66,9 @@ export const dataApi = [ { id: '1', cantidad: 30, - fecha: '24/05/2022 11:28 AM', + origen: 'Arequipa', + fecha: '24/05/2022 11:28 AM', destino: 'Cuzco', plazo_entrega: '24 horas', nombre: 'Juan', diff --git a/front/odiparpack/app/containers/Tables/demos/sampleData.js b/front/odiparpack/app/containers/Tables/demos/sampleData.js index d53d8e2..c783c81 100644 --- a/front/odiparpack/app/containers/Tables/demos/sampleData.js +++ b/front/odiparpack/app/containers/Tables/demos/sampleData.js @@ -9,53 +9,62 @@ export const anchorTable = [ label: 'Text Field', initialValue: null, width: 'auto', - hidden: false + hidden: false, + type:"texto" }, { name: 'email', label: 'Email Field', initialValue: null, width: 'auto', - hidden: false + hidden: false, + type:"texto" }, { name: 'radio', label: 'Radio Option', initialValue: 'option1', width: '80', - hidden: false + hidden: false, + type:"texto" }, { name: 'selection', label: 'Selection', initialValue: 'option1', width: '80', - hidden: false + hidden: false, + type:"texto" }, { name: 'onof', label: 'On/Of Input', initialValue: true, width: '80', - hidden: false + hidden: false, + type:"texto" }, { name: 'checkbox', label: 'Checkbox', initialValue: true, width: '80', - hidden: false + hidden: false, + type:"texto" }, { name: 'textarea', label: 'Text Area', initialValue: 'This is default text', width: 'auto', - hidden: false + hidden: false, + type:"texto" }, { name: 'edited', label: '', initialValue: '', - hidden: true + hidden: true, + type:"texto" }, { name: 'action', label: 'Action', initialValue: '', - hidden: false + hidden: false, + type:"texto" }, ]; diff --git a/front/odiparpack/app/redux/configureStore.js b/front/odiparpack/app/redux/configureStore.js index 49a6b7b..80c84c0 100644 --- a/front/odiparpack/app/redux/configureStore.js +++ b/front/odiparpack/app/redux/configureStore.js @@ -7,6 +7,7 @@ import { fromJS } from 'immutable'; import { routerMiddleware } from 'connected-react-router/immutable'; import createSagaMiddleware from 'redux-saga'; import createReducer from './reducers'; +import thunk from 'redux-thunk'; const sagaMiddleware = createSagaMiddleware(); @@ -14,7 +15,7 @@ export default function configureStore(initialState = {}, history) { // Create the store with two middlewares // 1. sagaMiddleware: Makes redux-sagas work // 2. routerMiddleware: Syncs the location/URL path to the state - const middlewares = [sagaMiddleware, routerMiddleware(history)]; + const middlewares = [thunk,sagaMiddleware, routerMiddleware(history)]; const enhancers = [applyMiddleware(...middlewares)]; @@ -29,11 +30,12 @@ export default function configureStore(initialState = {}, history) { shouldHotReload: false, }) : compose; + /* eslint-enable */ const store = createStore( createReducer(), fromJS(initialState), - composeEnhancers(...enhancers), + composeEnhancers(...enhancers) ); // Extensions diff --git a/front/odiparpack/app/redux/modules/crudTableForm.js b/front/odiparpack/app/redux/modules/crudTableForm.js index d5194c1..29b9813 100644 --- a/front/odiparpack/app/redux/modules/crudTableForm.js +++ b/front/odiparpack/app/redux/modules/crudTableForm.js @@ -24,6 +24,7 @@ const initialItem = (keyTemplate, anchor) => { for (let i = 0; i < rawKey.length; i += 1) { if (rawKey[i] !== 'id') { const itemIndex = anchor.findIndex(a => a.name === rawKey[i]); + if (itemIndex == -1) continue staticKey[rawKey[i]] = anchor[itemIndex].initialValue; } } diff --git a/front/odiparpack/app/redux/modules/message.js b/front/odiparpack/app/redux/modules/message.js new file mode 100644 index 0000000..e02eb08 --- /dev/null +++ b/front/odiparpack/app/redux/modules/message.js @@ -0,0 +1,30 @@ +import { CLOSE_MESSAGE,OPEN_MESSAGE } from 'ba-actions/actionTypes'; + +const initState = { + message: '', + type: '', + openMessage: false +} + +const message = (state = initState, action = {}) => { + + const { type, payload } = action; + + switch (type) { + + case CLOSE_MESSAGE: + return {...initState} + case OPEN_MESSAGE: + return { + ...state, + ...payload, + openMessage: true + } + default: + return state + + } + +} + +export default message;
\ No newline at end of file diff --git a/front/odiparpack/app/redux/modules/pedido.js b/front/odiparpack/app/redux/modules/pedido.js new file mode 100644 index 0000000..9101fe4 --- /dev/null +++ b/front/odiparpack/app/redux/modules/pedido.js @@ -0,0 +1,16 @@ +import { LISTA_PEDIDO } from 'ba-actions/actionTypes'; + +const initState = { + pedidos : [] +} + +const pedido = (state = initState, action) => { + switch (action.type) { + case LISTA_PEDIDO: + return { ...state, pedidos: action.payload } + default : + return state + } +} + +export default pedido;
\ No newline at end of file diff --git a/front/odiparpack/app/redux/reducers.js b/front/odiparpack/app/redux/reducers.js index 7327c48..e0e2547 100644 --- a/front/odiparpack/app/redux/reducers.js +++ b/front/odiparpack/app/redux/reducers.js @@ -20,6 +20,10 @@ import email from './modules/email'; import calendar from './modules/calendar'; import initval from './modules/initForm'; +//Odipar +import pedido from './modules/pedido'; +import message from './modules/message' + /** * Branching reducers to use one reducer for many components */ @@ -56,6 +60,8 @@ export default function createReducer(injectedReducers) { crudTableForm, crudTbFrmDemo: branchReducer(crudTableForm, 'crudTbFrmDemo'), crudPedido: branchReducer(crudTableForm, 'crudPedido'), + pedido, + message, language: languageProviderReducer, router: connectRouter(history), ...injectedReducers, diff --git a/front/odiparpack/app/utils/odipar/api.js b/front/odiparpack/app/utils/odipar/api.js new file mode 100644 index 0000000..ea5e617 --- /dev/null +++ b/front/odiparpack/app/utils/odipar/api.js @@ -0,0 +1,113 @@ +import Axios from 'axios' +import {apiUrl} from './constants'; +import qs from "query-string"; +import { openSuccessMessage, openErrorMessage } from 'ba-actions/message'; + +export function getHeaders() { + let session = getSession(); + return { + //Authorization: `Token ${(session && session.accessToken) || null}` + } +} + + +export function getSession() { + if (window && window.localStorage) { + return window.localStorage.getObject('session'); + } + + return null; +} + +export function saveSession(value) { + if (window && window.localStorage) { + return window.localStorage.saveObject('session', value); + } + + return null; +} + +export function apiReq(endPoint, data, method, headers, requestOptions = {}) { + return new Promise((res, rej) => { + + headers = { + ...headers + } + if (method === 'get' || method === 'delete') { + data = { + ...requestOptions, + params: data, + paramsSerializer: function (params) { + return qs.stringify(params, { arrayFormat: 'repeat' }) + }, + headers + } + } + + Axios[method](endPoint, data, { headers }).then((result) => { + let { data } = result; + console.log("aca en la promesa ps") + if (data.status === false) { + return rej(data); + } + + return res(data); + }).catch((err) => { + return rej(err); + }); + }) +} + +export function generateUrl(path) { + return apiUrl + path; +} + +export function apiPost(endPoint, data, headers = {}) { + return apiReq(generateUrl(endPoint), data, 'post', headers); +} + +export function apiDelete(endPoint, data, headers = {}) { + return apiReq(generateUrl(endPoint), data, 'delete', headers); +} + +export function apiGet(endPoint, data, headers = {}, requestOptions) { + return apiReq(generateUrl(endPoint), data, 'get', headers, requestOptions); +} + +export function apiPut(endPoint, data, headers = {}) { + return apiReq(generateUrl(endPoint), data, 'put', headers); +} + + +export function addMessageCurry(promise, dispatch, errorMsg = '', successMsg = '', showError = true) { + return new Promise( + (resolve, reject) => { + + promise + .then(response => { + + if (successMsg) { + console.log("mensajitooooo=?????") + dispatch( + openSuccessMessage(successMsg) + ) + } + + resolve(response) + }) + .catch( + err => { + if(showError) { + dispatch( + openErrorMessage(errorMsg || ((err.response && err.response.data.message) || 'Server encountered an error')) + ) + } + + reject(err) + } + ) + + } + ) + +}
\ No newline at end of file diff --git a/front/odiparpack/app/utils/odipar/constants.js b/front/odiparpack/app/utils/odipar/constants.js new file mode 100644 index 0000000..73f3521 --- /dev/null +++ b/front/odiparpack/app/utils/odipar/constants.js @@ -0,0 +1,9 @@ +//export const apiUrl = `${config.api}api/v1/`; +export const apiUrl = 'http://localhost:8083/'; + +//mensaje +export function partial(fn, ...presetArgs) { + return function partiallyApplied(...laterArgs) { + return fn(...presetArgs, ...laterArgs); + }; +}
\ No newline at end of file diff --git a/front/odiparpack/app/utils/odipar/menu.js b/front/odiparpack/app/utils/odipar/menu.js new file mode 100644 index 0000000..eca2600 --- /dev/null +++ b/front/odiparpack/app/utils/odipar/menu.js @@ -0,0 +1,51 @@ +module.exports = [ + { + key: 'seguimiento', + name: 'Seguimiento', + icon: 'near_me', + link: '/app/dashboard-v2', + child: [ ] + }, + { + key: 'pedidos', + name: 'Pedidos', + icon: 'inventory_2', + link: '/app/pedidos', + child: [ ] + }, + { + key: 'camiones', + name: 'Camiones', + icon: 'local_shipping', + link: '/app/layouts/grid', + child: [ ] + }, + { + key: 'almacenes', + name: 'Almacenes', + icon: 'warehouse', + link: '/app/tables/crud-table', + child: [ ] + }, + { + key: 'red_tramos', + name: 'Red de Tramos', + icon: 'location_on', + link: '/app/forms/reduxform', + child: [ ] + }, + { + key: 'otros', + name: 'Otros parámetros', + icon: 'settings', + link: '/app/ui/icons', + child: [ ] + }, + { + key: 'simulacion', + name: 'Simulación', + icon: 'fast_forward', + link: '/app/pages/calendar', + child: [ ] + } + ];
\ No newline at end of file diff --git a/front/odiparpack/internals/webpack/webpack.base.babel.js b/front/odiparpack/internals/webpack/webpack.base.babel.js index ca26c12..89ff730 100644 --- a/front/odiparpack/internals/webpack/webpack.base.babel.js +++ b/front/odiparpack/internals/webpack/webpack.base.babel.js @@ -197,6 +197,7 @@ module.exports = options => ({ 'ba-api': path.resolve(__dirname, '../../app/api/'), 'ba-images': path.resolve(__dirname, '../../public/images/'), 'ba-vendor': path.resolve(__dirname, '../../node_modules/'), + 'odi-utils': path.resolve(__dirname,'../../app/utils/odipar/') } }, devtool: options.devtool, diff --git a/front/odiparpack/package-lock.json b/front/odiparpack/package-lock.json index bf01861..ff64c1f 100644 --- a/front/odiparpack/package-lock.json +++ b/front/odiparpack/package-lock.json @@ -6069,8 +6069,7 @@ "decode-uri-component": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", - "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=", - "dev": true + "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=" }, "decompress-zip": { "version": "0.3.2", @@ -7772,6 +7771,11 @@ } } }, + "filter-obj": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/filter-obj/-/filter-obj-1.1.0.tgz", + "integrity": "sha1-mzERErxsYSehbgFsbF1/GeCAXFs=" + }, "finalhandler": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz", @@ -13963,6 +13967,17 @@ "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" }, + "query-string": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/query-string/-/query-string-7.1.1.tgz", + "integrity": "sha512-MplouLRDHBZSG9z7fpuAAcI7aAYjDLhtsiVZsevsfaHWDS2IDdORKbSd1kWUA+V4zyva/HZoSfpwnYMMQDhb0w==", + "requires": { + "decode-uri-component": "^0.2.0", + "filter-obj": "^1.1.0", + "split-on-first": "^1.0.0", + "strict-uri-encode": "^2.0.0" + } + }, "querystring": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", @@ -15204,6 +15219,11 @@ "symbol-observable": "^1.2.0" } }, + "redux-devtools-extension": { + "version": "2.13.9", + "resolved": "https://registry.npmjs.org/redux-devtools-extension/-/redux-devtools-extension-2.13.9.tgz", + "integrity": "sha512-cNJ8Q/EtjhQaZ71c8I9+BPySIBVEKssbPpskBfsXqb8HJ002A3KRVHfeRzwRo6mGPqsm7XuHTqNSNeS1Khig0A==" + }, "redux-form": { "version": "8.2.0", "resolved": "https://registry.npmjs.org/redux-form/-/redux-form-8.2.0.tgz", @@ -15244,6 +15264,11 @@ "@redux-saga/core": "^1.0.2" } }, + "redux-thunk": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/redux-thunk/-/redux-thunk-2.4.1.tgz", + "integrity": "sha512-OOYGNY5Jy2TWvTL1KgAlVy6dcx3siPJ1wTq741EPyUKfn6W6nChdICjZwCd0p8AZBs5kWpZlbkXW2nE/zjUa+Q==" + }, "reflect.ownkeys": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/reflect.ownkeys/-/reflect.ownkeys-0.2.0.tgz", @@ -16596,6 +16621,11 @@ "integrity": "sha512-1klA3Gi5PD1Wv9Q0wUoOQN1IWAuPu0D1U03ThXTr0cJ20+/iq2tHSDnK7Kk/0LXJ1ztUB2/1Os0wKmfyNgUQfg==", "dev": true }, + "split-on-first": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/split-on-first/-/split-on-first-1.1.0.tgz", + "integrity": "sha512-43ZssAJaMusuKWL8sKUBQXHWOpq8d6CfN/u1p4gUzfJkM05C8rxTmYrkIPTXapZpORA6LkkzcUulJ8FqA7Uudw==" + }, "split-string": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", @@ -16749,6 +16779,11 @@ "stream-to": "~0.2.0" } }, + "strict-uri-encode": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-2.0.0.tgz", + "integrity": "sha1-ucczDHBChi9rFC3CdLvMWGbONUY=" + }, "string-argv": { "version": "0.0.2", "resolved": "https://registry.npmjs.org/string-argv/-/string-argv-0.0.2.tgz", diff --git a/front/odiparpack/package.json b/front/odiparpack/package.json index 7e9a59a..480d0a7 100644 --- a/front/odiparpack/package.json +++ b/front/odiparpack/package.json @@ -136,6 +136,7 @@ "minimist": "1.2.0", "mui-datatables": "^2.13.1", "prop-types": "15.7.2", + "query-string": "^7.1.1", "rcolor": "^1.0.1", "react": "16.8.6", "react-anchor-link-smooth-scroll": "^1.0.11", @@ -171,9 +172,11 @@ "recharts": "^1.5.0", "recompose": "^0.28.2", "redux": "4.0.1", + "redux-devtools-extension": "^2.13.9", "redux-form": "8.2.0", "redux-immutable": "4.0.0", "redux-saga": "1.0.2", + "redux-thunk": "^2.4.1", "reselect": "4.0.0", "sanitize.css": "8.0.0", "serve-favicon": "^2.4.5", |
