diff --git a/package-lock.json b/package-lock.json index f1782f8fd..a17395140 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "business-create-ui", - "version": "5.6.19", + "version": "5.6.20", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "business-create-ui", - "version": "5.6.19", + "version": "5.6.20", "dependencies": { "@babel/compat-data": "^7.21.5", "@bcrs-shared-components/approval-type": "1.0.19", diff --git a/package.json b/package.json index ed648f6d5..8ee0345e6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "business-create-ui", - "version": "5.6.19", + "version": "5.6.20", "private": true, "appName": "Create UI", "sbcName": "SBC Common Components", diff --git a/src/components/Amalgamation/AmalgamatingBusinesses.vue b/src/components/Amalgamation/AmalgamatingBusinesses.vue index 7590b9a53..6480d7760 100644 --- a/src/components/Amalgamation/AmalgamatingBusinesses.vue +++ b/src/components/Amalgamation/AmalgamatingBusinesses.vue @@ -190,7 +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 { CanJurisdictions, 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' @@ -276,6 +276,40 @@ export default class AmalgamatingBusinesses extends Mixins(AmalgamationMixin, Co // Show spinner since the network calls below can take a few seconds. this.$root.$emit('showSpinner', true) + // Special case to handle Extra-pro A companies + if ((businessLookup.legalType as any) === CorpTypeCd.EXTRA_PRO_A) { + const region = CanJurisdictions.find(jurisdiction => jurisdiction.value === JurisdictionLocation.BC) + const tingBusiness = { + type: AmlTypes.FOREIGN, + role: AmlRoles.AMALGAMATING, + foreignJurisdiction: { + region: region.text, + country: JurisdictionLocation.CA + }, + legalName: businessLookup.name, + corpNumber: businessLookup.identifier + } as AmalgamatingBusinessIF + + // Check for duplicate + if (this.checkForDuplicateInTable(tingBusiness)) { + this.snackbarText = 'Business is already in table.' + this.snackbar = true + + // Hide spinner. + this.$root.$emit('showSpinner', false) + + return + } + + this.pushAmalgamatingBusiness(tingBusiness) + // Close the "Add an Amalgamating Business" panel. + this.isAddingAmalgamatingBusiness = false + // Hide spinner. + this.$root.$emit('showSpinner', false) + + return + } + // Get the business information const business = await this.fetchAmalgamatingBusinessInfo(businessLookup) @@ -322,7 +356,7 @@ export default class AmalgamatingBusinesses extends Mixins(AmalgamationMixin, Co } // Check for duplicate. - if (this.getAmalgamatingBusinesses.find((b: any) => b.identifier === business.businessInfo.identifier)) { + if (this.checkForDuplicateInTable(business)) { this.snackbarText = 'Business is already in table.' this.snackbar = true @@ -381,6 +415,20 @@ export default class AmalgamatingBusinesses extends Mixins(AmalgamationMixin, Co this.isAddingAmalgamatingForeignBusiness = false } + /** + * Check if business is already in table. + * @param business The business being added. + */ + checkForDuplicateInTable (business: any): boolean { + const checkDuplication = this.getAmalgamatingBusinesses.find((b: any) => + (business.type === AmlTypes.LEAR && b.identifier === business.businessInfo.identifier) || + (business.type === AmlTypes.FOREIGN && b.corpNumber === business.corpNumber) + ) + + if (checkDuplication) return true + return false + } + /** Validate Add Amalgamating Foreign Business. */ validateAddAmalgamatingForeignBusiness (): void { this.isForeignBusinessValid = ( diff --git a/src/mixins/amalgamation-mixin.ts b/src/mixins/amalgamation-mixin.ts index 7d4b71ccb..084b15637 100644 --- a/src/mixins/amalgamation-mixin.ts +++ b/src/mixins/amalgamation-mixin.ts @@ -88,9 +88,6 @@ export default class AmalgamationMixin extends Vue { if (!this.isRoleStaff && business.type === AmlTypes.FOREIGN) { return AmlStatuses.ERROR_FOREIGN } - if (!this.isRoleStaff && business.type === AmlTypes.LEAR && business.legalType === CorpTypeCd.EXTRA_PRO_A) { - return AmlStatuses.ERROR_FOREIGN - } return null } @@ -121,8 +118,7 @@ export default class AmalgamationMixin extends Vue { /** Disallow extra-pro (A company) into ULC or CCC. */ xproUlcCcc (business: AmalgamatingBusinessIF): AmlStatuses { if ( - business.type === AmlTypes.LEAR && - business.legalType === CorpTypeCd.EXTRA_PRO_A && + business.type === AmlTypes.FOREIGN && (!this.isTypeBcUlcCompany || !this.isTypeBcCcc) ) { return AmlStatuses.ERROR_XPRO_ULC_CCC @@ -250,15 +246,6 @@ export default class AmalgamationMixin extends Vue { return this.getAmalgamatingBusinesses.every(business => (business.type === AmlTypes.FOREIGN)) } - /** True if all companies in the table are foreign or extra-provincial. */ - get isAllForeignOrEp (): boolean { - return this.getAmalgamatingBusinesses.every(business => - (business.type === AmlTypes.FOREIGN || - (business.type === AmlTypes.LEAR && business.legalType === CorpTypeCd.EXTRA_PRO_A) - ) - ) - } - /** True if there a foreign company in the table. */ get isAnyForeign (): boolean { return this.getAmalgamatingBusinesses.some(business => (business.type === AmlTypes.FOREIGN))