CSR-111 Fix vehicle-parts issue

This commit is contained in:
Katie 2022-08-31 09:38:13 -04:00
parent a418144980
commit 474df4dea4

View file

@ -225,7 +225,7 @@ export const mutations = {
},
// applicationUser MUTATIONS
updateSaveOrderPromise(state, saveOrderPromise){
updateSaveOrderPromise(state, saveOrderPromise) {
state.applicationUser.saveOrderPromise = saveOrderPromise;
},
updateSavedSessionId(state, savedSessionId) {
@ -392,7 +392,7 @@ export const getters = {
parentAccountNumber: state.order.accountNumber,
isCoverageVerified: state.order.payment.insuranceCoverage.isVerified,
orderPartNumbers: [...getAllValuesOfPropertyInArrayOfObjects(state.order.lineItems.glassParts, "partNumber"), ...getAllValuesOfPropertyInArrayOfObjects(state.order.lineItems.otherParts, "partNumber")],
orderPartTypes: [...getAllValuesOfPropertyInArrayOfObjects(state.order.lineItems.glassParts, "recalibrationType"), ...getAllValuesOfPropertyInArrayOfObjects(state.order.lineItems.otherParts, "recalibrationType")],
orderPartTypes: [...getAllValuesOfPropertyInArrayOfObjects(state.order.lineItems.glassParts, "recalibrationType"), ...getAllValuesOfPropertyInArrayOfObjects(state.order.lineItems.otherParts, "recalibrationType")],
hasRecalibrationPart: getAllValuesOfPropertyInArrayOfObjects(state.order.lineItems.glassParts, "requiresRecalibration")?.length > 0,
selectedMultiGlass: state.order.damage.glassToReplace?.length > 1,
selectedWindshieldGlass: getAllValuesOfPropertyInArrayOfObjects(state.order.damage.glassToReplace, "glassLocation").includes(damageLocationsSelected.WINDSHIELD),
@ -760,7 +760,7 @@ export const actions = {
const part = pageData.partsOrQuestions.find(x => x.glassLocation === glassLocation).parts[0];
const capabilityQuestionAnswers = context.getters.damage.capabilityQuestionAnswers;
const capabilityQuestionAnswersForPart = capabilityQuestionAnswers.find(x => x.glassLocation === glassLocation);
return globalMethods.callHttpClient({
method: endpoints.GetPartFromCapabilityAnswer.method,
endpoint: endpoints.GetPartFromCapabilityAnswer.url,
@ -1022,7 +1022,9 @@ export const actions = {
const previousResultsArray = [{ parts: context.getters.lineItems.glassParts }];
function getAllPartNumbers(partsOrQuestions) {
return [...partsOrQuestions].map(glass => glass.parts).flat().map(part => part.partNumber).filter(partNumber => !partNumber.toUpperCase().includes("FEE")).sort().join(",");
return partsOrQuestions[0].parts
? [...partsOrQuestions].map(glass => glass.parts).flat().map(part => part.partNumber).filter(partNumber => !partNumber.toUpperCase().includes("FEE")).sort().join(",")
: []
}
const previouslySelectedPartNumbers = getAllPartNumbers(previousResultsArray);
@ -1041,7 +1043,7 @@ export const actions = {
saveMoldingQuestionAnswers(context, moldingQuestionAnswers) {
const previousResultsArray = context.getters.damage.moldingQuestionAnswers;
const haveMoldingQuestionAnswersChanged = previousResultsArray?.length !== moldingQuestionAnswers.length ||
!previousResultsArray.every((x, i) => x.partNum === moldingQuestionAnswers[i].partNum);
!previousResultsArray.every((x, i) => x.partNum === moldingQuestionAnswers[i].partNum);
if (haveMoldingQuestionAnswersChanged) {
context.commit(storeMutations.UPDATE_GLASS_PARTS, null);