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

19005 Implemented historical - amalgamation reason text #604

Merged
merged 1 commit into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "business-filings-ui",
"version": "7.0.29",
"version": "7.0.30",
"private": true,
"appName": "Filings UI",
"sbcName": "SBC Common Components",
Expand Down
2 changes: 1 addition & 1 deletion src/components/Dashboard/TodoList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@
<v-btn
class="ma-1 affiliation-invitation-action-button"
color="primary"
@click.native.stop="authorizeAffiliationInvitation(true, item)"

Check warning on line 252 in src/components/Dashboard/TodoList.vue

View workflow job for this annotation

GitHub Actions / linting (20.5.1)

'.native' modifier on 'v-on' directive is deprecated
>
<span>Authorize</span>
</v-btn>
Expand All @@ -257,7 +257,7 @@
class="ma-1 affiliation-invitation-action-button"
outlined
color="primary"
@click.native.stop="authorizeAffiliationInvitation(false, item)"

Check warning on line 260 in src/components/Dashboard/TodoList.vue

View workflow job for this annotation

GitHub Actions / linting (20.5.1)

'.native' modifier on 'v-on' directive is deprecated
>
<span>Do not authorize</span>
</v-btn>
Expand Down Expand Up @@ -324,7 +324,7 @@
class="btn-draft-resume"
color="primary"
:disabled="!item.enabled"
@click.native.stop="doResumeFiling(item)"

Check warning on line 327 in src/components/Dashboard/TodoList.vue

View workflow job for this annotation

GitHub Actions / linting (20.5.1)

'.native' modifier on 'v-on' directive is deprecated
>
<template v-if="isTypeAmalgamation(item) && item.isEmptyFiling">
<span>Fill out Amalgamation Application</span>
Expand Down Expand Up @@ -410,7 +410,7 @@
:class="{ 'cancellable' : isCancellableTodoItem(item) }"
color="primary"
:disabled="!item.enabled"
@click.native.stop="doResumePayment(item)"

Check warning on line 413 in src/components/Dashboard/TodoList.vue

View workflow job for this annotation

GitHub Actions / linting (20.5.1)

'.native' modifier on 'v-on' directive is deprecated
>
<span>Change Payment Type</span>
</v-btn>
Expand All @@ -420,7 +420,7 @@
:class="{ 'cancellable' : isCancellableTodoItem(item) }"
color="primary"
:disabled="!item.enabled"
@click.native.stop="doResumePayment(item)"

Check warning on line 423 in src/components/Dashboard/TodoList.vue

View workflow job for this annotation

GitHub Actions / linting (20.5.1)

'.native' modifier on 'v-on' directive is deprecated
>
<span>Resume Payment</span>
</v-btn>
Expand All @@ -438,7 +438,7 @@
color="primary"
:disabled="!item.enabled"
v-on="on"
@click.native.stop

Check warning on line 441 in src/components/Dashboard/TodoList.vue

View workflow job for this annotation

GitHub Actions / linting (20.5.1)

'.native' modifier on 'v-on' directive is deprecated
>
<v-icon>mdi-menu-down</v-icon>
</v-btn>
Expand All @@ -460,7 +460,7 @@
class="btn-retry-payment"
color="primary"
:disabled="!item.enabled"
@click.native.stop="doResumePayment(item)"

Check warning on line 463 in src/components/Dashboard/TodoList.vue

View workflow job for this annotation

GitHub Actions / linting (20.5.1)

'.native' modifier on 'v-on' directive is deprecated
>
<span>Retry Payment</span>
</v-btn>
Expand Down Expand Up @@ -528,7 +528,7 @@
</div>
</template>

<!-- is this a draft IA or Registration? -->
<!-- is this a draft Amalgamation or IA or Registration? -->
<template
v-else-if="isStatusDraft(item) && (isTypeAmalgamation(item) || isTypeIncorporationApplication(item) ||
isTypeRegistration(item))"
Expand Down
9 changes: 9 additions & 0 deletions src/interfaces/business-state-interfaces.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { EntityState, CorpTypeCd, FilingSubTypes, FilingTypes } from '@/enums'
import { AmalgamationTypes } from '@bcrs-shared-components/enums'
import { IsoDatePacific, ApiDateTimeUtc } from '@bcrs-shared-components/interfaces'

export interface FilingTypeIF {
Expand All @@ -16,6 +17,13 @@ export interface AllowedActionsIF {
}
}

