diff --git a/src/layouts/schedule/schedule.vue b/src/layouts/schedule/schedule.vue index b30fd88d8..c3081d0fe 100644 --- a/src/layouts/schedule/schedule.vue +++ b/src/layouts/schedule/schedule.vue @@ -100,6 +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 { errorMessages } from "@/constants/error-messages"; import { required } from "@/helpers/validation-rules"; import store from "@/store"; @@ -269,24 +270,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