summaryrefslogtreecommitdiffstats
path: root/front/odiparpack/app/containers
diff options
context:
space:
mode:
authorgabrhr <[email protected]>2022-05-31 03:58:23 -0500
committergabrhr <[email protected]>2022-05-31 03:58:23 -0500
commitcbc7d7f7494508fda69e88c76702a878bebca0e2 (patch)
tree7a3bec98a7deb82ac95850835d08b2a305b8a0cc /front/odiparpack/app/containers
parent32fb17de8f78317b165b6f269a8bab2d4e852d0d (diff)
downloadDP1_project-cbc7d7f7494508fda69e88c76702a878bebca0e2.tar.gz
DP1_project-cbc7d7f7494508fda69e88c76702a878bebca0e2.tar.bz2
DP1_project-cbc7d7f7494508fda69e88c76702a878bebca0e2.zip
Add Almacenes
- todo de almacenes, redux, pagina - mejoro form de pedido (etiqueta estado, RUC) #TODO - Ver combobox con API
Diffstat (limited to 'front/odiparpack/app/containers')
-rw-r--r--front/odiparpack/app/containers/App/Application.js4
-rw-r--r--front/odiparpack/app/containers/Odipar/Almacen/Almacenes.js66
-rw-r--r--front/odiparpack/app/containers/Odipar/Almacen/table/CrudAlmacen.js148
-rw-r--r--front/odiparpack/app/containers/Odipar/Almacen/table/FormAlmacen.js124
-rw-r--r--front/odiparpack/app/containers/Odipar/Almacen/table/dataAlmacen.js75
-rw-r--r--front/odiparpack/app/containers/Odipar/Almacen/table/index.js1
-rw-r--r--front/odiparpack/app/containers/Odipar/Pedidos/Pedidos.js3
-rw-r--r--front/odiparpack/app/containers/Odipar/Pedidos/table/FormPedido.js30
-rw-r--r--front/odiparpack/app/containers/Odipar/Pedidos/table/sampleData.js5
-rw-r--r--front/odiparpack/app/containers/pageListAsync.js8
10 files changed, 455 insertions, 9 deletions
diff --git a/front/odiparpack/app/containers/App/Application.js b/front/odiparpack/app/containers/App/Application.js
index 21c7a76..8a30720 100644
--- a/front/odiparpack/app/containers/App/Application.js
+++ b/front/odiparpack/app/containers/App/Application.js
@@ -26,7 +26,8 @@ import {
Photos, Error, Settings,
HelpSupport, MapMarker, MapDirection, SearchMap,
TrafficIndicator, StreetViewMap, NotFound,
- Pedidos
+ Pedidos,
+ Almacenes
} from '../pageListAsync';
function Application(props) {
@@ -39,6 +40,7 @@ function Application(props) {
<Route exact path="/app/dashboard-v2" component={DashboardV2} />
{/* Pedidos */}
<Route exact path="/app/pedidos" component={Pedidos}/>
+ <Route exact path="/app/almacenes" component={Almacenes}/>
{ /* Layout */ }
<Route exact path="/app/layouts" component={Parent} />
<Route path="/app/layouts/grid" component={Grid} />
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 (
+ <div>
+ <Typography variant="h4">
+ {`Almacenes`}
+ </Typography>
+ <div>
+ <Paper className={classes.root}>
+ <CrudAlmacen title = "Lista de Almacenes" dataReal={dataRealF}/>
+ </Paper>
+ </div>
+ </div>
+ );
+ }
+}
+
+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 }) => (
+ <RadioGroup
+ {...input}
+ {...rest}
+ valueselected={input.value}
+ onChange={(event, value) => 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 (
+ <div>
+ <Notification close={() => closeNotif(branch)} variant = "success" message={messageNotif} />
+ <Paper className={classes.root}>
+ <CrudTableForm
+ dataTable={dataTable}
+ openForm={openForm}
+ dataInit={dataReal}
+ anchor={anchorTable}
+ title={title}
+ fetchData={fetchData}
+ addNew={addNew}
+ closeForm={closeForm}
+ submit={submit}
+ removeRow={removeRow}
+ editRow={editRow}
+ branch={branch}
+ initValues={initValues}
+ addNewAPI={getPedidos}
+ removeRowAPI={getPedidos}
+ editRowAPI={getPedidos}
+ dispatch = {dispatch}
+ editingId = {editingId}
+ >
+ {/* Create Your own form, then arrange or custom it as You like */}
+ <FormAlmacen/>
+ {/* No need create button or submit, because that already made in this component */}
+ </CrudTableForm>
+ </Paper>
+ </div>
+ );
+ }
+}
+
+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 (
+ <>
+ <div>
+ <FormControl className={classes.field}>
+ <InputLabel htmlFor="selection">Tipo de Almacen</InputLabel>
+ <Field
+ name="esPrincipal"
+ component={SelectRedux}
+ placeholder="Seleccionar"
+ autoWidth={trueBool}
+ >
+ <MenuItem value={true}>Principal</MenuItem>
+ <MenuItem value={false}>Pequeño</MenuItem>
+ </Field>
+ </FormControl>
+ </div>
+ <div>
+ <FormControl className={classes.field}>
+ <InputLabel htmlFor="selection">Region</InputLabel>
+ <Field
+ name="region"
+ component={SelectRedux}
+ placeholder="Seleccionar"
+ autoWidth={trueBool}
+ >
+ <MenuItem value="Costa">Costa</MenuItem>
+ <MenuItem value="Sierra">Sierra</MenuItem>
+ <MenuItem value="Selva">Selva</MenuItem>
+ </Field>
+ </FormControl>
+ </div>
+ <div>
+ <FormControl className={classes.field}>
+ <InputLabel htmlFor="selection">Provincia</InputLabel>
+ <Field
+ name="provincia"
+ component={SelectRedux}
+ placeholder="Seleccionar"
+ autoWidth={trueBool}
+ >
+ <MenuItem value="Lima">Lima</MenuItem>
+ <MenuItem value="Arequipa">Arequipa</MenuItem>
+ <MenuItem value="Cuzco">Cuzco</MenuItem>
+ </Field>
+ </FormControl>
+ </div>
+ <div>
+ <Field
+ name="latitud"
+ component={TextFieldRedux}
+ placeholder="Latitud"
+ label="Latitud de Provincia"
+ validate={required}
+ disabled
+ required
+ ref={this.saveRef}
+ className={classes.field}
+ />
+ <Field
+ name="longitud"
+ component={TextFieldRedux}
+ placeholder="Longitud"
+ label="Longitud de Provincia"
+ validate={required}
+ disabled
+ required
+ ref={this.saveRef}
+ className={classes.field}
+ />
+ </div>
+ </>
+ );
+ }
+}
+
+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: '[email protected]',
+ dni: '123456'
+ }, {
+ id: '2',
+ esPrincipal: true,
+ region: 'Costa',
+ provincia: 'Lima',
+ latitud: 24,
+ longitud: 50,
+ nombre: 'Juan',
+ estado: 1,
+ correo: '[email protected]',
+ 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
diff --git a/front/odiparpack/app/containers/Odipar/Pedidos/Pedidos.js b/front/odiparpack/app/containers/Odipar/Pedidos/Pedidos.js
index 27adce5..f617458 100644
--- a/front/odiparpack/app/containers/Odipar/Pedidos/Pedidos.js
+++ b/front/odiparpack/app/containers/Odipar/Pedidos/Pedidos.js
@@ -5,9 +5,8 @@ import { CrudPedido } from './table'
import { Paper, Typography } from '@material-ui/core';
import { connect } from 'react-redux';
-//
+//actions
import { getPedidos } from 'ba-actions/pedido';
-import pedido from '../../../redux/modules/pedido';
const styles = ({
root: {
diff --git a/front/odiparpack/app/containers/Odipar/Pedidos/table/FormPedido.js b/front/odiparpack/app/containers/Odipar/Pedidos/table/FormPedido.js
index 40bc801..548f47b 100644
--- a/front/odiparpack/app/containers/Odipar/Pedidos/table/FormPedido.js
+++ b/front/odiparpack/app/containers/Odipar/Pedidos/table/FormPedido.js
@@ -6,12 +6,14 @@ import {required, integer} from 'ba-api/validation'
import {
SelectRedux,
TextFieldRedux,
- DatePickerRedux
+ DatePickerRedux,
+ EstadoRedux
} from 'ba-components/Forms/ReduxFormMUI';
import {
MenuItem,
InputLabel,
FormControl,
+ Typography,
} from '@material-ui/core';
const styles = ({
@@ -53,6 +55,9 @@ class FormPedido extends Component {
const trueBool = true;
return (
<>
+ <Typography variant="h5">
+ {`Datos de Pedido`}
+ </Typography>
<div>
<Field
name="cantidad"
@@ -76,9 +81,20 @@ class FormPedido extends Component {
/>
</FormControl>
</div>
+ <div>
+ <InputLabel htmlFor="selection" style={{fontSize:12.5, marginBottom: 5}}>Estado</InputLabel>
+ <Field
+ name = "estado"
+ component={EstadoRedux}
+ />
+
+ </div>
+ <Typography variant="h5" style={{marginTop: 5}}>
+ {`Datos de Entrega`}
+ </Typography>
<div>
<FormControl className={classes.field}>
- <InputLabel htmlFor="selection">Lugar de Origen</InputLabel>
+ <InputLabel htmlFor="selection">Origen</InputLabel>
<Field
name="origen"
component={SelectRedux}
@@ -113,9 +129,15 @@ class FormPedido extends Component {
placeholder="Plazo entrega"
label="Plazo de Entrega"
ref={this.saveRef}
+ disabled
className={classes.field}
/>
</div>
+
+ <Typography variant="h5">
+ {`Datos de Cliente`}
+ </Typography>
+
<div>
<Field
name="nombre"
@@ -132,8 +154,8 @@ class FormPedido extends Component {
<Field
name="dni"
component={TextFieldRedux}
- placeholder="Ingrese el dni"
- label="DNI del Cliente"
+ placeholder="Ingrese el RUC"
+ label="RUC del Cliente"
validate={required}
required
ref={this.saveRef}
diff --git a/front/odiparpack/app/containers/Odipar/Pedidos/table/sampleData.js b/front/odiparpack/app/containers/Odipar/Pedidos/table/sampleData.js
index 3a7556c..4972669 100644
--- a/front/odiparpack/app/containers/Odipar/Pedidos/table/sampleData.js
+++ b/front/odiparpack/app/containers/Odipar/Pedidos/table/sampleData.js
@@ -1,9 +1,10 @@
export const anchorTable = [
{
name: 'id',
- label: 'Id',
+ label: 'Identificador',
initialValue: '',
- hidden: true,
+ hidden: false,
+ type: 'texto'
}, {
name: 'cantidad',
label: 'Cantidad',
diff --git a/front/odiparpack/app/containers/pageListAsync.js b/front/odiparpack/app/containers/pageListAsync.js
index 102bb97..14381b1 100644
--- a/front/odiparpack/app/containers/pageListAsync.js
+++ b/front/odiparpack/app/containers/pageListAsync.js
@@ -7,6 +7,14 @@ export const Pedidos = Loadable({
loading: Loading,
});
+// 4. Almacenes
+export const Almacenes = Loadable({
+ loader: () => import('./Odipar/Almacen/Almacenes'),
+ loading: Loading,
+});
+
+
+
// Dashboard
export const DashboardV1 = Loadable({
loader: () => import('./Dashboard/Dashboard'),