commit
1cd30deb49
5 changed files with 59 additions and 8 deletions
|
|
@ -11,6 +11,7 @@ const cartItemTypes = {
|
||||||
EARLY_BIRD: "EARLY BIRD",
|
EARLY_BIRD: "EARLY BIRD",
|
||||||
SUPPLIES_REPAIR: "SUPPLIES-REPAIR",
|
SUPPLIES_REPAIR: "SUPPLIES-REPAIR",
|
||||||
SERVICE_PACKAGE_DISCOUNT: "SERVICE PACKAGE DISCOUNT",
|
SERVICE_PACKAGE_DISCOUNT: "SERVICE PACKAGE DISCOUNT",
|
||||||
|
DONATION: "DONATION",
|
||||||
};
|
};
|
||||||
|
|
||||||
export { cartItemTypes };
|
export { cartItemTypes };
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ const partTypeStrings = {
|
||||||
REPAIR_FEE: "REPAIR FEE",
|
REPAIR_FEE: "REPAIR FEE",
|
||||||
EARLY_BIRD: "EARLY BIRD",
|
EARLY_BIRD: "EARLY BIRD",
|
||||||
SERVICE_PACKAGE_DISCOUNT: "SERVICE PACKAGE DISCOUNT",
|
SERVICE_PACKAGE_DISCOUNT: "SERVICE PACKAGE DISCOUNT",
|
||||||
|
DONATION: "DONATION",
|
||||||
};
|
};
|
||||||
|
|
||||||
export { partTypeStrings };
|
export { partTypeStrings };
|
||||||
|
|
|
||||||
|
|
@ -403,7 +403,9 @@ export default {
|
||||||
}
|
}
|
||||||
return [
|
return [
|
||||||
...(this.lineItems.glassParts ?? []),
|
...(this.lineItems.glassParts ?? []),
|
||||||
...(this.lineItems.supportingItems ?? []),
|
...(this.lineItems.supportingItems.filter(
|
||||||
|
(item) => item.partType !== partTypeStrings.DONATION
|
||||||
|
) ?? []),
|
||||||
...(this.availableVaps ?? []),
|
...(this.availableVaps ?? []),
|
||||||
];
|
];
|
||||||
},
|
},
|
||||||
|
|
@ -466,6 +468,10 @@ export default {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.donationCartItem) {
|
||||||
|
cartItems.push(this.donationCartItem);
|
||||||
|
}
|
||||||
|
|
||||||
return cartItems;
|
return cartItems;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -1064,6 +1070,46 @@ export default {
|
||||||
|
|
||||||
return promoCartItems;
|
return promoCartItems;
|
||||||
},
|
},
|
||||||
|
showDonationCartItem() {
|
||||||
|
const donationLineItem = this.lineItems.supportingItems.find(
|
||||||
|
(item) => item.partType === partTypeStrings.DONATION
|
||||||
|
);
|
||||||
|
if (donationLineItem?.sellingPrice !== 0) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
donationCartItemName() {
|
||||||
|
return this.getCmsContent("DonationCartTextWidget", "Text");
|
||||||
|
},
|
||||||
|
donationCartItem() {
|
||||||
|
if (!this.lineItems || !this.lineItems.supportingItems) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const donationLineItem = this.lineItems.supportingItems.find(
|
||||||
|
(item) => item.partType === partTypeStrings.DONATION
|
||||||
|
);
|
||||||
|
|
||||||
|
if (donationLineItem?.sellingPrice > 0) {
|
||||||
|
return {
|
||||||
|
name: this.donationCartItemName,
|
||||||
|
category: cartItemCategories.SUPPORTING_ITEMS,
|
||||||
|
cartItemType: cartItemTypes.DONATION,
|
||||||
|
isDisplayed: true,
|
||||||
|
isRemovable: false,
|
||||||
|
subTotal: donationLineItem.sellingPrice,
|
||||||
|
salesTax: 0,
|
||||||
|
lineItems: [],
|
||||||
|
isCoveredByInsurance: cartItemTypesCoveredByInsurance.includes(
|
||||||
|
cartItemTypes.DONATION
|
||||||
|
),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
},
|
||||||
removeLinkText() {
|
removeLinkText() {
|
||||||
return this.getCmsContent("RemoveCartItemTextWidget", "Text");
|
return this.getCmsContent("RemoveCartItemTextWidget", "Text");
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,9 @@
|
||||||
:isExpandedOnLoad="false"
|
:isExpandedOnLoad="false"
|
||||||
:isItac="isItac"
|
:isItac="isItac"
|
||||||
:isNoComp="isNoComp"
|
:isNoComp="isNoComp"
|
||||||
:isMSRFeeApplicable="isMSRFeeApplicable" />
|
:isMSRFeeApplicable="isMSRFeeApplicable"
|
||||||
|
:donationAmount="donationAmount"
|
||||||
|
@update-donation-amount="updateDonationAmount" />
|
||||||
|
|
||||||
<div class="mt-3" v-if="DisplayFosterLove">
|
<div class="mt-3" v-if="DisplayFosterLove">
|
||||||
<donationBlock
|
<donationBlock
|
||||||
|
|
@ -532,7 +534,6 @@ export default {
|
||||||
},
|
},
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
console.log(donationResponse);
|
|
||||||
|
|
||||||
if (donationResponse?.wasSuccessful) {
|
if (donationResponse?.wasSuccessful) {
|
||||||
this.showDonationSuccess = true;
|
this.showDonationSuccess = true;
|
||||||
|
|
@ -542,9 +543,11 @@ export default {
|
||||||
parseInt(this.donationAmount),
|
parseInt(this.donationAmount),
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
this.lineItems = deepClone(this.getSubmittedOrder().lineItems);
|
||||||
} else {
|
} else {
|
||||||
this.showDonationError = true;
|
this.showDonationError = true;
|
||||||
this.showDonationSuccess = false;
|
this.showDonationSuccess = false;
|
||||||
|
this.donationAmount = 0;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -3298,16 +3298,16 @@ export const actions = {
|
||||||
"running addDonationToSubmittedOrder()... adding donation to supportingItems in session storage "
|
"running addDonationToSubmittedOrder()... adding donation to supportingItems in session storage "
|
||||||
);
|
);
|
||||||
submittedOrder.lineItems.supportingItems.push({
|
submittedOrder.lineItems.supportingItems.push({
|
||||||
partNumber: "DONATION",
|
partNumber: `DONATION_${donationAmount}`,
|
||||||
description: null,
|
description: `DONATION $${donationAmount}`,
|
||||||
partType: "DONATION",
|
partType: partTypeStrings.DONATION,
|
||||||
isInsurable: false,
|
isInsurable: false,
|
||||||
isChildPart: false,
|
isChildPart: false,
|
||||||
laborAmount: 0,
|
laborAmount: 0,
|
||||||
sellingPrice: donationAmount,
|
sellingPrice: donationAmount,
|
||||||
kitPrice: 0,
|
kitPrice: 0,
|
||||||
salesTax: null,
|
salesTax: 0,
|
||||||
id: "donation-" + donationAmount,
|
id: `donation-${donationAmount}`,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// filter out all donations
|
// filter out all donations
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue