CSR-2150 | Future proofing
This commit is contained in:
parent
13598aea94
commit
48c6a56e96
2 changed files with 18 additions and 9 deletions
|
|
@ -30,7 +30,7 @@
|
||||||
import { splitCopyOnCMSPlaceHolder } from "@/helpers/cms-content-helper";
|
import { splitCopyOnCMSPlaceHolder } from "@/helpers/cms-content-helper";
|
||||||
import baseMixin from "@/mixins/base-mixin.js";
|
import baseMixin from "@/mixins/base-mixin.js";
|
||||||
import { getPromosThatMatchLineItemsOnOrder } from "@/helpers/promotions-helper";
|
import { getPromosThatMatchLineItemsOnOrder } from "@/helpers/promotions-helper";
|
||||||
import { getArrayOfAllLineItems } from "@/store";
|
import { getArrayOfAllLineItemsAndChildParts } from "@/store";
|
||||||
|
|
||||||
const INLINE_IMAGE_TOKEN = "custom:inlineImage";
|
const INLINE_IMAGE_TOKEN = "custom:inlineImage";
|
||||||
const AFTERPAY_PRICE_TOKEN = "custom:afterpayPrice";
|
const AFTERPAY_PRICE_TOKEN = "custom:afterpayPrice";
|
||||||
|
|
@ -76,7 +76,7 @@ export default {
|
||||||
return this.getCmsContent(this.cmsWidgetName, "SubheaderText");
|
return this.getCmsContent(this.cmsWidgetName, "SubheaderText");
|
||||||
},
|
},
|
||||||
afterpayPrice() {
|
afterpayPrice() {
|
||||||
let allLineItems = getArrayOfAllLineItems(this.lineItems);
|
let allLineItems = getArrayOfAllLineItemsAndChildParts(this.lineItems);
|
||||||
if (this.lineItems.promos) {
|
if (this.lineItems.promos) {
|
||||||
allLineItems = allLineItems?.filter((item) => item.partType !== "PROMO_DISCOUNT");
|
allLineItems = allLineItems?.filter((item) => item.partType !== "PROMO_DISCOUNT");
|
||||||
}
|
}
|
||||||
|
|
@ -91,7 +91,7 @@ export default {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (this.lineItems.promos) {
|
if (this.lineItems.promos) {
|
||||||
let allLineItems = getArrayOfAllLineItems(this.lineItems);
|
let allLineItems = getArrayOfAllLineItemsAndChildParts(this.lineItems);
|
||||||
const promos = getPromosThatMatchLineItemsOnOrder(
|
const promos = getPromosThatMatchLineItemsOnOrder(
|
||||||
this.lineItems.promos,
|
this.lineItems.promos,
|
||||||
allLineItems
|
allLineItems
|
||||||
|
|
|
||||||
|
|
@ -2625,7 +2625,7 @@ export const actions = {
|
||||||
eon: order.eon,
|
eon: order.eon,
|
||||||
isRepair: order.damage.isRepair,
|
isRepair: order.damage.isRepair,
|
||||||
glassToReplace: renameGlassToReplaceAttributes(order.damage.glassToReplace),
|
glassToReplace: renameGlassToReplaceAttributes(order.damage.glassToReplace),
|
||||||
lineItemsOnOrder: getArrayOfAllLineItems(lineItemsToUse),
|
lineItemsOnOrder: getArrayOfAllLineItemsAndChildParts(lineItemsToUse),
|
||||||
parentAccountNumber: useDefaultCashParentAccount
|
parentAccountNumber: useDefaultCashParentAccount
|
||||||
? applicationConfig.CASH_PARENT_ACCOUNT_NUMBER
|
? applicationConfig.CASH_PARENT_ACCOUNT_NUMBER
|
||||||
: order.payment.parentAccountNumber,
|
: order.payment.parentAccountNumber,
|
||||||
|
|
@ -2697,7 +2697,7 @@ export const actions = {
|
||||||
eon: order.eon,
|
eon: order.eon,
|
||||||
isRepair: order.damage.isRepair,
|
isRepair: order.damage.isRepair,
|
||||||
glassToReplace: renameGlassToReplaceAttributes(order.damage.glassToReplace),
|
glassToReplace: renameGlassToReplaceAttributes(order.damage.glassToReplace),
|
||||||
lineItemsOnOrder: getArrayOfAllLineItems(lineItemsToUse),
|
lineItemsOnOrder: getArrayOfAllLineItemsAndChildParts(lineItemsToUse),
|
||||||
parentAccountNumber: useDefaultCashParentAccount
|
parentAccountNumber: useDefaultCashParentAccount
|
||||||
? applicationConfig.CASH_PARENT_ACCOUNT_NUMBER
|
? applicationConfig.CASH_PARENT_ACCOUNT_NUMBER
|
||||||
: order.payment.parentAccountNumber,
|
: order.payment.parentAccountNumber,
|
||||||
|
|
@ -3180,7 +3180,7 @@ export function mapTaxedLineItemsToStoreFormat(availableLineItems, storeLineItem
|
||||||
return lineItems;
|
return lineItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getArrayOfAllLineItems(lineItems) {
|
export function getArrayOfAllLineItemsAndChildParts(lineItems) {
|
||||||
let consolidatedLineItemsArray = [];
|
let consolidatedLineItemsArray = [];
|
||||||
|
|
||||||
if (lineItems.glassParts != null)
|
if (lineItems.glassParts != null)
|
||||||
|
|
@ -3190,13 +3190,22 @@ export function getArrayOfAllLineItems(lineItems) {
|
||||||
];
|
];
|
||||||
|
|
||||||
if (lineItems.supportingItems != null)
|
if (lineItems.supportingItems != null)
|
||||||
consolidatedLineItemsArray = [...consolidatedLineItemsArray, ...lineItems.supportingItems];
|
consolidatedLineItemsArray = [
|
||||||
|
...consolidatedLineItemsArray,
|
||||||
|
...getFlattenedArrayOfLineItemsWithChildParts(lineItems.supportingItems),
|
||||||
|
];
|
||||||
|
|
||||||
if (lineItems.vaps != null)
|
if (lineItems.vaps != null)
|
||||||
consolidatedLineItemsArray = [...consolidatedLineItemsArray, ...lineItems.vaps];
|
consolidatedLineItemsArray = [
|
||||||
|
...consolidatedLineItemsArray,
|
||||||
|
...getFlattenedArrayOfLineItemsWithChildParts(lineItems.vaps),
|
||||||
|
];
|
||||||
|
|
||||||
if (lineItems.promos != null)
|
if (lineItems.promos != null)
|
||||||
consolidatedLineItemsArray = [...consolidatedLineItemsArray, ...lineItems.promos];
|
consolidatedLineItemsArray = [
|
||||||
|
...consolidatedLineItemsArray,
|
||||||
|
...getFlattenedArrayOfLineItemsWithChildParts(lineItems.promos),
|
||||||
|
];
|
||||||
|
|
||||||
return consolidatedLineItemsArray;
|
return consolidatedLineItemsArray;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue