From be2ef4316226f9fed88c59fd9d9f663361fc51d9 Mon Sep 17 00:00:00 2001 From: Yash Maheshwari Date: Thu, 4 Apr 2024 11:53:19 +0530 Subject: [PATCH] Fixed: support to not open the details page for unarchived route(#145) When finding the index number for routes we honor the active and draft routes, but as the route is unarchived but not saved in the state, then the index for the route is not found resulting in displaying NaN. Added toast message to not redirect the user to the details page in the above case --- src/locales/en.json | 1 + src/views/BrokeringRoute.vue | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/src/locales/en.json b/src/locales/en.json index afea864..bb50de0 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -116,6 +116,7 @@ "Sales Channel": "Sales Channel", "Save": "Save", "Save changes": "Save changes", + "Save changes before moving to the details page of unarchived route": "Save changes before moving to the details page of unarchived route", "Schedule": "Schedule", "Scheduler": "Scheduler", "Search groups": "Search groups", diff --git a/src/views/BrokeringRoute.vue b/src/views/BrokeringRoute.vue index f6cc07d..801b19f 100644 --- a/src/views/BrokeringRoute.vue +++ b/src/views/BrokeringRoute.vue @@ -372,6 +372,13 @@ async function runNow() { } async function redirect(orderRouting: Route) { + let isRoutingArchived = currentRoutingGroup.value["routings"].some((routing: any) => routing.orderRoutingId === orderRouting.orderRoutingId && routing.statusId === "ROUTING_ARCHIVED" ) + + if(isRoutingArchived) { + showToast(translate("Save changes before moving to the details page of unarchived route")) + return; + } + await store.dispatch("orderRouting/setCurrentOrderRouting", orderRouting) router.push(`${orderRouting.orderRoutingId}/rules`) }