diff --git a/src/common-components/button-question/button-question.vue b/src/common-components/button-question/button-question.vue
index 80c02af69..b46d933c0 100644
--- a/src/common-components/button-question/button-question.vue
+++ b/src/common-components/button-question/button-question.vue
@@ -37,8 +37,8 @@
-
@@ -133,6 +133,7 @@ export default {
if(this.isMultiSelect && this.selectedValues) {
// Add or remove item to array of data to emit
const newSelectedValues = this.selectedValues;
+
if(Array.isArray(this.selectedValues)) {
val.checkValue ? newSelectedValues.push(val.value) : newSelectedValues.splice(newSelectedValues.indexOf(val.value), 1);
this.selectedValues = newSelectedValues;
diff --git a/src/layouts/vehicle-damage/replace-options-question/replace-options-question.vue b/src/layouts/vehicle-damage/replace-options-question/replace-options-question.vue
index cdbb0c48d..fe43419e8 100644
--- a/src/layouts/vehicle-damage/replace-options-question/replace-options-question.vue
+++ b/src/layouts/vehicle-damage/replace-options-question/replace-options-question.vue
@@ -10,6 +10,7 @@
buttonType="listCard"
v-model="selectedValues"
:validationRules="validationRules"
+ :suppressError="suppressError"
/>
@@ -35,6 +36,7 @@ export default ({
modelValue: Array,
isMultiSelect: Boolean,
validationRules: String,
+ suppressError: Boolean,
},
methods: {
initializeComponent(cmsContent, replaceOptions){
diff --git a/src/layouts/vehicle-damage/vehicle-damage.vue b/src/layouts/vehicle-damage/vehicle-damage.vue
index 0eb11fbf0..20c498198 100644
--- a/src/layouts/vehicle-damage/vehicle-damage.vue
+++ b/src/layouts/vehicle-damage/vehicle-damage.vue
@@ -19,6 +19,7 @@
ref="windshieldOptions"
v-model="selectedWindshieldOptions"
:hasRepairReplaceConflict="hasRepairReplaceConflict"
+ :hasSplitSingleConflict="hasSplitSingleConflict"
:selectedDamageLocations="selectedDamageLocations"
/>
1 && this.isWindshieldRepair;
},
+ hasSplitSingleConflict() {
+ if (!this.selectedWindshieldOptions.selectedWindshieldReplaceOptions) return false;
+
+ return this.selectedWindshieldOptions.selectedWindshieldReplaceOptions.some(selectedSingleWindshield =>
+ {
+ return selectedSingleWindshield.toUpperCase() === damageLocationsSelected.SINGLE.toUpperCase();
+ }) &&
+ (this.selectedWindshieldOptions.selectedWindshieldReplaceOptions.some(selectedDriverWindshield =>
+ {
+ return selectedDriverWindshield.toUpperCase() === damageLocationsSelected.DRIVER.toUpperCase();
+ }) ||
+ this.selectedWindshieldOptions.selectedWindshieldReplaceOptions.some(selectedPassengerWindshield =>
+ {
+ return selectedPassengerWindshield.toUpperCase() === damageLocationsSelected.PASSENGER.toUpperCase();
+ })
+ );
+ },
},
components: {
diff --git a/src/layouts/vehicle-damage/windshield-options/windshield-options.vue b/src/layouts/vehicle-damage/windshield-options/windshield-options.vue
index c1539e91a..21f4e6f33 100644
--- a/src/layouts/vehicle-damage/windshield-options/windshield-options.vue
+++ b/src/layouts/vehicle-damage/windshield-options/windshield-options.vue
@@ -2,14 +2,17 @@
+ isSplitWindshieldOption: {{isSplitWindshieldOption}}
+
+ isWindshieldReplaceAvailable: {{isWindshieldReplaceAvailable}}
+
@@ -53,17 +65,25 @@ defineRule("checkForRepairAndReplace", (value, [otherFieldValue]) => {
Array.isArray(otherFieldValue) &&
otherFieldValue.length > 1)
{
- return "checkForRepairAndReplace error"
+ return false;
}
return true;
});
-
defineRule("repairOnly", (value) => {
if (value.toString().toUpperCase() === damageLocationsSelected.REPAIR.toUpperCase()) {
return true;
}
return false;
});
+defineRule("preventSplitAndSingleTogether", (value) => {
+ if (value.toString().toUpperCase().includes(damageLocationsSelected.SINGLE.toUpperCase()) &&
+ (value.toString().toUpperCase().includes(damageLocationsSelected.DRIVER.toUpperCase()) ||
+ value.toString().toUpperCase().includes(damageLocationsSelected.PASSENGER.toUpperCase())))
+ {
+ return false;
+ }
+ return true;
+});
export default ({
name: "windshieldOptions",
@@ -77,7 +97,8 @@ export default ({
props: {
modelValue: Array,
selectedDamageLocations: Array,
- hasRepairReplaceConflict: Boolean
+ hasRepairReplaceConflict: Boolean,
+ hasSplitSingleConflict: Boolean,
},
methods: {
@@ -151,12 +172,28 @@ export default ({
isWindshieldReplaceAvailable() {
return !(Array.isArray(this.windshieldAvailableReplacementOptions) && this.windshieldAvailableReplacementOptions.length < 1);
},
- showNoReplaceAvailableError() {
+ isSplitWindshieldOption() {
+ const options = this.windshieldAvailableReplacementOptions.toString().toUpperCase();
+ if (options.includes('DRIVER') && options.includes('PASSENGER')) {
+ return true;
+ }
+ return false;
+ },
+ showNoReplacementAvailableError() {
if (this.isReplaceOptionSelected && !this.isWindshieldReplaceAvailable) {
return true;
}
return false;
},
+ windshieldDamageTypeQuestionValidationRules() {
+ // Note: the validation rules string is not dynamic (it cannot be changed once component has been created)
+ let validationRules = "windshield-damage-type-required|checkForRepairAndReplace:@DamageLocationQuestion";
+ // if vehicle has no windshield replacement option
+ if (!this.isWindshieldReplaceAvailable) {
+ validationRules = validationRules.concat('|repairOnly');
+ }
+ return validationRules;
+ }
},
components: {
windshieldDamageTypeQuestion,