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: 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) #103

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