-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Implemented: Online Store Order Limit on Online Fulfillment Card in the settings page (#241)
- Loading branch information
Showing
5 changed files
with
255 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
<template> | ||
<ion-content> | ||
<ion-list> | ||
<ion-list-header> | ||
{{ $t("Fulfillment capacity") }} | ||
</ion-list-header> | ||
<ion-item button @click="updateOrderLimitType('unlimited')"> | ||
<ion-icon slot="end" :icon="lockOpenOutline" /> | ||
{{ $t("Unlimited Capacity") }} | ||
</ion-item> | ||
<ion-item button @click="updateOrderLimitType('no-capacity')"> | ||
{{ $t("No Capacity") }} | ||
<ion-icon slot="end" :icon="lockClosedOutline" /> | ||
</ion-item> | ||
<ion-item button lines="none" @click="updateOrderLimitType('custom')"> | ||
{{ $t("Custom") }} | ||
</ion-item> | ||
</ion-list> | ||
</ion-content> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { | ||
IonContent, | ||
IonIcon, | ||
IonItem, | ||
IonList, | ||
IonListHeader, | ||
alertController, | ||
popoverController | ||
} from "@ionic/vue"; | ||
import { defineComponent } from "vue"; | ||
import { lockClosedOutline, lockOpenOutline } from 'ionicons/icons' | ||
import { translate } from '@/i18n'; | ||
import { showToast } from '@/utils'; | ||
export default defineComponent({ | ||
name: "OrderLimitPopover", | ||
components: { | ||
IonContent, | ||
IonIcon, | ||
IonItem, | ||
IonList, | ||
IonListHeader | ||
}, | ||
setup() { | ||
return { | ||
lockClosedOutline, | ||
lockOpenOutline | ||
} | ||
}, | ||
props: ['fulfillmentOrderLimit'], | ||
data() { | ||
return { | ||
setLimit: this.fulfillmentOrderLimit as any | ||
} | ||
}, | ||
methods: { | ||
async updateOrderLimitType(orderLimitType: string) { | ||
let header = "Unlimited fulfillment capacity" | ||
let message = "Unlimited capacity removes the fulfillment capacity limit entirely. To add a fulfillment capacity to this facility, use the custom option." | ||
let showInput = false | ||
if (orderLimitType === 'custom') { | ||
header = "Custom fulfillment capacity" | ||
message = "" | ||
showInput = true | ||
} else if (orderLimitType === 'no-capacity') { | ||
this.setLimit = 0 | ||
header = "No fulfillment capacity" | ||
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 = "" | ||
} | ||
this.showOrderLimitAlert(header, message, showInput) | ||
}, | ||
async showOrderLimitAlert(header: string, message: string, showInput: boolean) { | ||
const alert = await alertController.create({ | ||
header: translate(header), | ||
message: translate(message, {space: '</br></br>'}), | ||
inputs: showInput ? [{ | ||
name: "setLimit", | ||
placeholder: translate("Order fulfillment capacity"), | ||
type: "number", | ||
min: 0 | ||
}] : [], | ||
buttons: [{ | ||
text: translate('Cancel'), | ||
role: "cancel" | ||
}, | ||
{ | ||
text: translate('Apply'), | ||
handler: (data) => { | ||
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(setLimit) | ||
} | ||
}] | ||
}) | ||
await alert.present() | ||
} | ||
} | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.