CSR-1981 add back removed mobile fee references

CSR-1981 add back removed mobile fee references and use fee amount to determine when to show mobile fees
This commit is contained in:
CarlNation 2024-08-16 16:05:08 -04:00
parent 907ed95d96
commit 92e8ab0965
3 changed files with 65 additions and 11 deletions

View file

@ -377,6 +377,10 @@ export default {
cartItems.push(this.suppliesRepairCartItem); cartItems.push(this.suppliesRepairCartItem);
} }
if (this.mobileFeeCartItem) {
cartItems.push(this.mobileFeeCartItem);
}
if (this.servicePackageDiscountCartItem) { if (this.servicePackageDiscountCartItem) {
cartItems.push(this.servicePackageDiscountCartItem); cartItems.push(this.servicePackageDiscountCartItem);
} }
@ -756,6 +760,39 @@ export default {
return cartItem; return cartItem;
}, },
mobileFeeCartItemName() {
return this.getCmsContent("MobileServiceTextWidget", "Text");
},
mobileFeeCartItem() {
let cartItem = null;
const mobileFeeLineItem = this.supportingItems.find(
(lineItem) => lineItem.partType == partTypeStrings.MOBILE_FEE
);
if (mobileFeeLineItem) {
cartItem = {
name: this.mobileFeeCartItemName,
category: cartItemCategories.SUPPORTING_ITEMS,
cartItemType: cartItemTypes.MOBILE_FEE,
isDisplayed: true,
isRemovable: false,
subTotal: 0,
salesTax: 0,
lineItems: [],
isCoveredByInsurance: cartItemTypesCoveredByInsurance.includes(
cartItemTypes.MOBILE_FEE
),
};
mobileFeeLineItem.cartItemType = cartItem.cartItemType;
cartItem.lineItems.push(mobileFeeLineItem);
cartItem.subTotal +=
(mobileFeeLineItem.kitPrice ?? 0) +
(mobileFeeLineItem.laborAmount ?? 0) +
(mobileFeeLineItem.sellingPrice ?? 0);
cartItem.salesTax += mobileFeeLineItem.salesTax ?? 0;
}
return cartItem;
},
servicePackageDiscountCartItemName() { servicePackageDiscountCartItemName() {
return this.getCmsContent("ServicePackageDiscountTextWidget", "Text"); return this.getCmsContent("ServicePackageDiscountTextWidget", "Text");
}, },

View file

@ -24,6 +24,11 @@
{{ errorMessage }} {{ errorMessage }}
</span> </span>
</div> </div>
<textBlock
v-if="mobileFeeApplies"
:customText="mobileFeeText"
cmsWidgetName="MobileFeeDisclaimerWidget"
typeStyle="caption" />
</div> </div>
<modal <modal
:ref="modalName" :ref="modalName"
@ -149,6 +154,7 @@ export default {
alertInvalidZipWidgetName: String, alertInvalidZipWidgetName: String,
customComponentId: String, customComponentId: String,
validationRules: String, validationRules: String,
mobileFeeApplies: Boolean,
}, },
computed: { computed: {
mobileLocationLinkPromptText() { mobileLocationLinkPromptText() {
@ -170,6 +176,21 @@ export default {
} }
return this.getCmsContent(this.linkWidgetName, "BodyText"); return this.getCmsContent(this.linkWidgetName, "BodyText");
}, },
mobileFeeText() {
const cmsContentText = this.getCmsContent("MobileFeeDisclaimerWidget", "Text");
return cmsContentText.replaceAll("{custom:mobileFee}", this.mobileFee);
},
mobileFee() {
if (!this.mobileFeePart) {
return 0;
}
return (
this.mobileFeePart.laborAmount +
this.mobileFeePart.sellingPrice +
this.mobileFeePart.kitPrice
);
},
modalName() { modalName() {
return "MobileLocationModalWidget"; return "MobileLocationModalWidget";
}, },

View file

@ -87,6 +87,7 @@
v-if="selectedAppointmentType === 'Mobile'" v-if="selectedAppointmentType === 'Mobile'"
v-model="mobileLocationQuestions" v-model="mobileLocationQuestions"
:mobileFeePart="mobileFeePart" :mobileFeePart="mobileFeePart"
:mobileFeeApplies="mobileFeeApplies"
@updated-mobile-fee-part="setMobileFeePart" @updated-mobile-fee-part="setMobileFeePart"
@updated-serviceability="setServiceabilityDetails" @updated-serviceability="setServiceabilityDetails"
@updated-contains-military-base="setContainsMilitaryBase" @updated-contains-military-base="setContainsMilitaryBase"
@ -308,23 +309,16 @@ export default {
} }
}, },
mobileFeeApplies() { mobileFeeApplies() {
if (this.mobileFeePart) { if (this.mobileFeePart?.laborAmount > 0 ||
this.mobileFeePart?.sellingPrice > 0 ||
this.mobileFeePart?.kitPrice > 0) {
return true; return true;
} else { } else {
return false; return false;
} }
}, },
showMobileFreeAlert() { showMobileFreeAlert() {
var hasMobileFee = true; if (this.isServiceableMobile && !this.isInsurance && !this.mobileFeeApplies) {
if (
this.mobileFeePart?.laborAmount == 0 &&
this.mobileFeePart?.sellingPrice == 0 &&
this.mobileFeePart?.kitPrice == 0
) {
hasMobileFee = false;
}
if (this.isServiceableMobile && !this.isInsurance && !hasMobileFee) {
return true; return true;
} }
return false; return false;
@ -391,6 +385,7 @@ export default {
) { ) {
return true; return true;
} else { } else {
console.log("ins: servce-location invalid prereq:" + store.getters.payment.parentAccountNumber + ":" + store.getters.order.policy.policyNumber + ":" + store.getters.order.serviceLocation.zipCode);
return false; return false;
} }
} else { } else {
@ -400,6 +395,7 @@ export default {
) { ) {
return true; return true;
} else { } else {
console.log("cash: servce-location invalid prereq:" + JSON.stringify(store.getters.lineItems.supportingItems) + ":" + store.getters.order.serviceLocation.zipCode);
return false; return false;
} }
} }