From 13d6f15d371c999eda5352d3c0de7efc4e9a707b Mon Sep 17 00:00:00 2001 From: Adam Caouette Date: Tue, 12 Jul 2022 14:37:55 -0400 Subject: [PATCH 1/3] CSR-108: complete part-questions page, changes to question-chain --- .../question-chain/question-chain.vue | 18 +- src/constants/endpoints.js | 4 + src/constants/store-actions.js | 5 +- src/constants/store-mutations.js | 1 + .../address-vehicles/address-vehicles.vue | 10 +- src/layouts/part-questions/part-questions.vue | 202 +++++++++++++++--- .../router-constants/navigation-scenarios.js | 2 + src/router/router-constants/routing-table.js | 10 +- src/store/index.js | 35 ++- 9 files changed, 246 insertions(+), 41 deletions(-) diff --git a/src/common-components/question-chain/question-chain.vue b/src/common-components/question-chain/question-chain.vue index 9e8b97674..a248259ab 100644 --- a/src/common-components/question-chain/question-chain.vue +++ b/src/common-components/question-chain/question-chain.vue @@ -8,7 +8,7 @@ :questionText="q.questionText" :answers="q.answers" :groupName="`${questionData.glassName}-${questionData.glassLocation}-${i}`" - v-model="selectedValuesArray" + v-model="selectedValue" :isRequired=true :validationRules="validationRules" :clearOnUnmount=false @@ -25,13 +25,14 @@ export default { data() { return { currentQuestionNum: 1, - questions: [{ "BlankObject": "NOT USED... placeholder for question #0"}], + questions: [{ "BlankObject": "NOT USED... placeholder for question #0 to simplify indexing"}], }; }, props: { questionData: Object, validationRules: String, modelValue: Array, + partIndex: Number, }, created() { this.questionData.partQuestions.map((q, i) => { @@ -61,12 +62,11 @@ export default { }); }, computed: { - selectedValuesArray: { + selectedValue: { get: function() { - return []; + return ""; }, - set: function(returnedAnswerArray) { - const returnedAnswer = returnedAnswerArray[returnedAnswerArray.length-1]; + set: function(returnedAnswer) { const isQuestionChainComplete = this.handleReturnedAnswer(returnedAnswer); if (isQuestionChainComplete) { @@ -102,6 +102,7 @@ export default { // set this question as "answered" this.questions[questionNum].answerSelected = questionAnswerText; + this.questions[questionNum].answerNumber = questionNum; // update to next question index this.currentQuestionNum = questionType === "nextQuestion" ? parseInt(questionAnswer) : parseInt(questionNum); // update count to display next question @@ -116,16 +117,17 @@ export default { answeredQuestions.push({ questionText: q.questionText, selectedAnswerText: q.answerSelected, - questionNum: questionNum, + questionNum: q.answerNumber, }); } }); return { answerResult: questionAnswer, answeredQuestions: answeredQuestions, + partIndex: this.partIndex, }; } - } + }, }, watch: { currentQuestion: { diff --git a/src/constants/endpoints.js b/src/constants/endpoints.js index 7ff9e3cec..e7f856f40 100644 --- a/src/constants/endpoints.js +++ b/src/constants/endpoints.js @@ -55,6 +55,10 @@ const endpoints = { url: "/parts/api/v1/parts/parts-or-questions", method: "POST", }, + GetParts: { + url: "/parts/api/v1/parts/parts", + method: "POST", + }, SaveOrder: { url: "/order/api/v1/order/save", method: "POST", diff --git a/src/constants/store-actions.js b/src/constants/store-actions.js index 573d90e1d..86df61063 100644 --- a/src/constants/store-actions.js +++ b/src/constants/store-actions.js @@ -20,6 +20,7 @@ const storeActions = { LOOKUP_VIN_BY_ADDRESS: "lookupVinByAddress", GET_PARTS_OR_QUESTIONS: "getPartsOrQuestions", + GET_PARTS: "getParts", SAVE_ORDER: "saveOrder", LOAD_ORDER: "loadOrder", SET_REFERRAL_INFORMATION: "setReferralInformation", @@ -31,7 +32,6 @@ const storeActions = { GET_EXPERIMENTS_BY_USER: "GetExperimentsByUser", CLEAR_VIN: "clearVin", - // DEPENDENCY MUTATIONS RESET_VEHICLE_STATE_AND_DEPENDENCIES: "resetVehicleAndDependencies", RESET_DAMAGE_STATE_AND_DEPENDENCIES: "resetDamageAndDependencies", @@ -51,7 +51,8 @@ const storeActions = { SAVE_REGISTRATION_LICENSE_PLATE_LOOKUP: "saveRegistrationLicensePlateLookup", SAVE_VIN: "saveVin", SAVE_REGISTRATION_ADDRESS_LOOKUP: "saveRegistrationAddressLookup", - SAVE_GLASS_PARTS: "saveGlassParts", + SAVE_GLASS_PARTS: "saveGlassParts", + SAVE_PART_QUESTION_ANSWERS: "savePartQuestionAnswers", }; export { storeActions }; diff --git a/src/constants/store-mutations.js b/src/constants/store-mutations.js index a1358233a..167e0710c 100644 --- a/src/constants/store-mutations.js +++ b/src/constants/store-mutations.js @@ -16,6 +16,7 @@ const storeMutations = { UPDATE_IS_REPAIR: "updateIsRepair", UPDATE_NUMBER_OF_CHIPS: "updateNumberOfChips", UPDATE_GLASS_TO_REPLACE: "updateGlassToReplace", + UPDATE_PART_QUESTION_ANSWERS: "updatePartQuestionAnswers", UPDATE_GLASS_PARTS: "updateGlassParts", UPDATE_REGISTRATION_LICENSE_PLATE : "updateRegistrationLicensePlate", diff --git a/src/layouts/address-vehicles/address-vehicles.vue b/src/layouts/address-vehicles/address-vehicles.vue index 7936ef83e..38dea789d 100644 --- a/src/layouts/address-vehicles/address-vehicles.vue +++ b/src/layouts/address-vehicles/address-vehicles.vue @@ -12,12 +12,12 @@ + v-bind:isDismissible="false" + /> -
- - - -
-

Part Questions Page Placeholder

- -
-
+
+
+ + + +
+ +
+ +
+ +
+
+
+ + diff --git a/src/router/router-constants/navigation-scenarios.js b/src/router/router-constants/navigation-scenarios.js index 7bf425efc..a9cf0b0ea 100644 --- a/src/router/router-constants/navigation-scenarios.js +++ b/src/router/router-constants/navigation-scenarios.js @@ -17,6 +17,8 @@ const navigationScenarios = { SELECTED_MANUAL_VIN: "SELECTED_MANUAL_VIN", SELECTED_LICENSE_PLATE: "SELECTED_LICENSE_PLATE", SELECTED_HOME_ADDRESS: "SELECTED_HOME_ADDRESS", + ANSWERED_QUESTIONS_WITH_SINGLE_PART: "ANSWERED_QUESTIONS_WITH_SINGLE_PART", + ANSWERED_QUESTIONS_WITH_MULTIPLE_PARTS: "ANSWERED_QUESTIONS_WITH_MULTIPLE_PARTS", }; export { navigationScenarios }; diff --git a/src/router/router-constants/routing-table.js b/src/router/router-constants/routing-table.js index 78c5ac242..515465385 100644 --- a/src/router/router-constants/routing-table.js +++ b/src/router/router-constants/routing-table.js @@ -216,7 +216,15 @@ const routingTable = [ { scenario: navigationScenarios.CLICKED_BACK, destinationFmgPageValue: fmgPageValues.VIN_LOOKUP - } + }, + { + scenario: navigationScenarios.ANSWERED_QUESTIONS_WITH_MULTIPLE_PARTS, + destinationFmgPageValue: fmgPageValues.VEHICLE_PARTS + }, + { + scenario: navigationScenarios.ANSWERED_QUESTIONS_WITH_SINGLE_PART, + destinationFmgPageValue: fmgPageValues.QUOTE, + }, ] }, ]; diff --git a/src/store/index.js b/src/store/index.js index 0d8689242..a7676a04e 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -44,6 +44,7 @@ const getDefaultState = () => { isRepair: null, numberOfChips: null, glassToReplace: null, + partQuestionAnswers: null, }, lineItems: { glassParts: null, @@ -112,6 +113,9 @@ export const mutations = { updateGlassToReplace(state, glassToReplace) { state.order.damage.glassToReplace = glassToReplace; }, + updatePartQuestionAnswers(state, answersArray) { + state.order.damage.partQuestionAnswers = answersArray; + }, updateGlassParts(state, partsData) { state.order.lineItems.glassParts = partsData; }, @@ -555,7 +559,7 @@ export const actions = { }); }, - // Parts API Actions + // PartsOrQuestions API Actions getPartsOrQuestions(context) { const vehicle = context.getters.vehicle; const damage = context.getters.damage; @@ -578,6 +582,31 @@ export const actions = { }); }, + // Parts API Actions + getParts(context) { + const vehicle = context.getters.vehicle; + const damage = context.getters.damage; + const order = context.state.order; + + const carId = vehicle.carId; + const glassArray = damage.glassToReplace; + const resultsArray = damage.partQuestionAnswers; + const zipCode = order.serviceLocation.zipCode; + const vin = vehicle.vin; + + return globalMethods.callHttpClient({ + method: endpoints.GetParts.method, + endpoint: endpoints.GetParts.url, + payload: { + carId: carId, + glass: glassArray, + answerResults: resultsArray, + zip: zipCode, + vin: vin + }, + }); + }, + // Order API Actions saveOrder(context) { const vehicle = context.getters.vehicle; @@ -787,6 +816,10 @@ export const actions = { context.commit(storeMutations.UPDATE_REGISTRATION, registrationInfo); } }, + savePartQuestionAnswers(context, partQuestionAnswersArray) { + //Save new values + context.commit(storeMutations.UPDATE_PART_QUESTION_ANSWERS, partQuestionAnswersArray); + }, // Misc order actions saveServiceLocation(context, serviceLocationInfo) { From 43c95a81a36150f0a0516de912239f7bd813e3a4 Mon Sep 17 00:00:00 2001 From: Adam Caouette Date: Tue, 12 Jul 2022 15:43:11 -0400 Subject: [PATCH 2/3] CSR-108: minor CSS changes to match Figma --- src/common-components/button-question/button-question.vue | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/common-components/button-question/button-question.vue b/src/common-components/button-question/button-question.vue index aa4aec2a1..2ea6d1c3a 100644 --- a/src/common-components/button-question/button-question.vue +++ b/src/common-components/button-question/button-question.vue @@ -2,7 +2,7 @@