clean up round 1
This commit is contained in:
parent
7ff4edd743
commit
328aec39bd
3 changed files with 4 additions and 15 deletions
|
|
@ -234,8 +234,6 @@ export default {
|
|||
return getRecycleFeeLineItem(this.cartOrder);
|
||||
},
|
||||
servicePrice() {
|
||||
const x = getServiceLineItems(this.cartOrder);
|
||||
console.log(`service line items: ${JSON.stringify(x)}`);
|
||||
return getPriceOfLineItems(getServiceLineItems(this.cartOrder)) ?? 0;
|
||||
},
|
||||
isUnverified() {
|
||||
|
|
|
|||
|
|
@ -382,7 +382,6 @@ export default {
|
|||
...(this.mainStore.lineItems.supportingItems ?? []),
|
||||
...(clonedGlassParts ?? [])
|
||||
];
|
||||
console.log(`available line items: ${JSON.stringify(availableLineItems)}`);
|
||||
|
||||
// We only call the ITAC pricing endpoint if we are not repair or we are NoComp
|
||||
if (!this.isRepair || this.mainStore.isNoComp) {
|
||||
|
|
|
|||
|
|
@ -1136,8 +1136,6 @@ export const useMainStore = defineStore({
|
|||
|
||||
const { lineItems, serverData, isItac, primaryBillToNumber } = response.data;
|
||||
|
||||
console.log(`response data: ${JSON.stringify(response.data)}`);
|
||||
|
||||
if (serverData) {
|
||||
this.order.lineItems.serverData = serverData;
|
||||
}
|
||||
|
|
@ -1157,9 +1155,7 @@ export const useMainStore = defineStore({
|
|||
}
|
||||
|
||||
if (lineItems) {
|
||||
console.log(`returned line items: ${JSON.stringify(lineItems)}`);
|
||||
const retAvailableLineItems = addPricesToLineItems(availableLineItems, lineItems, false);
|
||||
console.log(`line items with prices: ${JSON.stringify(retAvailableLineItems)}`);
|
||||
return retAvailableLineItems;
|
||||
}
|
||||
|
||||
|
|
@ -2785,28 +2781,24 @@ function convertGlassPieceNamingFromApi(glassArray) {
|
|||
return glassArray;
|
||||
}
|
||||
|
||||
// TODO does this work
|
||||
// Note this is used for both the insurance and the itac endpoints, so it needs to deal with safelite or nags part numbers
|
||||
function addPricesToLineItems(lineItems, pricingLineItems, pricedPartNumberIsNags = true) {
|
||||
const partOffset = {};
|
||||
const partNumberProperty = pricedPartNumberIsNags ? 'partNumber' : 'safelitePartNumber';
|
||||
const partNumberPropertyToCompare = pricedPartNumberIsNags ? 'partNumber' : 'safelitePartNumber';
|
||||
|
||||
console.log(partNumberProperty);
|
||||
console.log(lineItems[0].partNumber);
|
||||
console.log(lineItems[0].safelitePartNumber);
|
||||
console.log(lineItems[0][partNumberProperty]);
|
||||
lineItems.forEach((lineItem) => {
|
||||
if (lineItem.childParts) {
|
||||
addPricesToLineItems(lineItem.childParts, pricingLineItems);
|
||||
}
|
||||
const partNumberToCompare = lineItem[partNumberPropertyToCompare];
|
||||
|
||||
const pricedIndex = findLineItemIndex(pricingLineItems, lineItem[partNumberProperty], partOffset[lineItem.partNumber] ?? 0);
|
||||
const pricedIndex = findLineItemIndex(pricingLineItems, partNumberToCompare, partOffset[partNumberToCompare] ?? 0);
|
||||
if (pricedIndex !== -1) {
|
||||
const pricedLineItem = pricingLineItems[pricedIndex];
|
||||
lineItem.laborAmount = pricedLineItem.laborAmount;
|
||||
lineItem.sellingPrice = pricedLineItem.sellingPrice;
|
||||
lineItem.kitPrice = pricedLineItem.kitPrice;
|
||||
partOffset[lineItem.partNumber] = pricedIndex + 1;
|
||||
partOffset[partNumberToCompare] = pricedIndex + 1;
|
||||
}
|
||||
});
|
||||
return lineItems;
|
||||
|
|
|
|||
Loading…
Reference in a new issue