diff options
| author | Dayana31 <[email protected]> | 2022-06-03 17:24:38 -0500 |
|---|---|---|
| committer | Dayana31 <[email protected]> | 2022-06-03 17:24:38 -0500 |
| commit | f4435233c0aad92f63ee097831565875a6dc903c (patch) | |
| tree | fb3460742efd381958c1715dd9908597bd7b3e2f /front/odiparpack/app/components | |
| parent | c4afbde59b708505803094724632774ffb35ee74 (diff) | |
| parent | 7494e99f73c3aa28f7caf8b6b0c063a0cb6035cf (diff) | |
| download | DP1_project-f4435233c0aad92f63ee097831565875a6dc903c.tar.gz DP1_project-f4435233c0aad92f63ee097831565875a6dc903c.tar.bz2 DP1_project-f4435233c0aad92f63ee097831565875a6dc903c.zip | |
Merge branch 'gabshr' into dayana
Diffstat (limited to 'front/odiparpack/app/components')
7 files changed, 189 insertions, 9 deletions
diff --git a/front/odiparpack/app/components/Odipar/EtiquetaData.js b/front/odiparpack/app/components/Odipar/EtiquetaData.js index a2f262d..e005f4d 100644 --- a/front/odiparpack/app/components/Odipar/EtiquetaData.js +++ b/front/odiparpack/app/components/Odipar/EtiquetaData.js @@ -51,8 +51,8 @@ export const pedido = { } } - //Bloqueos - export const bloqueo = { + //Rutas + export const ruta = { desbloqueado: { text: "Disponible", color: "#81C784", @@ -65,6 +65,25 @@ export const pedido = { } } + //Bloqueos + export const bloqueo = { + pendiente:{ + text: "Pendiente", + color: "#FFB74D", + icon: false + }, + bloqueado:{ + text: "Bloqueado", + color: "#E57373", + icon: false + }, + finalizado: { + text: "Finalizado", + color: "#81C784", + icon: false + } + } + //Almacen export const almacen = { noPrincipal: { @@ -77,4 +96,41 @@ export const pedido = { color: "#DED8D8", icon: 16 } - }
\ No newline at end of file + } + + //Averia - tipo + export const tipoAveria = { + moderada: { + text: "Moderada", + color: "#ff8b55", + icon: false + }, + fuerte:{ + text: "Fuerte", + color: "#ff3816", + icon: false + }, + siniestra:{ + text: "Siniestra", + color: "#c20000", + icon: false + } + } +// Averia - estado + export const estadoAveria = { + pendiente:{ + text: "Pendiente", + color: "#FFB74D", + icon: false + }, + bloqueado:{ + text: "Bloqueado", + color: "#E57373", + icon: false + }, + finalizado: { + text: "Finalizado", + color: "#81C784", + icon: false + } + } diff --git a/front/odiparpack/app/components/Odipar/common.js b/front/odiparpack/app/components/Odipar/common.js index b6fb49d..77f937d 100644 --- a/front/odiparpack/app/components/Odipar/common.js +++ b/front/odiparpack/app/components/Odipar/common.js @@ -1,6 +1,6 @@ import React from "react" import { Chip } from "@material-ui/core"; -import { pedido, camion, bloqueo, almacen } from './EtiquetaData' +import { pedido, camion, bloqueo, almacen, ruta, tipoAveria, estadoAveria } from './EtiquetaData' import Brightness1Icon from '@material-ui/icons/Brightness1'; export const etiquetaStyle = color => ({ @@ -26,6 +26,18 @@ export function etiqueta(tipo , estado) { // eslint-disable-line text = bloqueo[Object.keys(bloqueo)[estado]].text color = bloqueo[Object.keys(bloqueo)[estado]].color break; + case 'etiq_ruta': + text = ruta[Object.keys(ruta)[estado]].text + color = ruta[Object.keys(ruta)[estado]].color + break; + case 'etiq_tipoAveria': + text = tipoAveria[Object.keys(tipoAveria)[estado]].text + color = tipoAveria[Object.keys(tipoAveria)[estado]].color + break; + case 'etiq_estadoAveria': + text = estadoAveria[Object.keys(estadoAveria)[estado]].text + color = estadoAveria[Object.keys(estadoAveria)[estado]].color + break; case 'etiq_alma': let {estadoNum} = 2 estado === false? estadoNum = 0 : estadoNum = 1 diff --git a/front/odiparpack/app/components/Tables/CrudTableForm.js b/front/odiparpack/app/components/Tables/CrudTableForm.js index 017a3fc..8b7e6d5 100644 --- a/front/odiparpack/app/components/Tables/CrudTableForm.js +++ b/front/odiparpack/app/components/Tables/CrudTableForm.js @@ -5,16 +5,16 @@ import MainTableForm from './tableParts/MainTableForm'; import FloatingPanel from './../Panel/FloatingPanel'; class CrudTableForm extends React.Component { - /* componentDidMount(){ + componentDidMount(){ this.props.fetchData(this.props.dataInit, this.props.branch); - } */ + } - componentDidUpdate(previousProps) { + /* componentDidUpdate(previousProps) { if (previousProps.dataInit !== this.props.dataInit) { //console.log("en el FORM",this.props.dataInit)} this.props.fetchData(this.props.dataInit, this.props.branch); } - } + } */ sendValues = (values) => { setTimeout(() => { diff --git a/front/odiparpack/app/components/Tables/CrudTableForm2.js b/front/odiparpack/app/components/Tables/CrudTableForm2.js new file mode 100644 index 0000000..dd24aec --- /dev/null +++ b/front/odiparpack/app/components/Tables/CrudTableForm2.js @@ -0,0 +1,101 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import Form from './tableParts/Form'; +import MainTableForm from './tableParts/MainTableForm'; +import FloatingPanel from '../Panel/FloatingPanel'; + +class CrudTableForm extends React.Component { + /* componentDidMount(){ + this.props.fetchData(this.props.dataInit, this.props.branch); + } */ + + componentDidUpdate(previousProps) { + if (previousProps.dataInit !== this.props.dataInit) { + //console.log("en el FORM",this.props.dataInit)} + this.props.fetchData(this.props.dataInit, this.props.branch); + } + } + + sendValues = (values) => { + setTimeout(() => { + this.props.submit(values, this.props.branch); + }, 500); + if (this.props.editingId === this.props.initValues.get('id')) { + this.props.dispatch(this.props.editRowAPI()).then((res) => { + if (res) { + console.log("EDIT RO ", res) + } + }) + } else { + this.props.dispatch(this.props.addNewAPI()).then((res) => { + if (res) { + console.log("ADD NEW FORM ", res) + } + }) + } + + } + + getTitle( ){ + if (this.props.editingId === this.props.initValues.get(this.props.anchor[0].name)) { + return "Editar" + } + return "AƱadir nuevo" + } + + render() { + const { + title, + dataTable, + openForm, + closeForm, + removeRow, + addNew, + editRow, + anchor, + children, + branch, + initValues, + removeRowAPI + } = this.props; + return ( + <div> + + <FloatingPanel openForm={openForm} branch={branch} closeForm={closeForm} title = {this.getTitle()}> + <Form onSubmit={this.sendValues} initValues={initValues} branch={branch}> + {children} + </Form> + </FloatingPanel> + <MainTableForm + title={title} + addNew={addNew} + items={dataTable} + removeRow={removeRow} + editRow={editRow} + anchor={anchor} + branch={branch} + removeRowAPI={removeRowAPI} + /> + </div> + ); + } +} + +CrudTableForm.propTypes = { + title: PropTypes.string.isRequired, + anchor: PropTypes.array.isRequired, + dataInit: PropTypes.array.isRequired, + dataTable: PropTypes.object.isRequired, + fetchData: PropTypes.func.isRequired, + submit: PropTypes.func.isRequired, + addNew: PropTypes.func.isRequired, + openForm: PropTypes.bool.isRequired, + closeForm: PropTypes.func.isRequired, + removeRow: PropTypes.func.isRequired, + editRow: PropTypes.func.isRequired, + children: PropTypes.node.isRequired, + initValues: PropTypes.object.isRequired, + branch: PropTypes.string.isRequired, +}; + +export default CrudTableForm; diff --git a/front/odiparpack/app/components/Tables/tableParts/RowReadOnly.js b/front/odiparpack/app/components/Tables/tableParts/RowReadOnly.js index d060d02..f6be3fd 100644 --- a/front/odiparpack/app/components/Tables/tableParts/RowReadOnly.js +++ b/front/odiparpack/app/components/Tables/tableParts/RowReadOnly.js @@ -46,6 +46,9 @@ class RowReadOnly extends React.Component { case 'etiq_camion': case 'etiq_bloqueo': case 'etiq_alma': + case 'etiq_ruta': + case 'etiq_tipoAveria': + case 'etiq_estadoAveria': return ( <TableCell padding="none" key={index.toString()}> {etiqueta(inputType, item.get(itemCell.name))} @@ -57,6 +60,13 @@ class RowReadOnly extends React.Component { {item.get(itemCell.name) !== undefined ? item.get(itemCell.name).toString() : ''} </TableCell> ); + case 'averia_ubicacion': + return ( + <TableCell padding="none" key={index.toString()}> + Longitud: {item.get('longitud') !== undefined ? item.get('longitud').toString() : ''} + {'\u00A0'} Latitud: {item.get('latitud') !== undefined ? item.get('latitud').toString() : ''} + </TableCell> + ); } } return false; diff --git a/front/odiparpack/app/components/Tables/tableParts/tableStyle-jss.js b/front/odiparpack/app/components/Tables/tableParts/tableStyle-jss.js index bede0b8..bef1ac7 100644 --- a/front/odiparpack/app/components/Tables/tableParts/tableStyle-jss.js +++ b/front/odiparpack/app/components/Tables/tableParts/tableStyle-jss.js @@ -6,7 +6,7 @@ const styles = theme => ({ rootTable: { width: '100%', marginTop: theme.spacing(3), - overflowX: 'auto', + overflowX: 'hidden', }, highlight: theme.palette.type === 'light' ? { diff --git a/front/odiparpack/app/components/index.js b/front/odiparpack/app/components/index.js index 123b48c..e1903fc 100644 --- a/front/odiparpack/app/components/index.js +++ b/front/odiparpack/app/components/index.js @@ -23,6 +23,7 @@ export MapWidget from './Widget/MapWidget'; export TreeTable from './Tables/TreeTable'; export CrudTable from './Tables/CrudTable'; export CrudTableForm from './Tables/CrudTableForm'; +export CrudTableForm2 from './Tables/CrudTableForm2'; export AdvTable from './Tables/AdvTable'; export EmptyData from './Tables/EmptyData'; // Form |
