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
---
.../app/containers/Odipar/Pedidos/Pedidos.js | 39 +++++
.../containers/Odipar/Pedidos/table/CrudPedido.js | 132 +++++++++++++++++
.../containers/Odipar/Pedidos/table/FormPedido.js | 164 +++++++++++++++++++++
.../app/containers/Odipar/Pedidos/table/index.js | 1 +
.../containers/Odipar/Pedidos/table/sampleData.js | 88 +++++++++++
5 files changed, 424 insertions(+)
create mode 100644 front/odiparpack/app/containers/Odipar/Pedidos/Pedidos.js
create mode 100644 front/odiparpack/app/containers/Odipar/Pedidos/table/CrudPedido.js
create mode 100644 front/odiparpack/app/containers/Odipar/Pedidos/table/FormPedido.js
create mode 100644 front/odiparpack/app/containers/Odipar/Pedidos/table/index.js
create mode 100644 front/odiparpack/app/containers/Odipar/Pedidos/table/sampleData.js
(limited to 'front/odiparpack/app/containers/Odipar')
diff --git a/front/odiparpack/app/containers/Odipar/Pedidos/Pedidos.js b/front/odiparpack/app/containers/Odipar/Pedidos/Pedidos.js
new file mode 100644
index 0000000..c1539e0
--- /dev/null
+++ b/front/odiparpack/app/containers/Odipar/Pedidos/Pedidos.js
@@ -0,0 +1,39 @@
+import React, { Component } from 'react';
+import { withStyles } from '@material-ui/core/styles';
+import PropTypes from 'prop-types';
+import { CrudPedido } from './table'
+import { Paper, Typography } from '@material-ui/core';
+import { etiqueta } from 'ba-components/Odipar/common';
+const styles = ({
+ root: {
+ flexGrow: 1,
+ marginTop: 30,
+ }
+ });
+
+class Pedidos extends Component {
+ render() {
+ const { classes } = this.props;
+ return (
+
+
+ {`Pedidos`}
+
+
+ {etiqueta("etiq_pedido", 1)}
+
+
+
+ );
+ }
+}
+
+Pedidos.propTypes = {
+ classes: PropTypes.object.isRequired,
+};
+
+export default withStyles(styles)(Pedidos);
\ No newline at end of file
diff --git a/front/odiparpack/app/containers/Odipar/Pedidos/table/CrudPedido.js b/front/odiparpack/app/containers/Odipar/Pedidos/table/CrudPedido.js
new file mode 100644
index 0000000..b11881f
--- /dev/null
+++ b/front/odiparpack/app/containers/Odipar/Pedidos/table/CrudPedido.js
@@ -0,0 +1,132 @@
+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 './sampleData';
+import FormPedido from './FormPedido';
+
+
+const branch = 'crudPedido';
+
+const renderRadioGroup = ({ input, ...rest }) => (
+ input.onChange(value)}
+ />
+);
+
+
+const styles = ({
+ root: {
+ flexGrow: 1,
+ }
+});
+
+class CrudPedido extends Component {
+ render() {
+ const {
+ classes,
+ fetchData,
+ addNew,
+ closeForm,
+ submit,
+ removeRow,
+ editRow,
+ dataTable,
+ openForm,
+ initValues,
+ closeNotif,
+ messageNotif,
+ title,
+ } = this.props;
+ return (
+
+
closeNotif(branch)} 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,
+};
+
+CrudPedido.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']),
+});
+
+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),
+});
+
+const CrudPedidoMapped = connect(
+ mapStateToProps,
+ mapDispatchToProps
+)(CrudPedido);
+
+export default withStyles(styles)(CrudPedidoMapped);
diff --git a/front/odiparpack/app/containers/Odipar/Pedidos/table/FormPedido.js b/front/odiparpack/app/containers/Odipar/Pedidos/table/FormPedido.js
new file mode 100644
index 0000000..40bc801
--- /dev/null
+++ b/front/odiparpack/app/containers/Odipar/Pedidos/table/FormPedido.js
@@ -0,0 +1,164 @@
+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,
+ DatePickerRedux
+} 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 FormPedido extends Component {
+ 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;
+ return (
+ <>
+
+
+
+
+
+
+
+
+
+
+ Lugar de Origen
+
+
+
+
+
+
+
+
+
+ Destino
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ >
+ );
+ }
+}
+
+FormPedido.propTypes = {
+ classes: PropTypes.object.isRequired,
+ };
+
+export default withStyles(styles)(FormPedido);
\ No newline at end of file
diff --git a/front/odiparpack/app/containers/Odipar/Pedidos/table/index.js b/front/odiparpack/app/containers/Odipar/Pedidos/table/index.js
new file mode 100644
index 0000000..48f7c9e
--- /dev/null
+++ b/front/odiparpack/app/containers/Odipar/Pedidos/table/index.js
@@ -0,0 +1 @@
+export CrudPedido from "./CrudPedido";
\ No newline at end of file
diff --git a/front/odiparpack/app/containers/Odipar/Pedidos/table/sampleData.js b/front/odiparpack/app/containers/Odipar/Pedidos/table/sampleData.js
new file mode 100644
index 0000000..2e2b003
--- /dev/null
+++ b/front/odiparpack/app/containers/Odipar/Pedidos/table/sampleData.js
@@ -0,0 +1,88 @@
+export const anchorTable = [
+ {
+ name: 'id',
+ label: 'Id',
+ initialValue: '',
+ hidden: true,
+ type: 'texto'
+ }, {
+ name: 'cantidad',
+ label: 'Cantidad',
+ width: 'auto',
+ hidden: false,
+ type: 'texto'
+ }, {
+ name: 'fecha',
+ label: 'Fecha de pedido',
+ initialValue: new Date(),
+ width: 'auto',
+ hidden: false,
+ type: 'texto'
+ }, {
+ name: 'origen',
+ label: 'Origen',
+ initialValue: 'option1',
+ width: 'auto',
+ hidden: false,
+ type: 'texto'
+ }, {
+ name: 'destino',
+ label: 'Destino',
+ initialValue: 'option1',
+ width: 'auto',
+ hidden: false,
+ type: 'texto'
+ }, {
+ name: 'plazo_entrega',
+ label: 'Plazo de entrega',
+ initialValue: true,
+ width: 'auto',
+ hidden: false,
+ type: 'texto'
+ }, {
+ name: 'nombre',
+ label: 'Cliente',
+ initialValue: true,
+ width: 'auto',
+ hidden: false,
+ type: 'texto'
+ }, {
+ name: 'estado',
+ label: 'Estado',
+ initialValue: 0,
+ width: 'auto',
+ hidden: false,
+ type: 'etiq_pedido'
+ }, {
+ name: 'action',
+ label: 'Action',
+ initialValue: '',
+ hidden: false
+ },
+];
+
+export const dataApi = [
+ {
+ id: '1',
+ cantidad: 30,
+ fecha: '24/05/2022 11:28 AM',
+ origen: 'Arequipa',
+ destino: 'Cuzco',
+ plazo_entrega: '24 horas',
+ nombre: 'Juan',
+ estado: 0,
+ correo: 'mail@boss.com',
+ dni: '123456'
+ }, {
+ id: '2',
+ cantidad: 30,
+ fecha: '24/05/2022 10:28 AM',
+ origen: 'Lima',
+ destino: 'Cuzco',
+ plazo_entrega: '24 horas',
+ nombre: 'Juan',
+ estado: 1,
+ correo: 'mail@boss.com',
+ dni: '123456'
+ }
+];
--
cgit v1.2.3