Merge pull request #1960 from Safelite/feature/CSR-2182-ajc

Feature/csr 2182 ajc
This commit is contained in:
AdamCaouetteSafelite 2024-09-06 07:23:46 -04:00 committed by GitHub
commit fede1fe980
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 39 additions and 10 deletions

View file

@ -140,7 +140,7 @@
</div>
<div
class="my-2 lh-1 applied-promo-tag"
v-for="(promoCode, i) in this.getPromoCodeList()"
v-for="(promoCode, i) in getPromoCodeList"
:key="i">
<span class="caption"
>Promo code <span class="promo-code">{{ promoCode }}</span> applied
@ -184,6 +184,7 @@ export default {
allowItemRemoval: Boolean,
recyclingModalCmsWidgetName: String,
showAsPaid: Boolean,
isInsurance: Boolean,
insuranceDeductible: Number,
insuranceCompanyName: String,
showInsuranceCoverageAs: String,
@ -283,6 +284,7 @@ export default {
(lineItemsToKeep) => lineItemsToKeep.cartItemType != cartItemType
);
},
getPromoCodeList() {
if (this.$refs["promoModalQuestion"]) {
return this.$refs["promoModalQuestion"].getPromoCodeList();
@ -299,6 +301,14 @@ export default {
this.$emit("update:modelValue", newValue);
},
},
lineItemsWithoutRecal() {
if (!this.lineItems || this.lineItems.length < 1) return;
const lineItemsCopy = deepClone(this.lineItems);
lineItemsCopy.supportingItems = baseMixin.methods.filterOutRecalibration(
lineItemsCopy.supportingItems
);
return lineItemsCopy;
},
showCoverageAsPending() {
return this.showInsuranceCoverageAs === coverageStatus.PENDING;
},
@ -427,7 +437,14 @@ export default {
packagePrice() {
let packagePrice = 0;
if (!this.showCoverageAsVerified && !this.showCoverageAsPending) {
if (!this.isInsurance) {
// CASH ONLY
packagePrice = baseMixin.methods.getTierOnePackagePrice(
baseMixin.methods.filterOutFees(
baseMixin.methods.filterOutRecalibration(this.availableLineItems)
)
);
} else if (!this.showCoverageAsVerified && !this.showCoverageAsPending) {
packagePrice = baseMixin.methods.getTierOnePackagePrice(
baseMixin.methods.filterOutFees(this.availableLineItems)
);
@ -916,8 +933,6 @@ export default {
promoCartItems() {
const promoCartItems = [];
// clone the promos array
const promosClone = deepClone(this.promo);
// get unique promo codes
const uniquePromoCodes = [
...new Set(
@ -983,16 +998,23 @@ export default {
return this.getCmsContent("SubtotalTextWidget", "Text");
},
subTotal() {
return baseMixin.methods.getSubTotal(this.lineItems);
if (!this.lineItems || this.lineItems.length < 1) return;
return this.isInsurance
? baseMixin.methods.getSubTotal(this.lineItems)
: baseMixin.methods.getSubTotal(this.lineItemsWithoutRecal);
},
salesTax() {
return baseMixin.methods.getSalesTax(this.lineItems);
if (!this.lineItems || this.lineItems.length < 1) return;
return this.isInsurance
? baseMixin.methods.getSalesTax(this.lineItems)
: baseMixin.methods.getSalesTax(this.lineItemsWithoutRecal);
},
amountDue() {
if (this.showAsPaid) {
return 0;
}
return baseMixin.methods.getAmountDue(this.lineItems);
if (!this.lineItems || this.lineItems.length < 1) return;
if (this.showAsPaid) return 0;
return this.isInsurance
? baseMixin.methods.getAmountDue(this.lineItems)
: baseMixin.methods.getAmountDue(this.lineItemsWithoutRecal);
},
amountPaid() {
if (!this.showAsPaid) {

View file

@ -30,6 +30,7 @@
pageName="payment-method"
servicePackageOptionsCmsName="ServicePackageTitle"
recyclingModalCmsWidgetName="RecycleModal"
:isInsurance="isInsurance"
:insuranceDeductible="currentDeductible"
:insuranceCompanyName="insuranceCompanyName"
:showInsuranceCoverageAs="showInsuranceCoverageAs" />

View file

@ -102,6 +102,12 @@ export default {
});
return filteredLineItems;
},
filterOutRecalibration(lineItems) {
const filteredLineItems = lineItems.filter((item) => {
return item.partType != partTypeStrings.RECALIBRATION;
});
return filteredLineItems;
},
getTotalPriceOfAllLineItemsAndChildParts(lineItems, includeTax) {
let totalPrice = 0;
lineItems.forEach((lineItem) => {