Skip to content

Commit

Permalink
Merge pull request #90 from ymaheshwari1/#86
Browse files Browse the repository at this point in the history
Improved: support to have a default value for measurement system when selecting proximity and removed equals operator support from safety stock filter(#86)
  • Loading branch information
ymaheshwari1 authored Feb 13, 2024
2 parents 3c8b666 + ef67d58 commit 543de89
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/components/AddInventoryFilterOptionsModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ let inventoryRuleConditions = ref({}) as any
let enumerations = ref([]) as any
const hiddenOptions = ["IIP_MSMNT_SYSTEM"]
// managing this object, as we have some filters for which we need to have its associated filter, like in this case when we have PROXIMITY we also need to add MEASUREMENT_SYSTEM(this is not available on UI for selection and included in hiddenOptions)
const associatedOptions = { IIP_PROXIMITY: 'IIP_MSMNT_SYSTEM' } as any
const associatedOptions = { IIP_PROXIMITY: { enum: "IIP_MSMNT_SYSTEM", defaultValue: "IMPERIAL" }} as any
onMounted(() => {
inventoryRuleConditions.value = props.ruleConditions ? JSON.parse(JSON.stringify(props.ruleConditions)) : {}
Expand All @@ -69,8 +69,7 @@ onMounted(() => {
function addConditionOption(condition: any) {
const isConditionOptionAlreadyApplied = isConditionOptionSelected(condition.enumCode)?.fieldName
const associatedEnum = enums.value[props.parentEnumId][associatedOptions[condition.enumId]]
const associatedEnum = enums.value[props.parentEnumId][associatedOptions[condition.enumId]?.enum]
if(isConditionOptionAlreadyApplied) {
delete inventoryRuleConditions.value[condition.enumCode]
// When removing a condition, also remove its associated option if available
Expand All @@ -96,6 +95,7 @@ function addConditionOption(condition: any) {
routingRuleId: props.routingRuleId,
conditionTypeEnumId: props.conditionTypeEnumId,
fieldName: associatedEnum.enumCode,
fieldValue: associatedOptions[condition.enumId]?.defaultValue,
sequenceNum: Object.keys(inventoryRuleConditions.value).length && inventoryRuleConditions.value[Object.keys(inventoryRuleConditions.value)[Object.keys(inventoryRuleConditions.value).length - 1]]?.sequenceNum >= 0 ? inventoryRuleConditions.value[Object.keys(inventoryRuleConditions.value)[Object.keys(inventoryRuleConditions.value).length - 1]].sequenceNum + 5 : 0, // added check for `>= 0` as sequenceNum can be 0 which will result in again setting the new seqNum to 0
createdDate: DateTime.now().toMillis()
})
Expand Down
1 change: 0 additions & 1 deletion src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
"duration": "duration",
"Edit": "Edit",
"Error getting user profile": "Error getting user profile",
"equals": "equals",
"Failed to create brokering run": "Failed to create brokering run",
"Failed to create inventory rule": "Failed to create inventory rule",
"Failed to create order routing": "Failed to create order routing",
Expand Down
1 change: 0 additions & 1 deletion src/views/BrokeringQuery.vue
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@
<ion-label>{{ translate("Brokering safety stock") }}</ion-label>
<ion-chip outline>
<ion-select :placeholder="translate('operator')" aria-label="operator" interface="popover" :value="getFilterValue(inventoryRuleFilterOptions, conditionFilterEnums, 'BRK_SAFETY_STOCK').operator" @ionChange="updateOperator($event)">
<ion-select-option value="equals">{{ translate("equals") }}</ion-select-option>
<ion-select-option value="greater-equals">{{ translate("greater than or equal to") }}</ion-select-option>
<ion-select-option value="greater">{{ translate("greater") }}</ion-select-option>
</ion-select>
Expand Down

0 comments on commit 543de89

Please sign in to comment.