diff --git a/src/layouts/form-test/form-test.vue b/src/layouts/form-test/form-test.vue
index 32bf63289..cb2a7f653 100644
--- a/src/layouts/form-test/form-test.vue
+++ b/src/layouts/form-test/form-test.vue
@@ -16,13 +16,13 @@
/>
@@ -79,14 +82,13 @@ import { storeActions } from "@/constants/store-actions";
import store from "@/store";
import baseMixin from "@/mixins/base-mixin";
import { Form, defineRule } from "vee-validate";
+import { required } from "@/helpers/validation-rules";
+import { errorMessages } from "@/constants/error-messages";
+import { damageLocationsParts } from "@/constants/damage-locations-parts.js";
+import { damageLocationsCms } from "@/constants/damage-locations-cms.js";
// DEFINE VALIDATION RULES
-defineRule("replace-options-required", (value) => {
- if (!value || value.length < 1) {
- return "Please select rear window type";
- }
- return true;
-});
+defineRule("replace-options-required", required(errorMessages.REPLACE_OPTIONS_REQUIRED));
export default {
name: "form-test",
@@ -113,8 +115,6 @@ export default {
const resultMap = await settleAllPromises(promiseResultMap);
- console.log('resultMap: ', resultMap);
-
// Call the "next" function to complete the transition to this page.
next((vm) => {
vm.$refs.funnelHeader.initializeComponent(
@@ -156,32 +156,11 @@ export default {
selectedRearReplaceOptions: [],
}
},
- computed: {
- isRearWindowDamageLocation() {
- return this.selectedDamageLocations.some(selectedDamages =>
- {
- return selectedDamages.toUpperCase() === "REARWINDOW";
- });
- },
- },
- components: {
- Form,
- funnelHeader,
- vehicleBanner,
- funnelSubHeader,
- sideDoorOptions,
- damageLocationQuestion,
- replaceOptionsQuestion,
- funnelFooter,
- windshieldOptions,
- alert,
- },
methods: {
arePagePrerequisitesValid() {
return store.getters.vehicle.carId !== null;
},
resetDependentState() {
- // Invokes
store.dispatch(storeActions.RESET_PARTS_STATE_AND_DEPENDENCIES);
},
onSubmit(values) {
@@ -203,5 +182,64 @@ export default {
}
},
},
+ computed: {
+ isWindshieldDamageLocation() {
+ return this.selectedDamageLocations.some(selectedDamages =>
+ {
+ return selectedDamages.toUpperCase() === damageLocationsCms.WINDSHIELD;
+ });
+ },
+ isSideDoorDamageLocation() {
+ return this.selectedDamageLocations.some(selectedDamages =>
+ {
+ return selectedDamages.toUpperCase() === damageLocationsCms.SIDEDOOR;
+ });
+ },
+ isRearWindowDamageLocation() {
+ return this.selectedDamageLocations.some(selectedDamages =>
+ {
+ return selectedDamages.toUpperCase() === damageLocationsCms.REARWINDOW;
+ });
+ },
+ isWindshieldRepair() {
+ if (!this.isWindshieldDamageLocation) return false;
+
+ return this.selectedWindshieldOptions.selectedWindshieldDamageType && this.selectedWindshieldOptions.selectedWindshieldDamageType.some(selectedDamageType =>
+ {
+ return selectedDamageType.toUpperCase() === "REPAIR";
+ });
+ },
+ isDriverSideReplace() {
+ if (!this.isSideDoorDamageLocation) return false;
+
+ return this.sideDoorOptionsData.selectedDoorSides.some(selectedDriverSide =>
+ {
+ return selectedDriverSide.toUpperCase() === damageLocationsCms.DRIVERSIDE;
+ });
+ },
+ isPassengerSideReplace() {
+ if (!this.isSideDoorDamageLocation) return false;
+
+ return this.sideDoorOptionsData.selectedDoorSides.some(selectedPassengerSide =>
+ {
+ return selectedPassengerSide.toUpperCase() === damageLocationsCms.PASSENGERSIDE;
+ });
+ },
+ hasRepairReplaceConflict() {
+ return this.isWindshieldDamageLocation && this.selectedDamageLocations.length > 1 && this.isWindshieldRepair;
+ },
+ },
+ components: {
+ funnelHeader,
+ funnelFooter,
+ vehicleBanner,
+ funnelSubHeader,
+ sideDoorOptions,
+ damageLocationQuestion,
+ windshieldOptions,
+ replaceOptionsQuestion,
+ Form,
+ alert,
+ },
};