From f79cd6d5353d72847c2eafacfc24e35e3122d503 Mon Sep 17 00:00:00 2001 From: Bryan Mauger Date: Thu, 23 May 2024 13:31:41 -0400 Subject: [PATCH 1/3] CSR-2105 set specificity for radio button styles to fix radio buttons that look like checkboxes. --- src/ux-components/radio/radio.vue | 64 ++++++++++++++++--------------- 1 file changed, 33 insertions(+), 31 deletions(-) diff --git a/src/ux-components/radio/radio.vue b/src/ux-components/radio/radio.vue index 6a63ee3d5..12e55f67e 100644 --- a/src/ux-components/radio/radio.vue +++ b/src/ux-components/radio/radio.vue @@ -26,44 +26,46 @@ export default { From b34b7cd13442ec425b3d4d75b51ccb921c51b33e Mon Sep 17 00:00:00 2001 From: Adam Caouette Date: Thu, 23 May 2024 16:17:31 -0400 Subject: [PATCH 2/3] CSR-1742-r2: have cart use base-mixin shared logic --- src/fmg-components/cart/cart.vue | 41 +++----------------------------- src/mixins/base-mixin.js | 28 +++++++++++++++++----- 2 files changed, 25 insertions(+), 44 deletions(-) diff --git a/src/fmg-components/cart/cart.vue b/src/fmg-components/cart/cart.vue index 1ba5ea562..89382ed3f 100644 --- a/src/fmg-components/cart/cart.vue +++ b/src/fmg-components/cart/cart.vue @@ -915,48 +915,13 @@ export default { return this.getCmsContent("SubtotalTextWidget", "Text"); }, subTotal() { - let subTotal = 0; - - if (this.showCoverageAsVerified || this.showCoverageAsPending) { - // only include items NOT covered by insurance - this.cartItems.forEach((cartItem) => { - if (!cartItem.isCoveredByInsurance) { - subTotal += cartItem.subTotal ?? 0; - } - }); - // add deductible amount still to pay - subTotal += this.deductibleLineItem.subTotal ?? 0; - } else { - this.cartItems.forEach((cartItem) => { - subTotal += cartItem.subTotal ?? 0; - }); - } - - return subTotal; + return baseMixin.methods.getSubTotal(this.lineItems); }, salesTax() { - let salesTax = 0; - - if (this.showCoverageAsVerified || this.showCoverageAsPending) { - // only include items NOT covered by insurance - this.cartItems.forEach((cartItem) => { - if (!cartItem.isCoveredByInsurance) { - salesTax += cartItem.salesTax ?? 0; - } - }); - } else { - this.cartItems.forEach((cartItem) => { - salesTax += cartItem.salesTax ?? 0; - }); - } - - return salesTax; + return baseMixin.methods.getSalesTax(this.lineItems); }, amountDue() { - if (this.showAsPaid) { - return 0; - } - return this.subTotal + this.salesTax; + return baseMixin.methods.getAmountDue(this.lineItems); }, amountPaid() { if (!this.showAsPaid) { diff --git a/src/mixins/base-mixin.js b/src/mixins/base-mixin.js index ec49c3f0f..7e4fe2ce3 100644 --- a/src/mixins/base-mixin.js +++ b/src/mixins/base-mixin.js @@ -132,27 +132,32 @@ export default { currency: "USD", }); }, - getAmountDue(lineItems) { + getAmountDue(lineItems, includeTax = true) { var amountDue = 0; if (lineItems.glassParts) { amountDue += this.getTotalPriceOfAllLineItemsAndChildParts( lineItems.glassParts, - true + includeTax ); } if (lineItems.supportingItems) { amountDue += this.getTotalPriceOfAllLineItemsAndChildParts( lineItems.supportingItems, - true + includeTax ); } if (lineItems.vaps) { - amountDue += this.getTotalPriceOfAllLineItemsAndChildParts(lineItems.vaps, true); + amountDue += this.getTotalPriceOfAllLineItemsAndChildParts( + lineItems.vaps, + includeTax + ); } if (lineItems.promos) { - amountDue += this.getTotalPriceOfAllLineItemsAndChildParts(lineItems.promos, true); + amountDue += this.getTotalPriceOfAllLineItemsAndChildParts( + lineItems.promos, + includeTax + ); } - if ( store.getters.payment.insuranceCoverage.isVerified && !store.getters.policy.isNoComp && @@ -163,6 +168,17 @@ export default { return ((amountDue * 100) / 100).toFixed(2); }, + getSubTotal(lineItems) { + // this is amountDue without sales tax + return this.getAmountDue(lineItems, false); + }, + getSalesTax(lineItems) { + // this is amountDue minus subTotal + return ( + ((this.getAmountDue(lineItems) - this.getSubTotal(lineItems)) * 100) / + 100 + ).toFixed(2); + }, scrollToPageTop() { const container = document.getElementsByClassName("page-container-grouped-styles")[0]; container.scrollTo({ top: 0, left: 0, behavior: "smooth" }); From bc5ea319eddc3bea88166d3b6e8a925c442f8990 Mon Sep 17 00:00:00 2001 From: Adam Caouette Date: Thu, 23 May 2024 16:23:14 -0400 Subject: [PATCH 3/3] CSR-1742-r2: restore accidentally removed code --- src/fmg-components/cart/cart.vue | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/fmg-components/cart/cart.vue b/src/fmg-components/cart/cart.vue index 89382ed3f..dcf1375b7 100644 --- a/src/fmg-components/cart/cart.vue +++ b/src/fmg-components/cart/cart.vue @@ -921,6 +921,9 @@ export default { return baseMixin.methods.getSalesTax(this.lineItems); }, amountDue() { + if (this.showAsPaid) { + return 0; + } return baseMixin.methods.getAmountDue(this.lineItems); }, amountPaid() {