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: state management on count update and tab change #467

Merged
merged 3 commits into from
Oct 11, 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
7 changes: 6 additions & 1 deletion src/store/modules/count/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

const params = {
...payload,
pageSize: 100
pageSize: 200
}

if(state.query.facilityIds.length) {
Expand Down Expand Up @@ -176,10 +176,15 @@
commit(types.COUNT_ITEMS_UPDATED, items)
},

async updateCycleCountItems ({ commit }, payload) {
commit(types.COUNT_ITEMS_UPDATED, { itemList: payload })
},

async clearCycleCountItems ({ commit }) {
commit(types.COUNT_ITEMS_UPDATED, [])
},

async fetchCycleCountImportSystemMessages({commit} ,payload) {

Check warning on line 187 in src/store/modules/count/actions.ts

View workflow job for this annotation

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

'payload' is defined but never used

Check warning on line 187 in src/store/modules/count/actions.ts

View workflow job for this annotation

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

'payload' is defined but never used
let systemMessages;
try {
const fifteenMinutesEarlier = DateTime.now().minus({ minutes: 15 });
Expand Down
20 changes: 15 additions & 5 deletions src/views/CountDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
<Image :src="getProduct(item.productId)?.mainImageUrl" />
</div>
</div>
<div class="detail">
<div class="detail" v-if="Object.keys(product)?.length">
<ion-item lines="none">
<ion-label class="ion-text-wrap">
<h1>{{ getProductIdentificationValue(productStoreSettings["productIdentificationPref"].primaryId, getProduct(product.productId)) }}</h1>
Expand Down Expand Up @@ -345,10 +345,11 @@ function updateFilteredItems() {
});
}
if (filteredItems.value.length > 0) {
store.dispatch("product/currentProduct", product.value);
updateNavigationState(filteredItems.value.indexOf(product.value));
const updatedProduct = Object.keys(product.value)?.length ? product.value : filteredItems.value[0]
store.dispatch("product/currentProduct", updatedProduct);
updateNavigationState(filteredItems.value.indexOf(updatedProduct));
} else {
store.dispatch("product/currentProduct", null);
store.dispatch("product/currentProduct", {});
isFirstItem.value = true
isLastItem.value = false
}
Expand Down Expand Up @@ -445,9 +446,18 @@ async function saveCount() {
product.value.quantity = inputCount.value
product.value.countedByGroupName = userProfile.value.userFullName
product.value.countedByUserLoginId = userProfile.value.username
await store.dispatch('product/currentProduct', product.value);
inputCount.value = '';
product.value.isRecounting = false;
const items = JSON.parse(JSON.stringify(itemsList.value))
items.map((item) => {
if(item.importItemSeqId === product.value?.importItemSeqId) {
item.quantity = product.value.quantity
item.countedByGroupName = userProfile.value.userFullName
item.countedByUserLoginId = userProfile.value.username
}
})
await store.dispatch('count/updateCycleCountItems', items);
await store.dispatch('product/currentProduct', product.value);
} else {
throw resp.data;
}
Expand Down
Loading