From 829567d4018072e25fbbe0bdc85e2b4d15020869 Mon Sep 17 00:00:00 2001 From: CarlNation Date: Sun, 2 Feb 2025 11:11:49 -0500 Subject: [PATCH] CASH-48 CASH-48 switch to order object from applicationUser --- src/constants/endpoints.js | 2 +- src/layouts/confirmation/confirmation.vue | 52 +++++++++++------------ 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/constants/endpoints.js b/src/constants/endpoints.js index 43bf8c926..29d36d091 100644 --- a/src/constants/endpoints.js +++ b/src/constants/endpoints.js @@ -125,7 +125,7 @@ const endpoints = { method: "POST", }, SaveQuote: { - url: "/order/api/v1/order/initiate-saved-progress-email", + url: "/order/api/v1/order/save-progress", method: "POST", }, GetSignature: { diff --git a/src/layouts/confirmation/confirmation.vue b/src/layouts/confirmation/confirmation.vue index 26c0fd4a5..f699d6a59 100644 --- a/src/layouts/confirmation/confirmation.vue +++ b/src/layouts/confirmation/confirmation.vue @@ -116,40 +116,40 @@ export default { // send part question data to SPS API for logging const orderFromStore = await deepClone(store.getters.order); - const applicationUserFromStore = await deepClone(store.getters.applicationUser); - const ctu = orderFromStore.workOrderNumber?.split("-")[0]; - const partsOrQuestions = applicationUserFromStore.pageData["part-questions"].partsOrQuestions; - const onlyPartsWithQuestions = partsOrQuestions.filter((part) => { - return part.partQuestions?.length > 0; - }); + const ctu = orderFromStore.serviceLocation?.zipCodeCtu - onlyPartsWithQuestions.forEach(part => { + const partsOrQuestions = orderFromStore.damage?.partQuestionAnswers; + + partsOrQuestions.forEach(pqa => { const payloadPartQuestions = []; - part.partQuestions.forEach(question => { + pqa.answeredQuestions.forEach(answer => { payloadPartQuestions.push({ - questionSeq: question.questionSequence, - questionText: question.questionText, - answerText: question.answerSelected.split("|")[3], - basePart: question.answerSelected.split("|")[2], + questionSeq: answer?.questionNum, + questionText: answer?.questionText, + answerText: answer?.selectedAnswerText, + basePart: pqa?.result, }); }); - const payload = { - eon: orderFromStore.eon, - ctu: ctu, - workOrderId: orderFromStore.workOrderId, - workOrderNumber: orderFromStore.workOrderNumber, - carId: orderFromStore.vehicle.carId, - glassLocation: part.glassLocation, - partQuestions: payloadPartQuestions, - }; - baseMixin.methods.dispatchStoreAction( - storeActions.LOG_PART_QUESTIONS, - payload, - false - ); + const payload = { + eon: orderFromStore.eon, + ctu: ctu, + workOrderId: orderFromStore.workOrderId, + workOrderNumber: orderFromStore.workOrderNumber, + carId: orderFromStore.vehicle.carId, + glassLocation: pqa?.glassLocation, + partQuestions: payloadPartQuestions, + }; + + baseMixin.methods.dispatchStoreAction( + storeActions.LOG_PART_QUESTIONS, + payload, + false + ); + }); + // Create order await baseMixin.methods.dispatchStoreAction(storeActions.CREATE_SUBMITTED_ORDER); // This nulls the Store order