+
-
-
-
-
+
+ :ref="`${RefPrefix}-${item.glassLocation}-${item.glassName}`"
+ v-model="glassParts[item.glassLocation + '-' + item.glassName]"
+ :glassLocation="item.glassLocation"
+ :glassName="item.glassName"
+ :colorAnswers="item.colorAnswers"
+ :alreadyPopulatedPartsData="alreadyPopulatedPartsData"
+ />
@@ -64,12 +59,7 @@ import { settleAllPromises } from "@/helpers/layout-helper";
import { fmgPageValues } from "@/router/router-constants/fmgPage-values";
import { storeMutations } from "@/constants/store-mutations";
import store from "@/store";
-import { Form, defineRule } from "vee-validate";
-import { required } from "@/helpers/validation-rules";
-import { errorMessages } from "@/constants/error-messages";
-
-// DEFINE VALIDATION RULES
-defineRule("replace-options-required", required(errorMessages.OPTION_REQUIRED));
+import { Form } from "vee-validate";
export default {
name: "vehicle-parts",
@@ -88,12 +78,12 @@ export default {
// Glass Part Question dynamic component
Object.keys(vm.$refs)
- .filter((r) => r.includes(vm.RefPrefix) && vm.$refs[r][0] !== undefined)
- .forEach((c) =>
- vm.$refs[c][0].initializeComponent({
- ColorQuestionWidget: resultMap.cmsContent.ColorQuestionWidget,
- FeatureQuestionWidget: resultMap.cmsContent.FeatureQuestionWidget,
- })
+ .filter((r) => r.includes(vm.RefPrefix) && vm.$refs[r][0] !== undefined)
+ .forEach((c) =>
+ vm.$refs[c][0].initializeComponent({
+ ColorQuestionWidget: resultMap.cmsContent.ColorQuestionWidget,
+ FeatureQuestionWidget: resultMap.cmsContent.FeatureQuestionWidget,
+ })
);
});
},
@@ -101,6 +91,7 @@ data() {
return {
glassParts: {},
alertWidgetData: Object,
+ alreadyPopulatedPartsData: {}
};
},
components: {
@@ -113,7 +104,24 @@ components: {
alert,
},
computed: {
- PartsForQuestions() {
+ isForwardActionDisabled() {
+ return Object.keys(this.matchedParts).length !== this.PartsFromApi.partsOrQuestions.length;
+ },
+ matchedParts() {
+ const matchedParts = [];
+
+ // Match them to the parts from the API.
+ this.PartsFromApi.partsOrQuestions.forEach(part => {
+ const selectedPartForGlassLocationAndName = this.glassParts[`${part.glassLocation}-${part.glassName}`];
+ const selectedPartData = part.parts.filter(part => selectedPartForGlassLocationAndName && part.partNumber == selectedPartForGlassLocationAndName?.partNumber)[0];
+
+ if (selectedPartData)
+ matchedParts.push(selectedPartData);
+ })
+
+ return matchedParts;
+ },
+ PartsOrQuestions() {
const partsData = this.PartsFromApi;
// Map API result data, to vehicle-parts data structure
@@ -165,40 +173,14 @@ methods: {
this.$router.navigate(this.navigationScenarios.CLICKED_BACK, this.$route);
},
forwardButtonAction() {
- const selectedGlassPartNumbers = [];
- const matchedParts = [];
-
- // Compile all selected parts from the page.
- for (let [key, value] of Object.entries(this.glassParts)) {
- for (let [glassKey, glassValue] of Object.entries(value)) {
- selectedGlassPartNumbers.push(glassValue[0]);
- }
- }
-
- // Match them to the parts from the API.
- for (let [key, value] of Object.entries(
- this.PartsFromApi.partsOrQuestions
- )) {
- for (let [partKey, partValue] of Object.entries(value.parts)) {
- const currentPart =
- this.PartsFromApi.partsOrQuestions[key].parts[partKey];
- const isMatched = selectedGlassPartNumbers.some(
- (p) => p === currentPart.partNumber
- );
-
- if (isMatched) {
- matchedParts.push(currentPart);
- }
- }
- }
-
// If no parts could be matched, throw an error.
- if (matchedParts.length === 0) {
+ if (this.isForwardActionDisabled) {
+ this.$refs.funnelFooter.removeLoader();
throw new Error("Could not match any parts to the selected parts");
}
// Save parts to the store.
- store.commit(storeMutations.UPDATE_GLASS_PARTS, matchedParts);
+ store.commit(storeMutations.UPDATE_GLASS_PARTS, this.matchedParts);
// Navigate to the next page.
this.$router.navigateAfterSave(
@@ -212,25 +194,14 @@ methods: {
},
LoadInitialPartsData() {
- const partsData = this.PartsFromApi;
- const alreadyPopulatedPartsData =
- this.$store.getters.lineItems.glassParts === null
- ? {}
- : this.$store.getters.lineItems.glassParts;
-
- partsData.partsOrQuestions.map((g) => {
- // If the part is already populated, use the value from the store and populate the v-model.
- Object.keys(alreadyPopulatedPartsData).forEach((key) => {
- const partNumber = alreadyPopulatedPartsData[key].partNumber;
- g.parts.forEach((p) => {
- if (p.partNumber === partNumber) {
- this.glassParts[g.glassLocation + "-" + g.glassName] = {
- [g.glassLocation]: [partNumber],
- };
- }
- });
- });
- });
+ this.alreadyPopulatedPartsData = this.$store.getters.lineItems.glassParts ?? [];
+ const savedPartNumbers = this.alreadyPopulatedPartsData.map(part => part.partNumber)
+ this.PartsFromApi.partsOrQuestions.forEach(glass => {
+ const savedPart = glass.parts.filter(part => savedPartNumbers.includes(part.partNumber))[0];
+ if (savedPart) {
+ this.glassParts[`${glass.glassLocation}-${glass.glassName}`.replace(" ", "-")] = savedPart;
+ }
+ });
},
},
mounted() {
diff --git a/src/layouts/vehicle-style/style-question/style-question.vue b/src/layouts/vehicle-style/style-question/style-question.vue
index 45c0f7dea..e578bc192 100644
--- a/src/layouts/vehicle-style/style-question/style-question.vue
+++ b/src/layouts/vehicle-style/style-question/style-question.vue
@@ -7,7 +7,7 @@
:answers="styles"
groupName="ChooseVehicleStyle"
textPosition="text-start"
- v-model="selectedValueAsArray"
+ v-model="selectedValue"
isRequired=true
/>
@@ -34,14 +34,13 @@ export default {
questionText(){
return this.getCmsContent(this.cmsWidgetName, 'QuestionText');
},
- selectedValueAsArray: {
+ selectedValue: {
get: function() {
const modelValueAsArray = this.modelValue ? [this.modelValue] : [];
return modelValueAsArray;
},
set: function(newValue) {
- const newValueAsScalar = newValue && newValue.length > 0 ? newValue[0] : null;
- this.$emit("update:modelValue", newValueAsScalar);
+ this.$emit("update:modelValue", newValue);
}
}
},
diff --git a/src/layouts/vehicle-year/year-question/year-question.vue b/src/layouts/vehicle-year/year-question/year-question.vue
index a5b263fe8..ff2e2902a 100644
--- a/src/layouts/vehicle-year/year-question/year-question.vue
+++ b/src/layouts/vehicle-year/year-question/year-question.vue
@@ -7,7 +7,7 @@
:answers="years"
groupName="ChooseVehicleYear"
textPosition="text-start"
- v-model="selectedValueAsArray"
+ v-model="selectedValue"
isRequired=true
/>
@@ -35,14 +35,13 @@ export default {
questionText(){
return this.getCmsContent(this.cmsWidgetName, 'QuestionText');
},
- selectedValueAsArray: {
+ selectedValue: {
get: function() {
const modelValueAsArray = this.modelValue ? [this.modelValue] : [];
return modelValueAsArray;
},
set: function(newValue) {
- const newValueAsScalar = newValue && newValue.length > 0 ? newValue[0] : null;
- this.$emit("update:modelValue", newValueAsScalar);
+ this.$emit("update:modelValue", newValue);
}
}
},
diff --git a/src/layouts/vin-lookup/vin-lookup.vue b/src/layouts/vin-lookup/vin-lookup.vue
index b3ca243f0..214899d31 100644
--- a/src/layouts/vin-lookup/vin-lookup.vue
+++ b/src/layouts/vin-lookup/vin-lookup.vue
@@ -183,15 +183,10 @@ export default {
previouslyEnteredCarId: '',
invalidZip: '',
vinPopulatedOnPageLoad: this.getVinFromStore()?.length > 0,
- isInsuranceVerified: false,
};
},
mounted() {
this.attachCustomEvents();
- if (this.vinPopulatedOnPageLoad) {
- this.setupVinMask();
- this.isInsuranceVerified = store.getters.payment.insuranceCoverage.isVerified || getFunnelCookie().HasDelayedClaimRegistration;
- }
},
watch: {
vin() {
@@ -239,12 +234,20 @@ export default {
return this.getCmsContent("PerfectMatchInsuranceVerifiedAlert", "BodyText").replaceAll("{custom:damage}",
getIsWindshieldOnly())
},
+ isInsuranceVerified() {
+ return store.getters.payment.insuranceCoverage.isVerified || getFunnelCookie().HasDelayedClaimRegistration;
+ },
+ vinMask() {
+ if (this.vinPopulatedOnPageLoad) {
+ const lastSixChars = this.vin.substring(11, this.vin.length);
+ return `!X!X!X!X!X!X!X!X!X!X!X${lastSixChars}`;
+ }
+ else {
+ return 'XXXXXXXXXXXXXXXXX';
+ }
+ },
},
methods: {
- setupVinMask() {
- const lastSixChars = this.vin.substring(11, this.vin.length);
- this.vinMask = `!X!X!X!X!X!X!X!X!X!X!X${lastSixChars}`;
- },
arePagePrerequisitesValid() {
return store.getters.vehicle.carId !== null;
},
diff --git a/src/router/router-constants/fmgPage-values.js b/src/router/router-constants/fmgPage-values.js
index 9abb45cd2..d067895ee 100644
--- a/src/router/router-constants/fmgPage-values.js
+++ b/src/router/router-constants/fmgPage-values.js
@@ -12,6 +12,7 @@ const fmgPageValues = {
REVEAL: "reveal",
ESTIMATE: "estimate",
ADDRESS_VEHICLES: "address-vehicles",
+ QUOTE: "quote"
};
export { fmgPageValues };
diff --git a/src/styles/common-error-styles.scss b/src/styles/common-error-styles.scss
index 95985f7c4..25a651d52 100644
--- a/src/styles/common-error-styles.scss
+++ b/src/styles/common-error-styles.scss
@@ -46,6 +46,7 @@ html {
input[type=radio]+label:before,
input[type=checkbox]+label:before {
border: 1px solid $red;
+ background-color: initial;
}
input[type=checkbox]:checked + label:before {
border: 1px solid $blue;
diff --git a/src/ux-components/list-button-horizontal/list-button-horizontal.vue b/src/ux-components/list-button-horizontal/list-button-horizontal.vue
index dfd322cb3..e60d0d22c 100644
--- a/src/ux-components/list-button-horizontal/list-button-horizontal.vue
+++ b/src/ux-components/list-button-horizontal/list-button-horizontal.vue
@@ -223,18 +223,26 @@ export default {
span {
font-size: .875rem;
}
- }
+ }
+}
+
+.col {
&:first-of-type {
- label {
- border-bottom-left-radius: 0.5rem;
- border-top-left-radius: 0.5rem;
- z-index: 2;
+ .list-button-horizontal {
+ label {
+ border-bottom-left-radius: 0.5rem;
+ border-top-left-radius: 0.5rem;
+ z-index: 2;
+ }
}
}
+
&:last-of-type {
- label {
- border-bottom-right-radius: 0.5rem;
- border-top-right-radius: 0.5rem;
+ .list-button-horizontal {
+ label {
+ border-bottom-right-radius: 0.5rem;
+ border-top-right-radius: 0.5rem;
+ }
}
}
}
diff --git a/src/ux-components/list-card/list-card.spec.js b/src/ux-components/list-card/list-card.spec.js
index 2fbdaade4..7db735ced 100644
--- a/src/ux-components/list-card/list-card.spec.js
+++ b/src/ux-components/list-card/list-card.spec.js
@@ -205,7 +205,7 @@ describe("list-card.vue", () => {
});
wrapper.vm.handleCheckChange();
// Assert
- expect(wrapper.emitted()["isCheckedChanged"][0]).toEqual([{value: "List Card Checkbox", checkValue: [Boolean, String], buttonId: 'list-card-id'}]);
+ expect(wrapper.emitted()["isCheckedChanged"][0]).toEqual([{value: "List Card Checkbox", checkValue: "List Card Checkbox", buttonId: 'list-card-id'}]);
});
it("Should set checkValue data if selectedButtonIDs has value(s)", async () => {
diff --git a/src/ux-components/list-card/list-card.vue b/src/ux-components/list-card/list-card.vue
index 88aad0b6a..84762fc91 100644
--- a/src/ux-components/list-card/list-card.vue
+++ b/src/ux-components/list-card/list-card.vue
@@ -1,8 +1,9 @@
-
+