From 9083ffbaed34b1e527f19b8d6c358ef5992a922e Mon Sep 17 00:00:00 2001 From: Adam Caouette Date: Mon, 7 Apr 2025 15:59:57 -0400 Subject: [PATCH 1/2] CASH-484: add logic to make sure insurance orders won't keep the upcharge part item --- src/layouts/schedule/schedule.vue | 40 +++++++++++++++---------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/layouts/schedule/schedule.vue b/src/layouts/schedule/schedule.vue index 63e4a3775..d00f2dff2 100644 --- a/src/layouts/schedule/schedule.vue +++ b/src/layouts/schedule/schedule.vue @@ -269,14 +269,16 @@ 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) { + ); + if (pricingByDayUpchargeFeeIndex > -1 && !isInsurance) { includePricingByDayUpcharge = true; } } @@ -630,26 +632,24 @@ export default { const supportingItems = this.getSupportingItems(); // if we have a pricing by day upcharge, then save/update supporting items with it - if (this.showPricingByDay) { - const pricingByDayUpchargeFeeIndex = supportingItems?.findIndex( - (item) => item.partType == PRICING_BY_DAY_PART_TYPE - ); + 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; - } else { - supportingItems.push(this.pricingByDayUpchargeLineItem); - } + if (this.includePricingByDayUpcharge && this.showPricingByDay) { + if (pricingByDayUpchargeFeeIndex && pricingByDayUpchargeFeeIndex > -1) { + supportingItems[pricingByDayUpchargeFeeIndex].laborAmount = + this.pricingByDayUpchargeLineItem.laborAmount; + supportingItems[pricingByDayUpchargeFeeIndex].sellingPrice = + this.pricingByDayUpchargeLineItem.sellingPrice; + supportingItems[pricingByDayUpchargeFeeIndex].kitPrice = + this.pricingByDayUpchargeLineItem.kitPrice; } else { - if (pricingByDayUpchargeFeeIndex >= 0) { - supportingItems.splice(pricingByDayUpchargeFeeIndex, 1); - } + supportingItems.push(this.pricingByDayUpchargeLineItem); + } + } else { + if (pricingByDayUpchargeFeeIndex >= 0) { // remove pricing by day upcharge if it already was in store + supportingItems.splice(pricingByDayUpchargeFeeIndex, 1); } } From f71de530af85653f4daa4c2e5b96139c09393e89 Mon Sep 17 00:00:00 2001 From: Adam Caouette Date: Mon, 7 Apr 2025 16:17:11 -0400 Subject: [PATCH 2/2] CASH-484: prettier changes --- src/layouts/schedule/schedule.vue | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/layouts/schedule/schedule.vue b/src/layouts/schedule/schedule.vue index d00f2dff2..318ff0aa5 100644 --- a/src/layouts/schedule/schedule.vue +++ b/src/layouts/schedule/schedule.vue @@ -277,7 +277,7 @@ export default { if (supportingItemsFromStore) { const pricingByDayUpchargeFeeIndex = supportingItemsFromStore?.findIndex( (item) => item.partType == PRICING_BY_DAY_PART_TYPE - ); + ); if (pricingByDayUpchargeFeeIndex > -1 && !isInsurance) { includePricingByDayUpcharge = true; } @@ -636,7 +636,7 @@ export default { (item) => item.partType == PRICING_BY_DAY_PART_TYPE ); - if (this.includePricingByDayUpcharge && this.showPricingByDay) { + if (this.includePricingByDayUpcharge && this.showPricingByDay) { if (pricingByDayUpchargeFeeIndex && pricingByDayUpchargeFeeIndex > -1) { supportingItems[pricingByDayUpchargeFeeIndex].laborAmount = this.pricingByDayUpchargeLineItem.laborAmount; @@ -648,7 +648,8 @@ export default { supportingItems.push(this.pricingByDayUpchargeLineItem); } } else { - if (pricingByDayUpchargeFeeIndex >= 0) { // remove pricing by day upcharge if it already was in store + if (pricingByDayUpchargeFeeIndex >= 0) { + // remove pricing by day upcharge if it already was in store supportingItems.splice(pricingByDayUpchargeFeeIndex, 1); } }