From 2bd4d42f572cdb0affa1351f525060f4f7d066e7 Mon Sep 17 00:00:00 2001 From: Adam Caouette Date: Wed, 12 Mar 2025 11:27:09 -0400 Subject: [PATCH] CASH-152: get lowest selected package price on Schedule --- src/layouts/schedule/schedule.vue | 35 ++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/src/layouts/schedule/schedule.vue b/src/layouts/schedule/schedule.vue index c766d95ad..37aeb98dd 100644 --- a/src/layouts/schedule/schedule.vue +++ b/src/layouts/schedule/schedule.vue @@ -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: {