From ff15d2d8b1df09fec89d2bd0c2bc04b836699a34 Mon Sep 17 00:00:00 2001 From: Yash Maheshwari Date: Thu, 25 Jan 2024 19:18:08 +0530 Subject: [PATCH] Implementes: support to schedule and update a job(#39) --- .env.example | 3 +- src/services/RoutingService.ts | 11 ++- src/store/modules/orderRouting/getters.ts | 1 - src/views/BrokeringRoute.vue | 102 +++++++++++++++++++--- 4 files changed, 100 insertions(+), 17 deletions(-) diff --git a/.env.example b/.env.example index 6bc30d8..750230b 100644 --- a/.env.example +++ b/.env.example @@ -8,4 +8,5 @@ VUE_APP_RULE_ENUMS={"QUEUE":{"id":"OIP_QUEUE","code":"facilityId"},"SHIPPING_MET VUE_APP_RULE_FILTER_ENUMS={"FACILITY_GROUP":{"id":"IIP_FACILITY_GROUP","code":"facilityGroupId"},"PROXIMITY":{"id":"IIP_PROXIMITY","code":"distance"},"BRK_SAFETY_STOCK":{"id":"IIP_BRK_SFTY_STOCK","code":"brokeringSafetyStock"},"MEASUREMENT_SYSTEM":{"id":"IIP_MSMNT_SYSTEM","code":"measurementSystem"}} VUE_APP_RULE_SORT_ENUMS={"PROXIMITY":{"id":"ISP_PROXIMITY","code":"distance"},"INV_BALANCE":{"id":"ISP_INV_BAL","code":"inventoryForAllocation"},"CUSTOMER_SEQ":{"id":"ISP_CUST_SEQ","code":"facilitySequence"}} VUE_APP_RULE_ACTION_ENUMS={"AUTO_CANCEL_DAYS":{"id":"ORA_AUTO_CANCEL_DAYS","code":"ADD_AUTO_CANCEL_DATE"},"NEXT_RULE":{"id":"ORA_NEXT_RULE","code":"NEXT_RULE"},"MOVE_TO_QUEUE":{"id":"ORA_MV_TO_QUEUE","code":"MOVE_TO_QUEUE"}} -VUE_APP_ROUTE_STATUS_ENUMS={"ROUTING_DRAFT":{"id":"ROUTING_DRAFT","desc":"Draft","code":"DRAFT","color":"medium"},"ROUTING_ACTIVE":{"id":"ROUTING_ACTIVE","desc":"Active","code":"ACTIVE","color":"success"},"ROUTING_ARCHIVED":{"id":"ROUTING_ARCHIVED","desc":"Archived","code":"ARCHIVED","color":"warning"}} \ No newline at end of file +VUE_APP_ROUTE_STATUS_ENUMS={"ROUTING_DRAFT":{"id":"ROUTING_DRAFT","desc":"Draft","code":"DRAFT","color":"medium"},"ROUTING_ACTIVE":{"id":"ROUTING_ACTIVE","desc":"Active","code":"ACTIVE","color":"success"},"ROUTING_ARCHIVED":{"id":"ROUTING_ARCHIVED","desc":"Archived","code":"ARCHIVED","color":"warning"}} +VUE_APP_CRON_EXPRESSIONS={"Every 30 minutes":"0 */30 * ? * *","Hourly":"0 0 * ? * *","Every six hours":"0 0 */6 ? * *","Every day at midnight":"0 0 0 * * ?"} \ No newline at end of file diff --git a/src/services/RoutingService.ts b/src/services/RoutingService.ts index 0cd67ef..0a25fd8 100644 --- a/src/services/RoutingService.ts +++ b/src/services/RoutingService.ts @@ -1,6 +1,4 @@ import api from "@/api" -import logger from "@/logger"; -import { hasError, showToast } from "@/utils"; const fetchRoutingGroups = async (payload: any): Promise => { return api({ @@ -136,6 +134,14 @@ const fetchRuleActions = async (payload: any): Promise => { }); } +const scheduleBrokering = async (payload: any): Promise => { + return api({ + url: `groups/${payload.routingGroupId}/schedule`, + method: "POST", + data: payload + }); +} + export const OrderRoutingService = { createOrderRouting, createRoutingGroup, @@ -151,6 +157,7 @@ export const OrderRoutingService = { fetchRoutingRules, fetchRuleActions, fetchRuleConditions, + scheduleBrokering, updateOrderRouting, updateRoutingFilter, updateRoutingGroup diff --git a/src/store/modules/orderRouting/getters.ts b/src/store/modules/orderRouting/getters.ts index b66b13c..a95480f 100644 --- a/src/store/modules/orderRouting/getters.ts +++ b/src/store/modules/orderRouting/getters.ts @@ -1,7 +1,6 @@ import { GetterTree } from "vuex" import OrderRoutingState from "./OrderRoutingState" import RootState from "@/store/RootState" -import { Group, Route } from "@/types" const getters: GetterTree = { getRoutingGroups(state) { diff --git a/src/views/BrokeringRoute.vue b/src/views/BrokeringRoute.vue index d31cdbc..3dd0f26 100644 --- a/src/views/BrokeringRoute.vue +++ b/src/views/BrokeringRoute.vue @@ -71,22 +71,26 @@ {{ "Scheduler" }} - - - {{ "Run time" }} - - - {{ "Schedule" }} - + + {{ description }} + +
+
+ {{ "Disable" }} +
+
+ {{ "Save changes" }} +
+
- {{ `Created at ${currentRoutingGroup.createdDate || "-"}` }} + {{ `Created at ${getTime(currentRoutingGroup.createdDate)}` }} - {{ `Updated at ${currentRoutingGroup.lastUpdatedStamp || "-"}` }} + {{ `Updated at ${getTime(currentRoutingGroup.lastUpdatedStamp)}` }} @@ -101,14 +105,18 @@