diff --git a/src/layouts/schedule/schedule.vue b/src/layouts/schedule/schedule.vue index da3b3a69b..63e4a3775 100644 --- a/src/layouts/schedule/schedule.vue +++ b/src/layouts/schedule/schedule.vue @@ -306,7 +306,9 @@ export default { }); // Get pricingByDayUpcharge needed for Pricing By Day - const pricingByDayUpchargePartPromise = getPricingByDayPartWithPrice(); + const pricingByDayUpchargePartPromise = showPricingByDay + ? getPricingByDayPartWithPrice() + : null; const premiumFeePromise = baseMixin.methods.dispatchStoreActionWithLogging( storeActions.GET_MOBILE_PREMIUM_FEE, @@ -354,10 +356,12 @@ export default { const resultMap = await settleAllPromises(promiseResultMap); - const pricingByDayUpcharge = await baseMixin.methods.getTotalLineItemPrice( - resultMap.pricingByDayUpchargePart, - false - ); + const pricingByDayUpcharge = showPricingByDay + ? await baseMixin.methods.getTotalLineItemPrice( + resultMap.pricingByDayUpchargePart, + false + ) + : null; const datePickerInitialData = resultMap.datePickerInitialData; datePickerInitialData.pricingByDayBasePrice = pricingByDayBasePrice; @@ -626,24 +630,26 @@ export default { const supportingItems = this.getSupportingItems(); // if we have a pricing by day upcharge, then save/update supporting items with it - const pricingByDayUpchargeFeeIndex = supportingItems?.findIndex( - (item) => item.partType == PRICING_BY_DAY_PART_TYPE - ); + if (this.showPricingByDay) { + const pricingByDayUpchargeFeeIndex = supportingItems?.findIndex( + (item) => item.partType == PRICING_BY_DAY_PART_TYPE + ); - if (this.includePricingByDayUpcharge) { - if (pricingByDayUpchargeFeeIndex > -1) { - supportingItems[pricingByDayUpchargeFeeIndex].laborAmount = - this.pricingByDayUpchargeLineItem.laborAmount; - supportingItems[pricingByDayUpchargeFeeIndex].sellingPrice = - this.pricingByDayUpchargeLineItem.sellingPrice; - supportingItems[pricingByDayUpchargeFeeIndex].kitPrice = - this.pricingByDayUpchargeLineItem.kitPrice; + if (this.includePricingByDayUpcharge) { + if (pricingByDayUpchargeFeeIndex > -1) { + supportingItems[pricingByDayUpchargeFeeIndex].laborAmount = + this.pricingByDayUpchargeLineItem.laborAmount; + supportingItems[pricingByDayUpchargeFeeIndex].sellingPrice = + this.pricingByDayUpchargeLineItem.sellingPrice; + supportingItems[pricingByDayUpchargeFeeIndex].kitPrice = + this.pricingByDayUpchargeLineItem.kitPrice; + } else { + supportingItems.push(this.pricingByDayUpchargeLineItem); + } } else { - supportingItems.push(this.pricingByDayUpchargeLineItem); - } - } else { - if (pricingByDayUpchargeFeeIndex >= 0) { - supportingItems.splice(pricingByDayUpchargeFeeIndex, 1); + if (pricingByDayUpchargeFeeIndex >= 0) { + supportingItems.splice(pricingByDayUpchargeFeeIndex, 1); + } } }