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
---
.../app/containers/Odipar/Almacen/Almacenes.js | 66 +++++++++
.../containers/Odipar/Almacen/table/CrudAlmacen.js | 148 +++++++++++++++++++++
.../containers/Odipar/Almacen/table/FormAlmacen.js | 124 +++++++++++++++++
.../containers/Odipar/Almacen/table/dataAlmacen.js | 75 +++++++++++
.../app/containers/Odipar/Almacen/table/index.js | 1 +
5 files changed, 414 insertions(+)
create mode 100644 front/odiparpack/app/containers/Odipar/Almacen/Almacenes.js
create mode 100644 front/odiparpack/app/containers/Odipar/Almacen/table/CrudAlmacen.js
create mode 100644 front/odiparpack/app/containers/Odipar/Almacen/table/FormAlmacen.js
create mode 100644 front/odiparpack/app/containers/Odipar/Almacen/table/dataAlmacen.js
create mode 100644 front/odiparpack/app/containers/Odipar/Almacen/table/index.js
(limited to 'front/odiparpack/app/containers/Odipar/Almacen')
diff --git a/front/odiparpack/app/containers/Odipar/Almacen/Almacenes.js b/front/odiparpack/app/containers/Odipar/Almacen/Almacenes.js
new file mode 100644
index 0000000..31a3039
--- /dev/null
+++ b/front/odiparpack/app/containers/Odipar/Almacen/Almacenes.js
@@ -0,0 +1,66 @@
+import React, { Component } from 'react';
+import { withStyles } from '@material-ui/core/styles';
+import PropTypes from 'prop-types';
+import { CrudAlmacen } from './table'
+import { Paper, Typography } from '@material-ui/core';
+import { connect } from 'react-redux';
+
+//actions
+import { getAlmacenes } from '../../../actions/almacen';
+
+const styles = ({
+ root: {
+ flexGrow: 1,
+ marginTop: 30,
+ }
+ });
+
+class Almacenes extends Component {
+ constructor (props) {
+ super(props)
+ this.state = {
+ dataRealF: []
+ };
+ this.props.dispatch(getAlmacenes()).then((res) => {
+ if (res) {
+ this.setState({
+ dataRealF: res.data,
+ });
+ }
+ })
+ //console.log("Pedido - LUEGO DE THEN ", this.state.dataRealF)
+ }
+
+
+ render() {
+ const {dataRealF} = this.state;
+ //console.log ("aNTESZSSSS?")
+ const { classes } = this.props;
+ return (
+
+ );
+ }
+}
+
+Almacenes.propTypes = {
+ classes: PropTypes.object.isRequired,
+};
+
+const mapDispatchToProps = dispatch => ({
+ dispatch
+});
+
+const AlmacenesMapped = connect(
+ mapDispatchToProps
+)(Almacenes);
+
+export default withStyles(styles)(AlmacenesMapped);
\ No newline at end of file
diff --git a/front/odiparpack/app/containers/Odipar/Almacen/table/CrudAlmacen.js b/front/odiparpack/app/containers/Odipar/Almacen/table/CrudAlmacen.js
new file mode 100644
index 0000000..887d603
--- /dev/null
+++ b/front/odiparpack/app/containers/Odipar/Almacen/table/CrudAlmacen.js
@@ -0,0 +1,148 @@
+import React, { Component } from 'react';
+import PropTypes from 'prop-types';
+import { withStyles } from '@material-ui/core/styles';
+import { connect } from 'react-redux';
+import { bindActionCreators } from 'redux';
+import {
+ fetchAction,
+ addAction,
+ closeAction,
+ submitAction,
+ removeAction,
+ editAction,
+ closeNotifAction
+} from 'ba-actions/CrudTbFrmActions';
+import { CrudTableForm, Notification } from 'ba-components';
+import {
+ Paper,
+ RadioGroup,
+} from '@material-ui/core';
+import { anchorTable, dataApi } from './dataAlmacen';
+import FormAlmacen from './FormAlmacen';
+//actions
+import { getPedidos } from '../../../../actions/pedido';
+const branch = 'crudAlmacen';
+
+const renderRadioGroup = ({ input, ...rest }) => (
+ input.onChange(value)}
+ />
+);
+
+
+const styles = ({
+ root: {
+ flexGrow: 1,
+ }
+});
+
+class CrudAlmacen extends Component {
+ render() {
+ //console.log("render ps")
+ const {
+ classes,
+ fetchData,
+ addNew,
+ closeForm,
+ submit,
+ removeRow,
+ editRow,
+ dataTable,
+ openForm,
+ initValues,
+ closeNotif,
+ messageNotif,
+ title,
+ dataReal,
+ dispatch,
+ editingId
+ } = this.props;
+
+ //console.log("render ps DATA", dataReal)
+ //console.log("original", dataApi)
+ //console.log("original", anchorTable)
+
+ return (
+
+
closeNotif(branch)} variant = "success" message={messageNotif} />
+
+
+ {/* Create Your own form, then arrange or custom it as You like */}
+
+ {/* No need create button or submit, because that already made in this component */}
+
+
+
+ );
+ }
+}
+
+renderRadioGroup.propTypes = {
+ input: PropTypes.object.isRequired,
+};
+
+CrudAlmacen.propTypes = {
+ dataTable: PropTypes.object.isRequired,
+ openForm: PropTypes.bool.isRequired,
+ classes: PropTypes.object.isRequired,
+ fetchData: PropTypes.func.isRequired,
+ addNew: PropTypes.func.isRequired,
+ closeForm: PropTypes.func.isRequired,
+ submit: PropTypes.func.isRequired,
+ removeRow: PropTypes.func.isRequired,
+ editRow: PropTypes.func.isRequired,
+ initValues: PropTypes.object.isRequired,
+ closeNotif: PropTypes.func.isRequired,
+ messageNotif: PropTypes.string.isRequired,
+ title: PropTypes.string.isRequired,
+};
+
+
+const mapStateToProps = state => ({
+ force: state, // force state from reducer
+ initValues: state.getIn([branch, 'formValues']),
+ dataTable: state.getIn([branch, 'dataTable']),
+ openForm: state.getIn([branch, 'showFrm']),
+ messageNotif: state.getIn([branch, 'notifMsg']),
+ editingId: state.getIn([branch, 'editingId']),
+});
+
+const mapDispatchToProps = dispatch => ({
+ fetchData: bindActionCreators(fetchAction, dispatch),
+ addNew: bindActionCreators(addAction, dispatch),
+ closeForm: bindActionCreators(closeAction, dispatch),
+ submit: bindActionCreators(submitAction, dispatch),
+ removeRow: bindActionCreators(removeAction, dispatch),
+ editRow: bindActionCreators(editAction, dispatch),
+ closeNotif: bindActionCreators(closeNotifAction, dispatch),
+ dispatch
+});
+
+const CrudAlmacenMapped = connect(
+ mapStateToProps,
+ mapDispatchToProps
+)(CrudAlmacen);
+
+export default withStyles(styles)(CrudAlmacenMapped);
diff --git a/front/odiparpack/app/containers/Odipar/Almacen/table/FormAlmacen.js b/front/odiparpack/app/containers/Odipar/Almacen/table/FormAlmacen.js
new file mode 100644
index 0000000..05cfda7
--- /dev/null
+++ b/front/odiparpack/app/containers/Odipar/Almacen/table/FormAlmacen.js
@@ -0,0 +1,124 @@
+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 {
+ SelectRedux,
+ TextFieldRedux
+} from 'ba-components/Forms/ReduxFormMUI';
+import {
+ MenuItem,
+ InputLabel,
+ FormControl,
+ } from '@material-ui/core';
+
+const styles = ({
+ root: {
+ flexGrow: 1,
+ },
+ field: {
+ width: '100%',
+ marginBottom: 20
+ },
+ fieldBasic: {
+ width: '100%',
+ marginBottom: 20,
+ marginTop: 10
+ },
+ inlineWrap: {
+ display: 'flex',
+ flexDirection: 'row'
+ }
+ });
+
+
+class FormAlmacen extends Component {
+ saveRef = ref => {
+ this.ref = ref;
+ return this.ref;
+ };
+
+ render() {
+ const { classes } = this.props;
+ const trueBool = true;
+ return (
+ <>
+
+
+ Tipo de Almacen
+
+
+
+
+
+
+
+
+ Region
+
+
+
+
+
+
+
+
+
+ Provincia
+
+
+
+
+
+
+
+
+
+
+
+ >
+ );
+ }
+}
+
+FormAlmacen.propTypes = {
+ classes: PropTypes.object.isRequired,
+ };
+
+export default withStyles(styles)(FormAlmacen);
\ No newline at end of file
diff --git a/front/odiparpack/app/containers/Odipar/Almacen/table/dataAlmacen.js b/front/odiparpack/app/containers/Odipar/Almacen/table/dataAlmacen.js
new file mode 100644
index 0000000..685df27
--- /dev/null
+++ b/front/odiparpack/app/containers/Odipar/Almacen/table/dataAlmacen.js
@@ -0,0 +1,75 @@
+export const anchorTable = [
+ {
+ name: 'id',
+ label: 'Identificador',
+ initialValue: '',
+ hidden: false,
+ type: 'texto'
+ }, {
+ name: 'esPrincipal',
+ label: 'Tipo de Almacen',
+ initialValue: true,
+ width: 'auto',
+ hidden: false,
+ type: 'etiq_alma'
+ }, {
+ name: 'region',
+ label: 'Region',
+ initialValue: 'Costa',
+ width: 'auto',
+ hidden: false,
+ type: 'texto'
+ }, {
+ name: 'provincia',
+ label: 'Provincia',
+ initialValue: 'Lima',
+ width: 'auto',
+ hidden: false,
+ type: 'texto'
+ }, {
+ name: 'latitud',
+ label: 'Latitud',
+ initialValue: 0,
+ width: 'auto',
+ hidden: false,
+ type: 'texto'
+ }, {
+ name: 'longitud',
+ label: 'Longitud',
+ initialValue: 0,
+ width: 'auto',
+ hidden: false,
+ type: 'texto'
+ },
+ {
+ name: 'action',
+ label: 'Acciones',
+ initialValue: '',
+ hidden: false
+ },
+];
+
+export const dataApi = [
+ {
+ id: '1',
+ esPrincipal: false,
+ region: 'Costa',
+ provincia: 'Arequipa',
+ latitud: 24,
+ longitud: 50,
+ estado: 0,
+ correo: 'mail@boss.com',
+ dni: '123456'
+ }, {
+ id: '2',
+ esPrincipal: true,
+ region: 'Costa',
+ provincia: 'Lima',
+ latitud: 24,
+ longitud: 50,
+ nombre: 'Juan',
+ estado: 1,
+ correo: 'mail@boss.com',
+ dni: '123456'
+ }
+];
diff --git a/front/odiparpack/app/containers/Odipar/Almacen/table/index.js b/front/odiparpack/app/containers/Odipar/Almacen/table/index.js
new file mode 100644
index 0000000..38d22f6
--- /dev/null
+++ b/front/odiparpack/app/containers/Odipar/Almacen/table/index.js
@@ -0,0 +1 @@
+export CrudAlmacen from "./CrudAlmacen";
\ No newline at end of file
--
cgit v1.2.3