diff --git a/package-lock.json b/package-lock.json index 4f2c21def..e0262e8e4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "business-create-ui", - "version": "5.6.12", + "version": "5.6.14", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "business-create-ui", - "version": "5.6.12", + "version": "5.6.14", "dependencies": { "@babel/compat-data": "^7.21.5", "@bcrs-shared-components/approval-type": "1.0.19", diff --git a/package.json b/package.json index 5c35b393f..900f2cc11 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "business-create-ui", - "version": "5.6.12", + "version": "5.6.14", "private": true, "appName": "Create UI", "sbcName": "SBC Common Components", diff --git a/src/assets/styles/base.scss b/src/assets/styles/base.scss index eee3cfb7b..52951d9ab 100644 --- a/src/assets/styles/base.scss +++ b/src/assets/styles/base.scss @@ -299,6 +299,11 @@ p { border-bottom: 1px dotted; } +.text-decoration-dotted-underline { + text-decoration-style: dotted; + text-decoration-line: underline; +} + .section-container { font-size: $px-16; color: $gray7; diff --git a/src/components/Amalgamation/BusinessStatus.vue b/src/components/Amalgamation/BusinessStatus.vue index c7314a5ec..c054ab6df 100644 --- a/src/components/Amalgamation/BusinessStatus.vue +++ b/src/components/Amalgamation/BusinessStatus.vue @@ -10,16 +10,19 @@ {{ tooltip }} - - {{ text }} @@ -29,99 +32,70 @@ import { AmlStatuses } from '@/enums' @Component({}) export default class BusinessStatus extends Vue { - @Prop({ required: true }) readonly status!: AmlStatuses - - get icon (): string { - switch (this.status) { - case AmlStatuses.OK: - return 'mdi-check' - - case AmlStatuses.ERROR_CCC_MISMATCH: - case AmlStatuses.ERROR_FOREIGN: - case AmlStatuses.ERROR_FOREIGN_UNLIMITED: - case AmlStatuses.ERROR_FUTURE_EFFECTIVE_FILING: - case AmlStatuses.ERROR_LIMITED_RESTORATION: - case AmlStatuses.ERROR_NOT_AFFILIATED: - case AmlStatuses.ERROR_NOT_IN_GOOD_STANDING: - case AmlStatuses.ERROR_ULC_MISMATCH: - return 'mdi-alert' - - default: - return 'mdi-alert-circle-outline' // should never happen - } - } - - get color (): string { - switch (this.status) { - case AmlStatuses.OK: - return 'success' - - case AmlStatuses.ERROR_CCC_MISMATCH: - case AmlStatuses.ERROR_FOREIGN: - case AmlStatuses.ERROR_FOREIGN_UNLIMITED: - case AmlStatuses.ERROR_FUTURE_EFFECTIVE_FILING: - case AmlStatuses.ERROR_LIMITED_RESTORATION: - case AmlStatuses.ERROR_NOT_AFFILIATED: - case AmlStatuses.ERROR_NOT_IN_GOOD_STANDING: - case AmlStatuses.ERROR_ULC_MISMATCH: - return 'warning' - - default: - return 'error' // should never happen - } - } - - get text (): string { - switch (this.status) { - case AmlStatuses.OK: - return 'Ready' - - case AmlStatuses.ERROR_CCC_MISMATCH: - case AmlStatuses.ERROR_FOREIGN: - case AmlStatuses.ERROR_FOREIGN_UNLIMITED: - case AmlStatuses.ERROR_FUTURE_EFFECTIVE_FILING: - case AmlStatuses.ERROR_LIMITED_RESTORATION: - case AmlStatuses.ERROR_NOT_AFFILIATED: - case AmlStatuses.ERROR_NOT_IN_GOOD_STANDING: - case AmlStatuses.ERROR_ULC_MISMATCH: - return 'Attention Required' + readonly AmlStatuses = AmlStatuses - default: - return '(Unknown)' // should never happen - } - } + @Prop({ required: true }) readonly status!: AmlStatuses + /** + * The tooltip text for the current status. + * Note that the status is evaluated in amalgamation-mixin.ts. + */ get tooltip (): string { + /* eslint-disable indent */ switch (this.status) { case AmlStatuses.OK: - return '' + return 'The currently selected BC Registries account has access to this business.' + case AmlStatuses.ERROR_CCC_MISMATCH: return 'A BC Community Contribution Company must amalgamate to form a new BC Community ' + 'Contribution Company.' + case AmlStatuses.ERROR_FOREIGN: return 'A foreign corporation cannot be amalgamated except by Registries staff.' + + case AmlStatuses.ERROR_FOREIGN_HORIZONTAL: + return 'A foreign company (including an Extraprovincial Company) cannot be part of a Short ' + + 'Form Horizontal amalgamation. ' + case AmlStatuses.ERROR_FOREIGN_UNLIMITED: return 'A foreign corporation must not amalgamate with a limited company and continue as ' + 'an Unlimited Liability Company.' + + case AmlStatuses.ERROR_FOREIGN_UNLIMITED2: + return 'A BC Company cannot amalgamate with an existing foreign corporation to form a BC ' + + 'Unlimited Liability Company.' + + case AmlStatuses.ERROR_FOREIGN_UNLIMITED3: + return 'A BC Company cannot amalgamate with a foreign company to form a BC Unlimited ' + + 'Liability Company.' + case AmlStatuses.ERROR_FUTURE_EFFECTIVE_FILING: return 'This business has a future effective filing. It cannot be part of an amalgamation ' + 'until all future effective filings have come into effect.' + case AmlStatuses.ERROR_LIMITED_RESTORATION: return 'This business is under limited restoration. It cannot be part of an amalgamation ' + 'unless it is fully restored.' + + // case AmlStatuses.ERROR_NEED_BC_COMPANY: + // return 'You must add at least one BC company.' + case AmlStatuses.ERROR_NOT_AFFILIATED: return 'This business is not affiliated with the currently selected BC Registries account. ' + 'Affiliate this business with the account on My Business Registry page.' + case AmlStatuses.ERROR_NOT_IN_GOOD_STANDING: return 'This business is not in good standing. This filing cannot be submitted until all ' + 'businesses are in good standing.' - case AmlStatuses.ERROR_ULC_MISMATCH: - return 'A BC Unlimited Liability Company must amalgamate to form a new BC Unlimited Liability ' + - 'Company.' + + case AmlStatuses.ERROR_XPRO_ULC_CCC: + return 'An Extraprovincial Company cannot amalgamate to form a new BC Unlimited Liability ' + + 'Company or a new BC Community Contribution Company.' default: - return null // should never happen + return '(Unknown)' // should never happen } + /* eslint-enable indent */ } } diff --git a/src/components/Amalgamation/BusinessTable.vue b/src/components/Amalgamation/BusinessTable.vue index ac6a1b93b..df5e53e02 100644 --- a/src/components/Amalgamation/BusinessTable.vue +++ b/src/components/Amalgamation/BusinessTable.vue @@ -112,7 +112,7 @@ export default class BusinessTable extends Mixins(AmalgamationMixin) { // assign the value of the first failed rule (if any) else OK business.status = this.rules.reduce( (status: AmlStatuses, rule: (business: AmalgamatingBusinessIF) => AmlStatuses) => { - // if we already failed a rule, don't check the rest of the rules + // if we already failed a rule, don't evaluate the current rule if (status) return status // return the value of the current rule (may be null) return rule(business) diff --git a/src/enums/amalgamationEnums.ts b/src/enums/amalgamationEnums.ts index 9a1dcec3a..aa225d4e9 100644 --- a/src/enums/amalgamationEnums.ts +++ b/src/enums/amalgamationEnums.ts @@ -2,12 +2,16 @@ export enum AmlStatuses { OK, ERROR_CCC_MISMATCH, ERROR_FOREIGN, + ERROR_FOREIGN_HORIZONTAL, ERROR_FOREIGN_UNLIMITED, + ERROR_FOREIGN_UNLIMITED2, + ERROR_FOREIGN_UNLIMITED3, ERROR_FUTURE_EFFECTIVE_FILING, ERROR_LIMITED_RESTORATION, + // ERROR_NEED_BC_COMPANY, ERROR_NOT_AFFILIATED, ERROR_NOT_IN_GOOD_STANDING, - ERROR_ULC_MISMATCH, + ERROR_XPRO_ULC_CCC, } export enum AmlRoles { diff --git a/src/mixins/amalgamation-mixin.ts b/src/mixins/amalgamation-mixin.ts index 14ac5257d..198fc74a3 100644 --- a/src/mixins/amalgamation-mixin.ts +++ b/src/mixins/amalgamation-mixin.ts @@ -7,10 +7,12 @@ import { CorpTypeCd } from '@bcrs-shared-components/corp-type-module' /** * Mixin that provides amalgamation rules, etc. + * Note that the error text is declared in BusinessStatus.vue. */ @Component({}) export default class AmalgamationMixin extends Vue { @Getter(useStore) getAmalgamatingBusinesses!: AmalgamatingBusinessIF[] + @Getter(useStore) isAmalgamationFilingHorizontal!: boolean @Getter(useStore) isRoleStaff!: boolean @Getter(useStore) isTypeBcCcc!: boolean @Getter(useStore) isTypeBcUlcCompany!: boolean @@ -22,14 +24,17 @@ export default class AmalgamationMixin extends Vue { this.limitedRestoration, this.futureEffectiveFiling, this.foreign, - this.foreignUlc, + this.foreignUnlimited, this.cccMismatch, - this.ulcMismatch + this.foreignUnlimited2, + this.xproUlcCcc, + // this.needBcCompany, + this.foreignHorizontal ] /** If we don't have an address, assume business is not affiliated (except for staff). */ notAffiliated (business: AmalgamatingBusinessIF): AmlStatuses { - if (business.type === AmlTypes.LEAR && !business.address && !this.isRoleStaff) { + if (!this.isRoleStaff && business.type === AmlTypes.LEAR && !business.address) { return AmlStatuses.ERROR_NOT_AFFILIATED } return null @@ -37,7 +42,7 @@ export default class AmalgamationMixin extends Vue { /** Disallow if NIGS (except for staff). */ notInGoodStanding (business: AmalgamatingBusinessIF): AmlStatuses { - if (business.type === AmlTypes.LEAR && business.isNotInGoodStanding && !this.isRoleStaff) { + if (!this.isRoleStaff && business.type === AmlTypes.LEAR && business.isNotInGoodStanding) { return AmlStatuses.ERROR_NOT_IN_GOOD_STANDING } return null @@ -45,13 +50,13 @@ export default class AmalgamationMixin extends Vue { /** Disallow if limited restoration (except for staff). */ limitedRestoration (business: AmalgamatingBusinessIF): AmlStatuses { - if (business.type === AmlTypes.LEAR && business.isLimitedRestoration && !this.isRoleStaff) { + if (!this.isRoleStaff && business.type === AmlTypes.LEAR && business.isLimitedRestoration) { return AmlStatuses.ERROR_LIMITED_RESTORATION } return null } - /** Disallow if future effective filing. */ + /** Disallow if a future effective filing exists. */ futureEffectiveFiling (business: AmalgamatingBusinessIF): AmlStatuses { if (business.type === AmlTypes.LEAR && business.isFutureEffective) { return AmlStatuses.ERROR_FUTURE_EFFECTIVE_FILING @@ -60,20 +65,23 @@ export default class AmalgamationMixin extends Vue { } /** - * Disallow altogether if foreign (except for staff). + * Disallow altogether if foreign or extra-pro (except for staff). * (Could happen if staff added it and regular user resumes draft.) */ foreign (business: AmalgamatingBusinessIF): AmlStatuses { - if (business.type === AmlTypes.FOREIGN && !this.isRoleStaff) { + 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 } - /** Disallow if foreign into ULC if there is also a limited. */ - foreignUlc (business: AmalgamatingBusinessIF): AmlStatuses { + /** Disallow if foreign into ULC if there is also a limited company. */ + foreignUnlimited (business: AmalgamatingBusinessIF): AmlStatuses { if (business.type === AmlTypes.FOREIGN && this.isTypeBcUlcCompany && this.isAnyLimited) { - return AmlStatuses.ERROR_FOREIGN + return AmlStatuses.ERROR_FOREIGN_UNLIMITED } return null } @@ -86,49 +94,112 @@ export default class AmalgamationMixin extends Vue { return null } - /** Disallow ULC mismatch. */ - ulcMismatch (business: AmalgamatingBusinessIF): AmlStatuses { + /** Disallow if foreign into ULC if there is also a limited company. */ + foreignUnlimited2 (business: AmalgamatingBusinessIF): AmlStatuses { + if (business.type === AmlTypes.FOREIGN && this.isTypeBcUlcCompany && this.isAnyLimited) { + return AmlStatuses.ERROR_FOREIGN_UNLIMITED2 + } + return null + } + + /** Disallow extra-pro (A company) into ULC or CCC. */ + xproUlcCcc (business: AmalgamatingBusinessIF): AmlStatuses { if ( business.type === AmlTypes.LEAR && - business.legalType === CorpTypeCd.BC_ULC_COMPANY && - !this.isTypeBcUlcCompany + business.legalType === CorpTypeCd.EXTRA_PRO_A && + (!this.isTypeBcUlcCompany || !this.isTypeBcCcc) ) { - return AmlStatuses.ERROR_ULC_MISMATCH + return AmlStatuses.ERROR_XPRO_ULC_CCC } return null } - // TODO: cannot add foreign ULC if there is a BC company and ted is ULC + /** Disallow if ULC and there is also a foreign. */ + foreignUnlimited3 (business: AmalgamatingBusinessIF): AmlStatuses { + if ( + business.type === AmlTypes.LEAR && + business.legalType === CorpTypeCd.BC_ULC_COMPANY && + this.isAnyForeign + ) { + return AmlStatuses.ERROR_FOREIGN_UNLIMITED3 + } + return null + } - // TODO: cannot add BC company if there is a foreign ULC and ted is ULC + // NOT CURRENTLY USED + // /** + // * Disallow only foreign businesses (including EPs). + // * (An amalgamation where all TINGs are foreign will be Phase 2.) + // */ + // needBcCompany (): AmlStatuses { + // if (this.isAllForeignOrEp) { + // return AmlStatuses.ERROR_NEED_BC_COMPANY + // } + // return null + // } + + /** Disallow if foreign in a short-form horizontal amalgamation. */ + foreignHorizontal (business: AmalgamatingBusinessIF): AmlStatuses { + if (business.type === AmlTypes.FOREIGN && this.isAmalgamationFilingHorizontal) { + return AmlStatuses.ERROR_FOREIGN_HORIZONTAL + } + return null + } // // HELPERS + // (not all are used atm) // + /** True if all companies in the table are foreign. */ + get isAllForeign (): boolean { + 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)) } - /** True if there a CCC in the table. */ + /** True if there a Benefit Company in the table. */ + get isAnyBen (): boolean { + return this.getAmalgamatingBusinesses.some(business => + (business.type === AmlTypes.LEAR && business.legalType === CorpTypeCd.BENEFIT_COMPANY) + ) + } + + /** True if there is a BC CCC in the table. */ get isAnyCcc (): boolean { return this.getAmalgamatingBusinesses.some(business => (business.type === AmlTypes.LEAR && business.legalType === CorpTypeCd.BC_CCC) ) } - /** True if there a limited company in the table. */ + /** True if there is a BC Limited Company in the table. */ get isAnyLimited (): boolean { return this.getAmalgamatingBusinesses.some(business => (business.type === AmlTypes.LEAR && business.legalType === CorpTypeCd.BC_COMPANY) ) } - /** True if there is an unlimited company in the table. */ + /** True if there is an BC Unlimited Liability Company in the table. */ get isAnyUnlimited (): boolean { return this.getAmalgamatingBusinesses.some(business => (business.type === AmlTypes.LEAR && business.legalType === CorpTypeCd.BC_ULC_COMPANY) ) } + + /** True if there is a BC company in the table. */ + get isAnyBcCompany (): boolean { + return (this.isAnyBen || this.isAnyCcc || this.isAnyLimited || this.isAnyUnlimited) + } } diff --git a/src/mixins/filing-template-mixin.ts b/src/mixins/filing-template-mixin.ts index 3a9fc91fd..fa8ba7675 100644 --- a/src/mixins/filing-template-mixin.ts +++ b/src/mixins/filing-template-mixin.ts @@ -12,8 +12,9 @@ import { ShareStructureIF, SpecialResolutionIF, StaffPaymentIF, StaffPaymentStepIF, UploadAffidavitIF } from '@/interfaces' import { - AmalgamationTypes, ApprovalTypes, BusinessTypes, CoopTypes, CorrectNameOptions, DissolutionTypes, - EffectOfOrders, FilingTypes, PartyTypes, RelationshipTypes, RestorationTypes, RoleTypes, StaffPaymentOptions + AmalgamationTypes, AmlRoles, AmlTypes, ApprovalTypes, BusinessTypes, CoopTypes, CorrectNameOptions, + DissolutionTypes, EffectOfOrders, FilingTypes, PartyTypes, RelationshipTypes, RestorationTypes, RoleTypes, + StaffPaymentOptions } from '@/enums' import { CorpTypeCd } from '@bcrs-shared-components/corp-type-module/' @@ -225,7 +226,24 @@ export default class FilingTemplateMixin extends Mixins(DateMixin) { // restore the amalgamating businesses array if (draftFiling.amalgamation.amalgamatingBusinesses) { - this.setAmalgamatingBusinesses(draftFiling.amalgamation.amalgamatingBusinesses) + this.setAmalgamatingBusinesses([ + // *** TODO: remove static items when they are no longer needed for testing + // { + // type: AmlTypes.FOREIGN, + // corpNumber: 'XYZ789', + // legalName: 'Ice Cream Sandwich Canada', + // foreignJurisdiction: { region: 'FEDERAL', country: 'CA' }, + // role: AmlRoles.AMALGAMATING + // }, + // { + // type: AmlTypes.FOREIGN, + // corpNumber: 'ABC123', + // legalName: 'Gingerbread USA', + // foreignJurisdiction: { country: 'US' }, + // role: AmlRoles.AMALGAMATING + // }, + ...draftFiling.amalgamation.amalgamatingBusinesses + ]) } // restore the amalgamation court approval diff --git a/src/store/state/state-model.ts b/src/store/state/state-model.ts index c231c41e5..fb46adc24 100644 --- a/src/store/state/state-model.ts +++ b/src/store/state/state-model.ts @@ -1,5 +1,4 @@ import { - AmalgamatingBusinessIF, EmptyAccountInformation, EmptyContactPoint, EmptyFees, @@ -8,123 +7,8 @@ import { EmptyNaics, StateModelIF } from '@/interfaces' -import { AmlRoles, AmlTypes } from '@/enums' import { EmptyAddress } from '@bcrs-shared-components/interfaces' import { cloneDeep } from 'lodash' -import { CorpTypeCd } from '@bcrs-shared-components/corp-type-module' - -// const AMALGAMATING_BUSINESSES: AmalgamatingBusinessIF[] = [ -// { -// type: AmlTypes.LEAR, -// identifier: 'BC1111111', -// name: 'Frozen Yogurt', -// email: 'froyo@example.com', -// legalType: CorpTypeCd.BC_COMPANY, -// address: { -// streetAddress: '1234 Main St', -// addressCity: 'Vancouver', -// addressRegion: 'BC', -// postalCode: 'V6A 1A1', -// addressCountry: 'CA' -// }, -// role: AmlRoles.HOLDING, -// isNotInGoodStanding: true -// }, -// { -// // this business is an xpro and should only be valid if staff -// type: AmlTypes.LEAR, -// identifier: 'A5555555', -// name: 'Lollipop Canada', -// email: 'sucker@example.com', -// legalType: CorpTypeCd.EXTRA_PRO_A, -// address: { -// streetAddress: '4321 Principal Ave', -// addressCity: 'Halifax', -// addressRegion: 'NS', -// postalCode: 'B3H 1A1', -// addressCountry: 'CA' -// }, -// role: AmlRoles.AMALGAMATING, -// isNotInGoodStanding: true -// }, -// { -// // this business is NIGS and should only be valid if staff -// type: AmlTypes.LEAR, -// identifier: 'BC2222222', -// name: 'Jelly Bean', -// email: 'oval.treat@example.com', -// legalType: CorpTypeCd.BC_COMPANY, -// address: { -// streetAddress: '1234 Main St', -// addressCity: 'Vancouver', -// addressRegion: 'BC', -// postalCode: 'V6A 1A1', -// addressCountry: 'CA' -// }, -// role: AmlRoles.AMALGAMATING, -// isNotInGoodStanding: false -// }, -// { -// // this business has 2 issues: -// // 1. not affiliated -// // 2. not in good standing -// type: AmlTypes.LEAR, -// identifier: 'BC4444444', // we know this from the business lookup -// name: 'Eclair', // we know this from the business lookup -// email: undefined, // we don't know this yet (not affiliated) -// legalType: CorpTypeCd.BC_COMPANY, // we know this from the business lookup -// address: undefined, // we don't know this yet (not affiliated) -// role: AmlRoles.AMALGAMATING, -// isNotInGoodStanding: false // we know this from the business lookup -// }, -// { -// type: AmlTypes.FOREIGN, -// corpNumber: 'XYZ789', -// legalName: 'Ice Cream Sandwich Canada', -// foreignJurisdiction: { region: 'FEDERAL', country: 'CA' }, -// role: AmlRoles.AMALGAMATING -// }, -// { -// type: AmlTypes.FOREIGN, -// corpNumber: 'ABC123', -// legalName: 'Gingerbread USA', -// foreignJurisdiction: { country: 'US' }, -// role: AmlRoles.AMALGAMATING -// }, -// { -// // this business is CCC and should only be valid if amalg type is CCC -// type: AmlTypes.LEAR, -// identifier: 'BC7777777', -// name: 'Donut', -// email: 'holey.goodness@example.com', -// legalType: CorpTypeCd.BC_CCC, -// address: { -// streetAddress: '1234 Main St', -// addressCity: 'Vancouver', -// addressRegion: 'BC', -// postalCode: 'V6A 1A1', -// addressCountry: 'CA' -// }, -// role: AmlRoles.AMALGAMATING, -// isNotInGoodStanding: true -// }, -// { -// type: AmlTypes.LEAR, -// identifier: 'BC3333333', -// name: 'Cupcake', -// email: 'cute.sugarbomb@example.com', -// legalType: CorpTypeCd.BC_COMPANY, -// address: { -// streetAddress: '1234 Main St', -// addressCity: 'Vancouver', -// addressRegion: 'BC', -// postalCode: 'V6A 1A1', -// addressCountry: 'CA' -// }, -// role: AmlRoles.AMALGAMATING, -// isNotInGoodStanding: true -// } -// ] export const stateModel: StateModelIF = { currentJsDate: null, @@ -322,7 +206,7 @@ export const stateModel: StateModelIF = { isAutoPopulatedBusinessNumber: false }, amalgamation: { - amalgamatingBusinesses: [], // cloneDeep(AMALGAMATING_BUSINESSES), + amalgamatingBusinesses: [], amalgamatingBusinessesValid: false, courtApproval: null, type: null