From bba2631ec5722a8dc54b53f8862bf8882a10cad0 Mon Sep 17 00:00:00 2001 From: Chris Redelinghuys Date: Mon, 13 Jan 2025 09:36:16 -0500 Subject: [PATCH 1/4] CASH-69 --- src/constants/store-mutations.js | 2 ++ .../service-location/service-location.vue | 11 +++++++- src/layouts/vehicle/vehicle.vue | 8 ++++++ src/store/index.js | 25 ++++++++++++++++++- 4 files changed, 44 insertions(+), 2 deletions(-) diff --git a/src/constants/store-mutations.js b/src/constants/store-mutations.js index 740c5a47e..f625e27cf 100644 --- a/src/constants/store-mutations.js +++ b/src/constants/store-mutations.js @@ -16,6 +16,8 @@ const storeMutations = { UPDATE_VEHICLE_IMAGE_COLOR: "updateVehicleImageColor", UPDATE_VEHICLE_VIN: "updateVehicleVin", UPDATE_VEHICLE: "updateVehicle", + UPDATE_VEHICLE_MOBILE_STATIC_RECALIBRATION_APPLICABLE: + "updateIsMobileStaticRecalibrationApplicable", UPDATE_IS_REPAIR: "updateIsRepair", UPDATE_NUMBER_OF_CHIPS: "updateNumberOfChips", diff --git a/src/layouts/service-location/service-location.vue b/src/layouts/service-location/service-location.vue index 4017088c4..70991f0f5 100644 --- a/src/layouts/service-location/service-location.vue +++ b/src/layouts/service-location/service-location.vue @@ -188,6 +188,8 @@ export default { isRecalibrationServiceableInshop: null, isGlassServiceableMobile: null, isRecalibrationServiceableMobile: null, + isVehicleMobileStaticRecalibrationApplicable: + this.getIsVehicleMobileStaticRecalibrationApplicableFromStore(), selectedAppointmentType: this.getSelectedAppointmentType(), selectedProvider: this.getSelectedProvider(), mobileFeePart: null, @@ -306,7 +308,11 @@ export default { }, isServiceableMobile() { if (this.isRecalibrationServiceableMobile !== null) { - return this.isGlassServiceableMobile && this.isRecalibrationServiceableMobile; + return ( + this.isGlassServiceableMobile && + this.isRecalibrationServiceableMobile && + this.isVehicleMobileStaticRecalibrationApplicable + ); } else { return this.isGlassServiceableMobile; } @@ -485,6 +491,9 @@ export default { getSelectedProvider() { return store.getters.order.serviceLocation.provider; }, + getIsVehicleMobileStaticRecalibrationApplicableFromStore() { + return store.getters.order.vehicle.isMobileStaticRecalibrationApplicable; + }, resetMobileLocation() { this.streetAddress = ""; this.apartmentNumberOrBusinessName = ""; diff --git a/src/layouts/vehicle/vehicle.vue b/src/layouts/vehicle/vehicle.vue index 18eee6988..6a634d826 100644 --- a/src/layouts/vehicle/vehicle.vue +++ b/src/layouts/vehicle/vehicle.vue @@ -117,6 +117,7 @@ export default { modelOptions: [], styleOptions: [], displayNoServiceAlert: false, + isMobileStaticRecalibrationApplicable: this.getIsMobileStaticRecalibrationApplicable(), }; }, @@ -438,6 +439,8 @@ export default { this.imageVifNumber = result?.data.imageVifNumber; this.imageVifColor = result?.data.imageVifColor; this.displayNoServiceAlert = !result?.data.canSafeliteService; + this.isMobileStaticRecalibrationApplicable = + result?.data.isMobileStaticRecalibrationApplicable; }, resetAlert() { this.displayNoServiceAlert = false; @@ -456,6 +459,8 @@ export default { imageUrl: this.imageUrl, imageVifNumber: this.imageVifNumber, imageVifColor: this.imageVifColor, + isMobileStaticRecalibrationApplicable: + this.isMobileStaticRecalibrationApplicable, }, false ); @@ -531,6 +536,9 @@ export default { getImageVifColorfromStore() { return store.getters.vehicle.imageVifColor; }, + getIsMobileStaticRecalibrationApplicable() { + return store.getters.vehicle.isMobileStaticRecalibrationApplicable; + }, }, components: { diff --git a/src/store/index.js b/src/store/index.js index d964a48d5..d7f7dcb06 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -68,6 +68,7 @@ const getDefaultState = () => { registration: { licensePlate: null, }, + isMobileStaticRecalibrationApplicable: false, }, serviceLocation: { address: null, @@ -225,6 +226,10 @@ export const mutations = { updateVehicleVin(state, vin) { state.order.vehicle.vin = vin; }, + updateIsMobileStaticRecalibrationApplicable(state, isMobileStaticRecalibrationApplicable) { + state.order.vehicle.isMobileStaticRecalibrationApplicable = + isMobileStaticRecalibrationApplicable; + }, updateIsRepair(state, isRepair) { state.order.damage.isRepair = isRepair; }, @@ -350,6 +355,8 @@ export const mutations = { state.order.vehicle.imageUrl = vehicleInfo.imageUrl; state.order.vehicle.imageVifNumber = vehicleInfo.imageVifNumber; state.order.vehicle.imageColor = vehicleInfo.imageVifColor; + state.order.vehicle.isMobileStaticRecalibrationApplicable = + vehicleInfo.isMobileStaticRecalibrationApplicable; }, updateRegistration(state, registrationInfo) { state.order.vehicle.registration.licensePlate = registrationInfo?.licensePlate; @@ -534,6 +541,7 @@ export const mutations = { state.order.vehicle.imageUrl = null; state.order.vehicle.imageVifNumber = null; state.order.vehicle.imageColor = null; + state.order.vehicle.isMobileStaticRecalibrationApplicable = false; }, resetDamageState(state) { state.order.damage.isRepair = null; @@ -2221,7 +2229,18 @@ export const actions = { // Vehicle saveVehicle( context, - { year, make, model, style, carId, category, imageUrl, imageVifNumber, imageVifColor } + { + year, + make, + model, + style, + carId, + category, + imageUrl, + imageVifNumber, + imageVifColor, + isMobileStaticRecalibrationApplicable, + } ) { if ( context.state.order.vehicle.year != year || @@ -2242,6 +2261,10 @@ export const actions = { context.commit(storeMutations.UPDATE_VEHICLE_IMAGE_URL, imageUrl); context.commit(storeMutations.UPDATE_VEHICLE_IMAGE_VIF_NUMBER, imageVifNumber); context.commit(storeMutations.UPDATE_VEHICLE_IMAGE_COLOR, imageVifColor); + context.commit( + storeMutations.UPDATE_VEHICLE_MOBILE_STATIC_RECALIBRATION_APPLICABLE, + isMobileStaticRecalibrationApplicable + ); } }, From 32fc82176b7c6292aeb2cfaeea5386a88c32e44b Mon Sep 17 00:00:00 2001 From: Matt Caimi Date: Mon, 13 Jan 2025 13:57:06 -0500 Subject: [PATCH 2/4] CASH-69 fix unit test --- src/layouts/service-location/service-location.spec.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/layouts/service-location/service-location.spec.js b/src/layouts/service-location/service-location.spec.js index eea946b89..6333082ec 100644 --- a/src/layouts/service-location/service-location.spec.js +++ b/src/layouts/service-location/service-location.spec.js @@ -181,6 +181,9 @@ beforeEach(() => { zipCode: "43235", state: "OH", }, + vehicle: { + isMobileStaticRecalibrationApplicable: true, + }, }, damage: { isRepair: false, From d9933d861c6db1989b16f904fecf51dff27f5114 Mon Sep 17 00:00:00 2001 From: Chris Redelinghuys Date: Thu, 16 Jan 2025 10:05:20 -0500 Subject: [PATCH 3/4] CASH-69: Get MSR fee and offer mobile service if applicable for cash and insurance --- .../service-location-helper.js | 5 ++- .../service-location/service-location.vue | 23 +++++++++++--- src/store/index.js | 31 +++++++++++++++++-- 3 files changed, 51 insertions(+), 8 deletions(-) diff --git a/src/layouts/service-location/helpers/service-location-helper/service-location-helper.js b/src/layouts/service-location/helpers/service-location-helper/service-location-helper.js index 1e7b6bdb3..0e86c4143 100644 --- a/src/layouts/service-location/helpers/service-location-helper/service-location-helper.js +++ b/src/layouts/service-location/helpers/service-location-helper/service-location-helper.js @@ -11,7 +11,10 @@ export async function getPricedMobileFeePart(serviceZipCode, pageNameToLog) { // Get the Mobile Fee Part const mobileFeePart = await baseMixin.methods.dispatchStoreActionWithLogging( storeActions.GET_MOBILE_FEE_PART, - null, + { + serviceZipCode: serviceZipCode, + serviceZipCodeCtu: zipCodeData.zipCodeCtu, + }, pageNameToLog, false ); diff --git a/src/layouts/service-location/service-location.vue b/src/layouts/service-location/service-location.vue index 70991f0f5..21a123e6e 100644 --- a/src/layouts/service-location/service-location.vue +++ b/src/layouts/service-location/service-location.vue @@ -159,6 +159,7 @@ import { defineRule } from "vee-validate"; import { errorMessages } from "@/constants/error-messages"; const MOBILE_FEE_PART_TYPE = "MOBILE FEE"; +const MOBILE_STATIC_RECAL_FEE_PART_NUMBER = "RECAL MOBILE"; // DEFINE VALIDATION RULES defineRule("mobile-location-required", (value) => { @@ -309,14 +310,27 @@ export default { isServiceableMobile() { if (this.isRecalibrationServiceableMobile !== null) { return ( - this.isGlassServiceableMobile && - this.isRecalibrationServiceableMobile && - this.isVehicleMobileStaticRecalibrationApplicable + (this.isGlassServiceableMobile && this.isRecalibrationServiceableMobile) || + this.isMobileStaticRecalibrationApplicable ); } else { return this.isGlassServiceableMobile; } }, + isMobileStaticRecalibrationApplicable() { + if (!this.isInsurance) { + return ( + this.isVehicleMobileStaticRecalibrationApplicable && + this.mobileFeePart?.partNumber == MOBILE_STATIC_RECAL_FEE_PART_NUMBER + ); + } else { + return ( + this.isVehicleMobileStaticRecalibrationApplicable && + this.mobileFeePart?.partNumber == MOBILE_STATIC_RECAL_FEE_PART_NUMBER && + this.mobileFeePart?.isInsurable + ); + } + }, mobileFeeApplies() { if ( this.mobileFeePart?.laborAmount > 0 || @@ -355,7 +369,8 @@ export default { return ( this.isServiceableInshop && this.isGlassServiceableMobile && - this.isRecalibrationServiceableMobile === false + this.isRecalibrationServiceableMobile === false && + !this.isMobileStaticRecalibrationApplicable ); }, displayRecalibrationWarning() { diff --git a/src/store/index.js b/src/store/index.js index d7f7dcb06..2c68cab38 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -1607,7 +1607,7 @@ export const actions = { return response; }, - getMobileFeePart(context, { pageNameToLog }) { + getMobileFeePart(context, { payload: { serviceZipCode, serviceZipCodeCtu }, pageNameToLog }) { const serviceType = context.getters.damage.isRepair ? "Repair" : "Install"; const facilityType = "Mobile"; const parentAccountNumber = context.getters.payment.parentAccountNumber; @@ -1619,16 +1619,31 @@ export const actions = { const coverageStatus = coverageStatusEnum(order.payment?.insuranceCoverage?.coverageStatus); const coverageType = coverageTypeEnum(order.payment?.insuranceCoverage?.coverageType); const isItacOptimized = order.policy?.isItac ?? false; + const isMobileStaticRecalibrationApplicable = + order.vehicle?.isMobileStaticRecalibrationApplicable; const zipCode = - order.serviceLocation?.provider?.address?.zipCode ?? order.serviceLocation?.zipCode; + serviceZipCode ?? + order.serviceLocation?.provider?.address?.zipCode ?? + order.serviceLocation?.zipCode; var providerNumber = - order.serviceLocation?.provider?.providerNumber ?? order.serviceLocation?.zipCodeCtu; + serviceZipCodeCtu ?? + order.serviceLocation?.provider?.providerNumber ?? + order.serviceLocation?.zipCodeCtu; if (providerNumber.startsWith("00") && providerNumber.length > 5) { providerNumber = providerNumber.substring(1); } var endPoint = `${endpoints.GetMobileFeePart.url}/?serviceType=${serviceType}&facilityType=${facilityType}&parentAccountNumber=${parentAccountNumber}&billToAccountNumber=${billToAccountNumber}&providerNumber=${providerNumber}&isItacOptimized=${isItacOptimized}&zipCode=${zipCode}`; + + if (isMobileStaticRecalibrationApplicable) { + const staticRecalPartNumber = getStaticRecalPartNumber(order.lineItems?.glassParts[0]); + const carId = order.vehicle?.carId; + if (staticRecalPartNumber && carId) { + endPoint = `${endPoint}&partNumbers=${staticRecalPartNumber}&carId=${carId}`; + } + } + if (coverageStatus) { endPoint = `${endPoint}&coverageStatus=${coverageStatus}`; } @@ -3666,3 +3681,13 @@ function getExternalParameterDefaultState() { function saveExternalParameterState(externalParameterState) { window.sessionStorage.setItem("externalParameterState", JSON.stringify(externalParameterState)); } + +//This function checks if static recalibration is available for the vehicle and returns the part number for it. +function getStaticRecalPartNumber(glassPartsArray) { + const recalPart = glassPartsArray.childParts.find((item) => item.partNumber === "RECAL STATIC"); + if (recalPart) { + return recalPart.partNumber; + } else { + return null; + } +} From 38c16b434b5365e6a5d21718c511387be5c8b95c Mon Sep 17 00:00:00 2001 From: Chris Redelinghuys Date: Fri, 17 Jan 2025 08:29:25 -0500 Subject: [PATCH 4/4] CASH-69: Simplify logic --- .../service-location/service-location.vue | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/layouts/service-location/service-location.vue b/src/layouts/service-location/service-location.vue index 21a123e6e..71bfa4b01 100644 --- a/src/layouts/service-location/service-location.vue +++ b/src/layouts/service-location/service-location.vue @@ -318,18 +318,11 @@ export default { } }, isMobileStaticRecalibrationApplicable() { - if (!this.isInsurance) { - return ( - this.isVehicleMobileStaticRecalibrationApplicable && - this.mobileFeePart?.partNumber == MOBILE_STATIC_RECAL_FEE_PART_NUMBER - ); - } else { - return ( - this.isVehicleMobileStaticRecalibrationApplicable && - this.mobileFeePart?.partNumber == MOBILE_STATIC_RECAL_FEE_PART_NUMBER && - this.mobileFeePart?.isInsurable - ); - } + return ( + this.isVehicleMobileStaticRecalibrationApplicable && + this.mobileFeePart?.partNumber == MOBILE_STATIC_RECAL_FEE_PART_NUMBER && + (this.isInsurance ? this.mobileFeePart?.isInsurable : true) + ); }, mobileFeeApplies() { if (