diff --git a/src/locales/en.json b/src/locales/en.json
index 108014a..5980a8c 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -137,6 +137,7 @@
"sales channel": "sales channel",
"select days": "select days",
"select range": "select range",
+ "selected": "selected",
"shipping method": "shipping method",
"The timezone you select is used to ensure automations you schedule are always accurate to the time you select.": "The timezone you select is used to ensure automations you schedule are always accurate to the time you select.",
"Timezone": "Timezone",
diff --git a/src/views/BrokeringQuery.vue b/src/views/BrokeringQuery.vue
index b0e02d9..614211b 100644
--- a/src/views/BrokeringQuery.vue
+++ b/src/views/BrokeringQuery.vue
@@ -41,12 +41,12 @@
{{ translate("Select filter to apply") }}
-
+
{{ facility.facilityName || facilityId }}
-
+
{{ shippingMethod.description || shippingMethodId }}
@@ -633,6 +633,24 @@ function getFilterValue(options: any, enums: any, parameter: string) {
return options?.[enums[parameter].code]
}
+function getSelectedValue(options: any, enums: any, parameter: string) {
+ let value = options?.[enums[parameter].code].fieldValue
+
+ // Initially when adding a filter no value is selected thus returning empty string
+ if(!value) {
+ return "";
+ }
+
+ value = value?.split(',')
+
+ // If having more than 1 value selected then displaying the count of selected value otherwise returning the facilityName of the selected facility
+ if(value?.length > 1) {
+ return `${value.length} ${translate("selected")}`
+ } else {
+ return parameter === "SHIPPING_METHOD" ? shippingMethods.value[value[0]].description || value[0] : facilities.value[value[0]].facilityName || value[0]
+ }
+}
+
function getLabel(parentType: string, code: string) {
const enumerations = enums.value[parentType]
const enumInfo: any = Object.values(enumerations).find((enumeration: any) => enumeration.enumCode === code)
@@ -696,8 +714,20 @@ function updateOperator(event: CustomEvent) {
updateRule()
}
-function updateOrderFilterValue(event: CustomEvent, id: string) {
- orderRoutingFilterOptions.value[ruleEnums[id].code].fieldValue = event.detail.value
+function updateOrderFilterValue(event: CustomEvent, id: string, multi = false) {
+ let value = event.detail.value
+ let operator = "equals"
+ // When the filter has multiple selection support then we will receive an array in the event value and thus creating a string before updating the same as the fieldValue supports a string as value
+ if(multi && value.length > 1) {
+ value = value.join(',')
+ operator = "in"
+ } else if(multi) {
+ // When filter is having a single option selected with multiple selection enabled, we will receive an array with single value, but as we need to pass a string, so fetching the 0th index from the array
+ value = value[0]
+ }
+
+ orderRoutingFilterOptions.value[ruleEnums[id].code].fieldValue = value
+ orderRoutingFilterOptions.value[ruleEnums[id].code].operator = operator
hasUnsavedChanges.value = true
}