CASH-48
CASH-48 switch to order object from applicationUser
This commit is contained in:
parent
c71f2cd1d8
commit
829567d401
2 changed files with 27 additions and 27 deletions
|
|
@ -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: {
|
||||||
|
|
|
||||||
|
|
@ -116,40 +116,40 @@ 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 onlyPartsWithQuestions = partsOrQuestions.filter((part) => {
|
|
||||||
return part.partQuestions?.length > 0;
|
|
||||||
});
|
|
||||||
|
|
||||||
onlyPartsWithQuestions.forEach(part => {
|
const partsOrQuestions = orderFromStore.damage?.partQuestionAnswers;
|
||||||
|
|
||||||
|
partsOrQuestions.forEach(pqa => {
|
||||||
const payloadPartQuestions = [];
|
const payloadPartQuestions = [];
|
||||||
part.partQuestions.forEach(question => {
|
pqa.answeredQuestions.forEach(answer => {
|
||||||
payloadPartQuestions.push({
|
payloadPartQuestions.push({
|
||||||
questionSeq: question.questionSequence,
|
questionSeq: answer?.questionNum,
|
||||||
questionText: question.questionText,
|
questionText: answer?.questionText,
|
||||||
answerText: question.answerSelected.split("|")[3],
|
answerText: answer?.selectedAnswerText,
|
||||||
basePart: question.answerSelected.split("|")[2],
|
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(
|
const payload = {
|
||||||
storeActions.LOG_PART_QUESTIONS,
|
eon: orderFromStore.eon,
|
||||||
payload,
|
ctu: ctu,
|
||||||
false
|
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
|
// 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
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue