diff options
| author | Dayana31 <[email protected]> | 2022-06-06 18:22:06 -0500 |
|---|---|---|
| committer | Dayana31 <[email protected]> | 2022-06-06 18:22:06 -0500 |
| commit | c10432bd66dfbf040662e9c8203956ac3614f4ca (patch) | |
| tree | 88c739cdb9650408458ee300ca03a7fc7746cb9b /front/odiparpack/app/containers | |
| parent | f3c1a8c5dcc3c482205f34332a9d673b35b4cfb0 (diff) | |
| parent | fab7d63333b86b9fe0f1c52d2c642b52bbf506c0 (diff) | |
| download | DP1_project-c10432bd66dfbf040662e9c8203956ac3614f4ca.tar.gz DP1_project-c10432bd66dfbf040662e9c8203956ac3614f4ca.tar.bz2 DP1_project-c10432bd66dfbf040662e9c8203956ac3614f4ca.zip | |
Merge branch 'gabshr' into dayana
Diffstat (limited to 'front/odiparpack/app/containers')
4 files changed, 86 insertions, 47 deletions
diff --git a/front/odiparpack/app/containers/Odipar/Camiones/CamionTab/CamionTab.js b/front/odiparpack/app/containers/Odipar/Camiones/CamionTab/CamionTab.js index 5110566..bd86653 100644 --- a/front/odiparpack/app/containers/Odipar/Camiones/CamionTab/CamionTab.js +++ b/front/odiparpack/app/containers/Odipar/Camiones/CamionTab/CamionTab.js @@ -16,6 +16,7 @@ const styles = ({ }); class CamionTab extends Component { + //Obtenemos la lista constructor (props) { super(props) this.state = { @@ -26,7 +27,6 @@ class CamionTab extends Component { this.setState({ dataRealF: res.data, }); - console.log("Vengo del back", res.data) } }) } @@ -34,10 +34,9 @@ class CamionTab extends Component { render() { const {dataRealF} = this.state; - const { classes } = this.props; return ( - - <CrudCamionTab title = "Listado de Camiones" dataReal={dataRealF}/> + //Mandamos la lista(dataRealF) y la funcion del GET + <CrudCamionTab title = "Listado de Camiones" dataReal={dataRealF} getDataAPI={getCamiones}/> ); } diff --git a/front/odiparpack/app/containers/Odipar/Camiones/CamionTab/table/CrudCamionTab.js b/front/odiparpack/app/containers/Odipar/Camiones/CamionTab/table/CrudCamionTab.js index 11c0805..6d5f366 100644 --- a/front/odiparpack/app/containers/Odipar/Camiones/CamionTab/table/CrudCamionTab.js +++ b/front/odiparpack/app/containers/Odipar/Camiones/CamionTab/table/CrudCamionTab.js @@ -19,8 +19,10 @@ import { } from '@material-ui/core'; import { anchorTable, dataApi } from './dataCamion'; import FormCamionTab from './FormCamionTab'; + //actions -import { getPedidos } from 'ba-actions/pedido'; +import { insertarCamion, editarCamion, eliminarCamion } from 'ba-actions/camion'; + const branch = 'crudCamion'; const renderRadioGroup = ({ input, ...rest }) => ( @@ -42,7 +44,7 @@ const styles = ({ class CrudCamionTab extends Component { render() { - //console.log("render ps") + //Obtenemos dataReal y getDataAPI const { classes, fetchData, @@ -59,16 +61,17 @@ class CrudCamionTab extends Component { title, dataReal, dispatch, - editingId + editingId, + getDataAPI } = this.props; - //console.log("render ps DATA", dataReal) - //console.log("original", dataApi) - return ( <div> <Notification close={() => closeNotif(branch)} variant = "success" message={messageNotif} /> <Paper className={classes.root}> + {/* Enviamos dataReal como dataInit y getDataAPI. + También, mandamos addNewAPI, removeRowAPI, editRowAPI (con funciones de arriba "//actions") + */} <CrudTableForm dataTable={dataTable} openForm={openForm} @@ -83,14 +86,17 @@ class CrudCamionTab extends Component { editRow={editRow} branch={branch} initValues={initValues} - addNewAPI={getPedidos} - removeRowAPI={getPedidos} - editRowAPI={getPedidos} + getDataAPI = {getDataAPI} + addNewAPI={insertarCamion} + removeRowAPI={eliminarCamion} + editRowAPI={editarCamion} dispatch = {dispatch} editingId = {editingId} > - {/* Create Your own form, then arrange or custom it as You like */} - <FormCamionTab/> + {/* Create Your own form, then arrange or custom it as You like + ------------> OJO Mandamos dispatch + */} + <FormCamionTab dispatch = {dispatch}/> {/* No need create button or submit, because that already made in this component */} </CrudTableForm> </Paper> diff --git a/front/odiparpack/app/containers/Odipar/Camiones/CamionTab/table/FormCamionTab.js b/front/odiparpack/app/containers/Odipar/Camiones/CamionTab/table/FormCamionTab.js index 25d107c..f98ae20 100644 --- a/front/odiparpack/app/containers/Odipar/Camiones/CamionTab/table/FormCamionTab.js +++ b/front/odiparpack/app/containers/Odipar/Camiones/CamionTab/table/FormCamionTab.js @@ -2,19 +2,17 @@ import React, { Component } from 'react'; import { withStyles } from '@material-ui/core/styles'; import PropTypes from 'prop-types'; import { Field } from 'redux-form/immutable'; -import {required, integer} from 'ba-api/validation' +import {required} from 'ba-api/validation' import { SelectRedux, - TextFieldRedux, - DatePickerRedux, - EstadoRedux + TextFieldRedux } from 'ba-components/Forms/ReduxFormMUI'; import { MenuItem, InputLabel, - FormControl, - Typography, + FormControl } from '@material-ui/core'; + import { getTipoCamiones } from 'ba-actions/tipoCamion'; const styles = ({ root: { @@ -34,25 +32,56 @@ const styles = ({ flexDirection: 'row' } }); - + +const tipoCamion = [ + { + id: 1, + nombre: "A", + capacidad: 90 + }, + { + id: 2, + nombre: "B", + capacidad: 45 + }, + { + id: 3, + nombre: "C", + capacidad: 30 + }, + { + id: 4, + nombre: "D", + capacidad: 30 + } +] + class FormCamionTab extends Component { + constructor (props) { + super(props) + this.state = { + comboTipos: [] + }; + this.props.dispatch(getTipoCamiones()).then((res) => { + if (res) { + this.setState({ + comboTipos: res.data? res.data : [] + }); + } + }) + } + + saveRef = ref => { this.ref = ref; return this.ref; }; - state = { - selectedDate: new Date(), - } - - handleDateChange = (date) => { - this.setState({ selectedDate: date }); - } render() { const { classes } = this.props; - const { selectedDate } = this.state; const trueBool = true; + const {comboTipos} = this.state return ( <> <div> @@ -75,8 +104,11 @@ class FormCamionTab extends Component { placeholder="Seleccionar" autoWidth={trueBool} > - <MenuItem value="A">A</MenuItem> - <MenuItem value="B">B</MenuItem> + {comboTipos.map((item,index) => { + return ( + <MenuItem value={item.nombre}>{item.nombre}</MenuItem> + ) + })} </Field> </FormControl> </div> diff --git a/front/odiparpack/app/containers/Odipar/Simulacion/SimulacionMain.js b/front/odiparpack/app/containers/Odipar/Simulacion/SimulacionMain.js index b9447d8..52d821f 100644 --- a/front/odiparpack/app/containers/Odipar/Simulacion/SimulacionMain.js +++ b/front/odiparpack/app/containers/Odipar/Simulacion/SimulacionMain.js @@ -1,8 +1,9 @@ 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'; +import { Link } from 'react-router-dom'; +import { reduxForm } from "redux-form"; + const styles = ({ root: { @@ -30,13 +31,9 @@ class SimulacionMain extends Component { tipo:'' } - changeTipo(tipo){ - this.setState({tipo: tipo}) - } - handleChange = event => { - this.setState({ [event.target.name]: event.target.value }); - }; + this.setState({ tipo: event.target.value }); + }; render() { const trueBool = true; @@ -56,27 +53,32 @@ class SimulacionMain extends Component { <form> <div> <FormControl className={classes.field}> - <InputLabel htmlFor="selection">Tipo de simulación</InputLabel> + <InputLabel htmlFor="tipoid">Tipo de simulación</InputLabel> <Select + value={this.state.tipo} + onChange={this.handleChange} + placeholder="Seleccionar" + autoWidth={trueBool} inputProps={{ name: 'tipo', id: 'tipoid', }} - value={initData.selection} - onChange={this.handleChange} - placeholder="Seleccionar" - autoWidth={trueBool} > - <MenuItem value = "option1" >Simulación a 7 días</MenuItem> - <MenuItem value="option2" >Simulación a colapso</MenuItem> + <MenuItem value ={"option1"} >Simulación a 7 días</MenuItem> + <MenuItem value={"option2"} >Simulación as colapso</MenuItem> </Select> </FormControl> </div> <div> + <Link to ={{ + pathname:"/app/simulacion" + }} style={{ textDecoration: 'none' }}> + <Button variant="contained" color="secondary"> Iniciar Simulación </Button> + </Link> </div> </form> </Grid> |
