From 91577a4d400297ec34f453ad87fc9e5e05822f74 Mon Sep 17 00:00:00 2001 From: Adam Caouette Date: Wed, 16 Apr 2025 10:22:02 -0400 Subject: [PATCH 1/2] CASH-501: bugfix re setting PBD on preselected date on Schedule --- src/layouts/schedule/schedule.vue | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/src/layouts/schedule/schedule.vue b/src/layouts/schedule/schedule.vue index 2fd06d312..ba4430e03 100644 --- a/src/layouts/schedule/schedule.vue +++ b/src/layouts/schedule/schedule.vue @@ -100,6 +100,9 @@ import { PREMIUM_FEE_PART_TYPE, PRICING_BY_DAY_PART_TYPE, } from "@/constants/schedule-constants"; +import { + DAYS_OF_WEEK, +} from "@/digital-components/date-picker/mixins/constants"; import { errorMessages } from "@/constants/error-messages"; import { required } from "@/helpers/validation-rules"; import store from "@/store"; @@ -269,24 +272,22 @@ export default { const priceString = getAmountDue(lineItemsToBePriced, false); // pass the IncludeTax param as false const priceStringIntegerRoundedDown = priceString?.split(".")[0]; // same method used as getDisplayPrice() in service-package-radio used on /quote const pricingByDayBasePrice = parseInt(priceStringIntegerRoundedDown); - const payment = store.getters.order.payment; - const isInsurance = payment?.isInsurance; - - // Check to see if includePricingByDayUpcharge should already be set (based on order lineItems) let includePricingByDayUpcharge = false; - if (supportingItemsFromStore) { - const pricingByDayUpchargeFeeIndex = supportingItemsFromStore?.findIndex( - (item) => item.partType == PRICING_BY_DAY_PART_TYPE - ); - if (pricingByDayUpchargeFeeIndex > -1 && !isInsurance) { - includePricingByDayUpcharge = true; - } - } - // Load page with date already selected? + // Check to see if date should be pre-selected let preSelectedDate = await store.getters.order.schedule.date; if (!preSelectedDate || preSelectedDate.startTime === null) { preSelectedDate = null; + } else { + // Check to see if pre-selected date should have pricing by day upcharge + if (showPricingByDay) { + // is this preSelectedDate a premium day? + const dayIndex = convertDateStringToDate(preSelectedDate).getDay(); + const dayObject = DAYS_OF_WEEK[dayIndex]; + if (dayObject.isPricingByDayUpchargeDay) { + includePricingByDayUpcharge = true; + } + } } // Set up promises @@ -767,4 +768,4 @@ export default { margin-bottom: 0.25rem; } } - + \ No newline at end of file From 0c4a6606fd0ead82d4f07c47126bc4c72a9b1b7c Mon Sep 17 00:00:00 2001 From: Adam Caouette Date: Wed, 16 Apr 2025 10:24:02 -0400 Subject: [PATCH 2/2] CASH-501: prettier changes --- src/layouts/schedule/schedule.vue | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/layouts/schedule/schedule.vue b/src/layouts/schedule/schedule.vue index ba4430e03..cd3e09806 100644 --- a/src/layouts/schedule/schedule.vue +++ b/src/layouts/schedule/schedule.vue @@ -100,9 +100,7 @@ import { PREMIUM_FEE_PART_TYPE, PRICING_BY_DAY_PART_TYPE, } from "@/constants/schedule-constants"; -import { - DAYS_OF_WEEK, -} from "@/digital-components/date-picker/mixins/constants"; +import { DAYS_OF_WEEK } from "@/digital-components/date-picker/mixins/constants"; import { errorMessages } from "@/constants/error-messages"; import { required } from "@/helpers/validation-rules"; import store from "@/store"; @@ -768,4 +766,4 @@ export default { margin-bottom: 0.25rem; } } - \ No newline at end of file +