From 55c0f57d42d82f1f1f5809e9c7d6845b6e0b68af Mon Sep 17 00:00:00 2001 From: gabrhr <73925454+gabrhr@users.noreply.github.com> Date: Wed, 25 May 2022 15:36:35 -0500 Subject: Add PedidoPage - cambio de esqueleto segun figma - componente de etiquetas - tabla y form de Pedido #TODO - estetica de etiquetas - redux y crear end points --- .../components/Tables/tableParts/MainTableForm.js | 2 +- .../components/Tables/tableParts/RowReadOnly.js | 26 +++++++++++++++++----- 2 files changed, 21 insertions(+), 7 deletions(-) (limited to 'front/odiparpack/app/components/Tables') diff --git a/front/odiparpack/app/components/Tables/tableParts/MainTableForm.js b/front/odiparpack/app/components/Tables/tableParts/MainTableForm.js index ccf0e4a..8869212 100644 --- a/front/odiparpack/app/components/Tables/tableParts/MainTableForm.js +++ b/front/odiparpack/app/components/Tables/tableParts/MainTableForm.js @@ -61,7 +61,7 @@ class MainTableForm extends React.Component { diff --git a/front/odiparpack/app/components/Tables/tableParts/RowReadOnly.js b/front/odiparpack/app/components/Tables/tableParts/RowReadOnly.js index 7da655f..2f4a519 100644 --- a/front/odiparpack/app/components/Tables/tableParts/RowReadOnly.js +++ b/front/odiparpack/app/components/Tables/tableParts/RowReadOnly.js @@ -5,8 +5,9 @@ import classNames from 'classnames'; import css from 'ba-styles/Table.scss'; import DeleteIcon from '@material-ui/icons/Delete'; import EditIcon from '@material-ui/icons/BorderColor'; +import { etiqueta } from 'ba-components/Odipar/common'; -import { TableCell, IconButton } from '@material-ui/core'; +import { TableCell, IconButton, LinearProgress } from '@material-ui/core'; const styles = theme => ({ button: { @@ -32,11 +33,24 @@ class RowReadOnly extends React.Component { }; const renderCell = dataArray => dataArray.map((itemCell, index) => { if (itemCell.name !== 'action' && !itemCell.hidden) { - return ( - - {item.get(itemCell.name) !== undefined ? item.get(itemCell.name).toString() : ''} - - ); + const inputType = anchor[index].type; + switch (inputType) { + case 'etiq_pedido': + case 'etiq_camion': + case 'etiq_bloqueo': + case 'etiq_alma': + return ( + + {etiqueta(inputType, item.get(itemCell.name))} + + ); + case 'texto': + return ( + + {item.get(itemCell.name) !== undefined ? item.get(itemCell.name).toString() : ''} + + ); + } } return false; }); -- cgit v1.2.3 From 9c396976bb42a9d41407358ce1a1d37242230f21 Mon Sep 17 00:00:00 2001 From: gabrhr <73925454+gabrhr@users.noreply.github.com> Date: Fri, 27 May 2022 12:50:13 -0500 Subject: Add redux, dispatch and etiquetas MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- front/odiparpack/app/components/Tables/CrudTableForm.js | 2 ++ 1 file changed, 2 insertions(+) (limited to 'front/odiparpack/app/components/Tables') 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 (
+
{children} -- cgit v1.2.3 From 32fb17de8f78317b165b6f269a8bab2d4e852d0d Mon Sep 17 00:00:00 2001 From: gabrhr <73925454+gabrhr@users.noreply.github.com> Date: Mon, 30 May 2022 20:08:04 -0500 Subject: Fix axios and add new MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - FIX logica de añadiir (ok) - FIX axios y dispatch fuera de un componente (ok) - Cambiar las notificaciones --- .../app/components/Tables/CrudTableForm.js | 36 +++++++++++++++++++--- .../app/components/Tables/tableParts/Form.js | 4 +-- .../components/Tables/tableParts/MainTableForm.js | 4 ++- .../components/Tables/tableParts/RowReadOnly.js | 17 ++++++++-- 4 files changed, 51 insertions(+), 10 deletions(-) (limited to 'front/odiparpack/app/components/Tables') diff --git a/front/odiparpack/app/components/Tables/CrudTableForm.js b/front/odiparpack/app/components/Tables/CrudTableForm.js index 219fcd2..0ba5264 100644 --- a/front/odiparpack/app/components/Tables/CrudTableForm.js +++ b/front/odiparpack/app/components/Tables/CrudTableForm.js @@ -5,15 +5,39 @@ import MainTableForm from './tableParts/MainTableForm'; 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); + + 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() { @@ -28,12 +52,13 @@ class CrudTableForm extends React.Component { anchor, children, branch, - initValues + initValues, + removeRowAPI } = this.props; return (
- + {children} @@ -46,6 +71,7 @@ class CrudTableForm extends React.Component { editRow={editRow} anchor={anchor} branch={branch} + removeRowAPI={removeRowAPI} />
); diff --git a/front/odiparpack/app/components/Tables/tableParts/Form.js b/front/odiparpack/app/components/Tables/tableParts/Form.js index da66966..66188c7 100644 --- a/front/odiparpack/app/components/Tables/tableParts/Form.js +++ b/front/odiparpack/app/components/Tables/tableParts/Form.js @@ -31,14 +31,14 @@ class Form extends Component {
diff --git a/front/odiparpack/app/components/Tables/tableParts/MainTableForm.js b/front/odiparpack/app/components/Tables/tableParts/MainTableForm.js index 8869212..1437fa8 100644 --- a/front/odiparpack/app/components/Tables/tableParts/MainTableForm.js +++ b/front/odiparpack/app/components/Tables/tableParts/MainTableForm.js @@ -29,7 +29,8 @@ class MainTableForm extends React.Component { editRow, addNew, anchor, - branch + branch, + removeRowAPI } = this.props; const getItems = dataArray => dataArray.map(item => ( editRow(item, branch)} anchor={anchor} branch={branch} + removeRowAPI = {removeRowAPI} /> )); diff --git a/front/odiparpack/app/components/Tables/tableParts/RowReadOnly.js b/front/odiparpack/app/components/Tables/tableParts/RowReadOnly.js index 2f4a519..d060d02 100644 --- a/front/odiparpack/app/components/Tables/tableParts/RowReadOnly.js +++ b/front/odiparpack/app/components/Tables/tableParts/RowReadOnly.js @@ -8,6 +8,7 @@ import EditIcon from '@material-ui/icons/BorderColor'; import { etiqueta } from 'ba-components/Odipar/common'; import { TableCell, IconButton, LinearProgress } from '@material-ui/core'; +import { connect } from 'react-redux'; const styles = theme => ({ button: { @@ -23,10 +24,16 @@ class RowReadOnly extends React.Component { item, removeRow, editRow, - branch + branch, + removeRowAPI } = this.props; const eventDel = () => { removeRow(item, branch); + this.props.dispatch(removeRowAPI()).then((res) => { + if (res) { + console.log("REMOVE READ ONLY ", res) + } + }) }; const eventEdit = () => { editRow(item, branch); @@ -86,5 +93,11 @@ RowReadOnly.propTypes = { editRow: PropTypes.func.isRequired, branch: PropTypes.string.isRequired, }; +const mapDispatchToProps = dispatch => ({ + dispatch +}); -export default withStyles(styles)(RowReadOnly); +const RowReadOnlyMapped = connect( + mapDispatchToProps +)(RowReadOnly); +export default withStyles(styles)(RowReadOnlyMapped); -- cgit v1.2.3 From cbc7d7f7494508fda69e88c76702a878bebca0e2 Mon Sep 17 00:00:00 2001 From: gabrhr <73925454+gabrhr@users.noreply.github.com> Date: Tue, 31 May 2022 03:58:23 -0500 Subject: Add Almacenes - todo de almacenes, redux, pagina - mejoro form de pedido (etiqueta estado, RUC) #TODO - Ver combobox con API --- front/odiparpack/app/components/Tables/CrudTableForm.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'front/odiparpack/app/components/Tables') diff --git a/front/odiparpack/app/components/Tables/CrudTableForm.js b/front/odiparpack/app/components/Tables/CrudTableForm.js index 0ba5264..017a3fc 100644 --- a/front/odiparpack/app/components/Tables/CrudTableForm.js +++ b/front/odiparpack/app/components/Tables/CrudTableForm.js @@ -5,10 +5,13 @@ 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) + //console.log("en el FORM",this.props.dataInit)} this.props.fetchData(this.props.dataInit, this.props.branch); } } -- cgit v1.2.3