Skip to content

Commit

Permalink
Merge pull request #323 from amansinghbais/309-scan-result-toast
Browse files Browse the repository at this point in the history
Implemented: toast messages for the success and failure of product scan (#309)
  • Loading branch information
ymaheshwari1 authored Feb 21, 2024
2 parents 7fe09e3 + 4f558cc commit 150a48d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
3 changes: 2 additions & 1 deletion src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"Facility": "Facility",
"Location": "Location",
"Failed to receive some of the items": "Failed to receive some of the items",
"Failed to scan:": "Failed to scan: {itemName}",
"Failed to update product identifier preference": "Failed to update product identifier preference",
"facility location": "facility location",
"Facility locations were not found corresponding to destination facility of return shipment. Please add facility locations to avoid receive return shipment failure.": "Facility locations were not found corresponding to destination facility of return shipment. Please add facility locations to avoid receive return shipment failure.",
Expand Down Expand Up @@ -59,7 +60,6 @@
"primary identifier": "primary identifier",
"Primary Product Identifier": "Primary Product Identifier",
"Proceed": "Proceed",
"Product not found": "Product not found",
"Product Identifier": "Product Identifier",
"Product identifier preference updated": "Product identifier preference updated",
"Purchase Order": "Purchase Order",
Expand All @@ -86,6 +86,7 @@
"Scan ASN to start receiving": "Scan ASN to start receiving",
"Scan barcodes to receive them": "Scan barcodes to receive them",
"Scan items": "Scan items",
"Scanned successfully.": "Scanned {itemName} successfully.",
"secondary identifier": "secondary identifier",
"Search": "Search",
"Search purchase orders": "Search purchase orders",
Expand Down
7 changes: 4 additions & 3 deletions src/store/modules/order/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,14 @@ const actions: ActionTree<OrderState, RootState> = {
},
async updateProductCount({ commit, state }, payload ) {
const item = state.current.items.find((item: any) => item.internalName === payload);

if (item) {
item.quantityAccepted = item.quantityAccepted ? parseInt(item.quantityAccepted) + 1 : 1;
commit(types.ORDER_CURRENT_UPDATED, state.current )
showToast(translate("Scanned successfully.", { itemName: payload }))
} else {
showToast(translate("Product not found"));
showToast(translate("Failed to scan:", { itemName: payload }))
}

commit(types.ORDER_CURRENT_UPDATED, state.current )
},
async addOrderItem ({ commit }, payload) {
const product = {
Expand Down
7 changes: 4 additions & 3 deletions src/store/modules/return/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,14 @@ const actions: ActionTree<ReturnState, RootState> = {
},
async updateReturnProductCount ({ commit, state }, payload) {
const item = state.current.items.find((item: any) => item.sku === payload);

if (item) {
item.quantityAccepted = item.quantityAccepted ? parseInt(item.quantityAccepted) + 1 : 1;
commit(types.RETURN_CURRENT_UPDATED, state);
showToast(translate("Scanned successfully.", { itemName: payload }))
} else {
showToast(translate("Product not found"));
showToast(translate("Failed to scan:", { itemName: payload }))
}

commit(types.RETURN_CURRENT_UPDATED, state);
},
async setCurrent ({ commit, state }, payload) {
let resp;
Expand Down
7 changes: 4 additions & 3 deletions src/store/modules/shipment/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,14 @@ const actions: ActionTree<ShipmentState, RootState> = {

async updateShipmentProductCount ({ commit, state }, payload) {
const item = state.current.items.find((item: any) => item.sku === payload);

if (item) {
item.quantityAccepted = item.quantityAccepted ? parseInt(item.quantityAccepted) + 1 : 1;
commit(types.SHIPMENT_CURRENT_UPDATED, state);
showToast(translate("Scanned successfully.", { itemName: payload }))
} else {
showToast(translate("Product not found"));
showToast(translate("Failed to scan:", { itemName: payload }))
}

commit(types.SHIPMENT_CURRENT_UPDATED, state);
},
async setCurrent ({ commit }, payload) {
let resp;
Expand Down

0 comments on commit 150a48d

Please sign in to comment.