Fixing available vaps reactivity

This commit is contained in:
Michaela Brydon 2024-06-20 13:45:18 -04:00
parent cbbee5a21e
commit 3580155e42

View file

@ -196,7 +196,6 @@ export default {
data() { data() {
return { return {
isExpanded: this.isInitiallyExpanded, isExpanded: this.isInitiallyExpanded,
availableVaps: this.submittedOrder ? this.submittedOrder.lineItems.vaps : useMainStore().order.availableVaps,
widget: { widget: {
amountDue: 'AmountDueTextWidget', amountDue: 'AmountDueTextWidget',
amountPaid: 'AmountPaidTextWidget', amountPaid: 'AmountPaidTextWidget',
@ -209,11 +208,16 @@ export default {
servicePackage: 'ServicePackageTitle', servicePackage: 'ServicePackageTitle',
vapsItemDescriptions: 'VapsItemDescriptions' vapsItemDescriptions: 'VapsItemDescriptions'
}, },
cartItemType, cartItemType
cartOrder: this.submittedOrder ?? useMainStore().order
}; };
}, },
computed: { computed: {
cartOrder() {
return this.submittedOrder ?? useMainStore().order;
},
availableVaps() {
return this.cartOrder.availableVaps;
},
deductible() { deductible() {
return getDeductible(this.cartOrder); return getDeductible(this.cartOrder);
}, },
@ -255,13 +259,12 @@ export default {
return !this.showAsPaid ? 0 : this.total; return !this.showAsPaid ? 0 : this.total;
}, },
availableLineItems() { availableLineItems() {
const vapsToUse = this.availableVaps ?? this.lineItems.vaps;
const { supportingItems, glassParts, otherParts, feeItems } = this.lineItems; const { supportingItems, glassParts, otherParts, feeItems } = this.lineItems;
const result = [ const result = [
...(supportingItems ?? []), ...(supportingItems ?? []),
...(glassParts ?? []), ...(glassParts ?? []),
...(otherParts ?? []), ...(otherParts ?? []),
...(vapsToUse ?? []), ...(this.availableVaps ?? []),
...(feeItems ?? []) ...(feeItems ?? [])
]; ];
return result; return result;