From 4311c47b0a1d63e511f0a2c8eac11448bfe6016f Mon Sep 17 00:00:00 2001 From: Yash Maheshwari Date: Wed, 6 Nov 2024 14:37:23 +0530 Subject: [PATCH 1/2] Fixed: rule name not being updated(#269) Improved method to update the rule name on server --- src/locales/en.json | 2 ++ src/views/BrokeringQuery.vue | 28 ++++++++++++++++++++++++---- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/locales/en.json b/src/locales/en.json index f8614dd..fc90e67 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -62,6 +62,7 @@ "Failed to fetch sort options": "Failed to fetch sort options", "Failed to update group information": "Failed to update group information", "Failed to update group status": "Failed to update group status", + "Failed to update rule information": "Failed to update rule information", "Failed to schedule service": "Failed to schedule service", "Fetching filters and inventory rules": "Fetching filters and inventory rules", "Fetching runs": "Fetching runs", @@ -114,6 +115,7 @@ "Order priority": "Order priority", "Order Rule Filters": "Order Rule Filters", "Order Rule Sort": "Order Rule Sort", + "Order rule information updated": "Order rule information updated", "Order routing information updated": "Order routing information updated", "Orders will be brokered based on order date if no sorting is specified.": "Orders will be brokered based on order date if no sorting is specified.", "Origin Facility Group": "Origin Facility Group", diff --git a/src/views/BrokeringQuery.vue b/src/views/BrokeringQuery.vue index 2720023..54f9010 100644 --- a/src/views/BrokeringQuery.vue +++ b/src/views/BrokeringQuery.vue @@ -1076,14 +1076,34 @@ async function editRuleName() { ruleNameRef.value.$el.setFocus(); } -function updateRuleName(routingRuleId: string) { - // Checking the updated name with the original object, as we have reference to inventoryRules that will also gets updated on updating selectedRoutingRule +async function updateRuleName(routingRuleId: string) { + let isUpdateRequired = false; + currentRouting.value["rules"].map((inventoryRule: any) => { if(inventoryRule.routingRuleId === routingRuleId && inventoryRule.ruleName.trim() !== selectedRoutingRule.value.ruleName.trim()) { - hasUnsavedChanges.value = true + isUpdateRequired = true } }) - isRuleNameUpdating.value = false; + + if(isUpdateRequired) { + emitter.emit("presentLoader", { message: "Updating...", backdropDismiss: false }) + + let ruleId = await store.dispatch("orderRouting/updateRule", { + routingRuleId, + orderRoutingId: props.orderRoutingId, + ruleName: selectedRoutingRule.value.ruleName.trim() + }) + + if(ruleId) { + showToast(translate("Order rule information updated")) + } else { + showToast(translate("Failed to update rule information")) + } + + emitter.emit("dismissLoader") + } + + isRuleNameUpdating.value = false } async function cloneRule() { From 89fb3a938f5cbadd421e231cdb00452b6ce07fde Mon Sep 17 00:00:00 2001 From: Yash Maheshwari Date: Wed, 6 Nov 2024 14:39:01 +0530 Subject: [PATCH 2/2] Fixed: undefined error when same filter is not available as included/excluded(#269) --- src/views/BrokeringQuery.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/views/BrokeringQuery.vue b/src/views/BrokeringQuery.vue index 54f9010..efb5fdf 100644 --- a/src/views/BrokeringQuery.vue +++ b/src/views/BrokeringQuery.vue @@ -782,9 +782,9 @@ async function addInventoryRule() { function isFacilityGroupSelected(facilityGroupId: string, type: string) { if(type === "excluded") { - return facilityGroupId == getFilterValue(inventoryRuleFilterOptions.value, conditionFilterEnums, 'FACILITY_GROUP').fieldValue + return facilityGroupId == getFilterValue(inventoryRuleFilterOptions.value, conditionFilterEnums, 'FACILITY_GROUP')?.fieldValue } else { - return facilityGroupId == getFilterValue(inventoryRuleFilterOptions.value, conditionFilterEnums, 'FACILITY_GROUP_EXCLUDED').fieldValue + return facilityGroupId == getFilterValue(inventoryRuleFilterOptions.value, conditionFilterEnums, 'FACILITY_GROUP_EXCLUDED')?.fieldValue } }