summaryrefslogtreecommitdiffstats
path: root/front/odiparpack/app/redux/modules
diff options
context:
space:
mode:
authorDayana31 <[email protected]>2022-06-01 16:43:23 -0500
committerDayana31 <[email protected]>2022-06-01 16:43:23 -0500
commitec0c33156713e51c64f2a9de4f932cd5507c654b (patch)
treecc46421686a49bbc0a0c343e460c13a21af1015d /front/odiparpack/app/redux/modules
parent6971201caffc2fccee5bfb12e88e5510c85eeb49 (diff)
parente9cb09907f8dbc9a4a64549a3ea4d1d8313e7c25 (diff)
downloadDP1_project-ec0c33156713e51c64f2a9de4f932cd5507c654b.tar.gz
DP1_project-ec0c33156713e51c64f2a9de4f932cd5507c654b.tar.bz2
DP1_project-ec0c33156713e51c64f2a9de4f932cd5507c654b.zip
Merge branch 'develop' into dayana
Diffstat (limited to 'front/odiparpack/app/redux/modules')
-rw-r--r--front/odiparpack/app/redux/modules/almacen.js16
-rw-r--r--front/odiparpack/app/redux/modules/crudTableForm.js16
-rw-r--r--front/odiparpack/app/redux/modules/message.js30
-rw-r--r--front/odiparpack/app/redux/modules/pedido.js16
4 files changed, 77 insertions, 1 deletions
diff --git a/front/odiparpack/app/redux/modules/almacen.js b/front/odiparpack/app/redux/modules/almacen.js
new file mode 100644
index 0000000..bb9b7d6
--- /dev/null
+++ b/front/odiparpack/app/redux/modules/almacen.js
@@ -0,0 +1,16 @@
+import { LISTA_ALMACEN } from 'ba-actions/actionTypes';
+
+const initState = {
+ almacenes : []
+}
+
+const almacen = (state = initState, action) => {
+ switch (action.type) {
+ case LISTA_ALMACEN:
+ return { ...state, pedidos: action.payload }
+ default :
+ return state
+ }
+}
+
+export default almacen; \ No newline at end of file
diff --git a/front/odiparpack/app/redux/modules/crudTableForm.js b/front/odiparpack/app/redux/modules/crudTableForm.js
index d5194c1..acf9abd 100644
--- a/front/odiparpack/app/redux/modules/crudTableForm.js
+++ b/front/odiparpack/app/redux/modules/crudTableForm.js
@@ -24,12 +24,26 @@ const initialItem = (keyTemplate, anchor) => {
for (let i = 0; i < rawKey.length; i += 1) {
if (rawKey[i] !== 'id') {
const itemIndex = anchor.findIndex(a => a.name === rawKey[i]);
+ if (itemIndex == -1) continue
staticKey[rawKey[i]] = anchor[itemIndex].initialValue;
}
}
return Map(staticKey);
};
+
+const initialItemNew = (anchor) => {
+ const [...rawKey] = anchor.map((e) => e.name);
+ const staticKey = {};
+ for (let i = 0; i < rawKey.length; i += 1) {
+ if (rawKey[i] !== 'id') {
+ staticKey[rawKey[i]] = anchor[i].initialValue;
+ }
+ }
+
+ return Map(staticKey);
+};
+
let editingIndex = 0;
const initialImmutableState = fromJS(initialState);
@@ -45,7 +59,7 @@ export default function reducer(state = initialImmutableState, action = {}) {
case `${branch}/${ADD_NEW}`:
return state.withMutations((mutableState) => {
const raw = state.get('dataTable').last();
- const initial = initialItem(raw, action.anchor);
+ const initial = initialItemNew(action.anchor);
mutableState.set('formValues', initial);
mutableState.set('showFrm', true);
});
diff --git a/front/odiparpack/app/redux/modules/message.js b/front/odiparpack/app/redux/modules/message.js
new file mode 100644
index 0000000..e02eb08
--- /dev/null
+++ b/front/odiparpack/app/redux/modules/message.js
@@ -0,0 +1,30 @@
+import { CLOSE_MESSAGE,OPEN_MESSAGE } from 'ba-actions/actionTypes';
+
+const initState = {
+ message: '',
+ type: '',
+ openMessage: false
+}
+
+const message = (state = initState, action = {}) => {
+
+ const { type, payload } = action;
+
+ switch (type) {
+
+ case CLOSE_MESSAGE:
+ return {...initState}
+ case OPEN_MESSAGE:
+ return {
+ ...state,
+ ...payload,
+ openMessage: true
+ }
+ default:
+ return state
+
+ }
+
+}
+
+export default message; \ No newline at end of file
diff --git a/front/odiparpack/app/redux/modules/pedido.js b/front/odiparpack/app/redux/modules/pedido.js
new file mode 100644
index 0000000..9101fe4
--- /dev/null
+++ b/front/odiparpack/app/redux/modules/pedido.js
@@ -0,0 +1,16 @@
+import { LISTA_PEDIDO } from 'ba-actions/actionTypes';
+
+const initState = {
+ pedidos : []
+}
+
+const pedido = (state = initState, action) => {
+ switch (action.type) {
+ case LISTA_PEDIDO:
+ return { ...state, pedidos: action.payload }
+ default :
+ return state
+ }
+}
+
+export default pedido; \ No newline at end of file