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 * @returns {number|undefined|null} current deductible
*/ */
export function getDeductible(order) { 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; return damageString === 'match' ? '' : damageString;
}, },
deductibleValue() { deductibleValue() {
return this.isRepair ? useMainStore().order.currentRepairDeductible : useMainStore().order.currentReplaceDeductible; return this.mainStore.currentDeductible;
}, },
isNoCompQuoteVisible() { isNoCompQuoteVisible() {
return this.mainStore.isVerified && this.mainStore.isNoComp; return this.mainStore.isVerified && this.mainStore.isNoComp;

View file

@ -207,7 +207,7 @@ export default {
return this.mainStore.isVerified; return this.mainStore.isVerified;
}, },
currentDeductible() { currentDeductible() {
return this.mainStore.order.damage.isRepair ? this.mainStore.order.currentRepairDeductible : this.mainStore.order.currentReplaceDeductible; return this.mainStore.currentDeductible;
}, },
deductibleBoxValue() { deductibleBoxValue() {
return this.isVerified return this.isVerified

View file

@ -220,14 +220,14 @@ export const getDefaultState = () => ({
settledTenderAmount: null, settledTenderAmount: null,
lockToken: null, lockToken: null,
customerPortalLoginToken: null, customerPortalLoginToken: null,
// TO DO: remove one replace/repair logic is in place originalDeductible: {
originalDeductible: null, repair: null,
// TO DO: remove one replace/repair logic is in place replace: null
currentDeductible: null, },
originalReplaceDeductible: null, currentDeductible: {
currentReplaceDeductible: null, repair: null,
originalRepairDeductible: null, replace: null
currentRepairDeductible: null, },
totalTaxAmount: null, totalTaxAmount: null,
waiverReasons: null, waiverReasons: null,
carrierPhoneNumber: null, carrierPhoneNumber: null,
@ -447,7 +447,9 @@ export const useMainStore = defineStore({
experimentSettings: (state) => state.applicationUser.experiments experimentSettings: (state) => state.applicationUser.experiments
.filter((x) => !!x.isActive) .filter((x) => !!x.isActive)
.map((x) => x.settings) .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: actions:
{ {
@ -724,8 +726,8 @@ export const useMainStore = defineStore({
manualGlassNames: manualGlassNamesArray, manualGlassNames: manualGlassNamesArray,
policyState: this.order.customer.address.state, policyState: this.order.customer.address.state,
status: this.order.policy.status, status: this.order.policy.status,
originalDeductible: this.isRepair ? this.order.originalRepairDeductible : this.order.originalReplaceDeductible, originalDeductible: this.originalDeductible,
currentDeductible: this.isRepair ? this.order.currentRepairDeductible : this.order.currentReplaceDeductible, currentDeductible: this.currentDeductible,
noCoverage: false, noCoverage: false,
isRepair: this.order.damage.isRepair, isRepair: this.order.damage.isRepair,
policyNumber: this.order.policy.policyNumber, policyNumber: this.order.policy.policyNumber,
@ -1455,8 +1457,8 @@ export const useMainStore = defineStore({
}, },
policyNumber: policy.policyNumber, policyNumber: policy.policyNumber,
policyZipCode: policy.policyZipCode, policyZipCode: policy.policyZipCode,
originalDeductible: this.isRepair ? this.order.originalRepairDeductible : this.order.originalReplaceDeductible, originalDeductible: this.originalDeductible,
currentDeductible: this.isRepair ? this.order.currentRepairDeductible : this.order.currentReplaceDeductible, currentDeductible: this.currentDeductible,
OemEndorsement: this.hasOemEndorsement, OemEndorsement: this.hasOemEndorsement,
noCoverage: this.isNoComp, noCoverage: this.isNoComp,
isItac: this.isITAC 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.deductible.repair = coverage?.repairWaived ?? false ? 0 : coverage.deductible;
this.order.policy.endorsements = coverage?.endorsements; this.order.policy.endorsements = coverage?.endorsements;
this.order.originalReplaceDeductible = this.order.policy.deductible.replace; this.order.originalDeductible.replace = this.order.policy.deductible.replace;
this.order.currentReplaceDeductible = this.order.policy.deductible.replace; this.order.currentDeductible.replace = this.order.policy.deductible.replace;
this.order.originalRepairDeductible = this.order.policy.deductible.repair; this.order.originalDeductible.repair = this.order.policy.deductible.repair;
this.order.currentRepairDeductible = this.order.policy.deductible.repair; this.order.currentDeductible.repair = this.order.policy.deductible.repair;
}, },
resetOrder() { resetOrder() {
@ -2327,9 +2329,9 @@ export const useMainStore = defineStore({
}, },
updateDeductible(deductibleInfo) { updateDeductible(deductibleInfo) {
if (this.order.damage.isRepair) { if (this.order.damage.isRepair) {
this.order.currentRepairDeductible = deductibleInfo.deductible; this.order.currentDeductible.repair = deductibleInfo.deductible;
} else { } else {
this.order.currentReplaceDeductible = deductibleInfo.deductible; this.order.currentDeductible.replace = deductibleInfo.deductible;
} }
}, },
savePartQuestionAnswers(partQuestionAnswersArray) { savePartQuestionAnswers(partQuestionAnswersArray) {