From b73f4b2a0566dc74fb69ea39a889681877bec0f3 Mon Sep 17 00:00:00 2001 From: Katie Kroell Date: Thu, 29 Jan 2026 11:46:00 -0500 Subject: [PATCH] create getters for deductible / cursor fixes --- src/helpers/cart-helper.js | 2 +- .../coverage-statement/coverage-statement.vue | 2 +- src/layouts/tpa-submit/tpa-submit.vue | 2 +- src/store/index.js | 40 ++++++++++--------- 4 files changed, 24 insertions(+), 22 deletions(-) diff --git a/src/helpers/cart-helper.js b/src/helpers/cart-helper.js index 8faf1557..af2cb1b9 100644 --- a/src/helpers/cart-helper.js +++ b/src/helpers/cart-helper.js @@ -76,7 +76,7 @@ export function getMobileFeeLineItem(order) { * @returns {number|undefined|null} current deductible */ export function getDeductible(order) { - return order.damage.isRepair ? order.currentRepairDeductible : order.currentReplaceDeductible; + return order.damage.isRepair ? order.currentDeductible.repair : order.currentDeductible.replace; } /** diff --git a/src/layouts/coverage-statement/coverage-statement.vue b/src/layouts/coverage-statement/coverage-statement.vue index fab95579..d7119497 100644 --- a/src/layouts/coverage-statement/coverage-statement.vue +++ b/src/layouts/coverage-statement/coverage-statement.vue @@ -274,7 +274,7 @@ export default { return damageString === 'match' ? '' : damageString; }, deductibleValue() { - return this.isRepair ? useMainStore().order.currentRepairDeductible : useMainStore().order.currentReplaceDeductible; + return this.mainStore.currentDeductible; }, isNoCompQuoteVisible() { return this.mainStore.isVerified && this.mainStore.isNoComp; diff --git a/src/layouts/tpa-submit/tpa-submit.vue b/src/layouts/tpa-submit/tpa-submit.vue index 8b96d450..ae67e022 100644 --- a/src/layouts/tpa-submit/tpa-submit.vue +++ b/src/layouts/tpa-submit/tpa-submit.vue @@ -207,7 +207,7 @@ export default { return this.mainStore.isVerified; }, currentDeductible() { - return this.mainStore.order.damage.isRepair ? this.mainStore.order.currentRepairDeductible : this.mainStore.order.currentReplaceDeductible; + return this.mainStore.currentDeductible; }, deductibleBoxValue() { return this.isVerified diff --git a/src/store/index.js b/src/store/index.js index f0245855..8248cdd9 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -220,14 +220,14 @@ export const getDefaultState = () => ({ settledTenderAmount: null, lockToken: null, customerPortalLoginToken: null, - // TO DO: remove one replace/repair logic is in place - originalDeductible: null, - // TO DO: remove one replace/repair logic is in place - currentDeductible: null, - originalReplaceDeductible: null, - currentReplaceDeductible: null, - originalRepairDeductible: null, - currentRepairDeductible: null, + originalDeductible: { + repair: null, + replace: null + }, + currentDeductible: { + repair: null, + replace: null + }, totalTaxAmount: null, waiverReasons: null, carrierPhoneNumber: null, @@ -447,7 +447,9 @@ export const useMainStore = defineStore({ experimentSettings: (state) => state.applicationUser.experiments .filter((x) => !!x.isActive) .map((x) => x.settings) - .reduce((r, c) => Object.assign(r, c), {}) ?? {} + .reduce((r, c) => Object.assign(r, c), {}) ?? {}, + originalDeductible: (state) => (state.order.damage.isRepair ? state.originalDeductible.repair : state.originalDeductible.replace), + currentDeductible: (state) => (state.order.damage.isRepair ? state.currentDeductible.repair : state.currentDeductible.replace) }, actions: { @@ -724,8 +726,8 @@ export const useMainStore = defineStore({ manualGlassNames: manualGlassNamesArray, policyState: this.order.customer.address.state, status: this.order.policy.status, - originalDeductible: this.isRepair ? this.order.originalRepairDeductible : this.order.originalReplaceDeductible, - currentDeductible: this.isRepair ? this.order.currentRepairDeductible : this.order.currentReplaceDeductible, + originalDeductible: this.originalDeductible, + currentDeductible: this.currentDeductible, noCoverage: false, isRepair: this.order.damage.isRepair, policyNumber: this.order.policy.policyNumber, @@ -1455,8 +1457,8 @@ export const useMainStore = defineStore({ }, policyNumber: policy.policyNumber, policyZipCode: policy.policyZipCode, - originalDeductible: this.isRepair ? this.order.originalRepairDeductible : this.order.originalReplaceDeductible, - currentDeductible: this.isRepair ? this.order.currentRepairDeductible : this.order.currentReplaceDeductible, + originalDeductible: this.originalDeductible, + currentDeductible: this.currentDeductible, OemEndorsement: this.hasOemEndorsement, noCoverage: this.isNoComp, isItac: this.isITAC @@ -2038,10 +2040,10 @@ export const useMainStore = defineStore({ this.order.policy.deductible.repair = coverage?.repairWaived ?? false ? 0 : coverage.deductible; this.order.policy.endorsements = coverage?.endorsements; - this.order.originalReplaceDeductible = this.order.policy.deductible.replace; - this.order.currentReplaceDeductible = this.order.policy.deductible.replace; - this.order.originalRepairDeductible = this.order.policy.deductible.repair; - this.order.currentRepairDeductible = this.order.policy.deductible.repair; + this.order.originalDeductible.replace = this.order.policy.deductible.replace; + this.order.currentDeductible.replace = this.order.policy.deductible.replace; + this.order.originalDeductible.repair = this.order.policy.deductible.repair; + this.order.currentDeductible.repair = this.order.policy.deductible.repair; }, resetOrder() { @@ -2327,9 +2329,9 @@ export const useMainStore = defineStore({ }, updateDeductible(deductibleInfo) { if (this.order.damage.isRepair) { - this.order.currentRepairDeductible = deductibleInfo.deductible; + this.order.currentDeductible.repair = deductibleInfo.deductible; } else { - this.order.currentReplaceDeductible = deductibleInfo.deductible; + this.order.currentDeductible.replace = deductibleInfo.deductible; } }, savePartQuestionAnswers(partQuestionAnswersArray) {