CSR-1742: update naming and some logic to simplify
This commit is contained in:
parent
d3bc079eba
commit
15ca0785c1
2 changed files with 43 additions and 39 deletions
|
|
@ -11,7 +11,7 @@
|
|||
class="col d-flex justify-content-between py-0">
|
||||
<span class="label">{{ amountDueText }}</span>
|
||||
<span class="label amount-due">{{
|
||||
isInsuranceStatusPending
|
||||
isCoverageTypeToDisplayPending
|
||||
? verifyingCoverageText
|
||||
: getFormattedAmount("", amountDue)
|
||||
}}</span>
|
||||
|
|
@ -24,7 +24,7 @@
|
|||
<textBlock cmsWidgetName="DeductibleTextWidget" />
|
||||
<span>
|
||||
{{
|
||||
isInsuranceStatusPending
|
||||
isCoverageTypeToDisplayPending
|
||||
? verifyingCoverageText
|
||||
: getFormattedAmount("", deductibleLineItem.subTotal)
|
||||
}}
|
||||
|
|
@ -97,8 +97,8 @@
|
|||
</span>
|
||||
<span
|
||||
v-if="
|
||||
!isInsuranceStatusVerified ||
|
||||
(isInsuranceStatusVerified && !cartItem.isCoveredByInsurance)
|
||||
!isCoverageTypeToDisplayVerified ||
|
||||
(isCoverageTypeToDisplayVerified && !cartItem.isCoveredByInsurance)
|
||||
"
|
||||
>{{ getFormattedAmount(cartItem.category, cartItem.subTotal) }}</span
|
||||
>
|
||||
|
|
@ -106,25 +106,25 @@
|
|||
|
||||
<!-- Sub total, sales tax, total columns -->
|
||||
<div class="sub-total">
|
||||
<span>{{ subtotalText }}</span
|
||||
><span>{{
|
||||
isInsuranceStatusPending
|
||||
<span>{{ subtotalText }}</span>
|
||||
<span>{{
|
||||
isCoverageTypeToDisplayPending
|
||||
? verifyingCoverageText
|
||||
: getFormattedAmount("", subTotal)
|
||||
}}</span>
|
||||
</div>
|
||||
<div class="sales-tax">
|
||||
<span>{{ salesTaxText }}</span
|
||||
><span>{{ getFormattedAmount("", salesTax) }}</span>
|
||||
<span>{{ salesTaxText }}</span>
|
||||
<span>{{ getFormattedAmount("", salesTax) }}</span>
|
||||
</div>
|
||||
<div v-if="showAsPaid" class="amount-paid">
|
||||
<span>{{ amountPaidText }}</span
|
||||
><span>{{ getFormattedAmount("", amountPaid) }}</span>
|
||||
</div>
|
||||
<div class="amount-due">
|
||||
<span>{{ amountDueText }}</span
|
||||
><span>{{
|
||||
isInsuranceStatusPending
|
||||
<span>{{ amountDueText }}</span>
|
||||
<span>{{
|
||||
isCoverageTypeToDisplayPending
|
||||
? verifyingCoverageText
|
||||
: getFormattedAmount("", amountDue)
|
||||
}}</span>
|
||||
|
|
@ -188,9 +188,9 @@ export default {
|
|||
allowItemRemoval: Boolean,
|
||||
recyclingModalCmsWidgetName: String,
|
||||
showAsPaid: Boolean,
|
||||
currentDeductibleFromStore: Number,
|
||||
insuranceDeductible: Number,
|
||||
insuranceCompanyName: String,
|
||||
insuranceCoverageStatus: String,
|
||||
insuranceCoverageTypeToDisplay: String,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
|
@ -293,22 +293,18 @@ export default {
|
|||
this.$emit("update:modelValue", newValue);
|
||||
},
|
||||
},
|
||||
isInsuranceStatusPending() {
|
||||
if (this.insuranceCoverageStatus === coverageStatus.PENDING) return true;
|
||||
if (
|
||||
this.insuranceCoverageStatus === coverageStatus.VERIFIED &&
|
||||
!(this.currentDeductible === 0 || this.currentDeductible > 0)
|
||||
)
|
||||
return true;
|
||||
return false;
|
||||
isCoverageTypeToDisplayPending() {
|
||||
return this.insuranceCoverageTypeToDisplay === coverageStatus.PENDING;
|
||||
},
|
||||
isInsuranceStatusVerified() {
|
||||
return this.insuranceCoverageStatus === coverageStatus.VERIFIED;
|
||||
isCoverageTypeToDisplayVerified() {
|
||||
return this.insuranceCoverageTypeToDisplay === coverageStatus.VERIFIED;
|
||||
},
|
||||
currentDeductible() {
|
||||
if (this.insuranceCoverageStatus === coverageStatus.VERIFIED)
|
||||
return this.currentDeductibleFromStore;
|
||||
return null;
|
||||
const deductible = this.insuranceDeductible;
|
||||
if (!(deductible === 0 || deductible > 0)) {
|
||||
global.$logger.logError("Error: currentDeductible should not be null");
|
||||
}
|
||||
return deductible;
|
||||
},
|
||||
screenReaderTotalAmountDueText() {
|
||||
return this.getCmsContent("ScreenReaderTotalAmountDueWidget", "Text");
|
||||
|
|
@ -421,10 +417,7 @@ export default {
|
|||
packagePrice() {
|
||||
let packagePrice = 0;
|
||||
|
||||
if (
|
||||
!this.isInsuranceStatusVerified ||
|
||||
(this.isInsuranceStatusVerified && this.isInsuranceStatusPending)
|
||||
) {
|
||||
if (!this.isCoverageTypeToDisplayVerified) {
|
||||
packagePrice = baseMixin.methods.getTierOnePackagePrice(
|
||||
baseMixin.methods.filterOutFees(this.availableLineItems)
|
||||
);
|
||||
|
|
@ -476,10 +469,10 @@ export default {
|
|||
deductibleLineItem() {
|
||||
let lineItem = null;
|
||||
|
||||
if (this.isInsuranceStatusVerified || this.isInsuranceStatusPending) {
|
||||
if (this.isCoverageTypeToDisplayVerified || this.isCoverageTypeToDisplayPending) {
|
||||
lineItem = {
|
||||
name: this.deductibleLineItemName,
|
||||
subTotal: this.currentDeductible >= 0 ? this.currentDeductible : null,
|
||||
subTotal: this.currentDeductible,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -909,7 +902,7 @@ export default {
|
|||
subTotal() {
|
||||
let subTotal = 0;
|
||||
|
||||
if (this.isInsuranceStatusVerified) {
|
||||
if (this.isCoverageTypeToDisplayVerified) {
|
||||
// only include items NOT covered by insurance
|
||||
this.cartItems.forEach((cartItem) => {
|
||||
if (!cartItem.isCoveredByInsurance) {
|
||||
|
|
@ -929,7 +922,7 @@ export default {
|
|||
salesTax() {
|
||||
let salesTax = 0;
|
||||
|
||||
if (this.isInsuranceStatusVerified) {
|
||||
if (this.isCoverageTypeToDisplayVerified) {
|
||||
// only include items NOT covered by insurance
|
||||
this.cartItems.forEach((cartItem) => {
|
||||
if (!cartItem.isCoveredByInsurance) {
|
||||
|
|
|
|||
|
|
@ -29,9 +29,9 @@
|
|||
pageName="payment-method"
|
||||
servicePackageOptionsCmsName="ServicePackageTitle"
|
||||
recyclingModalCmsWidgetName="RecycleModal"
|
||||
:currentDeductibleFromStore="currentDeductible"
|
||||
:insuranceDeductible="currentDeductible"
|
||||
:insuranceCompanyName="insuranceCompanyName"
|
||||
:insuranceCoverageStatus="insuranceCoverageStatus" />
|
||||
:insuranceCoverageTypeToDisplay="insuranceCoverageTypeToDisplay" />
|
||||
|
||||
<hr class="my-5" />
|
||||
|
||||
|
|
@ -335,7 +335,18 @@ export default {
|
|||
(isMobile && mobileReqs) || (!isMobile && dropOffInshopReqs);
|
||||
|
||||
// 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
|
||||
const schedule = store.getters.order.schedule;
|
||||
|
|
@ -512,7 +523,7 @@ export default {
|
|||
}
|
||||
return false;
|
||||
},
|
||||
insuranceCoverageStatus() {
|
||||
insuranceCoverageTypeToDisplay() {
|
||||
if (!this.isInsurance) return null;
|
||||
if (this.isNoComp) {
|
||||
return coverageStatus.NOCOMP;
|
||||
|
|
|
|||
Loading…
Reference in a new issue