From 1acea62c2be9e3f9916b9430d8c594235ea6ac21 Mon Sep 17 00:00:00 2001 From: Yash Maheshwari Date: Fri, 12 Jan 2024 12:10:31 +0530 Subject: [PATCH 01/10] Implemented: util state for storing enumeration information(#17) --- src/store/RootState.ts | 3 +++ src/store/index.ts | 6 ++++-- src/store/modules/util/UtilState.ts | 15 +++++++++++++++ src/store/modules/util/actions.ts | 7 +++++++ src/store/modules/util/getters.ts | 7 +++++++ src/store/modules/util/index.ts | 18 ++++++++++++++++++ src/store/modules/util/mutation-types.ts | 2 ++ src/store/modules/util/mutations.ts | 10 ++++++++++ 8 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 src/store/modules/util/UtilState.ts create mode 100644 src/store/modules/util/actions.ts create mode 100644 src/store/modules/util/getters.ts create mode 100644 src/store/modules/util/index.ts create mode 100644 src/store/modules/util/mutation-types.ts create mode 100644 src/store/modules/util/mutations.ts diff --git a/src/store/RootState.ts b/src/store/RootState.ts index d3f55f7..cf8d84e 100644 --- a/src/store/RootState.ts +++ b/src/store/RootState.ts @@ -1,3 +1,6 @@ +import UtilState from "./modules/util/UtilState"; + export default interface RootState { user: any; + util: UtilState; } \ No newline at end of file diff --git a/src/store/index.ts b/src/store/index.ts index 0113bff..2c287cf 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -5,6 +5,7 @@ import actions from "./actions" import RootState from "./RootState" import createPersistedState from "vuex-persistedstate"; import userModule from "./modules/user"; +import utilModule from "./modules/util" // TODO check how to register it from the components only // Handle same module registering multiple time on page refresh @@ -13,7 +14,7 @@ import userModule from "./modules/user"; const state: any = {} const persistState = createPersistedState({ - paths: ["user"], + paths: ["user", "util"], fetchBeforeUse: true }) @@ -25,7 +26,8 @@ const store = createStore({ getters, plugins: [ persistState ], modules: { - "user": userModule + "user": userModule, + "util": utilModule }, }) diff --git a/src/store/modules/util/UtilState.ts b/src/store/modules/util/UtilState.ts new file mode 100644 index 0000000..98967f9 --- /dev/null +++ b/src/store/modules/util/UtilState.ts @@ -0,0 +1,15 @@ +enum Enumeration { + _entity, + enumId, + enumTypeId, + enumCode, + sequenceId, + description, + enumName, + sequenceNum, + lastUpdatedStamp +} + +export default interface UtilState { + enums: Array +} \ No newline at end of file diff --git a/src/store/modules/util/actions.ts b/src/store/modules/util/actions.ts new file mode 100644 index 0000000..f6b52d1 --- /dev/null +++ b/src/store/modules/util/actions.ts @@ -0,0 +1,7 @@ +import { ActionTree } from "vuex" +import RootState from "@/store/RootState" +import UtilState from "./UtilState" + +const actions: ActionTree = {} + +export default actions; \ No newline at end of file diff --git a/src/store/modules/util/getters.ts b/src/store/modules/util/getters.ts new file mode 100644 index 0000000..39918ab --- /dev/null +++ b/src/store/modules/util/getters.ts @@ -0,0 +1,7 @@ +import { GetterTree } from "vuex" +import UtilState from "./UtilState" +import RootState from "@/store/RootState" + +const getters: GetterTree = {} + +export default getters; \ No newline at end of file diff --git a/src/store/modules/util/index.ts b/src/store/modules/util/index.ts new file mode 100644 index 0000000..5318251 --- /dev/null +++ b/src/store/modules/util/index.ts @@ -0,0 +1,18 @@ +import actions from "./actions" +import getters from "./getters" +import mutations from "./mutations" +import { Module } from "vuex" +import UtilState from "./UtilState" +import RootState from "@/store/RootState" + +const utilModule: Module = { + namespaced: true, + state: { + enums: [], + }, + getters, + actions, + mutations, +} + +export default utilModule; \ No newline at end of file diff --git a/src/store/modules/util/mutation-types.ts b/src/store/modules/util/mutation-types.ts new file mode 100644 index 0000000..6bc0c05 --- /dev/null +++ b/src/store/modules/util/mutation-types.ts @@ -0,0 +1,2 @@ +export const SN_UTIL = "util" +export const UTIL_ENUMS_UPDATED = SN_UTIL + "/ENUMS_UPDATED" \ No newline at end of file diff --git a/src/store/modules/util/mutations.ts b/src/store/modules/util/mutations.ts new file mode 100644 index 0000000..6157429 --- /dev/null +++ b/src/store/modules/util/mutations.ts @@ -0,0 +1,10 @@ +import { MutationTree } from "vuex" +import UtilState from "./UtilState" +import * as types from "./mutation-types" + +const mutations: MutationTree = { + [types.UTIL_ENUMS_UPDATED](state, payload) { + state.enums = payload + } +} +export default mutations; \ No newline at end of file From 70ab1a07bb6a05f08ad1e1f3813d2a92336dd0e1 Mon Sep 17 00:00:00 2001 From: Yash Maheshwari Date: Fri, 12 Jan 2024 14:35:35 +0530 Subject: [PATCH 02/10] Implemented: support to define vuex store for routing(#17) --- .../modules/orderRouting/OrderRoutingState.ts | 7 ++++++ src/store/modules/orderRouting/actions.ts | 7 ++++++ src/store/modules/orderRouting/getters.ts | 7 ++++++ src/store/modules/orderRouting/index.ts | 22 +++++++++++++++++++ .../modules/orderRouting/mutation-types.ts | 6 +++++ src/store/modules/orderRouting/mutations.ts | 22 +++++++++++++++++++ 6 files changed, 71 insertions(+) create mode 100644 src/store/modules/orderRouting/OrderRoutingState.ts create mode 100644 src/store/modules/orderRouting/actions.ts create mode 100644 src/store/modules/orderRouting/getters.ts create mode 100644 src/store/modules/orderRouting/index.ts create mode 100644 src/store/modules/orderRouting/mutation-types.ts create mode 100644 src/store/modules/orderRouting/mutations.ts diff --git a/src/store/modules/orderRouting/OrderRoutingState.ts b/src/store/modules/orderRouting/OrderRoutingState.ts new file mode 100644 index 0000000..38e7251 --- /dev/null +++ b/src/store/modules/orderRouting/OrderRoutingState.ts @@ -0,0 +1,7 @@ +export default interface OrderRoutingState { + groups: Array; // runs + routes: Array; + rule: Array; + currentGroupId: string; + currentRouteId: string; +} \ No newline at end of file diff --git a/src/store/modules/orderRouting/actions.ts b/src/store/modules/orderRouting/actions.ts new file mode 100644 index 0000000..6f95e64 --- /dev/null +++ b/src/store/modules/orderRouting/actions.ts @@ -0,0 +1,7 @@ +import { ActionTree } from "vuex" +import RootState from "@/store/RootState" +import OrderRoutingState from "./OrderRoutingState" + +const actions: ActionTree = {} + +export default actions; \ No newline at end of file diff --git a/src/store/modules/orderRouting/getters.ts b/src/store/modules/orderRouting/getters.ts new file mode 100644 index 0000000..fc72a67 --- /dev/null +++ b/src/store/modules/orderRouting/getters.ts @@ -0,0 +1,7 @@ +import { GetterTree } from "vuex" +import OrderRoutingState from "./OrderRoutingState" +import RootState from "@/store/RootState" + +const getters: GetterTree = {} + +export default getters; \ No newline at end of file diff --git a/src/store/modules/orderRouting/index.ts b/src/store/modules/orderRouting/index.ts new file mode 100644 index 0000000..09fa840 --- /dev/null +++ b/src/store/modules/orderRouting/index.ts @@ -0,0 +1,22 @@ +import actions from "./actions" +import getters from "./getters" +import mutations from "./mutations" +import { Module } from "vuex" +import OrderRoutingState from "./OrderRoutingState" +import RootState from "@/store/RootState" + +const orderRoutingModule: Module = { + namespaced: true, + state: { + groups: [], + routes: [], + rule: [], + currentGroupId: '', + currentRouteId: '' + }, + getters, + actions, + mutations, +} + +export default orderRoutingModule; \ No newline at end of file diff --git a/src/store/modules/orderRouting/mutation-types.ts b/src/store/modules/orderRouting/mutation-types.ts new file mode 100644 index 0000000..7f9cb71 --- /dev/null +++ b/src/store/modules/orderRouting/mutation-types.ts @@ -0,0 +1,6 @@ +export const SN_ORDER_ROUTING = "orderRouting" +export const ORDER_ROUTING_GROUPS_UPDATED = SN_ORDER_ROUTING + "/GROUPS_UPDATED" +export const ORDER_ROUTING_ROUTES_UPDATED = SN_ORDER_ROUTING + "/ROUTES_UPDATED" +export const ORDER_ROUTING_RULE_UPDATED = SN_ORDER_ROUTING + "/RULE_UPDATED" +export const ORDER_ROUTING_CURRENT_GROUP_UPDATED = SN_ORDER_ROUTING + "/CURRENT_GROUP_UPDATED" +export const ORDER_ROUTING_CURRENT_ROUTE_UPDATED = SN_ORDER_ROUTING + "/CURRENT_ROUTE_UPDATED" \ No newline at end of file diff --git a/src/store/modules/orderRouting/mutations.ts b/src/store/modules/orderRouting/mutations.ts new file mode 100644 index 0000000..4604a31 --- /dev/null +++ b/src/store/modules/orderRouting/mutations.ts @@ -0,0 +1,22 @@ +import { MutationTree } from "vuex" +import OrderRoutingState from "./OrderRoutingState" +import * as types from "./mutation-types" + +const mutations: MutationTree = { + [types.ORDER_ROUTING_GROUPS_UPDATED](state, payload) { + state.groups = payload + }, + [types.ORDER_ROUTING_ROUTES_UPDATED](state, payload) { + state.routes = payload + }, + [types.ORDER_ROUTING_RULE_UPDATED](state, payload) { + state.rule = payload + }, + [types.ORDER_ROUTING_CURRENT_GROUP_UPDATED](state, groupId) { + state.currentGroupId = groupId + }, + [types.ORDER_ROUTING_CURRENT_ROUTE_UPDATED](state, routeId) { + state.currentRouteId = routeId + } +} +export default mutations; \ No newline at end of file From 7366117b25e631556fda8c9d8df751f780058f65 Mon Sep 17 00:00:00 2001 From: Yash Maheshwari Date: Sat, 13 Jan 2024 14:20:26 +0530 Subject: [PATCH 03/10] Implemented: support to register the order routing module(#17) --- src/store/index.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/store/index.ts b/src/store/index.ts index 2c287cf..2c6eba5 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -6,6 +6,7 @@ import RootState from "./RootState" import createPersistedState from "vuex-persistedstate"; import userModule from "./modules/user"; import utilModule from "./modules/util" +import orderRoutingModule from "./modules/orderRouting" // TODO check how to register it from the components only // Handle same module registering multiple time on page refresh @@ -27,7 +28,8 @@ const store = createStore({ plugins: [ persistState ], modules: { "user": userModule, - "util": utilModule + "util": utilModule, + "orderRouting": orderRoutingModule }, }) From 7455853193c560a82bfcbbb888eb8d55fa95a39e Mon Sep 17 00:00:00 2001 From: Yash Maheshwari Date: Sat, 13 Jan 2024 14:21:33 +0530 Subject: [PATCH 04/10] Implemented: type for rules, groups and enums(#17) --- src/store/modules/util/UtilState.ts | 12 +------ src/types/index.ts | 52 +++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 11 deletions(-) create mode 100644 src/types/index.ts diff --git a/src/store/modules/util/UtilState.ts b/src/store/modules/util/UtilState.ts index 98967f9..0533ce1 100644 --- a/src/store/modules/util/UtilState.ts +++ b/src/store/modules/util/UtilState.ts @@ -1,14 +1,4 @@ -enum Enumeration { - _entity, - enumId, - enumTypeId, - enumCode, - sequenceId, - description, - enumName, - sequenceNum, - lastUpdatedStamp -} +import { Enumeration } from "@/types"; export default interface UtilState { enums: Array diff --git a/src/types/index.ts b/src/types/index.ts new file mode 100644 index 0000000..3478479 --- /dev/null +++ b/src/types/index.ts @@ -0,0 +1,52 @@ +type Enumeration = { + enumId: string, + enumTypeId: string, + enumCode: string, + sequenceId: string, + description: string, + enumName: string, + sequenceNum: string +} + +type Group = { + routingGroupId: string, + productStoreId: string, + groupName: string, + sequenceNum: string, + description: string, + createdByUser: string, + createdDate: string, + lastUpdatedStamp: string, +} + +type Route = { + orderRoutingId: string, + routingGroupId: string, + statusId: string, + routingName: string, + sequenceNum: string, + description: string, + createdByUser: string, + createdDate: string, + lastUpdatedStamp: string +} + +type Rule = { + routingRuleId: string, + orderRoutingId: string, + ruleName: string, + statusId: string, + sequenceNum: string, + assignmentEnumId: string, + fulfillEntireShipGroup: string, + createdDate: string, + createdByUser: string, + lastUpdatedStamp: string +} + +export { + Enumeration, + Group, + Route, + Rule +} \ No newline at end of file From 16ef72fb2448a29b72dd1de6fc995fb65d2d6fbe Mon Sep 17 00:00:00 2001 From: Yash Maheshwari Date: Sat, 13 Jan 2024 14:22:37 +0530 Subject: [PATCH 05/10] Implemented: support to fetch brokering runs information on page load(#17) --- src/services/RoutingService.ts | 13 ++++++++++++ src/store/modules/orderRouting/actions.ts | 24 ++++++++++++++++++++++- src/views/BrokeringRuns.vue | 6 ++++++ 3 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 src/services/RoutingService.ts diff --git a/src/services/RoutingService.ts b/src/services/RoutingService.ts new file mode 100644 index 0000000..26d7c35 --- /dev/null +++ b/src/services/RoutingService.ts @@ -0,0 +1,13 @@ +import api from "@/api" + +const fetchRoutingGroups = async (payload: any): Promise => { + return api({ + url: "groups", + method: "GET", + data: payload + }); +} + +export const OrderRoutingService = { + fetchRoutingGroups +} \ No newline at end of file diff --git a/src/store/modules/orderRouting/actions.ts b/src/store/modules/orderRouting/actions.ts index 6f95e64..245e1e5 100644 --- a/src/store/modules/orderRouting/actions.ts +++ b/src/store/modules/orderRouting/actions.ts @@ -1,7 +1,29 @@ import { ActionTree } from "vuex" import RootState from "@/store/RootState" import OrderRoutingState from "./OrderRoutingState" +import { OrderRoutingService } from "@/services/RoutingService" +import { hasError } from "@/utils" +import * as types from './mutation-types' -const actions: ActionTree = {} +const actions: ActionTree = { + async fetchOrderRoutingGroups({ commit }) { + const routingGroups = [] as any; + const payload = {} + + try { + const resp = await OrderRoutingService.fetchRoutingGroups(payload); + + if(!hasError(resp)) { + console.log('resp', resp) + } else { + throw resp.data + } + } catch(err) { + console.log(err); + } + + commit(types.ORDER_ROUTING_GROUPS_UPDATED, routingGroups) + } +} export default actions; \ No newline at end of file diff --git a/src/views/BrokeringRuns.vue b/src/views/BrokeringRuns.vue index 471b41c..87cad99 100644 --- a/src/views/BrokeringRuns.vue +++ b/src/views/BrokeringRuns.vue @@ -103,10 +103,16 @@ From 08b89dce2cb1bee14ec3ed32ca53eb5d0408f538 Mon Sep 17 00:00:00 2001 From: Yash Maheshwari Date: Mon, 15 Jan 2024 11:58:49 +0530 Subject: [PATCH 06/10] Implemented: support to add a new run(#17) --- src/views/BrokeringRuns.vue | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/views/BrokeringRuns.vue b/src/views/BrokeringRuns.vue index 87cad99..338b72e 100644 --- a/src/views/BrokeringRuns.vue +++ b/src/views/BrokeringRuns.vue @@ -5,7 +5,7 @@ {{ "Brokering Runs" }} - + {{ "New Run" }} @@ -104,15 +104,32 @@ From 5c2480041a36ba6a037078d144c4d03bc76d1a21 Mon Sep 17 00:00:00 2001 From: Yash Maheshwari Date: Mon, 15 Jan 2024 17:46:57 +0530 Subject: [PATCH 07/10] Implemented: support to dislay the runs data dynamically(#17) --- src/store/modules/orderRouting/actions.ts | 7 +- src/store/modules/orderRouting/getters.ts | 6 +- src/views/BrokeringRuns.vue | 89 +++++------------------ 3 files changed, 27 insertions(+), 75 deletions(-) diff --git a/src/store/modules/orderRouting/actions.ts b/src/store/modules/orderRouting/actions.ts index 245e1e5..c7940ec 100644 --- a/src/store/modules/orderRouting/actions.ts +++ b/src/store/modules/orderRouting/actions.ts @@ -7,14 +7,15 @@ import * as types from './mutation-types' const actions: ActionTree = { async fetchOrderRoutingGroups({ commit }) { - const routingGroups = [] as any; + let routingGroups = [] as any; + // filter groups on the basis of productStoreId const payload = {} try { const resp = await OrderRoutingService.fetchRoutingGroups(payload); - if(!hasError(resp)) { - console.log('resp', resp) + if(!hasError(resp) && resp.data.length) { + routingGroups = resp.data } else { throw resp.data } diff --git a/src/store/modules/orderRouting/getters.ts b/src/store/modules/orderRouting/getters.ts index fc72a67..d4f946d 100644 --- a/src/store/modules/orderRouting/getters.ts +++ b/src/store/modules/orderRouting/getters.ts @@ -2,6 +2,10 @@ import { GetterTree } from "vuex" import OrderRoutingState from "./OrderRoutingState" import RootState from "@/store/RootState" -const getters: GetterTree = {} +const getters: GetterTree = { + getRoutingGroups(state) { + return state.groups + } +} export default getters; \ No newline at end of file diff --git a/src/views/BrokeringRuns.vue b/src/views/BrokeringRuns.vue index 4a302f6..e9b941e 100644 --- a/src/views/BrokeringRuns.vue +++ b/src/views/BrokeringRuns.vue @@ -14,99 +14,47 @@ -
+
- + - {{ "Brokering run name" }} + {{ group.groupName }} - {{ "Description" }} + {{ group.description }} - {{ "" }} - {{ "" }} + {{ group.frequency ? group.frequency : "-" }} + {{ group.runTime ? group.runTime : "-" }} - {{ "Created at - {{ "Updated at - - - - - {{ "Brokering run name" }} - - - - {{ "Description" }} - - - {{ "" }} - {{ "" }} - - - {{ "Created at - - {{ "Updated at - - - - - {{ "Brokering run name" }} - - - - {{ "Description" }} - - - {{ "" }} - {{ "" }} - - - {{ "Created at - - {{ "Updated at - - - - - {{ "Brokering run name" }} - - - - {{ "Description" }} - - - {{ "" }} - {{ "" }} - - - {{ "Created at - - {{ "Updated at
+
+ {{ "No runs scheduled" }} +