create getters for deductible / cursor fixes

This commit is contained in:
Katie Kroell 2026-01-29 11:46:00 -05:00
parent ea14a7f888
commit b73f4b2a05
4 changed files with 24 additions and 22 deletions

View file

@ -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;
}
/**

View file

@ -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;

View file

@ -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

View file

@ -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) {