CSR-715 Add check-for-repair-and-replace validation back in
This commit is contained in:
parent
ba1764b9e6
commit
15718a6403
3 changed files with 9 additions and 4 deletions
|
|
@ -383,7 +383,7 @@ export default {
|
||||||
return this.isWindshieldDamageLocation && this.selectedDamageLocations.length > 1 && this.isWindshieldRepair;
|
return this.isWindshieldDamageLocation && this.selectedDamageLocations.length > 1 && this.isWindshieldRepair;
|
||||||
},
|
},
|
||||||
hasSplitSingleConflict() {
|
hasSplitSingleConflict() {
|
||||||
if (!this.selectedDamageLocations?.includes("Windshield") || this.selectedWindshieldOptions.selectedWindshieldDamageType?.toUpperCase() === damageLocationsSelected.REPAIR || !this.selectedWindshieldOptions.selectedWindshieldReplaceOptions) return false;
|
if (!this.selectedDamageLocations?.includes("Windshield") || this.selectedWindshieldOptions.selectedWindshieldDamageType?.toUpperCase() === damageLocationsSelected.REPAIR.toUpperCase() || !this.selectedWindshieldOptions.selectedWindshieldReplaceOptions) return false;
|
||||||
|
|
||||||
return this.selectedWindshieldOptions.selectedWindshieldReplaceOptions.some(selectedSingleWindshield =>
|
return this.selectedWindshieldOptions.selectedWindshieldReplaceOptions.some(selectedSingleWindshield =>
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,11 @@ defineRule("windshield-damage-type-required", required(errorMessages.WINDSHIELD_
|
||||||
defineRule("windshield-chip-count-required", required(errorMessages.WINDSHIELD_CHIP_COUNT_REQUIRED));
|
defineRule("windshield-chip-count-required", required(errorMessages.WINDSHIELD_CHIP_COUNT_REQUIRED));
|
||||||
defineRule("windshield-replace-options-required", required(errorMessages.WINSHIELD_REPLACE_OPTIONS_REQUIRED));
|
defineRule("windshield-replace-options-required", required(errorMessages.WINSHIELD_REPLACE_OPTIONS_REQUIRED));
|
||||||
|
|
||||||
|
defineRule("check-for-repair-and-replace", (selectedWindshieldDamageType, [selectedDamageLocations]) => {
|
||||||
|
return selectedWindshieldDamageType.toString() != damageLocationsSelected.REPAIR ||
|
||||||
|
!selectedDamageLocations.includes(damageLocationsSelected.WINDSHIELD) ||
|
||||||
|
selectedDamageLocations.length === 1;
|
||||||
|
});
|
||||||
defineRule("repair-only", (value) => {
|
defineRule("repair-only", (value) => {
|
||||||
return value.toString().toUpperCase() === damageLocationsSelected.REPAIR.toUpperCase();
|
return value.toString().toUpperCase() === damageLocationsSelected.REPAIR.toUpperCase();
|
||||||
});
|
});
|
||||||
|
|
@ -165,7 +170,7 @@ export default ({
|
||||||
},
|
},
|
||||||
windshieldDamageTypeQuestionValidationRules() {
|
windshieldDamageTypeQuestionValidationRules() {
|
||||||
// Note: the validation rules string is not dynamic (it cannot be changed once component has been created)
|
// Note: the validation rules string is not dynamic (it cannot be changed once component has been created)
|
||||||
let validationRules = "windshield-damage-type-required";
|
let validationRules = "windshield-damage-type-required|check-for-repair-and-replace:@DamageLocationQuestion";
|
||||||
// if vehicle has no windshield replacement option
|
// if vehicle has no windshield replacement option
|
||||||
if (!this.isWindshieldReplaceAvailable) {
|
if (!this.isWindshieldReplaceAvailable) {
|
||||||
validationRules = validationRules.concat('|repair-only');
|
validationRules = validationRules.concat('|repair-only');
|
||||||
|
|
|
||||||
|
|
@ -134,7 +134,7 @@ export default {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
handleInputChange(x) {
|
handleInputChange() {
|
||||||
if(!this.selectingInitiatesLoad) {
|
if(!this.selectingInitiatesLoad) {
|
||||||
this.handleCheckChange();
|
this.handleCheckChange();
|
||||||
}
|
}
|
||||||
|
|
@ -149,7 +149,7 @@ export default {
|
||||||
}
|
}
|
||||||
this.handleChange(this.value);
|
this.handleChange(this.value);
|
||||||
},
|
},
|
||||||
triggerButton(x) {
|
triggerButton() {
|
||||||
if(this.selectingInitiatesLoad) {
|
if(this.selectingInitiatesLoad) {
|
||||||
this.displayLoader();
|
this.displayLoader();
|
||||||
this.handleCheckChange();
|
this.handleCheckChange();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue