From e435297ae12a3b0f1636b2f3a784f5d4ac561dbb Mon Sep 17 00:00:00 2001 From: Mruthunjay Date: Sat, 19 Oct 2024 16:05:11 +0530 Subject: [PATCH] Fix: Incorrect Toast Message Displayed When User Accepts Counted Value #473 --- src/views/PendingReviewDetail.vue | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/views/PendingReviewDetail.vue b/src/views/PendingReviewDetail.vue index a1377242..65aaa5d4 100644 --- a/src/views/PendingReviewDetail.vue +++ b/src/views/PendingReviewDetail.vue @@ -531,11 +531,23 @@ async function acceptItem(item?: any) { const resp = await Promise.allSettled(payloads.map((payload: any) => CountService.acceptItem(payload))) - const isAnyRespHasError = resp.some((response: any) => response.status === "rejected") - if(isAnyRespHasError) { - showToast(translate("Some of the item(s) are failed to accept")) + const primary = ( + getProductIdentificationValue( + productStoreSettings.value.productIdentificationPref.primaryId, + getProduct.value(item.productId) + ) + ); + const isAnyRespHasError = resp.some( + (response: any) => response.status === "rejected" + ); + if (isAnyRespHasError) { + showToast(translate("Some of the item(s) are failed to accept")); } else { - showToast(translate("All of the item(s) are accepted")) + if (payloads.length === 1) { + showToast(translate(`Item: ${primary} has been accepted`)); + } else { + showToast(translate("All items have been accepted")); + } } await fetchCountItems() }