CASH-152: get lowest selected package price on Schedule

This commit is contained in:
Adam Caouette 2025-03-12 11:27:09 -04:00
parent 51f0225e19
commit 2bd4d42f57

View file

@ -110,6 +110,10 @@ import { required } from "@/helpers/validation-rules";
import store from "@/store";
import experimentMixin from "@/mixins/experiment-mixin.js";
import { experimentSettings } from "@/constants/experiments";
import { getDisplayAmountDue } from "@/helpers/pricing-helper.js";
import { getItemsWithoutRecalParts } from "@/helpers/recal-helper";
import { partNumberStrings } from "@/constants/part-number-strings";
import { deepClone } from "@/helpers/object-helper";
// DEFINE VALIDATION RULES
defineRule("date-required", required(errorMessages.DATE_REQUIRED));
@ -333,7 +337,36 @@ export default {
);
},
showPricingByDay() {
return !this.$store.getters.payment.isInsurance;
return !this.$store.getters.payment.isInsurance && this.isPricingByDayExperiment;
},
lineItemsToBePriced() {
const lineItems = deepClone(store.getters.order.lineItems);
const glassParts = (this.isRecalibrationOnOrder && this.shouldHideRecalibration) ?
getItemsWithoutRecalParts(lineItems.glassParts) :
lineItems.glassParts ?? [];
const supportingItemsWithoutFees = baseMixin.methods.filterOutCertainPartTypesOrNumbers(lineItems.supportingItems, {partNumbersToRemove: [partNumberStrings.RECYCLE_FEE]});
return {
glassParts: glassParts,
supportingItems: supportingItemsWithoutFees,
vaps: lineItems.vaps ?? [],
promos: lineItems.promos ?? [],
};
},
lowestPrice() {
return getDisplayAmountDue(this.lineItemsToBePriced, false); // passing false here so IncludeTax is false
},
isRecalibrationOnOrder() {
return store.getters.isRecalibrationOnOrder;
},
shouldHideRecalibration() {
return (
experimentMixin.methods
.getSettingValue(experimentSettings.RECAL_PRICE_REMOVE)
?.toLowerCase() === "true" && this.isRecalibrationOnOrder
);
},
},
methods: {