diff --git a/src/Spd.Presentation.Licensing/ClientApp/src/app/core/services/business-application.helper.ts b/src/Spd.Presentation.Licensing/ClientApp/src/app/core/services/business-application.helper.ts
index d840830e0..52ab51f86 100644
--- a/src/Spd.Presentation.Licensing/ClientApp/src/app/core/services/business-application.helper.ts
+++ b/src/Spd.Presentation.Licensing/ClientApp/src/app/core/services/business-application.helper.ts
@@ -269,14 +269,14 @@ export abstract class BusinessApplicationHelper extends ApplicationHelper {
postalCode: new FormControl('', [FormControlValidators.required]),
province: new FormControl('', [
FormControlValidators.required,
- FormControlValidators.requiredValue(SPD_CONSTANTS.address.provinceBC),
- FormControlValidators.requiredValue(SPD_CONSTANTS.address.provinceBritishColumbia),
+ FormControlValidators.requiredValue(
+ SPD_CONSTANTS.address.provinceBC,
+ SPD_CONSTANTS.address.provinceBritishColumbia
+ ),
]),
country: new FormControl('', [
FormControlValidators.required,
- FormControlValidators.requiredValue(SPD_CONSTANTS.address.countryCA),
- FormControlValidators.required,
- FormControlValidators.requiredValue(SPD_CONSTANTS.address.countryCanada),
+ FormControlValidators.requiredValue(SPD_CONSTANTS.address.countryCA, SPD_CONSTANTS.address.countryCanada),
]),
});
@@ -320,10 +320,15 @@ export abstract class BusinessApplicationHelper extends ApplicationHelper {
postalCode: new FormControl('', [FormControlValidators.required]),
province: new FormControl('', [
FormControlValidators.required,
- FormControlValidators.requiredValue(SPD_CONSTANTS.address.provinceBC),
- FormControlValidators.requiredValue(SPD_CONSTANTS.address.provinceBritishColumbia),
+ FormControlValidators.requiredValue(
+ SPD_CONSTANTS.address.provinceBC,
+ SPD_CONSTANTS.address.provinceBritishColumbia
+ ),
+ ]),
+ country: new FormControl('', [
+ FormControlValidators.required,
+ FormControlValidators.requiredValue(SPD_CONSTANTS.address.countryCA, SPD_CONSTANTS.address.countryCanada),
]),
- country: new FormControl('', [FormControlValidators.required, FormControlValidators.requiredValue('Canada')]),
branchManager: new FormControl('', [FormControlValidators.required]),
branchPhoneNumber: new FormControl(''),
branchEmailAddr: new FormControl('', [FormControlValidators.email]),
diff --git a/src/Spd.Presentation.Licensing/ClientApp/src/app/core/validators/form-control.validators.ts b/src/Spd.Presentation.Licensing/ClientApp/src/app/core/validators/form-control.validators.ts
index c03ad87ab..045dcc53d 100644
--- a/src/Spd.Presentation.Licensing/ClientApp/src/app/core/validators/form-control.validators.ts
+++ b/src/Spd.Presentation.Licensing/ClientApp/src/app/core/validators/form-control.validators.ts
@@ -107,7 +107,7 @@ export class FormControlValidators {
* @description
* Checks the form control must have a specific value.
*/
- public static requiredValue(matchValue: string): ValidatorFn {
+ public static requiredValue(matchValue: string, otherMatchValue: string | null = null): ValidatorFn {
return (control: AbstractControl): ValidationErrors | null => {
if (!control.value) {
return null;
@@ -115,7 +115,10 @@ export class FormControlValidators {
if (!matchValue) {
return null;
}
- const valid = control.valid && control.value === matchValue;
+ let valid = control.valid && control.value === matchValue;
+ if (otherMatchValue && !valid) {
+ valid = control.valid && control.value === otherMatchValue;
+ }
return valid ? null : { requiredValue: true };
};
}
diff --git a/src/Spd.Presentation.Licensing/ClientApp/src/app/shared/components/address.component.ts b/src/Spd.Presentation.Licensing/ClientApp/src/app/shared/components/address.component.ts
index 2f25294ba..dd4d5675d 100644
--- a/src/Spd.Presentation.Licensing/ClientApp/src/app/shared/components/address.component.ts
+++ b/src/Spd.Presentation.Licensing/ClientApp/src/app/shared/components/address.component.ts
@@ -69,7 +69,7 @@ import { Address } from './address-autocomplete.component';
This is required
This must be '{{ provinceOfBC }}'This must be '{{ provinceOfBC }}' or '{{ provinceBritishColumbia }}'
@@ -78,7 +78,9 @@ import { Address } from './address-autocomplete.component';
Country
This is required
- This must be 'Canada'
+ This must be '{{ countryCA }}' or '{{ countryCanada }}'
@@ -89,7 +91,11 @@ import { Address } from './address-autocomplete.component';
})
export class AddressComponent implements OnInit {
matcher = new FormErrorStateMatcher();
+
provinceOfBC = SPD_CONSTANTS.address.provinceBC;
+ provinceBritishColumbia = SPD_CONSTANTS.address.provinceBritishColumbia;
+ countryCA = SPD_CONSTANTS.address.countryCA;
+ countryCanada = SPD_CONSTANTS.address.countryCanada;
@Input() form!: FormGroup;
@Input() isWideView = false;