Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed: rule name not being updated(#269) #277

Merged
merged 2 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
32 changes: 26 additions & 6 deletions src/views/BrokeringQuery.vue
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@

<script setup lang="ts">
import { IonBackButton, IonBadge, IonButton, IonButtons, IonCard, IonCardContent, IonCardHeader, IonCardTitle, IonChip, IonContent, IonFab, IonFabButton, IonHeader, IonIcon, IonInput, IonItem, IonItemDivider, IonItemGroup, IonLabel, IonList, IonNote, IonPage, IonReorder, IonReorderGroup, IonSelect, IonSelectOption, IonTitle, IonToggle, IonToolbar, alertController, modalController, onIonViewWillEnter, popoverController } from "@ionic/vue";
import { addCircleOutline, closeCircleOutline, copyOutline, filterOutline, golfOutline, optionsOutline, pencilOutline, playForwardOutline, pulseOutline, saveOutline, swapVerticalOutline, timeOutline } from "ionicons/icons"

Check warning on line 403 in src/views/BrokeringQuery.vue

View workflow job for this annotation

GitHub Actions / call-workflow-in-another-repo / reusable_workflow_job (18.x)

'copyOutline' is defined but never used

Check warning on line 403 in src/views/BrokeringQuery.vue

View workflow job for this annotation

GitHub Actions / call-workflow-in-another-repo / reusable_workflow_job (20.x)

'copyOutline' is defined but never used
import { onBeforeRouteLeave, useRouter } from "vue-router";
import { computed, defineProps, nextTick, ref } from "vue";
import store from "@/store";
Expand Down Expand Up @@ -782,9 +782,9 @@

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
}
}

Expand Down Expand Up @@ -1076,17 +1076,37 @@
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() {

Check warning on line 1109 in src/views/BrokeringQuery.vue

View workflow job for this annotation

GitHub Actions / call-workflow-in-another-repo / reusable_workflow_job (18.x)

'cloneRule' is defined but never used

Check warning on line 1109 in src/views/BrokeringQuery.vue

View workflow job for this annotation

GitHub Actions / call-workflow-in-another-repo / reusable_workflow_job (20.x)

'cloneRule' is defined but never used
emitter.emit("presentLoader", { message: `Cloning ${selectedRoutingRule.value.ruleName}`, backdropDismiss: false })

try {
Expand Down
Loading