Skip to content

Commit

Permalink
Merge pull request #103 from ymaheshwari1/#101
Browse files Browse the repository at this point in the history
Improved: button label when the description for the group is missing and handled case to not update the description when initially not available and after update was left empty(#101)
  • Loading branch information
ymaheshwari1 authored Feb 16, 2024
2 parents cac787f + 28d85e7 commit e9980da
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
1 change: 1 addition & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"A store repesents a company or a unique catalog of products. If your OMS is connected to multiple eCommerce stores sellling different collections of products, you may have multiple Product Stores set up in HotWax Commerce.": "A store repesents a company or a unique catalog of products. If your OMS is connected to multiple eCommerce stores sellling different collections of products, you may have multiple Product Stores set up in HotWax Commerce.",
"Actions": "Actions",
"Active": "Active",
"Add": "Add",
"Add inventory rule": "Add inventory rule",
"Allocated Items": "Allocated Items",
"Allow partial allocation": "Allow partial allocation",
Expand Down
7 changes: 4 additions & 3 deletions src/views/BrokeringRoute.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
<ion-item lines="none">
<h2>{{ translate("Description") }}</h2>
<ion-button fill="clear" slot="end" @click="isDescUpdating ? updateGroupDescription() : (isDescUpdating = !isDescUpdating)">
{{ translate(isDescUpdating ? "Save" : "Edit") }}
{{ translate(isDescUpdating ? "Save" : description ? "Edit" : "Add") }}
</ion-button>
</ion-item>
<ion-item :color="isDescUpdating ? 'light' : ''" lines="none">
Expand Down Expand Up @@ -444,8 +444,9 @@ function getArchivedOrderRoutings() {
}
async function updateGroupDescription() {
// Do not update description, if the desc is unchanged, and we do not have routingGroupId, and description is left empty
if(props.routingGroupId && currentRoutingGroup.value.description !== description.value) {
// Do not update description, if the desc is unchanged, and we do not have routingGroupId
// Added conversion using `!!`, as if the group does not have a description then we get `undefined` and if the description entered by the user is left empty then `undefined != ''` is true and thus it makes an api call, even when description is unchanged in this case.
if(props.routingGroupId && (!!currentRoutingGroup.value.description != !!description.value)) {
const routingGroupId = await updateRoutingGroup({ routingGroupId: props.routingGroupId, productStoreId: currentRoutingGroup.value.productStoreId, description: description.value })
if(routingGroupId) {
await store.dispatch("orderRouting/setCurrentGroup", { ...currentRoutingGroup.value, description: description.value })
Expand Down
14 changes: 7 additions & 7 deletions src/views/BrokeringRuns.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
</section>

<aside class="filters">
<ion-list-header>{{ "Product Stores" }}</ion-list-header>
<ion-list>
<ion-item lines="none">
<ion-radio-group :value="currentEComStore.productStoreId" @ionChange="setEComStore($event)">
<ion-radio v-for="store in (userProfile ? userProfile.stores : [])" :key="store.productStoreId" :value="store.productStoreId">{{ store.storeName }}</ion-radio>
</ion-radio-group>
</ion-item>
<ion-list-header>{{ translate("Product Store") }}</ion-list-header>
<ion-radio-group :value="currentEComStore.productStoreId" @ionChange="setEComStore($event)">
<ion-item v-for="store in (userProfile ? userProfile.stores : [])" :key="store.productStoreId" lines="none">
<ion-radio :value="store.productStoreId">{{ store.storeName }}</ion-radio>
</ion-item>
</ion-radio-group>
</ion-list>
</aside>

Expand All @@ -44,7 +44,7 @@
{{ group.groupName }}
</ion-card-title>
</ion-card-header>
<ion-item>
<ion-item v-if="group.description">
{{ group.description }}
</ion-item>
<ion-item>
Expand Down

0 comments on commit e9980da

Please sign in to comment.