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: condition to make the value of partial allocation updated on server when selecting promise date and also enabled partial group allocation when partial allocation is enabled(#257) #258

Merged
merged 2 commits into from
Sep 3, 2024
Merged
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
21 changes: 16 additions & 5 deletions src/views/BrokeringQuery.vue
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,11 @@
<ion-item>
<ion-icon slot="start" :icon="filterOutline"/>
<h4>{{ translate("Filters") }}</h4>
<ion-button v-if="inventoryRuleFilterOptions && Object.keys(inventoryRuleFilterOptions).length" slot="end" fill="clear" @click="addInventoryFilterOptions('INV_FILTER_PRM_TYPE', 'ENTCT_FILTER', 'Filters')">
<ion-button v-if="isInventoryRuleFiltersApplied()" slot="end" fill="clear" @click="addInventoryFilterOptions('INV_FILTER_PRM_TYPE', 'ENTCT_FILTER', 'Filters')">
<ion-icon slot="icon-only" :icon="optionsOutline"/>
</ion-button>
</ion-item>
<p class="empty-state" v-if="!inventoryRuleFilterOptions || !Object.keys(inventoryRuleFilterOptions).length">
<p class="empty-state" v-if="!isInventoryRuleFiltersApplied()">
{{ translate("All facilities enabled for online fulfillment will be attempted for brokering if no filter is applied.") }}<br /><br />
<span><a target="_blank" rel="noopener noreferrer" href="https://docs.hotwax.co/documents/v/system-admins/administration/facilities/configure-fulfillment-capacity">{{ translate("Learn more") }}</a>{{ translate(" about enabling a facility for online fulfillment.") }}</span>
<ion-button fill="clear" @click="addInventoryFilterOptions('INV_FILTER_PRM_TYPE', 'ENTCT_FILTER', 'Filters')">
Expand Down Expand Up @@ -257,8 +257,7 @@
{{ translate("Select if partial allocation should be allowed in this inventory rule") }}
</ion-card-content>
<ion-item lines="none">
<!-- When selecting promiseDate route filter we will show the partial allocation option as checked on UI, but will not update its value on backend. Discussed with Aditya Sir -->
<ion-toggle :disabled="isPromiseDateFilterApplied()" :checked="selectedRoutingRule.assignmentEnumId === 'ORA_MULTI' || isPromiseDateFilterApplied()" @ionChange="updatePartialAllocation($event.detail.checked)">{{ translate("Allow partial allocation") }}</ion-toggle>
<ion-toggle :disabled="isPromiseDateFilterApplied()" :checked="selectedRoutingRule.assignmentEnumId === 'ORA_MULTI'" @ionChange="updatePartialAllocation($event.detail.checked)">{{ translate("Allow partial allocation") }}</ion-toggle>
</ion-item>
<ion-item v-show="isPromiseDateFilterApplied()" lines="none">
<ion-label class="ion-text-wrap">
Expand Down Expand Up @@ -333,7 +332,7 @@

<script setup lang="ts">
import { IonBackButton, IonBadge, IonButton, IonButtons, IonCard, IonCardContent, IonCardHeader, IonCardTitle, IonChip, IonContent, IonFab, IonFabButton, IonHeader, IonIcon, IonInput, IonItem, IonItemDivider, IonItemGroup, IonLabel, IonList, IonNote, IonPage, IonReorder, IonReorderGroup, IonSelect, IonSelectOption, IonTitle, IonToggle, IonToolbar, alertController, modalController, onIonViewWillEnter, popoverController } from "@ionic/vue";
import { addCircleOutline, closeCircleOutline, copyOutline, filterOutline, golfOutline, optionsOutline, pencilOutline, playForwardOutline, pulseOutline, saveOutline, swapVerticalOutline, timeOutline } from "ionicons/icons"

Check warning on line 335 in src/views/BrokeringQuery.vue

View workflow job for this annotation

GitHub Actions / call-workflow-in-another-repo / reusable_workflow_job (18.x)

'copyOutline' is defined but never used

Check warning on line 335 in src/views/BrokeringQuery.vue

View workflow job for this annotation

GitHub Actions / call-workflow-in-another-repo / reusable_workflow_job (20.x)

'copyOutline' is defined but never used
import { onBeforeRouteLeave, useRouter } from "vue-router";
import { computed, defineProps, nextTick, ref } from "vue";
import store from "@/store";
Expand Down Expand Up @@ -808,17 +807,26 @@
if(inventoryRule.routingRuleId === selectedRoutingRule.value.routingRuleId) {
// Updating selected routing rule explicitely as we are using rulesForReorder for fetching selected values
inventoryRule.assignmentEnumId = selectedRoutingRule.value.assignmentEnumId = checked ? "ORA_MULTI" : "ORA_SINGLE"

// When enabling partial allocation, updating the value of partial group item allocation by default,
// as when partial allocation is enabled we are saying to partial allocate all items of orders thus need to make
// group items allocation enabled as well in this case.
updatePartialGroupItemsAllocation(checked)
}
})
hasUnsavedChanges.value = true
}

function isInventoryRuleFiltersApplied() {
const ruleFilters = Object.keys(inventoryRuleFilterOptions.value).filter((rule: string) => rule !== conditionFilterEnums["SPLIT_ITEM_GROUP"].code);
return ruleFilters.length
}

function isPromiseDateFilterApplied() {
if(!currentRouting.value["rules"]?.length) {
return;
}

// When user updates partial allocation and then selects promiseDate filter then we will assume that the user wants to change the value for partialAllocation on server and thus we will not revert any change made in the partial allocation action and update its value on server
const filter = getFilterValue(orderRoutingFilterOptions.value, ruleEnums, "PROMISE_DATE")
return filter?.fieldValue || filter?.fieldValue == 0
}
Expand Down Expand Up @@ -876,6 +884,9 @@
if(result.data?.duration || result.data?.duration == 0) {
getFilterValue(orderRoutingFilterOptions.value, ruleEnums, "PROMISE_DATE").fieldValue = result.data?.isPastDuration ? `-${result.data?.duration}` : result.data?.duration
hasUnsavedChanges.value = true

// When selecting promiseDate route filter value, we also need to enable partial allocation and make its value change on the server
updatePartialAllocation(true);
}
getFilterValue(orderRoutingFilterOptions.value, ruleEnums, "PROMISE_DATE").operator = "less-equals"
})
Expand Down Expand Up @@ -993,7 +1004,7 @@
isRuleNameUpdating.value = false;
}

async function cloneRule() {

Check warning on line 1007 in src/views/BrokeringQuery.vue

View workflow job for this annotation

GitHub Actions / call-workflow-in-another-repo / reusable_workflow_job (18.x)

'cloneRule' is defined but never used

Check warning on line 1007 in src/views/BrokeringQuery.vue

View workflow job for this annotation

GitHub Actions / call-workflow-in-another-repo / reusable_workflow_job (20.x)

'cloneRule' is defined but never used
emitter.emit("presentLoader", { message: `Cloning ${selectedRoutingRule.value.ruleName}`, backdropDismiss: false })

try {
Expand Down
Loading