Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

18534 Changes to support amalgamation applications #590

Merged
merged 4 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 23 additions & 23 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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",
Expand Down
128 changes: 81 additions & 47 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -162,14 +162,14 @@ import {
TaskTodoIF
} from '@/interfaces'
import {
CorpTypeCd,
EntityStatus,
FilingStatus,
FilingTypes,
NameRequestStates,
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'

Expand Down Expand Up @@ -239,12 +239,15 @@ export default {
[
'getEntityName',
'getLegalType',
'getIdentifier'
'getIdentifier',
'isSoleProp'
]),

...mapState(useRootStore,
[
'getKeycloakRoles',
'isAppFiling',
'isAppTask',
'isRoleStaff',
'showFetchingDataSpinner'
]),
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -523,15 +526,15 @@ export default {
async fetchDraftAppData (): Promise<void> {
this.nameRequestInvalidType = null // reset for new fetches

const draft = await LegalServices.fetchDraftApp(this.tempRegNumber)
const application = await LegalServices.fetchDraftApp(this.tempRegNumber)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All methods in here call this thing an application, so I'm being consistent.


// 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) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the fix for 18736 (which was merged into a release branch and deployed to Prod already).

const nr = await LegalServices.fetchNameRequest(this.localNrNumber)
this.storeNrData(nr, draft)
this.storeNrData(nr, application)
}
},

Expand Down Expand Up @@ -610,23 +613,54 @@ 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`)
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved this in to a switch-case statement below, where I also set the entity status. This is because we previously had an if-else (2 possible draft apps) but now we have 3.

const status = filing.header.status as FilingStatus
if (!status) {
throw new Error(`Invalid ${filingName} filing - filing status`)
}

let entityStatus: EntityStatus
switch (status) {
case FilingStatus.DRAFT:
case FilingStatus.PENDING:
// this is a draft application
if (filingName === FilingTypes.AMALGAMATION) {
entityStatus = EntityStatus.DRAFT_AMALGAMATION
} else if (filingName === FilingTypes.INCORPORATION_APPLICATION) {
entityStatus = EntityStatus.DRAFT_INCORP_APP
} else if (filingName === FilingTypes.REGISTRATION) {
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 (filingName === FilingTypes.AMALGAMATION) {
entityStatus = EntityStatus.FILED_AMALGAMATION
} else if (filingName === FilingTypes.INCORPORATION_APPLICATION) {
entityStatus = EntityStatus.FILED_INCORP_APP
} else if (filingName === FilingTypes.REGISTRATION) {
entityStatus = EntityStatus.FILED_REGISTRATION
} else {
throw new Error(`Invalid ${filingName} filing - filing name`)
}
break

default:
throw new Error(`Invalid ${filingName} filing - filing status`)
}

// NB: different object from actual NR
const nameRequest = filing[filingName].nameRequest as {
legalName?: string
Expand All @@ -644,41 +678,38 @@ 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

// 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}`
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can use this in the Todo List and Entity Header.


// add this as a task item
const taskItem: ApiTaskIF = {
enabled: true,
order: 1,
Expand All @@ -688,29 +719,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)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same code as for a draft app task.


// 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,
Expand Down
1 change: 1 addition & 0 deletions src/components/Dashboard/FilingHistoryList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Loading
Loading