From 453121e8be4747630fc88a972dae3ad9a6d628f0 Mon Sep 17 00:00:00 2001 From: leodube-aot Date: Tue, 19 Dec 2023 14:16:37 -0600 Subject: [PATCH 01/11] Update mras corp number rules --- .../Amalgamation/AmalgamatingBusinesses.vue | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/components/Amalgamation/AmalgamatingBusinesses.vue b/src/components/Amalgamation/AmalgamatingBusinesses.vue index b537f029d..cbb54c4c3 100644 --- a/src/components/Amalgamation/AmalgamatingBusinesses.vue +++ b/src/components/Amalgamation/AmalgamatingBusinesses.vue @@ -238,11 +238,26 @@ export default class AmalgamatingBusinesses extends Mixins(AmalgamationMixin, Co /** TextField rules for "Add an Amalgamating Foreign Business" Panel. */ get foreignBusinessLegalNameRules (): Array<(v) => boolean | string> { - return [ v => !!v || 'Full legal name is required' ] + return [ + v => !!v || 'Full legal name is required', + v => (!v || v.length <= 3) || 'Must be at least 3 characters', + v => (!v || v.length >= 150) || 'Cannot exceed 40 characters' + ] } get foreignBusinessCorpNumberRules (): Array<(v) => boolean | string> { - return [ v => !!v || 'Corporate number is required' ] + return [ + v => (!v && this.isMrasJurisdiction && /^[0-9a-zA-Z-]+$/.test(v)) || + 'Corporate number is required', + v => (!v || v.length <= 3) || 'Must be at least 3 characters', + v => (!v || v.length >= 40) || 'Cannot exceed 40 characters' + ] + } + + get isMrasJurisdiction (): boolean { + return ['AB', 'MB', 'NS', 'ON', 'QC', 'SK'].includes( + this.jurisdiction.value + ) } /** Called when Jurisdiction menu item is changed. */ From ac2d16f7c43e8297dd8386bbf87a692c98b68679 Mon Sep 17 00:00:00 2001 From: leodube-aot Date: Tue, 19 Dec 2023 14:36:43 -0600 Subject: [PATCH 02/11] Add test code --- src/components/Amalgamation/AmalgamatingBusinesses.vue | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/Amalgamation/AmalgamatingBusinesses.vue b/src/components/Amalgamation/AmalgamatingBusinesses.vue index cbb54c4c3..9bcfe4056 100644 --- a/src/components/Amalgamation/AmalgamatingBusinesses.vue +++ b/src/components/Amalgamation/AmalgamatingBusinesses.vue @@ -13,7 +13,6 @@ Date: Tue, 19 Dec 2023 14:56:48 -0600 Subject: [PATCH 03/11] Fix foreign jurisdiction validations --- .../Amalgamation/AmalgamatingBusinesses.vue | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/components/Amalgamation/AmalgamatingBusinesses.vue b/src/components/Amalgamation/AmalgamatingBusinesses.vue index 9bcfe4056..af4b6dab3 100644 --- a/src/components/Amalgamation/AmalgamatingBusinesses.vue +++ b/src/components/Amalgamation/AmalgamatingBusinesses.vue @@ -239,22 +239,22 @@ export default class AmalgamatingBusinesses extends Mixins(AmalgamationMixin, Co get foreignBusinessLegalNameRules (): Array<(v) => boolean | string> { return [ v => !!v || 'Full legal name is required', - v => (!v || v.length <= 3) || 'Must be at least 3 characters', - v => (!v || v.length >= 150) || 'Cannot exceed 40 characters' + v => (!v || v.length >= 3) || 'Must be at least 3 characters', + v => (!v || v.length <= 150) || 'Cannot exceed 40 characters' ] } get foreignBusinessCorpNumberRules (): Array<(v) => boolean | string> { return [ - v => (!v && this.isMrasJurisdiction && /^[0-9a-zA-Z-]+$/.test(v)) || + v => ((!!v && this.isMrasJurisdiction) || /^[0-9a-zA-Z-]+$/.test(v)) || 'Corporate number is required', - v => (!v || v.length <= 3) || 'Must be at least 3 characters', - v => (!v || v.length >= 40) || 'Cannot exceed 40 characters' + v => (!v || v.length >= 3) || 'Must be at least 3 characters', + v => (!v || v.length <= 40) || 'Cannot exceed 40 characters' ] } get isMrasJurisdiction (): boolean { - return ['AB', 'MB', 'NS', 'ON', 'QC', 'SK'].includes( + return !!this.jurisdiction && ['AB', 'MB', 'NS', 'ON', 'QC', 'SK'].includes( this.jurisdiction.value ) } From a258a923c1fefdcb63bebce81192bf1967583452 Mon Sep 17 00:00:00 2001 From: leodube-aot Date: Tue, 19 Dec 2023 15:21:42 -0600 Subject: [PATCH 04/11] Corp Number only required if Mras --- src/components/Amalgamation/AmalgamatingBusinesses.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/Amalgamation/AmalgamatingBusinesses.vue b/src/components/Amalgamation/AmalgamatingBusinesses.vue index af4b6dab3..60bfc5e16 100644 --- a/src/components/Amalgamation/AmalgamatingBusinesses.vue +++ b/src/components/Amalgamation/AmalgamatingBusinesses.vue @@ -13,6 +13,7 @@ boolean | string> { return [ - v => ((!!v && this.isMrasJurisdiction) || /^[0-9a-zA-Z-]+$/.test(v)) || - 'Corporate number is required', + v => /^[0-9a-zA-Z-]+$/.test(v) || 'Corporate number is required', v => (!v || v.length >= 3) || 'Must be at least 3 characters', v => (!v || v.length <= 40) || 'Cannot exceed 40 characters' ] From 0d3cf7ac37d2ea0ed02d919c838bff5e4b3f73f7 Mon Sep 17 00:00:00 2001 From: leodube-aot Date: Wed, 20 Dec 2023 09:56:27 -0600 Subject: [PATCH 05/11] Update validation on jurisdiction change --- .../Amalgamation/AmalgamatingBusinesses.vue | 32 +++++++++++-------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/src/components/Amalgamation/AmalgamatingBusinesses.vue b/src/components/Amalgamation/AmalgamatingBusinesses.vue index 60bfc5e16..51da8a548 100644 --- a/src/components/Amalgamation/AmalgamatingBusinesses.vue +++ b/src/components/Amalgamation/AmalgamatingBusinesses.vue @@ -125,7 +125,7 @@ v-model="corpNumber" filled label="Corporate number in home jurisdiction" - :rules="isMrasJurisdiction ? foreignBusinessCorpNumberRules : []" + :rules="foreignBusinessCorpNumberRules" /> boolean | string> { return [ - v => /^[0-9a-zA-Z-]+$/.test(v) || 'Corporate number is required', + v => (!this.isMrasJurisdiction || (!!v && /^[0-9a-zA-Z-]+$/.test(v))) || + 'Corporate number is required', v => (!v || v.length >= 3) || 'Must be at least 3 characters', v => (!v || v.length <= 40) || 'Cannot exceed 40 characters' ] } - get isMrasJurisdiction (): boolean { - return !!this.jurisdiction && ['AB', 'MB', 'NS', 'ON', 'QC', 'SK'].includes( - this.jurisdiction.value - ) - } - /** Called when Jurisdiction menu item is changed. */ onJurisdictionChange (jurisdiction: any): void { this.jurisdiction = jurisdiction this.isCan = jurisdiction.group === 0 - this.jurisdictionErrorMessage = this.jurisdiction ? '' : 'Required.' + this.jurisdictionErrorMessage = this.jurisdiction ? '' : 'Home jurisdiction is required' + this.isMrasJurisdiction = ['AB', 'MB', 'NS', 'ON', 'QC', 'SK'].includes( + this.jurisdiction.value + ) + + // Update validation on jurisdiction change + if (this.isForeignBusinessValid != null) { + this.validateAddAmalgamatingForeignBusiness() + } } async saveAmalgamatingBusiness (businessLookup: BusinessLookupResultIF): Promise { @@ -378,9 +382,9 @@ export default class AmalgamatingBusinesses extends Mixins(AmalgamationMixin, Co /** Validate Add Amalgamating Foreign Business. */ validateAddAmalgamatingForeignBusiness (): void { this.isForeignBusinessValid = ( - this.jurisdiction && - this.legalName && - this.corpNumber + !!this.jurisdiction && + !!this.legalName && + (!this.isMrasJurisdiction || !!this.corpNumber) ) this.jurisdictionErrorMessage = this.jurisdiction ? '' : 'Home jurisdiction is required' this.$refs.foreignBusinessForm.validate() @@ -398,10 +402,12 @@ export default class AmalgamatingBusinesses extends Mixins(AmalgamationMixin, Co ) // Reset "Add an Amalgamating Foreign Business" Panel on change + this.isForeignBusinessValid = null this.jurisdiction = null this.legalName = null this.corpNumber = null this.jurisdictionErrorMessage = '' + this.isMrasJurisdiction = false } } From d730f8abe6776165e7b6e9b4fac57923e5492915 Mon Sep 17 00:00:00 2001 From: leodube-aot Date: Wed, 20 Dec 2023 09:58:27 -0600 Subject: [PATCH 06/11] Update isForeignBusinessValid --- src/components/Amalgamation/AmalgamatingBusinesses.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/Amalgamation/AmalgamatingBusinesses.vue b/src/components/Amalgamation/AmalgamatingBusinesses.vue index 51da8a548..8bc14110a 100644 --- a/src/components/Amalgamation/AmalgamatingBusinesses.vue +++ b/src/components/Amalgamation/AmalgamatingBusinesses.vue @@ -382,9 +382,9 @@ export default class AmalgamatingBusinesses extends Mixins(AmalgamationMixin, Co /** Validate Add Amalgamating Foreign Business. */ validateAddAmalgamatingForeignBusiness (): void { this.isForeignBusinessValid = ( - !!this.jurisdiction && - !!this.legalName && - (!this.isMrasJurisdiction || !!this.corpNumber) + this.jurisdiction && + this.legalName && + (!this.isMrasJurisdiction || this.corpNumber) ) this.jurisdictionErrorMessage = this.jurisdiction ? '' : 'Home jurisdiction is required' this.$refs.foreignBusinessForm.validate() From 7087d237163a8b71d4201ca9e8da199491ef6b9d Mon Sep 17 00:00:00 2001 From: leodube-aot Date: Wed, 20 Dec 2023 11:12:02 -0600 Subject: [PATCH 07/11] Fix typo --- src/components/Amalgamation/AmalgamatingBusinesses.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Amalgamation/AmalgamatingBusinesses.vue b/src/components/Amalgamation/AmalgamatingBusinesses.vue index 8bc14110a..cd4ad15d0 100644 --- a/src/components/Amalgamation/AmalgamatingBusinesses.vue +++ b/src/components/Amalgamation/AmalgamatingBusinesses.vue @@ -242,7 +242,7 @@ export default class AmalgamatingBusinesses extends Mixins(AmalgamationMixin, Co return [ v => !!v || 'Full legal name is required', v => (!v || v.length >= 3) || 'Must be at least 3 characters', - v => (!v || v.length <= 150) || 'Cannot exceed 40 characters' + v => (!v || v.length <= 150) || 'Cannot exceed 150 characters' ] } From b81fd1835cf8207d20fba959a2dcf1898f22d0bb Mon Sep 17 00:00:00 2001 From: leodube-aot Date: Wed, 20 Dec 2023 11:29:10 -0600 Subject: [PATCH 08/11] Use common Mras list --- .../Amalgamation/AmalgamatingBusinesses.vue | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/components/Amalgamation/AmalgamatingBusinesses.vue b/src/components/Amalgamation/AmalgamatingBusinesses.vue index cd4ad15d0..6d7d55cf9 100644 --- a/src/components/Amalgamation/AmalgamatingBusinesses.vue +++ b/src/components/Amalgamation/AmalgamatingBusinesses.vue @@ -190,6 +190,7 @@ import { AmalgamationMixin, CommonMixin } from '@/mixins' import { BusinessLookupServices } from '@/services' import { BusinessLookup } from '@bcrs-shared-components/business-lookup' import { Jurisdiction } from '@bcrs-shared-components/jurisdiction' +import { MrasJurisdictions } from '@bcrs-shared-components/jurisdiction/list-data' import { AmalgamatingBusinessIF, BusinessLookupResultIF, EmptyBusinessLookup } from '@/interfaces' import { AmlRoles, AmlTypes, EntityStates } from '@/enums' import { JurisdictionLocation } from '@bcrs-shared-components/enums' @@ -260,8 +261,8 @@ export default class AmalgamatingBusinesses extends Mixins(AmalgamationMixin, Co this.jurisdiction = jurisdiction this.isCan = jurisdiction.group === 0 this.jurisdictionErrorMessage = this.jurisdiction ? '' : 'Home jurisdiction is required' - this.isMrasJurisdiction = ['AB', 'MB', 'NS', 'ON', 'QC', 'SK'].includes( - this.jurisdiction.value + this.isMrasJurisdiction = MrasJurisdictions.includes( + this.jurisdiction.text.toLowerCase() ) // Update validation on jurisdiction change @@ -382,9 +383,9 @@ export default class AmalgamatingBusinesses extends Mixins(AmalgamationMixin, Co /** Validate Add Amalgamating Foreign Business. */ validateAddAmalgamatingForeignBusiness (): void { this.isForeignBusinessValid = ( - this.jurisdiction && - this.legalName && - (!this.isMrasJurisdiction || this.corpNumber) + !!this.jurisdiction && + !!this.legalName && + (!this.isMrasJurisdiction || !!this.corpNumber) ) this.jurisdictionErrorMessage = this.jurisdiction ? '' : 'Home jurisdiction is required' this.$refs.foreignBusinessForm.validate() From 3e23c358084a5391f6e0375d85779099e068910f Mon Sep 17 00:00:00 2001 From: leodube-aot Date: Wed, 20 Dec 2023 12:23:00 -0600 Subject: [PATCH 09/11] Add comments to foreign business validation --- src/components/Amalgamation/AmalgamatingBusinesses.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/Amalgamation/AmalgamatingBusinesses.vue b/src/components/Amalgamation/AmalgamatingBusinesses.vue index 6d7d55cf9..0084c1fb4 100644 --- a/src/components/Amalgamation/AmalgamatingBusinesses.vue +++ b/src/components/Amalgamation/AmalgamatingBusinesses.vue @@ -230,9 +230,10 @@ export default class AmalgamatingBusinesses extends Mixins(AmalgamationMixin, Co legalName = null corpNumber = null isCan = false - isForeignBusinessValid = null isMrasJurisdiction = false jurisdictionErrorMessage = '' + // Null for no validation, false for invalid, true for valid + isForeignBusinessValid = null // Button properties isAddingAmalgamatingBusiness = false From 08eee58731e19f9d04aeb99aca484b968ad4dc30 Mon Sep 17 00:00:00 2001 From: leodube-aot Date: Wed, 20 Dec 2023 12:23:30 -0600 Subject: [PATCH 10/11] Update != to !== --- src/components/Amalgamation/AmalgamatingBusinesses.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Amalgamation/AmalgamatingBusinesses.vue b/src/components/Amalgamation/AmalgamatingBusinesses.vue index 0084c1fb4..ee633a13b 100644 --- a/src/components/Amalgamation/AmalgamatingBusinesses.vue +++ b/src/components/Amalgamation/AmalgamatingBusinesses.vue @@ -267,7 +267,7 @@ export default class AmalgamatingBusinesses extends Mixins(AmalgamationMixin, Co ) // Update validation on jurisdiction change - if (this.isForeignBusinessValid != null) { + if (this.isForeignBusinessValid !== null) { this.validateAddAmalgamatingForeignBusiness() } } From dfebc731e43ae4ede860024515fc5eb876a1afbd Mon Sep 17 00:00:00 2001 From: leodube-aot Date: Wed, 20 Dec 2023 12:30:56 -0600 Subject: [PATCH 11/11] Update version to 5.6.17 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 74f788b4d..103c88518 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "business-create-ui", - "version": "5.6.16", + "version": "5.6.17", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "business-create-ui", - "version": "5.6.16", + "version": "5.6.17", "dependencies": { "@babel/compat-data": "^7.21.5", "@bcrs-shared-components/approval-type": "1.0.19", diff --git a/package.json b/package.json index cb740ccb7..0be6c0d4c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "business-create-ui", - "version": "5.6.16", + "version": "5.6.17", "private": true, "appName": "Create UI", "sbcName": "SBC Common Components",