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 = []; 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); pricingResults = await useMainStore().getPriceOrderItems(availableLineItems);
await useMainStore().getFinalDeductible();
} }
// Call the "next" function to complete the transition to this page. // Call the "next" function to complete the transition to this page.
@ -181,6 +183,8 @@ export default {
vm.setSupportingItems(resultMap.supportingItems); vm.setSupportingItems(resultMap.supportingItems);
// eslint-disable-next-line no-param-reassign // eslint-disable-next-line no-param-reassign
vm.availableLineItems = pricingResults; vm.availableLineItems = pricingResults;
// eslint-disable-next-line no-param-reassign
vm.finalDeductible = deductibleResults;
vm.$refs.loadingModal.showModal(); vm.$refs.loadingModal.showModal();
vm.initializeComponent(availableLineItems); vm.initializeComponent(availableLineItems);
}); });
@ -203,7 +207,8 @@ export default {
rules: { rules: {
selectionRequired: globalRules.OPTION_REQUIRED selectionRequired: globalRules.OPTION_REQUIRED
}, },
supportingItems: null supportingItems: null,
finalDeductible: null
}; };
}, },
computed: { computed: {

View file

@ -1396,8 +1396,10 @@ export const useMainStore = defineStore({
this.order.policy.endorsements = vehicle?.endorsements; this.order.policy.endorsements = vehicle?.endorsements;
// TODO logic should be more complicated later on // TODO logic should be more complicated later on
this.order.originalDeductible = 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 = parseFloat(vehicle.deductible); // this.order.currentDeductible = this.order.originalDeductible;
this.order.originalDeductible = vehicle.deductible;
this.order.currentDeductible = vehicle.deductible;
this.resetSupportingItemsState(); this.resetSupportingItemsState();
this.resetVapsState(); this.resetVapsState();