From 112d2efc8b08b65f492924c82bb57dd663d17aa9 Mon Sep 17 00:00:00 2001 From: Disha Talreja Date: Mon, 25 Jul 2022 21:36:25 +0530 Subject: [PATCH 1/3] Fixed: code to display the correct estimated delivery date(#2me4rbb) --- src/views/OrderDetail.vue | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/views/OrderDetail.vue b/src/views/OrderDetail.vue index 16e098b..c5b3dc2 100644 --- a/src/views/OrderDetail.vue +++ b/src/views/OrderDetail.vue @@ -150,7 +150,7 @@ export default defineComponent({ }, isPreorderBackorderItem (item: any) { const property = item.properties?.find((property: any) => property.name === 'Note')?.value; - return !!property; + return property ? property : "" ; }, timeFromNow (time: string) { if (time) { @@ -159,11 +159,11 @@ export default defineComponent({ } }, getEstimatedDeliveryDate(item: any, label: string){ - if(this.isPreorderBackorderItem(item)){ - return item.properties.find((property: any) => property.name === "PROMISE_DATE") ? item.properties.find((property: any) => property.name === "PROMISE_DATE")["PROMISE_DATE"] : ""; - } const product = this.getPreorderItemAvailability(item.sku); if(product.label === label){ + if(this.isPreorderBackorderItem(item)){ + return item.properties.find((property: any) => property.name === "PROMISE_DATE") ? item.properties.find((property: any) => property.name === "PROMISE_DATE").value : ""; + } return DateTime.fromISO(product.estimatedDeliveryDate).toFormat("MM/dd/yyyy"); } } From 71bc3a5c00bd7cfd729058abed880e22bd9b2c48 Mon Sep 17 00:00:00 2001 From: Disha Talreja Date: Tue, 26 Jul 2022 10:57:41 +0530 Subject: [PATCH 2/3] Improved method name(#2me4rbb) --- src/views/OrderDetail.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/views/OrderDetail.vue b/src/views/OrderDetail.vue index c5b3dc2..7b61776 100644 --- a/src/views/OrderDetail.vue +++ b/src/views/OrderDetail.vue @@ -36,7 +36,7 @@ {{ $t("Pickup") }} {{ getProductStock(item.sku, shopifyStores[0]?.storeCode) }} {{ $t("in stock") }} - + {{ $t("Pre Order") }} @@ -148,7 +148,7 @@ export default defineComponent({ updateDraftOrder () { this.store.dispatch('order/updateDraftOrder', this.order); }, - isPreorderBackorderItem (item: any) { + checkPreorderBackorderItem (item: any) { const property = item.properties?.find((property: any) => property.name === 'Note')?.value; return property ? property : "" ; }, @@ -161,7 +161,7 @@ export default defineComponent({ getEstimatedDeliveryDate(item: any, label: string){ const product = this.getPreorderItemAvailability(item.sku); if(product.label === label){ - if(this.isPreorderBackorderItem(item)){ + if(this.checkPreorderBackorderItem(item)){ return item.properties.find((property: any) => property.name === "PROMISE_DATE") ? item.properties.find((property: any) => property.name === "PROMISE_DATE").value : ""; } return DateTime.fromISO(product.estimatedDeliveryDate).toFormat("MM/dd/yyyy"); From 4104deeebfa96eeaad9c1d5062a0528caaee4a02 Mon Sep 17 00:00:00 2001 From: Disha Talreja Date: Tue, 26 Jul 2022 11:34:20 +0530 Subject: [PATCH 3/3] Updated code to display the correct estimated delivery date(#2me4rbb) --- src/views/OrderDetail.vue | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/views/OrderDetail.vue b/src/views/OrderDetail.vue index 7b61776..5043143 100644 --- a/src/views/OrderDetail.vue +++ b/src/views/OrderDetail.vue @@ -159,11 +159,15 @@ export default defineComponent({ } }, getEstimatedDeliveryDate(item: any, label: string){ + const labelMapping = { + "BACKORDER": "Back Order", + "PRE-ORDER": "Pre Order", + } as any + if(this.checkPreorderBackorderItem(item) === labelMapping[label]) { + return item.properties.find((property: any) => property.name === "PROMISE_DATE") ? item.properties.find((property: any) => property.name === "PROMISE_DATE").value : ""; + } const product = this.getPreorderItemAvailability(item.sku); if(product.label === label){ - if(this.checkPreorderBackorderItem(item)){ - return item.properties.find((property: any) => property.name === "PROMISE_DATE") ? item.properties.find((property: any) => property.name === "PROMISE_DATE").value : ""; - } return DateTime.fromISO(product.estimatedDeliveryDate).toFormat("MM/dd/yyyy"); } }