From 92e8ab096545555bae355bd5900b42d5e1cecfeb Mon Sep 17 00:00:00 2001 From: CarlNation Date: Fri, 16 Aug 2024 16:05:08 -0400 Subject: [PATCH] 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 --- src/fmg-components/cart/cart.vue | 37 +++++++++++++++++++ .../mobile-location-modal-questions.vue | 21 +++++++++++ .../service-location/service-location.vue | 18 ++++----- 3 files changed, 65 insertions(+), 11 deletions(-) diff --git a/src/fmg-components/cart/cart.vue b/src/fmg-components/cart/cart.vue index a712b8127..bdc217299 100644 --- a/src/fmg-components/cart/cart.vue +++ b/src/fmg-components/cart/cart.vue @@ -377,6 +377,10 @@ export default { cartItems.push(this.suppliesRepairCartItem); } + if (this.mobileFeeCartItem) { + cartItems.push(this.mobileFeeCartItem); + } + if (this.servicePackageDiscountCartItem) { cartItems.push(this.servicePackageDiscountCartItem); } @@ -756,6 +760,39 @@ export default { 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() { return this.getCmsContent("ServicePackageDiscountTextWidget", "Text"); }, diff --git a/src/layouts/service-location/mobile-location-modal-questions/mobile-location-modal-questions.vue b/src/layouts/service-location/mobile-location-modal-questions/mobile-location-modal-questions.vue index 96b12d240..4bdc00cb3 100644 --- a/src/layouts/service-location/mobile-location-modal-questions/mobile-location-modal-questions.vue +++ b/src/layouts/service-location/mobile-location-modal-questions/mobile-location-modal-questions.vue @@ -24,6 +24,11 @@ {{ errorMessage }} + 0 || + this.mobileFeePart?.sellingPrice > 0 || + this.mobileFeePart?.kitPrice > 0) { return true; } else { return false; } }, showMobileFreeAlert() { - var hasMobileFee = true; - if ( - this.mobileFeePart?.laborAmount == 0 && - this.mobileFeePart?.sellingPrice == 0 && - this.mobileFeePart?.kitPrice == 0 - ) { - hasMobileFee = false; - } - - if (this.isServiceableMobile && !this.isInsurance && !hasMobileFee) { + if (this.isServiceableMobile && !this.isInsurance && !this.mobileFeeApplies) { return true; } return false; @@ -391,6 +385,7 @@ export default { ) { return true; } else { + console.log("ins: servce-location invalid prereq:" + store.getters.payment.parentAccountNumber + ":" + store.getters.order.policy.policyNumber + ":" + store.getters.order.serviceLocation.zipCode); return false; } } else { @@ -400,6 +395,7 @@ export default { ) { return true; } else { + console.log("cash: servce-location invalid prereq:" + JSON.stringify(store.getters.lineItems.supportingItems) + ":" + store.getters.order.serviceLocation.zipCode); return false; } }