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

Improved: support to have a default value for measurement system when selecting proximity and removed equals operator support from safety stock filter(#86) #90

Merged
merged 3 commits into from
Feb 13, 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
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
Loading