From 1f7786a50303d49f54fa713b540b176131faf971 Mon Sep 17 00:00:00 2001 From: gabrhr <73925454+gabrhr@users.noreply.github.com> Date: Thu, 2 Jun 2022 23:10:42 -0500 Subject: Add mapa v1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Mapa con algunos punto - Zoom al mapa xdddd - Punto que se mueve #TODO - añadir todos los puntos - Mejorar el path del punto con funcion - añadir tiempos segun distancia - estetica al final (camion, colores, etc) --- .../Odipar/Simulacion/Simulacion7Dias.js | 81 ++++++++++++++++++++++ .../app/containers/Odipar/Simulacion/utilCoords.js | 42 +++++++++++ 2 files changed, 123 insertions(+) create mode 100644 front/odiparpack/app/containers/Odipar/Simulacion/Simulacion7Dias.js create mode 100644 front/odiparpack/app/containers/Odipar/Simulacion/utilCoords.js (limited to 'front/odiparpack/app/containers/Odipar/Simulacion') diff --git a/front/odiparpack/app/containers/Odipar/Simulacion/Simulacion7Dias.js b/front/odiparpack/app/containers/Odipar/Simulacion/Simulacion7Dias.js new file mode 100644 index 0000000..eff6d5d --- /dev/null +++ b/front/odiparpack/app/containers/Odipar/Simulacion/Simulacion7Dias.js @@ -0,0 +1,81 @@ +import React, { Component } from "react"; +import { withStyles } from '@material-ui/core/styles'; +import {getX, getY} from './utilCoords' +import { Icon } from "@material-ui/core"; +import { TransformWrapper, TransformComponent } from "react-zoom-pan-pinch"; +import { mapaH, mapaW } from "odi-utils/constants" + +const styles = ({ + root: { + flexGrow: 1, + marginTop: 30, + } + }); + + +class Simulacion7Dias extends Component { + almacenes = [ + { + ubigeo: '150101', + provincia: 'LIMA', + latitud:-12.04591952, + longitud: -77.03049615, + region: 'Costa', + esPrincipal: 1 + },{ + ubigeo: '130101', + provincia: 'TRUJILLO', + latitud: -8.11176389, + longitud: -79.02868652, + region: 'Costa', + esPrincipal: 1 + },{ + ubigeo: '040101', + provincia: 'AREQUIPA', + latitud:-16.39881421, + longitud: -71.537019649, + region: 'Costa', + esPrincipal: 1 + },{ + ubigeo: '050301', + provincia: 'HUANCA SANCOS', + latitud:-13.91988366, + longitud: -74.33388289, + region: 'Costa', + esPrincipal: 0 + } + ] + render() { + return ( + + +
+ + {this.almacenes.map((item,index) => { + console.log(index) + return
+ house +
+ })} +
+ + + + + + +
+
+ + ); + } +} + +export default withStyles(styles)(Simulacion7Dias); \ No newline at end of file diff --git a/front/odiparpack/app/containers/Odipar/Simulacion/utilCoords.js b/front/odiparpack/app/containers/Odipar/Simulacion/utilCoords.js new file mode 100644 index 0000000..bac5f9b --- /dev/null +++ b/front/odiparpack/app/containers/Odipar/Simulacion/utilCoords.js @@ -0,0 +1,42 @@ +import { mapaH, mapaW } from "odi-utils/constants" +export function transform(lonlat){ + const earth_radius_km = 6378.1370 + return earth_radius_km*(lonlat)*Math.PI/180 +} + + +export function limits(type){ + const inferior={lon:-81.324216, lat: -18.345605} + const superior={lon:-68.654087, lat:-0.043656} + + if (type == 'x'){ + return [transform(inferior.lon), transform(superior.lon)] + } + return [transform(inferior.lat),transform(superior.lat)] + +} + +//inicio de mapa en x = 13 y = 33 +export function getX (lon){ + const [infx, supx] = limits('x'); + const imgW = mapaW + const inicioX= -3 + const Fx = Math.abs(infx) - Math.abs(supx) + const xPrev = transform(lon) + const newX = Math.abs(infx) - Math.abs(xPrev) + const x = Math.trunc((Math.abs(newX)*(imgW))/(Fx)) + console.log("x: ", x + 0) + return x + inicioX; +} + +export function getY (lat){ + const [ infy, supy] = limits('y'); + const imgH = mapaH + const inicioY = -8 + const Fy = Math.abs(infy) - Math.abs(supy) + const yPrev = transform(lat) + const newY = Math.abs(yPrev) - Math.abs(supy) + const y = Math.trunc((Math.abs(newY)*(imgH))/(Fy)) + console.log("y: ", y +0) + return y + inicioY + } \ No newline at end of file -- cgit v1.2.3 From 7494e99f73c3aa28f7caf8b6b0c063a0cb6035cf Mon Sep 17 00:00:00 2001 From: gabrhr <73925454+gabrhr@users.noreply.github.com> Date: Fri, 3 Jun 2022 17:17:41 -0500 Subject: Add page Simulacion 7 dias falta bastante solo v1 para probar back --- .../Odipar/Simulacion/Simulacion7Dias.js | 8 +- .../containers/Odipar/Simulacion/SimulacionMain.js | 96 ++++++++++++++++++++++ 2 files changed, 102 insertions(+), 2 deletions(-) create mode 100644 front/odiparpack/app/containers/Odipar/Simulacion/SimulacionMain.js (limited to 'front/odiparpack/app/containers/Odipar/Simulacion') diff --git a/front/odiparpack/app/containers/Odipar/Simulacion/Simulacion7Dias.js b/front/odiparpack/app/containers/Odipar/Simulacion/Simulacion7Dias.js index eff6d5d..97bcf5b 100644 --- a/front/odiparpack/app/containers/Odipar/Simulacion/Simulacion7Dias.js +++ b/front/odiparpack/app/containers/Odipar/Simulacion/Simulacion7Dias.js @@ -1,7 +1,7 @@ import React, { Component } from "react"; import { withStyles } from '@material-ui/core/styles'; import {getX, getY} from './utilCoords' -import { Icon } from "@material-ui/core"; +import { Icon, Typography } from "@material-ui/core"; import { TransformWrapper, TransformComponent } from "react-zoom-pan-pinch"; import { mapaH, mapaW } from "odi-utils/constants" @@ -47,6 +47,10 @@ class Simulacion7Dias extends Component { ] render() { return ( + <> + + {`Resultado de simulación a 7 días`} + - + ); } } diff --git a/front/odiparpack/app/containers/Odipar/Simulacion/SimulacionMain.js b/front/odiparpack/app/containers/Odipar/Simulacion/SimulacionMain.js new file mode 100644 index 0000000..616fab8 --- /dev/null +++ b/front/odiparpack/app/containers/Odipar/Simulacion/SimulacionMain.js @@ -0,0 +1,96 @@ +import React, {Component} from "react"; +import { Button, Divider, FormControl, Grid, InputLabel, MenuItem, Paper, Select, Typography } from "@material-ui/core"; +import { withStyles } from '@material-ui/core/styles'; +import { Field, reduxForm } from "redux-form"; +import { SelectRedux } from 'ba-components/Forms/ReduxFormMUI'; + +const styles = ({ + root: { + flexGrow: 1, + marginTop: 30, + padding: 20 + }, + field: { + width: '70%', + marginBottom: 20 + } + }); + + const initData = { + selection: 'option1', + }; + +class SimulacionMain extends Component { + state = { + tipo:'' + } + + changeTipo(tipo){ + this.setState({tipo: tipo}) + } + + handleChange = event => { + this.setState({ [event.target.name]: event.target.value }); + }; + + render() { + const trueBool = true; + const { classes } = this.props; + return ( +
+ + {`Simulación`} + +
+ + + + + {`Datos generales`} + +
+
+ + Tipo de simulación + + +
+ +
+ +
+
+
+ + + + {`Pedidos`} + + +
+
+
+
+ ); + } +} + +const SimulacionMainMapped = reduxForm({ + form: 'immutableExample', + })(SimulacionMain); + +export default withStyles(styles)(SimulacionMainMapped); \ No newline at end of file -- cgit v1.2.3