diff --git a/src/layouts/vehicle-parts/vehicle-parts.vue b/src/layouts/vehicle-parts/vehicle-parts.vue index 83d4077f..7bd3241c 100644 --- a/src/layouts/vehicle-parts/vehicle-parts.vue +++ b/src/layouts/vehicle-parts/vehicle-parts.vue @@ -191,8 +191,6 @@ methods: { throw new Error("Could not match any parts to the selected parts"); } - await this.mainStore.resetMoldingAndCapabilityQuestionAnswersIfNeeded(matchedParts); - this.navigateForward(matchedParts, null); }, diff --git a/src/store/index.js b/src/store/index.js index 1ef28968..fbd2c784 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -734,28 +734,6 @@ export const useMainStore = defineStore({ this.order.damage.glassToReplace = null; }, - resetMoldingAndCapabilityQuestionAnswersIfNeeded(matchedParts) { - const partsOrQuestionsDataToCompareWith = - this.pageData(issPageValues.MOLDING_QUESTIONS)?.partsOrQuestions ?? - this.pageData(issPageValues.CAPABILITY_QUESTIONS)?.partsOrQuestions ?? - []; - - const previouslySelectedPartNumbers = getAllPartNumbers(partsOrQuestionsDataToCompareWith); - const currentlySelectedPartNumbers = getAllPartNumbers(matchedParts); - - const haveSelectedVehiclePartsChanged = - previouslySelectedPartNumbers !== currentlySelectedPartNumbers; - - if (haveSelectedVehiclePartsChanged) { - //was updateGlassParts, added dependencies for SSR-290 - this.resetPartsAndDependencies(); - this.updateMoldingQuestionAnswers(null); - this.updateCapabilityQuestionAnswers(null); - this.updatePageData({ page: issPageValues.MOLDING_QUESTIONS, data: null }); - this.updatePageData({ page: issPageValues.CAPABILITY_QUESTIONS, data: null }); - } - }, - resetISSConfigState() { this.issConfig.clientName = 'Generic Insurance'; this.issConfig.clientDisplayName = 'Generic Insurance'; @@ -1358,30 +1336,23 @@ function convertGlassPieceNamingFromApi(glassArray) { return glassArray; } -function getAllPartNumbers(partsOrQuestions) { - return partsOrQuestions[0]?.parts - ? [...partsOrQuestions] - .map((glass) => glass.parts) - .flat() - .map((part) => part.partNumber) - .filter((partNumber) => !partNumber.toUpperCase().includes('FEE')) - .sort() - .join(',') - : []; -} - function addPricesToLineItems(lineItems, pricingLineItems) { lineItems.forEach((lineItem) => { - const lineItemIndex = pricingLineItems.findIndex( - (pricingLineItem) => pricingLineItem.partNumber === lineItem.partNumber - ); if (lineItem.childParts) { addPricesToLineItems(lineItem.childParts, pricingLineItems); } - const pricedLineItem = pricingLineItems.splice(lineItemIndex, 1)[0]; - lineItem.laborAmount = pricedLineItem.laborAmount; - lineItem.sellingPrice = pricedLineItem.sellingPrice; - lineItem.kitPrice = pricedLineItem.kitPrice; + + const lineItemIndex = pricingLineItems.findIndex( + (pricingLineItem) => pricingLineItem.partNumber === lineItem.partNumber + ); + + if(lineItemIndex > -1) + { + const pricedLineItem = pricingLineItems[lineItemIndex]; + lineItem.laborAmount = pricedLineItem.laborAmount; + lineItem.sellingPrice = pricedLineItem.sellingPrice; + lineItem.kitPrice = pricedLineItem.kitPrice; + } }); return lineItems; }