Skip to content

Commit

Permalink
Improved: alert buttons handling for apply case (#241)
Browse files Browse the repository at this point in the history
  • Loading branch information
amansinghbais committed Oct 10, 2023
1 parent 3463145 commit 97f1471
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 21 deletions.
30 changes: 16 additions & 14 deletions src/components/OrderLimitPopover.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ""
}
Expand All @@ -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)
}
}]
})
Expand Down
3 changes: 2 additions & 1 deletion src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
3 changes: 2 additions & 1 deletion src/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down Expand Up @@ -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",
Expand Down
9 changes: 4 additions & 5 deletions src/views/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -84,20 +84,19 @@
</ion-card-header>
<ion-card-content>
{{ $t('Configure the order fulfillment capacity of your facility.') }}
</ion-card-content>
<ion-card-content>
<br/><br/>
{{ $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.") }}
</ion-card-content>
<ion-item lines="none" v-if="orderLimitType === 'custom'">
<ion-text>{{currentFacilityDetails?.orderCount}}</ion-text>
<ion-text>{{ currentFacilityDetails?.orderCount }}</ion-text>
<ion-progress-bar class="ion-margin" :value="currentFacilityDetails?.orderCount / fulfillmentOrderLimit"></ion-progress-bar>
<ion-chip :disabled="!hasPermission(Actions.APP_UPDT_STR_FULFLMNT_CONFIG)" :outline="true" @click="changeOrderLimitPopover">{{currentFacilityDetails?.maximumOrderLimit}}</ion-chip>
</ion-item>
<ion-item lines="none" v-if="orderLimitType === 'unlimited'">
<ion-item lines="none" v-else-if="orderLimitType === 'unlimited'">
<ion-label>{{ $t("orders allocated today", {orderCount: currentFacilityDetails?.orderCount}) }}</ion-label>
<ion-chip :disabled="!hasPermission(Actions.APP_UPDT_STR_FULFLMNT_CONFIG)" :outline="true" @click="changeOrderLimitPopover">{{ $t("Unlimited") }}</ion-chip>
</ion-item>
<ion-item lines="none" v-if="orderLimitType === 'no-capacity'">
<ion-item lines="none" v-else>
<ion-label>{{ $t("orders in fulfillment queue", {orderCount: currentFacilityDetails?.orderCount}) }}</ion-label>
<ion-chip :disabled="!hasPermission(Actions.APP_UPDT_STR_FULFLMNT_CONFIG)" :outline="true" @click="changeOrderLimitPopover" color="danger" fill="outline">{{ fulfillmentOrderLimit }}</ion-chip>
</ion-item>
Expand Down

0 comments on commit 97f1471

Please sign in to comment.