refactor WIP

This commit is contained in:
Katie Kroell 2023-12-01 15:44:02 -05:00
parent d992e1fc84
commit 6fbb437838
2 changed files with 12 additions and 5 deletions

View file

@ -170,9 +170,11 @@ export default {
];
let pricingResults = [];
if (useMainStore().order.policy.policyLookupSuccessful && useMainStore().order.vehicle.policyVehicleId) {
let deductibleResults = 0;
if (useMainStore().order.policy.policyLookupSuccessful) {
// && useMainStore().order.vehicle.policyVehicleId
deductibleResults = await useMainStore().getFinalDeductible();
pricingResults = await useMainStore().getPriceOrderItems(availableLineItems);
await useMainStore().getFinalDeductible();
}
// Call the "next" function to complete the transition to this page.
@ -181,6 +183,8 @@ export default {
vm.setSupportingItems(resultMap.supportingItems);
// eslint-disable-next-line no-param-reassign
vm.availableLineItems = pricingResults;
// eslint-disable-next-line no-param-reassign
vm.finalDeductible = deductibleResults;
vm.$refs.loadingModal.showModal();
vm.initializeComponent(availableLineItems);
});
@ -203,7 +207,8 @@ export default {
rules: {
selectionRequired: globalRules.OPTION_REQUIRED
},
supportingItems: null
supportingItems: null,
finalDeductible: null
};
},
computed: {

View file

@ -1396,8 +1396,10 @@ export const useMainStore = defineStore({
this.order.policy.endorsements = vehicle?.endorsements;
// TODO logic should be more complicated later on
this.order.originalDeductible = parseFloat(vehicle.deductible);
this.order.currentDeductible = parseFloat(vehicle.deductible);
// this.order.originalDeductible = this.order.damage.isRepair ? parseFloat(this.order.policy.deductible.repair) : parseFloat(this.order.policy.deductible.replace);
// this.order.currentDeductible = this.order.originalDeductible;
this.order.originalDeductible = vehicle.deductible;
this.order.currentDeductible = vehicle.deductible;
this.resetSupportingItemsState();
this.resetVapsState();