CASH-132: move donationAmount into data and calc it before page load

This commit is contained in:
Adam Caouette 2025-02-18 14:12:00 -05:00
parent 59c4046281
commit cb22453eb0

View file

@ -218,6 +218,11 @@ export default {
return hasRecalPriceRemoveExperiment && isRecalibrationOnOrder;
};
const donationItems = lineItemsFromSubmittedOrder.supportingItems?.filter(
(item) => item.partNumber === "DONATION"
);
const donationAmount = (donationItems?.length > 0) ? donationItems[0].sellingPrice : 0;
// Call the "next" function to complete the transition to this page.
next((vm) => {
vm.setCmsContent(resultMap.cmsContent);
@ -225,6 +230,7 @@ export default {
vm.vaps = availableVaps;
vm.submittedOrder = submittedOrder;
vm.shouldHideRecalibration = shouldHideRecalibration();
vm.donationAmount = donationAmount;
});
},
data() {
@ -233,6 +239,7 @@ export default {
vaps: [],
submittedOrder: null,
shouldHideRecalibration: null,
donationAmount: null,
};
},
computed: {
@ -464,15 +471,6 @@ export default {
donationValues() {
return [1, 3, 5];
},
donationAmount() {
const donationItems = this.submittedOrder?.lineItems?.supportingItems?.filter(
(item) => item.partNumber === "DONATION"
);
if (donationItems?.length > 0) {
return donationItems[0].sellingPrice;
}
return 0;
},
},
methods: {
arePagePrerequisitesValid() {