export interface AmalgamatedIntoIF {
amalgamationDate: ApiDateTimeUtc
amalgamationType: AmalgamationTypes
identifier: string // eg, BC7654321
legalName: string
}

export interface BusinessWarningIF {
code: string // FUTURE: use an enum
filing?: string // not used
Expand All @@ -28,6 +36,7 @@ export interface BusinessWarningIF {
export interface ApiBusinessIF {
adminFreeze: boolean
allowedActions: AllowedActionsIF
amalgamatedInto?: AmalgamatedIntoIF
arMaxDate?: IsoDatePacific // not used
arMinDate?: IsoDatePacific // not used
associationType: string // COOP only
Expand Down
5 changes: 5 additions & 0 deletions src/mixins/enum-mixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ export default class EnumMixin extends Vue {
return (item.name === FilingTypes.CORRECTION)
}

/** DEPRECATED Returns True if filing is a Dissolution. */
isTypeDissolution (item: any): boolean {
return (item.name === FilingTypes.DISSOLUTION)
}

/** DEPRECATED Returns True if filing is an Incorporation Application. */
isTypeIncorporationApplication (item: any): boolean {
return (item.name === FilingTypes.INCORPORATION_APPLICATION)
Expand Down
5 changes: 5 additions & 0 deletions src/services/enum-utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,11 @@ export default class EnumUtilities {
return (item.name === FilingTypes.CORRECTION)
}

/** Returns True if filing is a Dissolution. */
static isTypeDissolution (item: any): boolean {
JazzarKarim marked this conversation as resolved.
Show resolved Hide resolved
return (item.name === FilingTypes.DISSOLUTION)
}

/** Returns True if filing is an Amalgamation. */
static isTypeAmalgamation (item: any): boolean {
return (item.name === FilingTypes.AMALGAMATION_APPLICATION)
Expand Down
12 changes: 9 additions & 3 deletions src/stores/businessStore.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { AllowedActionsIF, ApiBusinessIF, ApiDateTimeUtc, BusinessStateIF, BusinessWarningIF } from '@/interfaces'
import { AllowedActionsIF, AmalgamatedIntoIF, ApiBusinessIF, ApiDateTimeUtc, BusinessStateIF, BusinessWarningIF }
from '@/interfaces'
import { defineStore } from 'pinia'
import { CorpTypeCd, EntityState } from '@/enums'
import { DateUtilities, LegalServices } from '@/services/'
Expand Down Expand Up @@ -34,11 +35,16 @@ export const useBusinessStore = defineStore('business', {
}),

getters: {
/** The allowed actions object. */
/** The Allowed Actions object. */
getAllowedActions (state: BusinessStateIF): AllowedActionsIF {
return state.businessInfo.allowedActions
},

/** The Amalgamated Info object. */
getAmalgamatedInto (state: BusinessStateIF): AmalgamatedIntoIF {
return state.businessInfo.amalgamatedInto
},

/** The business number (aka Tax ID). */
getBusinessNumber (state: BusinessStateIF): string {
return state.businessInfo.taxId
Expand All @@ -49,7 +55,7 @@ export const useBusinessStore = defineStore('business', {
return state.businessInfo.warnings
},

/** The business state.businessInfo. */
/** The business state. */
getBusinessState (state: BusinessStateIF): EntityState {
return state.businessInfo.state
},
Expand Down
4 changes: 2 additions & 2 deletions src/stores/filingHistoryListStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const useFilingHistoryListStore = defineStore('filingHistoryList', {
})
},

/** Returns the total AGM extension duration requires argument for year */
/** The function to compute total AGM extension duration. Requires argument for AGM Year. */
getTotalAgmExtensionDuration (state: FilingHistoryListStateIF): (year: number) => number {
return (year: number) => {
return state.filings.reduce((totalMonths, filing) => {
Expand All @@ -47,11 +47,11 @@ export const useFilingHistoryListStore = defineStore('filingHistoryList', {
return totalMonths
}
const filingExtension = filing.data?.agmExtension
// Cast year as number
// Skip if extension data is missing
if (!filingExtension) {
return totalMonths
}
// Cast year as number
// Skip if years don't match
if (Number(filingExtension.year) !== year) {
return totalMonths
Expand Down
78 changes: 56 additions & 22 deletions src/stores/rootStore.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { defineStore } from 'pinia'
import { CorpTypeCd, EntityStatus, FilingSubTypes, FilingTypes } from '@/enums'
import { ApiTaskIF, DissolutionConfirmationResourceIF, FilingDataIF, OfficeAddressIF, PartyIF, RootStateIF,
TodoListResourceIF, IsoDatePacific, StateFilingIF } from '@/interfaces'
import { ApiTaskIF, DissolutionConfirmationResourceIF, FilingDataIF, OfficeAddressIF, PartyIF,
RootStateIF, TodoListResourceIF, IsoDatePacific, StateFilingIF } from '@/interfaces'
import { DateUtilities, EnumUtilities, LegalServices } from '@/services'
import { useBusinessStore } from './businessStore'
import { useFilingHistoryListStore } from './filingHistoryListStore'
Expand Down Expand Up @@ -225,40 +225,74 @@ export const useRootStore = defineStore('root', {
return state.stateFiling
},

/**
* A formatted concatenation of the name and the effective date of the filing.
* Only used when entity is historical.
*/
/** The historical reason text to display in the info header. */
getReasonText (): string {
const enDash = '–' // ALT + 0150
JazzarKarim marked this conversation as resolved.
Show resolved Hide resolved
const businessStore = useBusinessStore()
const stateFiling = this.getStateFiling as StateFilingIF // may be null

if (!businessStore.isHistorical) return null // safety check

// check if historical reason is amalgamation
const amalgamatedInto = businessStore.getAmalgamatedInto
if (amalgamatedInto) return reasonTextAmalgamation()

// get state filing (may be null)
const stateFiling = this.getStateFiling as StateFilingIF
const filingType = stateFiling?.header?.name
if (!filingType) return null // safety check

// create reason text to display in the info header
let name: string
let date: string
// check if historical reason is dissolution
if (filingType === FilingTypes.DISSOLUTION) return reasonTextDissolution()

// check if historical reason is continuation out
if (filingType === FilingTypes.CONTINUATION_OUT) return reasonTextContinuationOut()

// fallback reason text
return reasonTextOther()

if (filingType === FilingTypes.DISSOLUTION) {
name = EnumUtilities.dissolutionTypeToName(
//
// helper functions
//

/** The reason text for a business made historical by an amalgamation. */
function reasonTextAmalgamation (): string {
const name = 'Amalgamation'
const amalgamationDate = DateUtilities.apiToDate(amalgamatedInto.amalgamationDate)
if (!amalgamationDate) throw new Error('Invalid amalgamation date')
const date = DateUtilities.dateToPacificDate(amalgamationDate, true)
const identifier = amalgamatedInto.identifier || 'Unknown Company'
return `${name} ${enDash} ${date} ${enDash} ${identifier}`
}

/** The reason text for a business made historical by a dissolution. */
function reasonTextDissolution (): string {
const name = EnumUtilities.dissolutionTypeToName(
businessStore.isFirm,
(stateFiling?.dissolution?.dissolutionType as FilingSubTypes)
(stateFiling.dissolution?.dissolutionType as FilingSubTypes)
)
const dissolutionDate = DateUtilities.yyyyMmDdToDate(stateFiling.dissolution?.dissolutionDate)
if (!dissolutionDate) throw new Error('Invalid dissolution date')
date = DateUtilities.dateToPacificDate(dissolutionDate, true)
} else {
name = (filingType === FilingTypes.CONTINUATION_OUT)
? 'Continued Out'
: EnumUtilities.filingTypeToName(filingType)
const effectiveDate = DateUtilities.apiToDate(stateFiling.header.effectiveDate)
const date = DateUtilities.dateToPacificDate(dissolutionDate, true)
return `${name} ${enDash} ${date}`
}

/** The reason text for a business made historical by a continuation out. */
function reasonTextContinuationOut (): string {
const name = 'Continued Out'
const effectiveDate = DateUtilities.apiToDate(stateFiling.header?.effectiveDate)
if (!effectiveDate) throw new Error('Invalid effective date')
date = DateUtilities.dateToPacificDateTime(effectiveDate)
const dateTime = DateUtilities.dateToPacificDateTime(effectiveDate)
return `${name} ${enDash} ${dateTime}`
}

const enDash = '–' // ALT + 0150
return `${name} ${enDash} ${date}`
/** The reason text for a business made historical by some other state filing. */
function reasonTextOther (): string {
const name = EnumUtilities.filingTypeToName(filingType)
const effectiveDate = DateUtilities.apiToDate(stateFiling.header?.effectiveDate)
if (!effectiveDate) throw new Error('Invalid effective date')
const dateTime = DateUtilities.dateToPacificDateTime(effectiveDate)
return `${name} ${enDash} ${dateTime}`
}
},

/** The limited restoration active-until date, if it exists, otherwise null. */
Expand Down
2 changes: 1 addition & 1 deletion src/views/AgmExtension.vue
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ export default class AgmExtension extends Mixins(CommonMixin, DateMixin,
ret = await LegalServices.createFiling(this.getIdentifier, filing, isDraft)
}
return ret
} catch (error) {
} catch (error: any) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

By default, error is of type Unknown, which causes code errors on lines 459 and 460.

// save errors or warnings, if any
this.saveErrors = error?.response?.data?.errors || []
this.saveWarnings = error?.response?.data?.warnings || []
Expand Down
2 changes: 1 addition & 1 deletion src/views/AgmLocationChg.vue
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ export default class AgmLocationChg extends Mixins(CommonMixin, DateMixin,
ret = await LegalServices.createFiling(this.getIdentifier, filing, isDraft)
}
return ret
} catch (error) {
} catch (error: any) {
// save errors or warnings, if any
this.saveErrors = error?.response?.data?.errors || []
this.saveWarnings = error?.response?.data?.warnings || []
Expand Down
2 changes: 1 addition & 1 deletion src/views/AnnualReport.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1134,7 +1134,7 @@ export default class AnnualReport extends Mixins(CommonMixin, DateMixin, FilingM
ret = await LegalServices.createFiling(this.getIdentifier, filing, isDraft)
}
return ret
} catch (error) {
} catch (error: any) {
// save errors or warnings, if any
this.saveErrors = error?.response?.data?.errors || []
this.saveWarnings = error?.response?.data?.warnings || []
Expand Down
2 changes: 1 addition & 1 deletion src/views/ConsentContinuationOut.vue
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,7 @@ export default class ConsentContinuationOut extends Mixins(CommonMixin, DateMixi
ret = await LegalServices.createFiling(this.getIdentifier, filing, isDraft)
}
return ret
} catch (error) {
} catch (error: any) {
// save errors or warnings, if any
this.saveErrors = error?.response?.data?.errors || []
this.saveWarnings = error?.response?.data?.warnings || []
Expand Down
2 changes: 1 addition & 1 deletion src/views/ContinuationOut.vue
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,7 @@ export default class ContinuationOut extends Mixins(CommonMixin, DateMixin,
ret = await LegalServices.createFiling(this.getIdentifier, filing, isDraft)
}
return ret
} catch (error) {
} catch (error: any) {
// save errors or warnings, if any
this.saveErrors = error?.response?.data?.errors || []
this.saveWarnings = error?.response?.data?.warnings || []
Expand Down
2 changes: 1 addition & 1 deletion src/views/Correction.vue
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,7 @@ export default class Correction extends Mixins(CommonMixin, DateMixin, EnumMixin
ret = await LegalServices.createFiling(this.getIdentifier, filing, isDraft)
}
return ret
} catch (error) {
} catch (error: any) {
// save errors or warnings, if any
this.saveErrors = error?.response?.data?.errors || []
this.saveWarnings = error?.response?.data?.warnings || []
Expand Down
2 changes: 1 addition & 1 deletion src/views/StandaloneDirectorsFiling.vue
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,7 @@ export default class StandaloneDirectorsFiling extends Mixins(CommonMixin, DateM
ret = await LegalServices.createFiling(this.getIdentifier, filing, isDraft)
}
return ret
} catch (error) {
} catch (error: any) {
// save errors or warnings, if any
this.saveErrors = error?.response?.data?.errors || []
this.saveWarnings = error?.response?.data?.warnings || []
Expand Down
2 changes: 1 addition & 1 deletion src/views/StandaloneOfficeAddressFiling.vue
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,7 @@ export default class StandaloneOfficeAddressFiling extends Mixins(CommonMixin, D
ret = await LegalServices.createFiling(this.getIdentifier, filing, isDraft)
}
return ret
} catch (error) {
} catch (error: any) {
// save errors or warnings, if any
this.saveErrors = error?.response?.data?.errors || []
this.saveWarnings = error?.response?.data?.warnings || []
Expand Down
Loading
Loading