CSR-1742: update naming and some logic to simplify

This commit is contained in:
Adam Caouette 2024-04-23 17:39:47 -04:00
parent d3bc079eba
commit 15ca0785c1
2 changed files with 43 additions and 39 deletions

View file

@ -11,7 +11,7 @@
class="col d-flex justify-content-between py-0"> class="col d-flex justify-content-between py-0">
<span class="label">{{ amountDueText }}</span> <span class="label">{{ amountDueText }}</span>
<span class="label amount-due">{{ <span class="label amount-due">{{
isInsuranceStatusPending isCoverageTypeToDisplayPending
? verifyingCoverageText ? verifyingCoverageText
: getFormattedAmount("", amountDue) : getFormattedAmount("", amountDue)
}}</span> }}</span>
@ -24,7 +24,7 @@
<textBlock cmsWidgetName="DeductibleTextWidget" /> <textBlock cmsWidgetName="DeductibleTextWidget" />
<span> <span>
{{ {{
isInsuranceStatusPending isCoverageTypeToDisplayPending
? verifyingCoverageText ? verifyingCoverageText
: getFormattedAmount("", deductibleLineItem.subTotal) : getFormattedAmount("", deductibleLineItem.subTotal)
}} }}
@ -97,8 +97,8 @@
</span> </span>
<span <span
v-if=" v-if="
!isInsuranceStatusVerified || !isCoverageTypeToDisplayVerified ||
(isInsuranceStatusVerified && !cartItem.isCoveredByInsurance) (isCoverageTypeToDisplayVerified && !cartItem.isCoveredByInsurance)
" "
>{{ getFormattedAmount(cartItem.category, cartItem.subTotal) }}</span >{{ getFormattedAmount(cartItem.category, cartItem.subTotal) }}</span
> >
@ -106,25 +106,25 @@
<!-- Sub total, sales tax, total columns --> <!-- Sub total, sales tax, total columns -->
<div class="sub-total"> <div class="sub-total">
<span>{{ subtotalText }}</span <span>{{ subtotalText }}</span>
><span>{{ <span>{{
isInsuranceStatusPending isCoverageTypeToDisplayPending
? verifyingCoverageText ? verifyingCoverageText
: getFormattedAmount("", subTotal) : getFormattedAmount("", subTotal)
}}</span> }}</span>
</div> </div>
<div class="sales-tax"> <div class="sales-tax">
<span>{{ salesTaxText }}</span <span>{{ salesTaxText }}</span>
><span>{{ getFormattedAmount("", salesTax) }}</span> <span>{{ getFormattedAmount("", salesTax) }}</span>
</div> </div>
<div v-if="showAsPaid" class="amount-paid"> <div v-if="showAsPaid" class="amount-paid">
<span>{{ amountPaidText }}</span <span>{{ amountPaidText }}</span
><span>{{ getFormattedAmount("", amountPaid) }}</span> ><span>{{ getFormattedAmount("", amountPaid) }}</span>
</div> </div>
<div class="amount-due"> <div class="amount-due">
<span>{{ amountDueText }}</span <span>{{ amountDueText }}</span>
><span>{{ <span>{{
isInsuranceStatusPending isCoverageTypeToDisplayPending
? verifyingCoverageText ? verifyingCoverageText
: getFormattedAmount("", amountDue) : getFormattedAmount("", amountDue)
}}</span> }}</span>
@ -188,9 +188,9 @@ export default {
allowItemRemoval: Boolean, allowItemRemoval: Boolean,
recyclingModalCmsWidgetName: String, recyclingModalCmsWidgetName: String,
showAsPaid: Boolean, showAsPaid: Boolean,
currentDeductibleFromStore: Number, insuranceDeductible: Number,
insuranceCompanyName: String, insuranceCompanyName: String,
insuranceCoverageStatus: String, insuranceCoverageTypeToDisplay: String,
}, },
data() { data() {
return { return {
@ -293,22 +293,18 @@ export default {
this.$emit("update:modelValue", newValue); this.$emit("update:modelValue", newValue);
}, },
}, },
isInsuranceStatusPending() { isCoverageTypeToDisplayPending() {
if (this.insuranceCoverageStatus === coverageStatus.PENDING) return true; return this.insuranceCoverageTypeToDisplay === coverageStatus.PENDING;
if (
this.insuranceCoverageStatus === coverageStatus.VERIFIED &&
!(this.currentDeductible === 0 || this.currentDeductible > 0)
)
return true;
return false;
}, },
isInsuranceStatusVerified() { isCoverageTypeToDisplayVerified() {
return this.insuranceCoverageStatus === coverageStatus.VERIFIED; return this.insuranceCoverageTypeToDisplay === coverageStatus.VERIFIED;
}, },
currentDeductible() { currentDeductible() {
if (this.insuranceCoverageStatus === coverageStatus.VERIFIED) const deductible = this.insuranceDeductible;
return this.currentDeductibleFromStore; if (!(deductible === 0 || deductible > 0)) {
return null; global.$logger.logError("Error: currentDeductible should not be null");
}
return deductible;
}, },
screenReaderTotalAmountDueText() { screenReaderTotalAmountDueText() {
return this.getCmsContent("ScreenReaderTotalAmountDueWidget", "Text"); return this.getCmsContent("ScreenReaderTotalAmountDueWidget", "Text");
@ -421,10 +417,7 @@ export default {
packagePrice() { packagePrice() {
let packagePrice = 0; let packagePrice = 0;
if ( if (!this.isCoverageTypeToDisplayVerified) {
!this.isInsuranceStatusVerified ||
(this.isInsuranceStatusVerified && this.isInsuranceStatusPending)
) {
packagePrice = baseMixin.methods.getTierOnePackagePrice( packagePrice = baseMixin.methods.getTierOnePackagePrice(
baseMixin.methods.filterOutFees(this.availableLineItems) baseMixin.methods.filterOutFees(this.availableLineItems)
); );
@ -476,10 +469,10 @@ export default {
deductibleLineItem() { deductibleLineItem() {
let lineItem = null; let lineItem = null;
if (this.isInsuranceStatusVerified || this.isInsuranceStatusPending) { if (this.isCoverageTypeToDisplayVerified || this.isCoverageTypeToDisplayPending) {
lineItem = { lineItem = {
name: this.deductibleLineItemName, name: this.deductibleLineItemName,
subTotal: this.currentDeductible >= 0 ? this.currentDeductible : null, subTotal: this.currentDeductible,
}; };
} }
@ -909,7 +902,7 @@ export default {
subTotal() { subTotal() {
let subTotal = 0; let subTotal = 0;
if (this.isInsuranceStatusVerified) { if (this.isCoverageTypeToDisplayVerified) {
// only include items NOT covered by insurance // only include items NOT covered by insurance
this.cartItems.forEach((cartItem) => { this.cartItems.forEach((cartItem) => {
if (!cartItem.isCoveredByInsurance) { if (!cartItem.isCoveredByInsurance) {
@ -929,7 +922,7 @@ export default {
salesTax() { salesTax() {
let salesTax = 0; let salesTax = 0;
if (this.isInsuranceStatusVerified) { if (this.isCoverageTypeToDisplayVerified) {
// only include items NOT covered by insurance // only include items NOT covered by insurance
this.cartItems.forEach((cartItem) => { this.cartItems.forEach((cartItem) => {
if (!cartItem.isCoveredByInsurance) { if (!cartItem.isCoveredByInsurance) {

View file

@ -29,9 +29,9 @@
pageName="payment-method" pageName="payment-method"
servicePackageOptionsCmsName="ServicePackageTitle" servicePackageOptionsCmsName="ServicePackageTitle"
recyclingModalCmsWidgetName="RecycleModal" recyclingModalCmsWidgetName="RecycleModal"
:currentDeductibleFromStore="currentDeductible" :insuranceDeductible="currentDeductible"
:insuranceCompanyName="insuranceCompanyName" :insuranceCompanyName="insuranceCompanyName"
:insuranceCoverageStatus="insuranceCoverageStatus" /> :insuranceCoverageTypeToDisplay="insuranceCoverageTypeToDisplay" />
<hr class="my-5" /> <hr class="my-5" />
@ -335,7 +335,18 @@ export default {
(isMobile && mobileReqs) || (!isMobile && dropOffInshopReqs); (isMobile && mobileReqs) || (!isMobile && dropOffInshopReqs);
// Insurance // Insurance
const isInsuranceSet = store.getters.order.payment.isInsurance !== null; const isInsurance = store.getters.order.payment.isInsurance;
const insuranceCoverageStatus = store.getters.payment.insuranceCoverage.coverageStatus;
const currentDeductible = store.getters.policy.currentDeductible;
const isInsuranceSet = () => {
if (isInsurance !== null) {
if (insuranceCoverageStatus === coverageStatus.VERIFIED && !(currentDeductible === 0 || currentDeductible > 0) ) {
return false; // if coverageStatus is verified there must be a valid deductible also
}
return true;
}
return false;
};
// Schedule // Schedule
const schedule = store.getters.order.schedule; const schedule = store.getters.order.schedule;
@ -512,7 +523,7 @@ export default {
} }
return false; return false;
}, },
insuranceCoverageStatus() { insuranceCoverageTypeToDisplay() {
if (!this.isInsurance) return null; if (!this.isInsurance) return null;
if (this.isNoComp) { if (this.isNoComp) {
return coverageStatus.NOCOMP; return coverageStatus.NOCOMP;