Skip to content

Commit

Permalink
Implemented: support to revert the value for rule assignmentEnumId to…
Browse files Browse the repository at this point in the history
… its initial valuea and disable the same when promise date range is selected in order filter
  • Loading branch information
ymaheshwari1 committed Jan 29, 2024
1 parent d66571a commit c00dca2
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/views/BrokeringQuery.vue
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@
{{ "Select if partial allocation should be allowed in this inventory rule" }}
</ion-card-content>
<ion-item lines="none">
<ion-toggle :checked="selectedRoutingRule.assignmentEnumId === 'ORA_MULTI'" @ionChange="updatePartialAllocation($event.detail.checked)">{{ "Allow partial allocation" }}</ion-toggle>
<ion-toggle :disabled="isPromiseDateFilterApplied()" :checked="selectedRoutingRule.assignmentEnumId === 'ORA_MULTI'" @ionChange="updatePartialAllocation($event.detail.checked)">{{ "Allow partial allocation" }}</ion-toggle>
</ion-item>
</ion-card>
<ion-card>
Expand Down Expand Up @@ -490,6 +490,23 @@ function updatePartialAllocation(checked: any) {
})
}
function isPromiseDateFilterApplied() {
const filter = getFilterValue(orderRoutingFilterOptions.value, ruleEnums, 'PROMISE_DATE')
// When promise date range is selected for order filter, we will revert any change made to the partialAllocation enum and will change it to its initial value and will disable the partial allocation feature
if(filter?.fieldValue || filter?.fieldValue == 0) {
inventoryRules.value.find((inventoryRule: any) => {
const assignmentEnumId = JSON.parse(JSON.stringify(currentRouting.value["rules"])).find((rule: any) => rule.routingRuleId === selectedRoutingRule.value.routingRuleId)?.assignmentEnumId
if(inventoryRule.routingRuleId === selectedRoutingRule.value.routingRuleId) {
inventoryRule.assignmentEnumId = assignmentEnumId
return true;
}
})
}
return filter?.fieldValue || filter?.fieldValue == 0
}
function getFilterValue(options: any, enums: any, parameter: string) {
return options?.[enums[parameter].code]
}
Expand Down

0 comments on commit c00dca2

Please sign in to comment.