CASH-48 switch to order object from applicationUser
This commit is contained in:
CarlNation 2025-02-02 11:11:49 -05:00
parent c71f2cd1d8
commit 829567d401
2 changed files with 27 additions and 27 deletions

View file

@ -125,7 +125,7 @@ const endpoints = {
method: "POST", method: "POST",
}, },
SaveQuote: { SaveQuote: {
url: "/order/api/v1/order/initiate-saved-progress-email", url: "/order/api/v1/order/save-progress",
method: "POST", method: "POST",
}, },
GetSignature: { GetSignature: {

View file

@ -116,30 +116,28 @@ export default {
// send part question data to SPS API for logging // send part question data to SPS API for logging
const orderFromStore = await deepClone(store.getters.order); const orderFromStore = await deepClone(store.getters.order);
const applicationUserFromStore = await deepClone(store.getters.applicationUser); const ctu = orderFromStore.serviceLocation?.zipCodeCtu
const ctu = orderFromStore.workOrderNumber?.split("-")[0];
const partsOrQuestions = applicationUserFromStore.pageData["part-questions"].partsOrQuestions; const partsOrQuestions = orderFromStore.damage?.partQuestionAnswers;
const onlyPartsWithQuestions = partsOrQuestions.filter((part) => {
return part.partQuestions?.length > 0; partsOrQuestions.forEach(pqa => {
const payloadPartQuestions = [];
pqa.answeredQuestions.forEach(answer => {
payloadPartQuestions.push({
questionSeq: answer?.questionNum,
questionText: answer?.questionText,
answerText: answer?.selectedAnswerText,
basePart: pqa?.result,
});
}); });
onlyPartsWithQuestions.forEach(part => {
const payloadPartQuestions = [];
part.partQuestions.forEach(question => {
payloadPartQuestions.push({
questionSeq: question.questionSequence,
questionText: question.questionText,
answerText: question.answerSelected.split("|")[3],
basePart: question.answerSelected.split("|")[2],
});
});
const payload = { const payload = {
eon: orderFromStore.eon, eon: orderFromStore.eon,
ctu: ctu, ctu: ctu,
workOrderId: orderFromStore.workOrderId, workOrderId: orderFromStore.workOrderId,
workOrderNumber: orderFromStore.workOrderNumber, workOrderNumber: orderFromStore.workOrderNumber,
carId: orderFromStore.vehicle.carId, carId: orderFromStore.vehicle.carId,
glassLocation: part.glassLocation, glassLocation: pqa?.glassLocation,
partQuestions: payloadPartQuestions, partQuestions: payloadPartQuestions,
}; };
@ -148,8 +146,10 @@ export default {
payload, payload,
false false
); );
}); });
// Create order // Create order
await baseMixin.methods.dispatchStoreAction(storeActions.CREATE_SUBMITTED_ORDER); // This nulls the Store order await baseMixin.methods.dispatchStoreAction(storeActions.CREATE_SUBMITTED_ORDER); // This nulls the Store order