Skip to content

Commit

Permalink
Merge pull request #255 from amansinghbais/fulfillment-pwa/#241
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
ravilodhi authored Oct 10, 2023
2 parents 9d27735 + 97f1471 commit 0794027
Show file tree
Hide file tree
Showing 5 changed files with 255 additions and 88 deletions.
116 changes: 116 additions & 0 deletions src/components/OrderLimitPopover.vue
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>
25 changes: 21 additions & 4 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"Additional documents": "Additional documents",
"Address 1": "Address 1",
"Address 2": "Address 2",
"Apply": "Apply",
"Authenticating": "Authenticating",
"Are you sure you want to change the time zone to?": "Are you sure you want to change the time zone to?",
"Are you sure you want to delete this CSV mapping? This action cannot be undone.": "Are you sure you want to delete this CSV mapping? This action cannot be undone.",
Expand All @@ -29,13 +30,16 @@
"Completed": "Completed",
"Configuration Missing": "Configuration Missing",
"Confirm": "Confirm",
"Configure the order fulfillment capacity of your facility.": "Configure the order fulfillment capacity of your facility.",
"Control whether the store's inventory should be made available for online sales or not.": "Control whether the store's inventory should be made available for online sales or not.",
"Copied": "Copied { value }",
"Copied to clipboard": "Copied to clipboard",
"Copy ID": "Copy ID",
"Country Code": "Country Code",
"CSV Mapping": "CSV Mapping",
"Custom Label": "Custom Label",
"Custom": "Custom",
"Custom fulfillment capacity": "Custom fulfillment capacity",
"Customer letter": "Customer letter",
"Damaged": "Damaged",
"Define custom label for": "Define custom label for {field}",
Expand Down Expand Up @@ -89,7 +93,7 @@
"File downloaded successfully": "File downloaded successfully",
"File uploaded successfully": "File uploaded successfully",
"Full Address": "Full Address",
"Fulfill online orders": "Fulfill online orders",
"Fulfillment capacity": "Fulfillment capacity",
"Generate packing slip": "Generate packing slip",
"Generate shipping label": "Generate shipping label",
"Go to OMS": "Go to OMS",
Expand Down Expand Up @@ -118,15 +122,21 @@
"Map all fields": "Map all fields",
"Mapping name": "Mapping name",
"Mismatch": "Mismatch",
"Next day": "Next day",
"New mapping": "New mapping",
"No data available!": "No data available!",
"No data Found.": "No data Found.",
"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",
"No results found for . Try searching Open or Completed tab instead. If you still can't find what you're looking for, try switching stores.": "No results found for { searchedQuery }. Try searching Open or Completed tab instead.{ lineBreak } If you still can't find what you're looking for, try switching stores.",
"No results found for . Try searching In Progress or Open tab instead. If you still can't find what you're looking for, try switching stores.": "No results found for { searchedQuery }. Try searching In Progress or Open tab instead.{ lineBreak } If you still can't find what you're looking for, try switching stores.",
"No results found for . Try searching In Progress or Completed tab instead. If you still can't find what you're looking for, try switching stores.": "No results found for { searchedQuery }. Try searching In Progress or Completed tab instead.{ lineBreak } If you still can't find what you're looking for, try switching stores.",
"No time zone found": "No time zone found",
"Not in Stock": "Not in Stock",
"No Capacity": "No Capacity",
"No packed shipments to ship for these orders": "No packed shipments to ship for these orders",
"order": "order",
"of": "of",
"Off": "Off",
Expand All @@ -135,6 +145,10 @@
"On": "On",
"Online Order Fulfillment": "Online Order Fulfillment",
"Open": "Open",
"orders allocated today": "{orderCount} orders allocated today",
"orders in fulfillment queue": "{orderCount} orders in fulfillment queue",
"Order fulfillment capacity": "Order fulfillment capacity",
"Order fulfillment capacity updated successfully": "Order fulfillment capacity updated successfully",
"Options": "Options",
"Ordered": "Ordered",
"Order ID": "Order ID",
Expand All @@ -146,9 +160,6 @@
"Order updated successfully": "Order updated successfully",
"orders": "orders",
"Out of stock": "Out of stock",
"New mapping": "New mapping",
"Next day": "Next day",
"No packed shipments to ship for these orders": "No packed shipments to ship for these orders",
"package": "package",
"packages": "packages",
"Pack": "Pack",
Expand All @@ -167,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 Expand Up @@ -219,6 +231,7 @@
"Selected Fields: ": "Selected Fields: ",
"Sell inventory online": "Sell inventory online",
"Sell online": "Sell online",
"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.": "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.",
"Settings": "Settings",
"Set Limit": "Set Limit",
"Ship": "Ship",
Expand Down Expand Up @@ -266,6 +279,10 @@
"Turn on fulfillment": "Turn on fulfillment",
"Turn on fulfillment for ": "Turn on fulfillment for { facilityName }",
"Turn off fulfillment for ": "Turn off fulfillment for { facilityName }",
"Unlimited": "Unlimited",
"Unlimited Capacity": "Unlimited Capacity",
"Unlimited capacity removes the fulfillment capacity limit entirely. To add a fulfillment capacity to this facility, use the custom option.": "Unlimited capacity removes the fulfillment capacity limit entirely. To add a fulfillment capacity to this facility, use the custom option.",
"Unlimited fulfillment capacity": "Unlimited fulfillment capacity",
"Unable to open as browser is blocking pop-ups.": "Unable to open { documentName } as browser is blocking pop-ups.",
"Unpack": "Unpack",
"Unpacking this order will send it back to 'In progress' and it will have to be repacked.": "Unpacking this order will send it back to 'In progress' and it will have to be repacked.",
Expand Down
25 changes: 21 additions & 4 deletions src/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"Additional documents": "Additional documents",
"Address 1": "Address 1",
"Address 2": "Address 2",
"Apply": "Apply",
"Authenticating": "Authenticating",
"Are you sure you want to change the time zone to?": "¿Estás seguro/a de que quieres cambiar la zona horaria a?",
"Are you sure you want to delete this CSV mapping? This action cannot be undone.": "Are you sure you want to delete this CSV mapping? This action cannot be undone.",
Expand All @@ -29,12 +30,15 @@
"Completed": "Completado",
"Configuration Missing": "Configuración Faltante",
"Confirm": "Confirmar",
"Configure the order fulfillment capacity of your facility.": "Configure the order fulfillment capacity of your facility.",
"Control whether the store's inventory should be made available for online sales or not.": "Control whether the store's inventory should be made available for online sales or not.",
"Copied": "Copiado {texto}",
"Copied to clipboard": "Copiado al portapapeles",
"Copy ID": "Copy ID",
"Country Code": "Country Code",
"CSV Mapping": "CSV Mapping",
"Custom": "Custom",
"Custom fulfillment capacity": "Custom fulfillment capacity",
"Custom Label": "Etiqueta Personalizada",
"Customer letter": "Carta al Cliente",
"Damaged": "Dañado",
Expand Down Expand Up @@ -89,7 +93,7 @@
"File downloaded successfully": "Archivo descargado exitosamente",
"File uploaded successfully": "Archivo cargado exitosamente",
"Full Address": "Full Address",
"Fulfill online orders": "Fulfill online orders",
"Fulfillment capacity": "Fulfillment capacity",
"Generate packing slip": "Generate packing slip",
"Generate shipping label": "Generate shipping label",
"Go to OMS": "Go to OMS",
Expand Down Expand Up @@ -118,6 +122,10 @@
"Map all fields": "Map all fields",
"Mapping name": "Mapping name",
"Mismatch": "Inconsistencia",
"New mapping": "New mapping",
"Next day": "Día siguiente",
"No Capacity": "No Capacity",
"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 All @@ -126,8 +134,12 @@
"No results found for . Try searching In Progress or Open tab instead. If you still can't find what you're looking for, try switching stores.": "No results found for { searchedQuery }. Try searching In Progress or Open tab instead.{ lineBreak } If you still can't find what you're looking for, try switching stores.",
"No results found for . Try searching In Progress or Completed tab instead. If you still can't find what you're looking for, try switching stores.": "No results found for { searchedQuery }. Try searching In Progress or Completed tab instead.{ lineBreak } If you still can't find what you're looking for, try switching stores.",
"No time zone found": "No se encontró zona horaria",
"No fulfillment capacity": "No fulfillment capacity",
"Not in Stock": "No en Stock",
"No packed shipments to ship for these orders": "No hay envíos empacados para estos pedidos",
"order": "pedido",
"orders allocated today": "{orderCount} orders allocated today",
"orders in fulfillment queue": "{orderCount} orders in fulfillment queue",
"of": "de",
"Off": "Apagado",
"OMS": "OMS",
Expand All @@ -137,6 +149,8 @@
"Open": "Abierto",
"Options": "Options",
"Ordered": "Ordenado",
"Order fulfillment capacity": "Order fulfillment capacity",
"Order fulfillment capacity updated successfully": "Order fulfillment capacity updated successfully",
"Order ID": "ID del Pedido",
"Order packed successfully": "Pedido empacado exitosamente",
"Order packed successfully. Document generation in process": "Order packed successfully. Document generation in process",
Expand All @@ -146,9 +160,6 @@
"Order updated successfully": "Pedido actualizado exitosamente",
"orders": "pedidos",
"Out of stock": "Agotado",
"New mapping": "New mapping",
"Next day": "Día siguiente",
"No packed shipments to ship for these orders": "No hay envíos empacados para estos pedidos",
"package": "paquete",
"packages": "paquetes",
"Pack": "Empacar",
Expand All @@ -167,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 Expand Up @@ -221,6 +233,7 @@
"Selected Fields: ": "Selected Fields: ",
"Sell inventory online": "Sell inventory online",
"Sell online": "Sell online",
"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.": "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.",
"Settings": "Configuraciones",
"Set Limit": "Establecer Límite",
"Ship": "Enviar",
Expand Down Expand Up @@ -268,6 +281,10 @@
"Turn on fulfillment": "Activar Cumplimiento",
"Turn on fulfillment for ": "Activar cumplimiento para {facilityName}",
"Turn off fulfillment for ": "Desactivar cumplimiento para {facilityName}",
"Unlimited": "Unlimited",
"Unlimited Capacity": "Unlimited Capacity",
"Unlimited fulfillment capacity": "Unlimited fulfillment capacity",
"Unlimited capacity removes the fulfillment capacity limit entirely. To add a fulfillment capacity to this facility, use the custom option.": "Unlimited capacity removes the fulfillment capacity limit entirely. To add a fulfillment capacity to this facility, use the custom option.",
"Unable to open as browser is blocking pop-ups.": "Unable to open { documentName } as browser is blocking pop-ups.",
"Unpack": "Desempacar",
"Unpacking this order will send it back to 'In progress' and it will have to be repacked.": "Desempacar este pedido lo enviará de vuelta a 'En curso' y tendrá que ser vuelto a empacar.",
Expand Down
9 changes: 9 additions & 0 deletions src/services/UserService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ const getFacilityDetails = async (payload: any): Promise<any> => {
})
}

const getFacilityOrderCount = async (payload: any): Promise<any> => {
return api({
url: "performFind",
method: "get",
params: payload
})
}

const updateFacility = async (payload: any): Promise<any> => {
return api({
url: "service/updateFacility",
Expand Down Expand Up @@ -309,6 +317,7 @@ export const UserService = {
getAvailableTimeZones,
getEComStores,
getFacilityDetails,
getFacilityOrderCount,
getFieldMappings,
getFacilityGroupDetails,
getFacilityGroupAndMemberDetails,
Expand Down
Loading

0 comments on commit 0794027

Please sign in to comment.