Skip to content

Commit

Permalink
Fixed: case when saving exclude options on server
Browse files Browse the repository at this point in the history
  • Loading branch information
ymaheshwari1 committed Oct 15, 2024
1 parent 1cce8e7 commit 4d5c546
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
9 changes: 1 addition & 8 deletions src/components/GroupActionsPopover.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ const props = defineProps(["group"])
const isOmsConnectionExist = computed(() => store.getters["util/isOmsConnectionExist"])
async function updateGroupStatus(paused: string) {
console.log(props.group)
let routingGroups = [];
const payload = {
routingGroupId: props.group.routingGroupId,
Expand All @@ -52,13 +51,7 @@ async function updateGroupStatus(paused: string) {
try {
const resp = await OrderRoutingService.scheduleBrokering(payload)
console.log('resp', resp, hasError(resp))
if(!hasError(resp)){
props.group.schedule = {
...props.group.schedule,
cronExpression: payload.cronExpression,
cronDescription:
}
if(!hasError(resp)) {
showToast(translate("Group status updated"))
routingGroups = await store.dispatch("orderRouting/updateGroupStatus", { routingGroupId: props.group.routingGroupId, value: paused })
} else {
Expand Down
16 changes: 14 additions & 2 deletions src/views/BrokeringQuery.vue
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,7 @@ function getSelectedValue(options: any, enumerations: any, parameter: string) {
if(value?.length > 1) {
return `${value.length} ${translate("selected")}`
} else {
return parameter === "SHIPPING_METHOD" ? shippingMethods.value[value[0]]?.description || value[0] : parameter === "SALES_CHANNEL" ? enums.value["ORDER_SALES_CHANNEL"] ? enums.value["ORDER_SALES_CHANNEL"][value[0]]?.description : value[0] : parameter === "ORIGIN_FACILITY_GROUP" ? facilityGroups.value[value[0]]?.facilityGroupName || value[0] : facilities.value[value[0]]?.facilityName || value[0]
return parameter === "SHIPPING_METHOD" || parameter === "SHIPPING_METHOD_EXCLUDED" ? shippingMethods.value[value[0]]?.description || value[0] : parameter === "SALES_CHANNEL" || parameter === "SALES_CHANNEL_EXCLUDED" ? enums.value["ORDER_SALES_CHANNEL"] ? enums.value["ORDER_SALES_CHANNEL"][value[0]]?.description : value[0] : parameter === "ORIGIN_FACILITY_GROUP" || parameter === "ORIGIN_FACILITY_GROUP_EXCLUDED" ? facilityGroups.value[value[0]]?.facilityGroupName || value[0] : facilities.value[value[0]]?.facilityName || value[0]
}
}
Expand Down Expand Up @@ -1010,7 +1010,6 @@ function updateOperator(event: CustomEvent) {
}
function updateOrderFilterValue(event: CustomEvent, id: string, multi = false) {
console.log('id', id)
let value = event.detail.value
let operator = id.includes("_EXCLUDED") ? "not-equals" : "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
Expand Down Expand Up @@ -1341,6 +1340,19 @@ async function save() {
const routeSortOptionsDiff = findSortDiff(initialOrderFilters["ENTCT_SORT_BY"] ? initialOrderFilters["ENTCT_SORT_BY"] : {}, orderRoutingSortOptions.value)
const routeFilterOptionsDiff = findFilterDiff(initialOrderFilters["ENTCT_FILTER"] ? initialOrderFilters["ENTCT_FILTER"] : {}, orderRoutingFilterOptions.value)
// As we have explicitely added the options for exclude filter for inventory rules, we will remove the _excluded from the fieldName parameter before updating the same
Object.entries(routeFilterOptionsDiff.seqToRemove).map(([key, value]: any) => {
if(key.includes("_excluded")) {
value["fieldName"] = value["fieldName"].split("_")[0]
}
})
Object.entries(routeFilterOptionsDiff.seqToUpdate).map(([key, value]: any) => {
if(key.includes("_excluded")) {
value["fieldName"] = value["fieldName"].split("_")[0]
}
})
const filtersToRemove = Object.values({ ...routeFilterOptionsDiff.seqToRemove, ...routeSortOptionsDiff.seqToRemove })
const filtersToUpdate = Object.values({ ...routeFilterOptionsDiff.seqToUpdate, ...routeSortOptionsDiff.seqToUpdate })
// Diff found for removing and updating filters
Expand Down

0 comments on commit 4d5c546

Please sign in to comment.