From 8d57a26a3855b71ea8231084a10c4c46be464d71 Mon Sep 17 00:00:00 2001 From: Yash Maheshwari Date: Mon, 1 Apr 2024 16:12:45 +0530 Subject: [PATCH] Improved: check for rule and route name fields(#141) --- src/views/BrokeringQuery.vue | 10 ++++++++-- src/views/BrokeringRoute.vue | 8 +++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/views/BrokeringQuery.vue b/src/views/BrokeringQuery.vue index 731c022..8cf12e5 100644 --- a/src/views/BrokeringQuery.vue +++ b/src/views/BrokeringQuery.vue @@ -254,7 +254,7 @@ import { onBeforeRouteLeave, useRouter } from "vue-router"; import { computed, defineProps, ref } from "vue"; import store from "@/store"; import AddInventoryFilterOptionsModal from "@/components/AddInventoryFilterOptionsModal.vue"; -import { getDateAndTimeShort, sortSequence } from "@/utils"; +import { getDateAndTimeShort, showToast, sortSequence } from "@/utils"; import { Rule } from "@/types"; import AddOrderRouteFilterOptions from "@/components/AddOrderRouteFilterOptions.vue" import PromiseFilterPopover from "@/components/PromiseFilterPopover.vue" @@ -497,7 +497,13 @@ async function addInventoryRule() { text: translate("Cancel"), role: "cancel" }, { - text: translate("Save") + text: translate("Save"), + handler: (data) => { + if(!data.ruleName?.trim().length) { + showToast(translate("Please enter a valid name")) + return false; + } + } }], inputs: [{ name: "ruleName", diff --git a/src/views/BrokeringRoute.vue b/src/views/BrokeringRoute.vue index b689fb4..30263b5 100644 --- a/src/views/BrokeringRoute.vue +++ b/src/views/BrokeringRoute.vue @@ -387,7 +387,13 @@ async function createOrderRoute() { text: translate("Cancel"), role: "cancel" }, { - text: translate("Save") + text: translate("Save"), + handler: (data) => { + if(!data.routingName?.trim().length) { + showToast(translate("Please enter a valid name")) + return false; + } + } }], inputs: [{ name: "routingName",