From b20dc579e832bb327124923ea99e92485f84eba5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9verin=20Beauvais?= Date: Mon, 27 Nov 2023 16:09:47 -0800 Subject: [PATCH] 18534 Changes to support amalgamation applications (#590) * - app version = 7.0.20 - updated some shared imports - added amalgamation as supported filing type - added amalgamation template to Filing History List - added amalgamation application to Todo List - added amalgamation sub-types to enum - added amalgamation to API Filing interface - added amalgamation to Task Todo interface - added an enum mixin method - added enum utilities methods - updated filingTypeToName() - replaced overly complex "currentFilingStatus" with filing id check - refactored entityStatus to identify the application type (amal/IA/reg) - updated unit tests * - applied fix for #18736 * - added displayName to draft app code - used displayName in TodoList.vue - used displayName in EntityHeader.vue * - added check for amalgamation type --- package-lock.json | 46 +++--- package.json | 10 +- src/App.vue | 127 +++++++++------ .../Dashboard/FilingHistoryList.vue | 1 + .../filings/AmalgamationFiling.vue | 133 ++++++++++++++++ .../FilingHistoryList/filings/index.ts | 1 + src/components/Dashboard/TodoList.vue | 150 ++++++++++++------ src/components/EntityInfo/EntityHeader.vue | 30 ++-- src/components/common/NameRequestInfo.vue | 5 +- src/enums/entityStatus.ts | 8 +- src/enums/filingSubTypes.ts | 13 +- src/enums/nameRequestTypes.ts | 1 + src/interfaces/api-filing-interface.ts | 2 + src/interfaces/api-task-interface.ts | 2 + src/interfaces/root-state-interface.ts | 5 +- src/mixins/enum-mixin.ts | 5 + src/mixins/name-request-mixin.ts | 5 +- src/services/enum-utilities.ts | 42 ++++- src/stores/businessStore.ts | 13 +- src/stores/rootStore.ts | 64 +++++--- src/stores/state.ts | 1 - src/views/AnnualReport.vue | 15 +- src/views/Dashboard.vue | 8 +- tests/unit/AgmLocationChg.spec.ts | 2 - tests/unit/AnnualReport.spec.ts | 17 +- tests/unit/App.spec.ts | 18 +-- tests/unit/ConsentContinuationOut.spec.ts | 2 - tests/unit/Dashboard.spec.ts | 22 ++- tests/unit/EntityHeader.spec.ts | 22 +-- tests/unit/EntityMenu.spec.ts | 8 +- tests/unit/StandaloneDirectorsFiling.spec.ts | 3 +- .../StandaloneOfficeAddressFiling.spec.ts | 3 +- tests/unit/TodoList1.spec.ts | 22 +-- 33 files changed, 546 insertions(+), 260 deletions(-) create mode 100644 src/components/Dashboard/FilingHistoryList/filings/AmalgamationFiling.vue diff --git a/package-lock.json b/package-lock.json index f77a01a30..055b13748 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,26 +1,26 @@ { "name": "business-filings-ui", - "version": "7.0.19", + "version": "7.0.20", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "business-filings-ui", - "version": "7.0.19", + "version": "7.0.20", "dependencies": { "@babel/compat-data": "^7.21.5", "@bcrs-shared-components/base-address": "2.0.9", "@bcrs-shared-components/breadcrumb": "2.1.11", "@bcrs-shared-components/confirm-dialog": "1.2.1", - "@bcrs-shared-components/corp-type-module": "1.0.11", + "@bcrs-shared-components/corp-type-module": "1.0.14", "@bcrs-shared-components/court-order-poa": "2.1.4", "@bcrs-shared-components/date-picker": "1.2.38", "@bcrs-shared-components/document-delivery": "1.2.1", - "@bcrs-shared-components/enums": "1.0.51", + "@bcrs-shared-components/enums": "1.1.2", "@bcrs-shared-components/expandable-help": "1.0.1", "@bcrs-shared-components/folio-number-input": "1.1.18", - "@bcrs-shared-components/interfaces": "1.0.76", - "@bcrs-shared-components/mixins": "1.1.27", + "@bcrs-shared-components/interfaces": "1.1.2", + "@bcrs-shared-components/mixins": "1.1.30", "@bcrs-shared-components/staff-comments": "1.3.11", "@bcrs-shared-components/staff-payment": "2.1.11", "@mdi/font": "^5.9.55", @@ -246,7 +246,9 @@ } }, "node_modules/@bcrs-shared-components/corp-type-module": { - "version": "1.0.11" + "version": "1.0.14", + "resolved": "https://registry.npmjs.org/@bcrs-shared-components/corp-type-module/-/corp-type-module-1.0.14.tgz", + "integrity": "sha512-SZhJw4hpqQT2BL3RuVB0Z1hmShhrv5byhH4gnaF1fVl9jsUGkjC/Ytic08UnEX4DIyR1/VWNyjTclNgxi9+0Bw==" }, "node_modules/@bcrs-shared-components/court-order-poa": { "version": "2.1.4", @@ -308,16 +310,13 @@ } }, "node_modules/@bcrs-shared-components/enums": { - "version": "1.0.51", - "resolved": "https://registry.npmjs.org/@bcrs-shared-components/enums/-/enums-1.0.51.tgz", - "integrity": "sha512-FTFovs3NUgqDVaoUJOjF/F4sHsh27Ih7KRArZ2fQUP6aMVGTKHII5poeaP5w0PeV9UsMKTBBVsKF3TILY7s3RA==", + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@bcrs-shared-components/enums/-/enums-1.1.2.tgz", + "integrity": "sha512-ttgHwwnLZh9f75GlxpMU0hI22Nd98zzdq+vBEQd95U6k5UrZI0jGwKFYhtuyjoLLPwtiSsjtsLdSw/n/lJTfZw==", "dependencies": { - "@bcrs-shared-components/corp-type-module": "^1.0.13" + "@bcrs-shared-components/corp-type-module": "^1.0.14" } }, - "node_modules/@bcrs-shared-components/enums/node_modules/@bcrs-shared-components/corp-type-module": { - "version": "1.0.13" - }, "node_modules/@bcrs-shared-components/expandable-help": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/@bcrs-shared-components/expandable-help/-/expandable-help-1.0.1.tgz", @@ -334,21 +333,22 @@ } }, "node_modules/@bcrs-shared-components/interfaces": { - "version": "1.0.76", - "resolved": "https://registry.npmjs.org/@bcrs-shared-components/interfaces/-/interfaces-1.0.76.tgz", - "integrity": "sha512-jsN6k8Du7gcV7WnRuqAIrpmxdlLNYtvInfHGzgTSHoADLd+G2NFhEW8E0qPR7eVMA+0EA7/sr6Ijp9m2gCpKzg==", + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@bcrs-shared-components/interfaces/-/interfaces-1.1.2.tgz", + "integrity": "sha512-MMZISHIbTkQ86PGWmGqo0aLlRjpRVJ1WOP0R99gay4fjpzylPgrNO/aYHWj7nyT0zeIEQ1g/aCW5UaUCIHHm8w==", "dependencies": { - "@bcrs-shared-components/enums": "^1.0.51", + "@bcrs-shared-components/corp-type-module": "^1.0.14", + "@bcrs-shared-components/enums": "^1.1.2", "vue": "^2.7.14" } }, "node_modules/@bcrs-shared-components/mixins": { - "version": "1.1.27", - "resolved": "https://registry.npmjs.org/@bcrs-shared-components/mixins/-/mixins-1.1.27.tgz", - "integrity": "sha512-/GEZKPhIwY8EXFaP37fV5Hlun+/F+Tx6hXeu/Djzk19xFv7Y5KQeFdsX2cLTHrkqtTZAhVzoUboQ+RCCo41lgw==", + "version": "1.1.30", + "resolved": "https://registry.npmjs.org/@bcrs-shared-components/mixins/-/mixins-1.1.30.tgz", + "integrity": "sha512-piKdDz93Xv2np32k9Gm2S3HScicOtCctR+yPy5rgo2j9kLM5DoUrXFv8ptHiFoSx55EF+jd5c0lzIXYTIjZaYQ==", "dependencies": { - "@bcrs-shared-components/enums": "^1.0.51", - "@bcrs-shared-components/interfaces": "^1.0.76", + "@bcrs-shared-components/enums": "^1.1.2", + "@bcrs-shared-components/interfaces": "^1.1.2", "country-list": "^2.3.0", "lodash": "4.17.21", "provinces": "^1.11.0", diff --git a/package.json b/package.json index c8f356610..dffd4c1ae 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "business-filings-ui", - "version": "7.0.19", + "version": "7.0.20", "private": true, "appName": "Filings UI", "sbcName": "SBC Common Components", @@ -17,15 +17,15 @@ "@bcrs-shared-components/base-address": "2.0.9", "@bcrs-shared-components/breadcrumb": "2.1.11", "@bcrs-shared-components/confirm-dialog": "1.2.1", - "@bcrs-shared-components/corp-type-module": "1.0.11", + "@bcrs-shared-components/corp-type-module": "1.0.14", "@bcrs-shared-components/court-order-poa": "2.1.4", "@bcrs-shared-components/date-picker": "1.2.38", "@bcrs-shared-components/document-delivery": "1.2.1", - "@bcrs-shared-components/enums": "1.0.51", + "@bcrs-shared-components/enums": "1.1.2", "@bcrs-shared-components/expandable-help": "1.0.1", "@bcrs-shared-components/folio-number-input": "1.1.18", - "@bcrs-shared-components/interfaces": "1.0.76", - "@bcrs-shared-components/mixins": "1.1.27", + "@bcrs-shared-components/interfaces": "1.1.2", + "@bcrs-shared-components/mixins": "1.1.30", "@bcrs-shared-components/staff-comments": "1.3.11", "@bcrs-shared-components/staff-payment": "2.1.11", "@mdi/font": "^5.9.55", diff --git a/src/App.vue b/src/App.vue index 9c7dbb937..bcfbc1700 100644 --- a/src/App.vue +++ b/src/App.vue @@ -162,7 +162,6 @@ import { TaskTodoIF } from '@/interfaces' import { - CorpTypeCd, EntityStatus, FilingStatus, FilingTypes, @@ -170,6 +169,7 @@ import { NigsMessage, Routes } from '@/enums' +import { CorpTypeCd, GetCorpFullDescription } from '@bcrs-shared-components/corp-type-module' import { SessionStorageKeys } from 'sbc-common-components/src/util/constants' import { useBusinessStore, useConfigurationStore, useFilingHistoryListStore, useRootStore } from './stores' @@ -239,12 +239,15 @@ export default { [ 'getEntityName', 'getLegalType', - 'getIdentifier' + 'getIdentifier', + 'isSoleProp' ]), ...mapState(useRootStore, [ 'getKeycloakRoles', + 'isAppFiling', + 'isAppTask', 'isRoleStaff', 'showFetchingDataSpinner' ]), @@ -463,7 +466,7 @@ export default { } } - // is this a draft app entity? + // is this a draft app entity (incorporation/registration/amalgamation)? if (this.tempRegNumber) { try { await this.fetchDraftAppData() // throws on error @@ -523,15 +526,15 @@ export default { async fetchDraftAppData (): Promise { this.nameRequestInvalidType = null // reset for new fetches - const draft = await LegalServices.fetchDraftApp(this.tempRegNumber) + const application = await LegalServices.fetchDraftApp(this.tempRegNumber) - // Handle Draft filings - this.storeDraftApp(draft) + // handle draft application + this.storeDraftApp(application) - // if the draft has a NR, load it - if (this.localNrNumber) { + // if this app is a task (not a filing), and it has a NR, load it + if (this.isAppTask && this.localNrNumber) { const nr = await LegalServices.fetchNameRequest(this.localNrNumber) - this.storeNrData(nr, draft) + this.storeNrData(nr, application) } }, @@ -610,23 +613,53 @@ export default { } }, - /** Verifies and stores a draft applications data. */ + /** Verifies and stores a draft application's data. */ storeDraftApp (application: any): void { const filing = application?.filing const filingName = filing.header?.name as FilingTypes + if (!filing || !filing.header || !filingName) { throw new Error(`Invalid ${filingName} filing`) } - if (![FilingTypes.INCORPORATION_APPLICATION, FilingTypes.REGISTRATION].includes(filingName)) { - throw new Error(`Invalid ${filingName} filing - filing name`) - } - const status = filing.header.status as FilingStatus if (!status) { throw new Error(`Invalid ${filingName} filing - filing status`) } + const isAmalgamation = (filingName === FilingTypes.AMALGAMATION) + const isIncorporationApplication = (filingName === FilingTypes.INCORPORATION_APPLICATION) + const isRegistration = (filingName === FilingTypes.REGISTRATION) + + let entityStatus: EntityStatus + switch (status) { + case FilingStatus.DRAFT: + case FilingStatus.PENDING: + // this is a draft application + if (isAmalgamation) entityStatus = EntityStatus.DRAFT_AMALGAMATION + else if (isIncorporationApplication) entityStatus = EntityStatus.DRAFT_INCORP_APP + else if (isRegistration) entityStatus = EntityStatus.DRAFT_REGISTRATION + else throw new Error(`Invalid ${filingName} filing - filing name`) + break + + case FilingStatus.COMPLETED: + case FilingStatus.PAID: + // this is a filed application + if (isAmalgamation) entityStatus = EntityStatus.FILED_AMALGAMATION + else if (isIncorporationApplication) entityStatus = EntityStatus.FILED_INCORP_APP + else if (isRegistration) entityStatus = EntityStatus.FILED_REGISTRATION + else throw new Error(`Invalid ${filingName} filing - filing name`) + break + + default: + throw new Error(`Invalid ${filingName} filing - filing status`) + } + + // special check for amalgamation application + if (isAmalgamation && !filing.amalgamation.type) { + throw new Error('Missing amalgamation type') + } + // NB: different object from actual NR const nameRequest = filing[filingName].nameRequest as { legalName?: string @@ -644,11 +677,10 @@ export default { } // store business info + this.setEntityStatus(entityStatus) this.setIdentifier(this.tempRegNumber) this.setLegalType(legalType) - - // Draft Applications are always in good standing - this.setGoodStanding(true) + this.setGoodStanding(true) // draft apps are always in good standing // save local NR Number if present this.localNrNumber = nameRequest.nrNumber || null @@ -656,29 +688,27 @@ export default { // store Legal Name if present if (nameRequest.legalName) this.setLegalName(nameRequest.legalName) - switch (status) { - case FilingStatus.DRAFT: - case FilingStatus.PENDING: - // this is a draft application - this.setEntityStatus(EntityStatus.DRAFT_APP) - this.storeDraftAppTask(application) - break - - case FilingStatus.COMPLETED: - case FilingStatus.PAID: - // this is a filed application - this.setEntityStatus(EntityStatus.FILED_APP) - this.storeFiledApp(application) - break - - default: - throw new Error(`Invalid ${filingName} filing - filing status`) - } + // store the application in the right list + if (this.isAppTask) this.storeDraftAppTask(application) + else if (this.isAppFiling) this.storeDraftAppFiling(application) + else throw new Error(`Invalid ${filingName} filing - filing status`) }, /** Stores draft application as a task in the Todo List. */ storeDraftAppTask (application: any): void { const filing = application.filing as TaskTodoIF + // NB: these were already validated in storeDraftApp() + const header = filing.header + const data = filing[header.name] + + const description = GetCorpFullDescription(data.nameRequest.legalType) + const dba = this.isSoleProp ? ' / Doing Business As (DBA) ' : ' ' + const filingName = EnumUtilities.filingTypeToName(header.name, null, data.type) + + // save display name for later + filing.displayName = `${description}${dba}${filingName}` + + // add this as a task item const taskItem: ApiTaskIF = { enabled: true, order: 1, @@ -688,29 +718,32 @@ export default { }, /** Stores filed application as a filing in the Filing History List. */ - storeFiledApp (filedApplication: any): void { - const filing = filedApplication.filing as TaskTodoIF + storeDraftAppFiling (application: any): void { + const filing = application.filing as TaskTodoIF // NB: these were already validated in storeDraftApp() const header = filing.header - const application = filing[header.name] + const data = filing[header.name] // set addresses - this.storeAddresses({ data: application.offices || [] }) + this.storeAddresses({ data: data.offices || [] }) + + // set parties + this.storeParties({ data: { parties: data.parties || [] } }) - // Set parties - this.storeParties({ data: { parties: application.parties || [] } }) + const description = GetCorpFullDescription(data.nameRequest.legalType) + const filingName = EnumUtilities.filingTypeToName(header.name, null, data.type) - // add this as a filing (for Filing History List) + // add this as a filing item const filingItem = { availableOnPaperOnly: header.availableOnPaperOnly, businessIdentifier: this.getIdentifier, - commentsCount: filedApplication.commentsCount, - commentsLink: filedApplication.commentsLink, - displayName: EnumUtilities.filingTypeToName(header.name), - documentsLink: filedApplication.documentsLink, + commentsCount: application.commentsCount, + commentsLink: application.commentsLink, + displayName: `${description} ${filingName}`, + documentsLink: application.documentsLink, effectiveDate: this.apiToUtcString(header.effectiveDate), filingId: header.filingId, - filingLink: filedApplication.filingLink, + filingLink: application.filingLink, isFutureEffective: header.isFutureEffective, name: header.name, status: header.status, diff --git a/src/components/Dashboard/FilingHistoryList.vue b/src/components/Dashboard/FilingHistoryList.vue index bb38a5b64..68e9b828f 100644 --- a/src/components/Dashboard/FilingHistoryList.vue +++ b/src/components/Dashboard/FilingHistoryList.vue @@ -145,6 +145,7 @@ export default class FilingHistoryList extends Mixins(FilingMixin) { case filing.availableOnPaperOnly: return 'paper-filing' // must come first case EnumUtilities.isTypeAgmExtension(filing): return 'agm-extension' case EnumUtilities.isTypeAlteration(filing): return 'alteration-filing' + case EnumUtilities.isTypeAmalgamation(filing): return 'amalgamation-filing' case EnumUtilities.isTypeChangeOfAddress(filing): return 'change-of-address' case EnumUtilities.isTypeConsentContinuationOut(filing): return 'consent-continuation-out' case EnumUtilities.isTypeContinuationOut(filing): return 'continuation-out' diff --git a/src/components/Dashboard/FilingHistoryList/filings/AmalgamationFiling.vue b/src/components/Dashboard/FilingHistoryList/filings/AmalgamationFiling.vue new file mode 100644 index 000000000..bc576ee95 --- /dev/null +++ b/src/components/Dashboard/FilingHistoryList/filings/AmalgamationFiling.vue @@ -0,0 +1,133 @@ + + + + + diff --git a/src/components/Dashboard/FilingHistoryList/filings/index.ts b/src/components/Dashboard/FilingHistoryList/filings/index.ts index 1d39a9ed3..6e24864f3 100644 --- a/src/components/Dashboard/FilingHistoryList/filings/index.ts +++ b/src/components/Dashboard/FilingHistoryList/filings/index.ts @@ -1,5 +1,6 @@ export { default as AgmExtension } from './AgmExtension.vue' export { default as AlterationFiling } from './AlterationFiling.vue' +export { default as AmalgamationFiling } from './AmalgamationFiling.vue' export { default as ChangeOfAddress } from './ChangeOfAddress.vue' export { default as ConsentContinuationOut } from './ConsentContinuationOut.vue' export { default as ContinuationOut } from './ContinuationOut.vue' diff --git a/src/components/Dashboard/TodoList.vue b/src/components/Dashboard/TodoList.vue index 716847891..5e6176e63 100644 --- a/src/components/Dashboard/TodoList.vue +++ b/src/components/Dashboard/TodoList.vue @@ -165,6 +165,14 @@ + +
+ {{ item.subtitle }} +
+
Do not authorize
+
-