Skip to content

Commit

Permalink
Create draft amalgamation + redirect + misc. fixes/updates (bcgov#601)
Browse files Browse the repository at this point in the history
* Create draft amalgamation + redirect + misc. fixes/updates

* Fixed comments

* Fixed in response to Sev's comments + added unit tests

* fixed typos
  • Loading branch information
JazzarKarim authored Dec 20, 2023
1 parent 927667d commit 03aca5b
Show file tree
Hide file tree
Showing 13 changed files with 259 additions and 33 deletions.
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.27",
"version": "7.0.28",
"private": true,
"appName": "Filings UI",
"sbcName": "SBC Common Components",
Expand Down
16 changes: 12 additions & 4 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@
</div>
</v-fade-transition>

<!-- Fetching Data spinner -->
<!-- Fetching Data/Starting Amalgamation spinner -->
<v-fade-transition>
<div
v-show="showFetchingDataSpinner"
v-show="spinnerText"
class="loading-container grayed-out"
>
<div class="loading__content">
Expand All @@ -88,7 +88,7 @@
indeterminate
/>
<div class="loading-msg white--text">
Fetching Data
{{ spinnerText }}
</div>
</div>
</div>
Expand Down Expand Up @@ -250,7 +250,8 @@ export default {
'isAppFiling',
'isAppTask',
'isRoleStaff',
'showFetchingDataSpinner'
'showFetchingDataSpinner',
'showStartingAmalgamationSpinner'
]),
/** The Business ID string. */
Expand Down Expand Up @@ -308,6 +309,13 @@ export default {
return bannerText?.trim() || null
},
/** Spinner text. */
spinnerText (): string {
if (this.showFetchingDataSpinner) return 'Fetching Data'
if (this.showStartingAmalgamationSpinner) return 'Starting Amalgamation'
return null
},
/** The route breadcrumbs list. */
breadcrumbs (): Array<BreadcrumbIF> {
const breadcrumbs = this.$route?.meta?.breadcrumb
Expand Down
5 changes: 3 additions & 2 deletions src/components/Dashboard/TodoList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1325,12 +1325,13 @@ export default class TodoList extends Mixins(AllowableActionsMixin, DateMixin, E
const paymentStatusCode = header.paymentStatusCode
const payErrorObj = paymentStatusCode && await PayServices.getPayErrorObj(this.getPayApiUrl, paymentStatusCode)
// NB: incorporationApplicationmay be undefined
// NB: amalgamation application may be undefined
const haveData = Boolean(
amalgamation?.amalgamatingBusinesses ||
amalgamation?.offices ||
amalgamation?.contactPoint ||
amalgamation?.parties ||
amalgamation?.shareClasses
amalgamation?.shareStructure?.shareClasses
)
const item: TodoItemIF = {
Expand Down
67 changes: 67 additions & 0 deletions src/interfaces/amalgamation-interfaces.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import { AmalgamationTypes, CorpTypeCd, FilingTypes } from '@/enums'
import { CorrectNameOptions } from '@bcrs-shared-components/enums'
import { CompletingPartyIF, ContactPointIF, CourtOrderIF,
NameTranslationIF, ShareClassIF } from '@bcrs-shared-components/interfaces'
import { OfficeAddressIF } from './address-interfaces'

/**
* A filing's amalgamation application object from the API. See:
* https://github.com/bcgov/business-schemas/blob/main/src/registry_schemas/schemas/amalgamation_application.json
*/
export interface RegisteredRecordsAddressesIF {
registeredOffice: OfficeAddressIF
recordsOffice?: OfficeAddressIF
}

export interface NameRequestFilingIF {
legalType: CorpTypeCd
legalName?: string
nrNumber?: string
correctNameOption?: CorrectNameOptions
}

export interface AmalgamationApplicationIF {
amalgamatingBusinesses: any[]
courtApproval: boolean
type: AmalgamationTypes
nameRequest: NameRequestFilingIF
nameTranslations: NameTranslationIF[]
offices: RegisteredRecordsAddressesIF | object
contactPoint: ContactPointIF
parties: CompletingPartyIF[]

// BEN / CC / BC / ULC only:
shareStructure?: {
shareClasses: ShareClassIF[]
}
incorporationAgreement?: {
agreementType: string
}
// ULC only:
courtOrder?: CourtOrderIF
}

/** Amalgamation Application filing interface. */
export interface AmalgamationApplicationFilingIF {
header: {
name: FilingTypes
certifiedBy: string
date: string
effectiveDate?: string
filingId?: number
folioNumber?: string
isFutureEffective: boolean

// staff payment properties:
routingSlipNumber?: string
bcolAccountNumber?: string
datNumber?: string
waiveFees?: boolean
priority?: boolean
}
business: {
legalType: CorpTypeCd
identifier: string
}
amalgamationApplication: AmalgamationApplicationIF
}
5 changes: 3 additions & 2 deletions src/interfaces/api-task-interface.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { AlterationIF, ApiBusinessIF, RestorationIF, SpecialResolutionIF } from '@/interfaces'
import { AlterationIF, AmalgamationApplicationIF,
ApiBusinessIF, RestorationIF, SpecialResolutionIF } from '@/interfaces'
import { FilingStatus, FilingTypes } from '@/enums'

/** A filing's header object from the Legal API. */
Expand Down Expand Up @@ -39,7 +40,7 @@ export interface TaskTodoIF {
agmExtension?: any
agmLocationChange?: any
alteration?: AlterationIF
amalgamationApplication?: any
amalgamationApplication?: AmalgamationApplicationIF
annualReport?: any
business: ApiBusinessIF
changeOfAddress?: any
Expand Down
1 change: 1 addition & 0 deletions src/interfaces/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export * from './address-interfaces'
export * from './affiliation-invitation-interface'
export * from './agm-ext-eval-interface'
export * from './alert-message-interface'
export * from './amalgamation-interfaces'
export * from './api-filing-interface'
export * from './api-task-interface'
export * from './authentication-state-interface'
Expand Down
1 change: 1 addition & 0 deletions src/interfaces/root-state-interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export interface RootStateIF {
businessAddress: OfficeAddressIF
configObject: any
fetchingDataSpinner: boolean
startingAmalgamationSpinner: boolean
filingData: Array<FilingDataIF>
nameRequest: any
parties: Array<PartyIF>
Expand Down
4 changes: 1 addition & 3 deletions src/services/legal-services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,7 @@ export default class LegalServices {
* Throws an exception on error.
*/
static async createBusiness (businessRequest: any): Promise<any> {
const legalApiUrl = sessionStorage.getItem('LEGAL_API_URL')

const url = `${legalApiUrl}/businesses?draft=true`
const url = `businesses?draft=true`
return axios.post(url, businessRequest)
}

Expand Down
10 changes: 10 additions & 0 deletions src/stores/rootStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export const useRootStore = defineStore('root', {
businessAddress: null,
configObject: null,
fetchingDataSpinner: false,
startingAmalgamationSpinner: false,
filingData: [],
nameRequest: null,
parties: [],
Expand Down Expand Up @@ -159,6 +160,11 @@ export const useRootStore = defineStore('root', {
return state.fetchingDataSpinner
},

/** Whether to show the Starting Amalgamation spinner. */
showStartingAmalgamationSpinner (state: RootStateIF): boolean {
return state.startingAmalgamationSpinner
},

/**
* This is used to show Legal Obligations only for a new business
* that has no tasks and hasn't filed anything yet (except their IA).
Expand Down Expand Up @@ -284,6 +290,10 @@ export const useRootStore = defineStore('root', {
this.fetchingDataSpinner = val
},

setStartingAmalgamationSpinner (val: boolean) {
this.startingAmalgamationSpinner = val
},

setStateFiling (stateFilingResponse: any) {
this.stateFiling = stateFilingResponse
},
Expand Down
45 changes: 27 additions & 18 deletions src/views/AmalgamationSelection.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div id="agm-location-chg">
<div id="amalgamation-selection">
<!-- Main Body -->
<v-container class="view-container">
<v-row>
Expand All @@ -25,6 +25,7 @@
<!-- First Choice -->
<v-col>
<v-card
id="start-horizontal-short-form-card"
flat
class="pt-6 pb-8 px-4"
>
Expand All @@ -43,9 +44,10 @@
</ul>
<br>
<p>Shareholders of the amalgamating corporations do not need to approve the amalgamation.</p>
<div class="start-horizontal-short-form-btn-div">
<div class="btn-div">
<!-- TODO: Remove disabled when doing short form amalgamations -->
<v-btn
id="horizontal-short-form-btn"
disabled
color="primary"
large
Expand All @@ -59,6 +61,7 @@
<!-- Second Choice -->
<v-col>
<v-card
id="start-vertical-short-form-card"
flat
class="pt-6 pb-8 px-4"
>
Expand All @@ -77,9 +80,10 @@
</ul>
<br>
<p>Shareholders of the amalgamating corporations do not need to approve the amalgamation.</p>
<div class="start-horizontal-short-form-btn-div">
<div class="btn-div">
<!-- TODO: Remove disabled when doing short form amalgamations -->
<v-btn
id="vertical-short-form-btn"
disabled
color="primary"
large
Expand All @@ -93,6 +97,7 @@
<!-- Third Choice -->
<v-col>
<v-card
id="start-regular-long-form-card"
flat
class="pt-6 pb-8 px-4"
>
Expand All @@ -117,8 +122,9 @@
When the amalgamation is complete, your company will be a
<strong>{{ getRegularAmalgamationText() }}.</strong>
</p>
<div class="start-horizontal-short-form-btn-div">
<div class="btn-div">
<v-btn
id="regular-long-form-btn"
color="primary"
large
@click="startRegularAmalgamation()"
Expand All @@ -134,23 +140,27 @@
</template>

<script lang="ts">
import { useBusinessStore } from '@/stores'
import { Getter } from 'pinia-class'
import { useBusinessStore, useConfigurationStore, useRootStore } from '@/stores'
import { Action, Getter } from 'pinia-class'
import { Component, Vue } from 'vue-property-decorator'
import { CorpTypeCd } from '@bcrs-shared-components/corp-type-module'
import { AmalgamationTypes, FilingTypes } from '@bcrs-shared-components/enums'
import { Routes } from '@/enums'
import { LegalServices } from '@/services'
import { navigate } from '@/utils'
@Component({})
export default class AmalgamationSelection extends Vue {
@Getter(useConfigurationStore) getCreateUrl!: string
@Getter(useBusinessStore) getIdentifier!: string
@Getter(useBusinessStore) getLegalType!: string
@Getter(useBusinessStore) isBComp!: boolean
@Getter(useBusinessStore) isBcCompany!: boolean
@Getter(useBusinessStore) isCcc!: boolean
@Getter(useBusinessStore) isUlc!: boolean
@Action(useRootStore) setStartingAmalgamationSpinner!: (x: boolean) => void
/** Called when component is created. */
created (): void {
const filingId = +this.$route.params.filingId // id param of this selection panel route, must be 0
Expand All @@ -171,20 +181,19 @@ export default class AmalgamationSelection extends Vue {
/** Start Regular Long-form button pressed. */
async startRegularAmalgamation (): Promise<any> {
// let legalType = null
// if (this.isBComp) legalType = CorpTypeCd.BC_COMPANY
// else legalType = this.getLegalType
window.alert('This action is not available at the moment. Please check again later.')
const legalType = this.getLegalType as CorpTypeCd
// Create a draft amalgamation and redirect to Create UI
try {
// show spinner since this is a network call
this.$root.$emit('showSpinner', true)
// const accountId = +JSON.parse(sessionStorage.getItem('CURRENT_ACCOUNT'))?.id || 0
// const businessId = await this.createBusinessAA(accountId, legalType)
this.setStartingAmalgamationSpinner(true)
const accountId = +JSON.parse(sessionStorage.getItem('CURRENT_ACCOUNT'))?.id || 0
const businessId = await this.createBusinessAA(accountId, legalType, AmalgamationTypes.REGULAR)
const amalgamationUrl = `${this.getCreateUrl}?id=${businessId}`
navigate(amalgamationUrl)
return
} catch (error) {
this.$root.$emit('showSpinner', false)
this.setStartingAmalgamationSpinner(false)
throw new Error('Unable to Amalgamate Now ' + error)
}
}
Expand All @@ -194,7 +203,7 @@ export default class AmalgamationSelection extends Vue {
* @param accountId Account ID of logged in user.
* @param legalType The legal type of the amalgamated business
*/
async createBusinessAA (accountId: number, legalType: CorpTypeCd): Promise<string> {
async createBusinessAA (accountId: number, legalType: CorpTypeCd, type: AmalgamationTypes): Promise<string> {
const businessRequest = {
filing: {
header: {
Expand All @@ -208,7 +217,7 @@ export default class AmalgamationSelection extends Vue {
nameRequest: {
legalType: legalType
},
type: AmalgamationTypes.REGULAR
type: type
}
}
} as any
Expand Down Expand Up @@ -247,7 +256,7 @@ h1 {
// Center and push the buttons to the botton of the cards.
// Keep them centered in the cards regardless of screen size.
.start-horizontal-short-form-btn-div {
.btn-div {
position: absolute;
bottom: 2rem;
margin-left: auto;
Expand Down
Loading

0 comments on commit 03aca5b

Please sign in to comment.