From 97f14715c47d2e6b6e6c8ce55f82081f2703b072 Mon Sep 17 00:00:00 2001 From: amansinghbais Date: Tue, 10 Oct 2023 12:55:03 +0530 Subject: [PATCH] Improved: alert buttons handling for apply case (#241) --- src/components/OrderLimitPopover.vue | 30 +++++++++++++++------------- src/locales/en.json | 3 ++- src/locales/es.json | 3 ++- src/views/Settings.vue | 9 ++++----- 4 files changed, 24 insertions(+), 21 deletions(-) diff --git a/src/components/OrderLimitPopover.vue b/src/components/OrderLimitPopover.vue index 88bd8bb3..d073f576 100644 --- a/src/components/OrderLimitPopover.vue +++ b/src/components/OrderLimitPopover.vue @@ -67,7 +67,7 @@ export default defineComponent({ } else if (orderLimitType === 'no-capacity') { this.setLimit = 0 header = "No fulfillment capacity" - message = "No capacity removes sets the fulfillment capacity to 0, preventing any new orders from being allocated to this facility. Use the \"Reject all orders\" option in the fulfillment pages to clear your facilities fulfillment queue. To add a fulfillment capacity to this facility, use the custom option." + message = "No capacity sets the fulfillment capacity to 0, preventing any new orders from being allocated to this facility. Use the \"Reject all orders\" option in the fulfillment pages to clear your facilities fulfillment queue. To add a fulfillment capacity to this facility, use the custom option." } else if (orderLimitType === 'unlimited') { this.setLimit = "" } @@ -84,26 +84,28 @@ export default defineComponent({ type: "number", min: 0 }] : [], - buttons: showInput ? [{ + buttons: [{ text: translate('Cancel'), role: "cancel" }, { text: translate('Apply'), handler: (data) => { - if (data.setLimit <= 0) { - showToast(translate('Provide a value greater than 0')) - return; + let setLimit = this.setLimit as any; + + if(data) { + if(data.setLimit === '') { + showToast(translate('Please provide a value')) + return false; + } else if(data.setLimit <= 0) { + showToast(translate('Provide a value greater than 0')) + return false; + } else { + setLimit = data.setLimit + } } - popoverController.dismiss(data.setLimit) - } - }] : [{ - text: translate('Cancel'), - role: 'cancel' - }, { - text: translate('Apply'), - handler: () => { - popoverController.dismiss(this.setLimit) + + popoverController.dismiss(setLimit) } }] }) diff --git a/src/locales/en.json b/src/locales/en.json index 885fa104..8e444ed1 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -126,7 +126,7 @@ "New mapping": "New mapping", "No data available!": "No data available!", "No data Found.": "No data Found.", - "No capacity removes sets the fulfillment capacity to 0, preventing any new orders from being allocated to this facility. Use the \"Reject all orders\" option in the fulfillment pages to clear your facilities fulfillment queue. To add a fulfillment capacity to this facility, use the custom option.": "No capacity removes sets the fulfillment capacity to 0, preventing any new orders from being allocated to this facility. Use the \"Reject all orders\" option in the fulfillment pages to clear your facilities fulfillment queue. {space}To add a fulfillment capacity to this facility, use the custom option.", + "No capacity sets the fulfillment capacity to 0, preventing any new orders from being allocated to this facility. Use the \"Reject all orders\" option in the fulfillment pages to clear your facilities fulfillment queue. To add a fulfillment capacity to this facility, use the custom option.": "No capacity sets the fulfillment capacity to 0, preventing any new orders from being allocated to this facility. Use the \"Reject all orders\" option in the fulfillment pages to clear your facilities fulfillment queue. {space}To add a fulfillment capacity to this facility, use the custom option.", "No new file upload. Please try again": "No new file upload. Please try again", "No fulfillment capacity": "No fulfillment capacity", "No reason": "No reason", @@ -178,6 +178,7 @@ "pieces in stock": "pieces in stock", "Please enter a unique key": "Please enter a unique key", "Please enter a valid key": "Please enter a valid key", + "Please provide a value": "Please provide a value", "Please provide unique labels": "Please provide unique labels", "Please select at least one field to generate CSV": "Please select at least one field to generate CSV", "Please upload a valid csv to continue": "Please upload a valid csv to continue", diff --git a/src/locales/es.json b/src/locales/es.json index be2029b2..f1170dcf 100644 --- a/src/locales/es.json +++ b/src/locales/es.json @@ -125,7 +125,7 @@ "New mapping": "New mapping", "Next day": "Día siguiente", "No Capacity": "No Capacity", - "No capacity removes sets the fulfillment capacity to 0, preventing any new orders from being allocated to this facility. Use the \"Reject all orders\" option in the fulfillment pages to clear your facilities fulfillment queue. To add a fulfillment capacity to this facility, use the custom option.": "No capacity removes sets the fulfillment capacity to 0, preventing any new orders from being allocated to this facility. Use the \"Reject all orders\" option in the fulfillment pages to clear your facilities fulfillment queue. {space}To add a fulfillment capacity to this facility, use the custom option.", + "No capacity sets the fulfillment capacity to 0, preventing any new orders from being allocated to this facility. Use the \"Reject all orders\" option in the fulfillment pages to clear your facilities fulfillment queue. To add a fulfillment capacity to this facility, use the custom option.": "No capacity sets the fulfillment capacity to 0, preventing any new orders from being allocated to this facility. Use the \"Reject all orders\" option in the fulfillment pages to clear your facilities fulfillment queue. {space}To add a fulfillment capacity to this facility, use the custom option.", "No data available!": "No data available!", "No data Found.": "No data Found.", "No new file upload. Please try again": "No se cargó ningún archivo nuevo. Por favor, inténtalo nuevamente.", @@ -178,6 +178,7 @@ "pieces in stock": "piezas en stock", "Please enter a unique key": "Please enter a unique key", "Please enter a valid key": "Please enter a valid key", + "Please provide a value": "Please provide a value", "Please provide unique labels": "Por favor, proporciona etiquetas únicas", "Please select at least one field to generate CSV": "Por favor, selecciona al menos un campo para generar el archivo CSV", "Please upload a valid csv to continue": "Por favor, carga un archivo CSV válido para continuar", diff --git a/src/views/Settings.vue b/src/views/Settings.vue index 786b22f9..e73b5c4f 100644 --- a/src/views/Settings.vue +++ b/src/views/Settings.vue @@ -84,20 +84,19 @@ {{ $t('Configure the order fulfillment capacity of your facility.') }} - - +

{{ $t("Setting fulfillment capacity to 0 disables new order from being allocated to this facility. Leave this empty if this facility's fulfillment capacity is unrestricted.") }}
- {{currentFacilityDetails?.orderCount}} + {{ currentFacilityDetails?.orderCount }} {{currentFacilityDetails?.maximumOrderLimit}} - + {{ $t("orders allocated today", {orderCount: currentFacilityDetails?.orderCount}) }} {{ $t("Unlimited") }} - + {{ $t("orders in fulfillment queue", {orderCount: currentFacilityDetails?.orderCount}) }} {{ fulfillmentOrderLimit }}