CSR-2150 | Make recal promos work
This commit is contained in:
parent
81b846d044
commit
13598aea94
1 changed files with 11 additions and 2 deletions
|
|
@ -2950,7 +2950,9 @@ export const actions = {
|
||||||
|
|
||||||
async getRecalPartsAndSaveToLineItems(context, { pageNameToLog }) {
|
async getRecalPartsAndSaveToLineItems(context, { pageNameToLog }) {
|
||||||
// identify each part that needs recal
|
// identify each part that needs recal
|
||||||
const glassParts = context.state.order?.lineItems?.glassParts ?? [];
|
const glassParts = context.state.order?.lineItems?.glassParts
|
||||||
|
? deepClone(context.state.order.lineItems.glassParts)
|
||||||
|
: [];
|
||||||
|
|
||||||
for (let i = 0; i < glassParts.length; i++) {
|
for (let i = 0; i < glassParts.length; i++) {
|
||||||
// does this part need recal?
|
// does this part need recal?
|
||||||
|
|
@ -2983,6 +2985,7 @@ export const actions = {
|
||||||
}
|
}
|
||||||
|
|
||||||
glassParts[i].childParts.push(...recalPartResponse.data.recalibrationParts);
|
glassParts[i].childParts.push(...recalPartResponse.data.recalibrationParts);
|
||||||
|
context.dispatch(storeActions.SAVE_GLASS_PARTS, glassParts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3181,7 +3184,10 @@ export function getArrayOfAllLineItems(lineItems) {
|
||||||
let consolidatedLineItemsArray = [];
|
let consolidatedLineItemsArray = [];
|
||||||
|
|
||||||
if (lineItems.glassParts != null)
|
if (lineItems.glassParts != null)
|
||||||
consolidatedLineItemsArray = [...consolidatedLineItemsArray, ...lineItems.glassParts];
|
consolidatedLineItemsArray = [
|
||||||
|
...consolidatedLineItemsArray,
|
||||||
|
...getFlattenedArrayOfLineItemsWithChildParts(lineItems.glassParts),
|
||||||
|
];
|
||||||
|
|
||||||
if (lineItems.supportingItems != null)
|
if (lineItems.supportingItems != null)
|
||||||
consolidatedLineItemsArray = [...consolidatedLineItemsArray, ...lineItems.supportingItems];
|
consolidatedLineItemsArray = [...consolidatedLineItemsArray, ...lineItems.supportingItems];
|
||||||
|
|
@ -3269,6 +3275,9 @@ function addGuidToLineItemsIfNotAlreadyThere(lineItems) {
|
||||||
if (!lineItem.id) {
|
if (!lineItem.id) {
|
||||||
lineItem.id = crypto.randomUUID();
|
lineItem.id = crypto.randomUUID();
|
||||||
}
|
}
|
||||||
|
if (lineItem.childParts) {
|
||||||
|
addGuidToLineItemsIfNotAlreadyThere(lineItem.childParts);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue