From 22509f1d35d71f7026b60a8ecfcffa9d4ac9824c Mon Sep 17 00:00:00 2001 From: Yash Maheshwari Date: Fri, 8 Oct 2021 16:57:47 +0530 Subject: [PATCH 1/6] Improved: code to redirect the user to the search page after clicking save button on count page(#ew3j63) --- src/views/count.vue | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/views/count.vue b/src/views/count.vue index 3e1f226c..8c46a47f 100644 --- a/src/views/count.vue +++ b/src/views/count.vue @@ -74,6 +74,7 @@ import { colorPaletteOutline, resize, saveOutline } from "ionicons/icons"; import { mapGetters, useStore } from "vuex"; import { showToast } from "@/utils"; import { translate } from "@/i18n"; +import { useRouter } from "vue-router"; export default defineComponent({ name: "Count", @@ -101,6 +102,7 @@ export default defineComponent({ updateProductInventoryCount() { if (this.product.quantity) { this.store.dispatch('product/updateInventoryCount', this.product); + this.router.push('/search') } else { showToast(translate("Enter the stock count for the product")) } @@ -108,9 +110,11 @@ export default defineComponent({ }, setup() { const store = useStore(); + const router = useRouter(); return { store, + router, colorPaletteOutline, resize, saveOutline, From 52b35d231f48167385b31f36f10f83ddbc694424 Mon Sep 17 00:00:00 2001 From: Yash Maheshwari Date: Tue, 12 Oct 2021 13:00:18 +0530 Subject: [PATCH 2/6] Added: toast message on the count page, updated the show toast function to add dismiss button(#ew3j63) --- src/locales/en.json | 3 ++- src/utils/index.ts | 20 ++++++++++++-------- src/views/count.vue | 1 + 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/locales/en.json b/src/locales/en.json index 0c0e6c5d..93a95390 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -22,5 +22,6 @@ "The products in the upload list will be removed.": "The products in the upload list will be removed.", "Ok": "Ok", "Cancel": "Cancel", - "Loading": "Loading" + "Loading": "Loading", + "Item added to upload list": "Item added to upload list" } \ No newline at end of file diff --git a/src/utils/index.ts b/src/utils/index.ts index f9f42fcc..775bb4d3 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -4,17 +4,21 @@ import { toastController } from '@ionic/vue'; // TODO Remove it when HC APIs are fully REST compliant const hasError = (response: any) => { - return !!response.data._ERROR_MESSAGE_ || !!response.data._ERROR_MESSAGE_LIST_; + return !!response.data._ERROR_MESSAGE_ || !!response.data._ERROR_MESSAGE_LIST_; } const showToast = async (message: string) => { - const toast = await toastController - .create({ - message, - duration: 3000, - position: 'top', - }) - return toast.present(); + const toast = await toastController + .create({ + message: message, + duration: 3000, + position: 'bottom', + buttons: [{ + text: 'Dismiss', + role: 'cancel' + }] + }) + return toast.present(); } export { showToast, hasError } diff --git a/src/views/count.vue b/src/views/count.vue index 8c46a47f..13046c11 100644 --- a/src/views/count.vue +++ b/src/views/count.vue @@ -102,6 +102,7 @@ export default defineComponent({ updateProductInventoryCount() { if (this.product.quantity) { this.store.dispatch('product/updateInventoryCount', this.product); + showToast(translate("Item added to upload list")) this.router.push('/search') } else { showToast(translate("Enter the stock count for the product")) From f3d54c17a2a4d0c8c24cb0549c2726f61187b52d Mon Sep 17 00:00:00 2001 From: Yash Maheshwari Date: Tue, 12 Oct 2021 16:37:44 +0530 Subject: [PATCH 3/6] Improved: the position of toast message to top(#ew3j63) --- src/utils/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/index.ts b/src/utils/index.ts index 775bb4d3..458caad8 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -12,7 +12,7 @@ const showToast = async (message: string) => { .create({ message: message, duration: 3000, - position: 'bottom', + position: 'top', buttons: [{ text: 'Dismiss', role: 'cancel' From 109f2c082f55d1d987a6dba143ee3e115f660d56 Mon Sep 17 00:00:00 2001 From: Yash Maheshwari Date: Tue, 12 Oct 2021 18:43:24 +0530 Subject: [PATCH 4/6] Added: an view button on the count page to redirect the user to the upload page(#ew3j63) --- src/utils/index.ts | 14 +++++++++----- src/views/count.vue | 8 +++++++- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/utils/index.ts b/src/utils/index.ts index 458caad8..3e910e93 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -7,16 +7,20 @@ const hasError = (response: any) => { return !!response.data._ERROR_MESSAGE_ || !!response.data._ERROR_MESSAGE_LIST_; } -const showToast = async (message: string) => { +const showToast = async (message: string, configButtons?: any) => { + const defaultButtons = [{ + text: 'Dismiss', + role: 'cancel' + }] + + if (configButtons) defaultButtons.push(...configButtons); + const toast = await toastController .create({ message: message, duration: 3000, position: 'top', - buttons: [{ - text: 'Dismiss', - role: 'cancel' - }] + buttons: defaultButtons }) return toast.present(); } diff --git a/src/views/count.vue b/src/views/count.vue index 13046c11..2e04eae1 100644 --- a/src/views/count.vue +++ b/src/views/count.vue @@ -102,7 +102,13 @@ export default defineComponent({ updateProductInventoryCount() { if (this.product.quantity) { this.store.dispatch('product/updateInventoryCount', this.product); - showToast(translate("Item added to upload list")) + showToast(translate("Item added to upload list"), [{ + text: translate('View'), + role: 'view', + handler: () => { + this.router.push('/upload') + } + }]) this.router.push('/search') } else { showToast(translate("Enter the stock count for the product")) From 5c83985a7f2e276e4f269f60cd254b7e8965d922 Mon Sep 17 00:00:00 2001 From: Yash Maheshwari Date: Tue, 12 Oct 2021 18:46:43 +0530 Subject: [PATCH 5/6] Added: changelog entry file(#ew3j63) --- changelogs/unreleased/-ew3j63.yml | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 changelogs/unreleased/-ew3j63.yml diff --git a/changelogs/unreleased/-ew3j63.yml b/changelogs/unreleased/-ew3j63.yml new file mode 100644 index 00000000..a3318e1a --- /dev/null +++ b/changelogs/unreleased/-ew3j63.yml @@ -0,0 +1,7 @@ +--- +title: 'Improved: code for the count page to redirect the user to search and also + updated the showToast function to add custom buttons(#ew3j63)' +ticket_id: "#ew3j63" +merge_request: 1 +author: Yash Maheshwari +type: changed From f640bb3231b4a7b8583180baf2568aece44b4598 Mon Sep 17 00:00:00 2001 From: Yash Maheshwari Date: Tue, 12 Oct 2021 18:51:20 +0530 Subject: [PATCH 6/6] Removed: the branch name from the changelog entry(#ew3j63) --- changelogs/unreleased/-ew3j63.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelogs/unreleased/-ew3j63.yml b/changelogs/unreleased/-ew3j63.yml index a3318e1a..7796f3b7 100644 --- a/changelogs/unreleased/-ew3j63.yml +++ b/changelogs/unreleased/-ew3j63.yml @@ -1,6 +1,6 @@ --- title: 'Improved: code for the count page to redirect the user to search and also - updated the showToast function to add custom buttons(#ew3j63)' + updated the showToast function to add custom buttons' ticket_id: "#ew3j63" merge_request: 1 author: Yash Maheshwari