Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed: code to display the correct estimated delivery date and Pre order/Back order radio buttons not working(#2me4rbb) #8

Merged
merged 3 commits into from
Jul 26, 2022
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 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,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.checkPreorderBackorderItem(item)){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Handle case when we have property already set, but the product is no longer backorder

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");
}
}
Expand Down