updating deductible logic WIP

This commit is contained in:
Katie Kroell 2026-01-28 12:08:59 -05:00
parent 0ab2752953
commit c148de71a6
2 changed files with 24 additions and 9 deletions

View file

@ -336,7 +336,7 @@ export default {
return damageString === 'match' ? '' : damageString;
},
deductibleValue() {
return useMainStore().order.currentDeductible;
return this.isRepair ? useMainStore().order.currentRepairDeductible : useMainStore().order.currentReplaceDeductible;
},
isNoCompQuoteVisible() {
return this.mainStore.isVerified && this.mainStore.isNoComp;

View file

@ -222,6 +222,12 @@ export const getDefaultState = () => ({
customerPortalLoginToken: null,
originalDeductible: null,
currentDeductible: null,
originalReplaceDeductible: null,
currentReplaceDeductible: null,
originalRepairDeductible: null,
currentRepairDeductible: null,
totalTaxAmount: null,
waiverReasons: null,
carrierPhoneNumber: null,
loadedFromCookie: false,
loadedFromDupeCheck: null,
@ -653,7 +659,7 @@ export const useMainStore = defineStore({
safelitePolicy: {
policies: []
},
actualDeductible: this.order.currentDeductible?.toString() ?? ''
actualDeductible: this.isRepair ? this.order.currentRepairDeductible?.toString() ?? '' : this.order.currentReplaceDeductible?.toString() ?? ''
},
lossInfo: {
dateOfLoss: this.order.policy.dateOfLoss,
@ -716,8 +722,8 @@ export const useMainStore = defineStore({
manualGlassNames: manualGlassNamesArray,
policyState: this.order.customer.address.state,
status: this.order.policy.status,
originalDeductible: this.order.originalDeductible,
currentDeductible: this.order.currentDeductible,
originalDeductible: this.isRepair ? this.order.originalRepairDeductible : this.order.originalReplaceDeductible,
currentDeductible: this.isRepair ? this.order.currentRepairDeductible : this.order.currentReplaceDeductible,
noCoverage: false,
isRepair: this.order.damage.isRepair,
policyNumber: this.order.policy.policyNumber,
@ -731,7 +737,8 @@ export const useMainStore = defineStore({
}
}).then((r) => {
this.order.policy.policyData = r.data.policyData;
this.updateDeductible(r.data.deductible);
this.updateDeductible(r.data);
// this.updateDeductible(r.data);
return resolve(r);
}).catch((error) => reject(error));
});
@ -2031,8 +2038,12 @@ export const useMainStore = defineStore({
this.order.policy.endorsements = coverage?.endorsements;
// TODO logic should be more complicated later on
this.order.originalDeductible = coverage.deductible;
this.order.currentDeductible = coverage.deductible;
this.order.originalReplaceDeductible = coverage.deductible;
this.order.currentReplaceDeductible = coverage.deductible;
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;
},
resetOrder() {
@ -2316,8 +2327,12 @@ export const useMainStore = defineStore({
updateIsSafeliteProvider(isSafelite) {
this.order.serviceLocation.IsSafeliteProvider = isSafelite;
},
updateDeductible(finalDeductible) {
this.order.currentDeductible = finalDeductible;
updateDeductible(deductibleInfo) {
if (!this.order.damage.isRepair) {
this.order.currentReplaceDeductible = deductibleInfo.deductible;
} else {
this.order.currentRepairDeductible = deductibleInfo.deductible;
}
},
savePartQuestionAnswers(partQuestionAnswersArray) {
// if part question answers have changed, reset subsequent question answers