Skip to content

Commit

Permalink
Merge pull request #8 from disha1202/#2me4rbb-updated
Browse files Browse the repository at this point in the history
Fixed: code to display the correct estimated delivery date and Pre order/Back order radio buttons not working(#2me4rbb)
  • Loading branch information
adityasharma7 authored Jul 26, 2022
2 parents 70d2f9f + 4104dee commit aebd330
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/views/OrderDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<ion-label>{{ $t("Pickup") }}</ion-label>
<ion-note slot="end">{{ getProductStock(item.sku, shopifyStores[0]?.storeCode) }} {{ $t("in stock") }}</ion-note>
</ion-item>
<ion-radio-group :value="isPreorderBackorderItem(item)" @ionChange="markPreorderBackorderItem(item, $event)">
<ion-radio-group :value="checkPreorderBackorderItem(item)" @ionChange="markPreorderBackorderItem(item, $event)">
<ion-item class="border-top">
<ion-radio :disabled="isPreorderOrBackorderProduct(item, 'PRE-ORDER')" slot="start" value="Pre Order" />
<ion-label>{{ $t("Pre Order") }}</ion-label>
Expand Down Expand Up @@ -148,9 +148,9 @@ 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;
return property ? property : "" ;
},
timeFromNow (time: string) {
if (time) {
Expand All @@ -159,8 +159,12 @@ 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 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){
Expand Down

0 comments on commit aebd330

Please sign in to comment.