CSR-111 Get capability questions
This commit is contained in:
parent
db0c5de20f
commit
2fd175711a
8 changed files with 43 additions and 17 deletions
|
|
@ -1,5 +1,7 @@
|
|||
<template>
|
||||
<div v-for="(q, i) in questions" :key="i">
|
||||
{{ questions }}<br/>
|
||||
{{q}}
|
||||
<transition appear name="fade" mode="out-in">
|
||||
<buttonQuestion
|
||||
v-if="q.answerSelected || (q.questionSequence === currentQuestionNum)"
|
||||
|
|
|
|||
|
|
@ -59,6 +59,10 @@ const endpoints = {
|
|||
url: "/parts/api/v1/parts/parts",
|
||||
method: "POST",
|
||||
},
|
||||
GetCapabilityQuestions: {
|
||||
url: "/parts/api/v1/parts/capability-questions",
|
||||
method: "GET"
|
||||
},
|
||||
SaveOrder: {
|
||||
url: "/order/api/v1/order/save",
|
||||
method: "POST",
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ const storeActions = {
|
|||
|
||||
GET_PARTS_OR_QUESTIONS: "getPartsOrQuestions",
|
||||
GET_PARTS: "getParts",
|
||||
GET_CAPABILITY_QUESTIONS: "getCapabilityQuestions",
|
||||
SAVE_ORDER: "saveOrder",
|
||||
LOAD_ORDER: "loadOrder",
|
||||
UPDATE_STORE_WITH_SAVE_ORDER_RESPONSE: "updateStoreWithSaveOrderResponse",
|
||||
|
|
|
|||
|
|
@ -20,13 +20,12 @@
|
|||
:manualCopy="AlertFewMoreQuestionsCopy"
|
||||
v-bind:isDismissible="false"
|
||||
/>
|
||||
<div v-for="(part, i) in capabilityQuestionsData" :key="i">
|
||||
<div v-for="(question, i) in capabilityQuestionsData" :key="i">
|
||||
<questionChain
|
||||
ref="questionChain"
|
||||
v-model="selectedModel"
|
||||
:questionData="part"
|
||||
:questionData="question"
|
||||
:partIndex="i"
|
||||
v-if="showThisPartQuestionChain(part, i)"
|
||||
validationRules="questions-required"
|
||||
/>
|
||||
</div>
|
||||
|
|
@ -71,6 +70,7 @@ export default {
|
|||
async beforeRouteEnter(to, from, next) {
|
||||
// Call APIs
|
||||
const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage);
|
||||
const getCapabilityQuestions = store.dispatch(storeActions.GET_CAPABILITY_QUESTIONS, store.getters.pageData(fmgPageValues.CAPABILITY_QUESTIONS));
|
||||
|
||||
// Settle promises and get results
|
||||
const promiseResultMap = [
|
||||
|
|
@ -78,6 +78,10 @@ export default {
|
|||
resultKey: "cmsContent",
|
||||
promise: cmsContentPromise,
|
||||
},
|
||||
{
|
||||
resultKey: "capabilityQuestions",
|
||||
promise: getCapabilityQuestions,
|
||||
},
|
||||
];
|
||||
|
||||
const resultMap = await settleAllPromises(promiseResultMap);
|
||||
|
|
@ -85,20 +89,14 @@ export default {
|
|||
// Call the "next" function to complete the transition to this page.
|
||||
next((vm) => {
|
||||
vm.setCmsContent(resultMap.cmsContent);
|
||||
vm.capabilityQuestionsData = resultMap.capabilityQuestions;
|
||||
console.log("CQ: ", resultMap.capabilityQuestions)
|
||||
});
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
selectedModel: [],
|
||||
partsQuestionsData: this.$store.getters.pageData(fmgPageValues.CAPABILITY_QUESTIONS).partsOrQuestions.filter((p) => {
|
||||
if (Array.isArray(p.partQuestions) && p.partQuestions.length > 0) {
|
||||
return {
|
||||
glassName: p.glassName,
|
||||
glassLocation: p.glassLocation,
|
||||
partQuestions: p.partQuestions,
|
||||
};
|
||||
}
|
||||
}),
|
||||
capabilityQuestionsData: [],
|
||||
currentPartNum: 0,
|
||||
};
|
||||
},
|
||||
|
|
@ -112,8 +110,8 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
arePagePrerequisitesValid() {
|
||||
return false; // TODO - DO TRUE TEST OF PAGEDATA
|
||||
// return Object.keys(store.getters.pageData(fmgPageValues.CAPABILITY_QUESTIONS)).length > 0;
|
||||
const capabilityQuestionsPageData = store.getters.pageData(fmgPageValues.CAPABILITY_QUESTIONS);
|
||||
return capabilityQuestionsPageData && Object.keys(capabilityQuestionsPageData).length > 0;
|
||||
},
|
||||
showThisPartQuestionChain(part, i) {
|
||||
if (part.partQuestions?.length < 1) { return false; } // return false if only one partQuestion
|
||||
|
|
@ -129,6 +127,12 @@ export default {
|
|||
},
|
||||
async forwardButtonAction() {
|
||||
// TODO: TO COME
|
||||
// if questions are answered:
|
||||
|
||||
this.$router.navigate(
|
||||
this.navigationScenarios.CLICKED_FORWARD,
|
||||
this.$route
|
||||
);
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
|
|
|
|||
|
|
@ -132,8 +132,8 @@ export default {
|
|||
ColorAnswerText: p.color,
|
||||
FeatureAnswers: [
|
||||
{
|
||||
FeatureAnswerText: p.description === "" ? p.color : p.description,
|
||||
PartNumber: p.partNumber,
|
||||
FeatureAnswerText: p.description === "" ? p.color : p.description,
|
||||
PartNumber: p.partNumber,
|
||||
},
|
||||
],
|
||||
});
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import { storeActions } from "@/constants/store-actions.js";
|
|||
import { storeMutations } from "@/constants/store-mutations.js";
|
||||
import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper";
|
||||
import vehicleQuestionsMixin from "@/mixins/vehicle-questions-mixin";
|
||||
import { damageLocationsSelected } from "@/constants/damage-locations-selected";
|
||||
|
||||
export default {
|
||||
mixins: [vehicleQuestionsMixin],
|
||||
|
|
@ -26,7 +27,10 @@ export default {
|
|||
this.$router.navigate(this.navigationScenarios.SELECTED_VIN_WITH_MOLDING_QUESTIONS, this.$route, {}, {}, result.data);
|
||||
}
|
||||
else if (hasCapabilityQuestions) {
|
||||
this.$router.navigate(this.navigationScenarios.SELECTED_VIN_WITH_CAPABILITY_QUESTIONS, this.$route, {}, {}, result.data);
|
||||
this.$router.navigate(this.navigationScenarios.SELECTED_VIN_WITH_CAPABILITY_QUESTIONS, this.$route, {}, {}, {
|
||||
carId: this.$store.getters.vehicle.carId,
|
||||
partNumber: result.data.partsOrQuestions.filter(x => x.glassLocation === damageLocationsSelected.WINDSHIELD)[0].parts[0].partNumber
|
||||
});
|
||||
}
|
||||
else {
|
||||
// if single parts only
|
||||
|
|
|
|||
|
|
@ -297,6 +297,10 @@ const routingTable = function(store) {
|
|||
scenario: navigationScenarios.CLICKED_BACK,
|
||||
destinationFmgPageValue: fmgPageValues.VEHICLE_PARTS
|
||||
},
|
||||
{
|
||||
scenario: navigationScenarios.CLICKED_FORWARD,
|
||||
destinationFmgPageValue: fmgPageValues.QUOTE
|
||||
},
|
||||
]
|
||||
},
|
||||
];
|
||||
|
|
|
|||
|
|
@ -722,6 +722,13 @@ export const actions = {
|
|||
});
|
||||
},
|
||||
|
||||
getCapabilityQuestions(context, { carId, partNumber }) {
|
||||
return globalMethods.callHttpClient({
|
||||
method: endpoints.GetCapabilityQuestions.method,
|
||||
endpoint: `${endpoints.GetCapabilityQuestions.url}/${carId}/${partNumber}`,
|
||||
})
|
||||
},
|
||||
|
||||
// Order API Actions
|
||||
saveOrder(context) {
|
||||
const vehicle = context.getters.vehicle;
|
||||
|
|
|
|||
Loading…
Reference in a new issue