CASH-484: add logic to make sure insurance orders won't keep the upcharge part item
This commit is contained in:
parent
962c9ffed3
commit
9083ffbaed
1 changed files with 20 additions and 20 deletions
|
|
@ -269,14 +269,16 @@ export default {
|
||||||
const priceString = getAmountDue(lineItemsToBePriced, false); // pass the IncludeTax param as false
|
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 priceStringIntegerRoundedDown = priceString?.split(".")[0]; // same method used as getDisplayPrice() in service-package-radio used on /quote
|
||||||
const pricingByDayBasePrice = parseInt(priceStringIntegerRoundedDown);
|
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)
|
// Check to see if includePricingByDayUpcharge should already be set (based on order lineItems)
|
||||||
let includePricingByDayUpcharge = false;
|
let includePricingByDayUpcharge = false;
|
||||||
if (supportingItemsFromStore) {
|
if (supportingItemsFromStore) {
|
||||||
const pricingByDayUpchargeFeeIndex = supportingItemsFromStore?.findIndex(
|
const pricingByDayUpchargeFeeIndex = supportingItemsFromStore?.findIndex(
|
||||||
(item) => item.partType == PRICING_BY_DAY_PART_TYPE
|
(item) => item.partType == PRICING_BY_DAY_PART_TYPE
|
||||||
);
|
);
|
||||||
if (pricingByDayUpchargeFeeIndex > -1) {
|
if (pricingByDayUpchargeFeeIndex > -1 && !isInsurance) {
|
||||||
includePricingByDayUpcharge = true;
|
includePricingByDayUpcharge = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -630,26 +632,24 @@ export default {
|
||||||
const supportingItems = this.getSupportingItems();
|
const supportingItems = this.getSupportingItems();
|
||||||
|
|
||||||
// if we have a pricing by day upcharge, then save/update supporting items with it
|
// if we have a pricing by day upcharge, then save/update supporting items with it
|
||||||
if (this.showPricingByDay) {
|
const pricingByDayUpchargeFeeIndex = supportingItems?.findIndex(
|
||||||
const pricingByDayUpchargeFeeIndex = supportingItems?.findIndex(
|
(item) => item.partType == PRICING_BY_DAY_PART_TYPE
|
||||||
(item) => item.partType == PRICING_BY_DAY_PART_TYPE
|
);
|
||||||
);
|
|
||||||
|
|
||||||
if (this.includePricingByDayUpcharge) {
|
if (this.includePricingByDayUpcharge && this.showPricingByDay) {
|
||||||
if (pricingByDayUpchargeFeeIndex > -1) {
|
if (pricingByDayUpchargeFeeIndex && pricingByDayUpchargeFeeIndex > -1) {
|
||||||
supportingItems[pricingByDayUpchargeFeeIndex].laborAmount =
|
supportingItems[pricingByDayUpchargeFeeIndex].laborAmount =
|
||||||
this.pricingByDayUpchargeLineItem.laborAmount;
|
this.pricingByDayUpchargeLineItem.laborAmount;
|
||||||
supportingItems[pricingByDayUpchargeFeeIndex].sellingPrice =
|
supportingItems[pricingByDayUpchargeFeeIndex].sellingPrice =
|
||||||
this.pricingByDayUpchargeLineItem.sellingPrice;
|
this.pricingByDayUpchargeLineItem.sellingPrice;
|
||||||
supportingItems[pricingByDayUpchargeFeeIndex].kitPrice =
|
supportingItems[pricingByDayUpchargeFeeIndex].kitPrice =
|
||||||
this.pricingByDayUpchargeLineItem.kitPrice;
|
this.pricingByDayUpchargeLineItem.kitPrice;
|
||||||
} else {
|
|
||||||
supportingItems.push(this.pricingByDayUpchargeLineItem);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (pricingByDayUpchargeFeeIndex >= 0) {
|
supportingItems.push(this.pricingByDayUpchargeLineItem);
|
||||||
supportingItems.splice(pricingByDayUpchargeFeeIndex, 1);
|
}
|
||||||
}
|
} else {
|
||||||
|
if (pricingByDayUpchargeFeeIndex >= 0) { // remove pricing by day upcharge if it already was in store
|
||||||
|
supportingItems.splice(pricingByDayUpchargeFeeIndex, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue