Skip to content

Commit

Permalink
18640 More amalgamating business table work (#589)
Browse files Browse the repository at this point in the history
* - app version = 5.6.7

* - changed break to return in App.vue
- always import CorpTypeCd from corp-type-module (never enums)
- added some TING business rules
- removed status from static data

* - more table logic
- more test data cleanup

* wip

* wip

* - deleted unneeded getters, etc
- added Business Table Summary

* wip

* wip
  • Loading branch information
severinbeauvais authored Dec 5, 2023
1 parent a57bd1c commit 95e789a
Show file tree
Hide file tree
Showing 47 changed files with 393 additions and 126 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-create-ui",
"version": "5.6.6",
"version": "5.6.7",
"private": true,
"appName": "Create UI",
"sbcName": "SBC Common Components",
Expand Down
10 changes: 5 additions & 5 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -732,23 +732,23 @@ export default class App extends Mixins(CommonMixin, DateMixin, FilingTemplateMi
switch (this.getFilingType) {
case FilingTypes.AMALGAMATION:
this.$router.push(RouteNames.AMALG_REG_INFORMATION).catch(() => {})
break
return
case FilingTypes.DISSOLUTION:
if (this.isTypeFirm) {
this.$router.push(RouteNames.DISSOLUTION_FIRM).catch(() => {})
} else {
this.$router.push(RouteNames.DISSOLUTION_DEFINE_DISSOLUTION).catch(() => {})
}
return // *** TODO: should this be "break"?
return
case FilingTypes.INCORPORATION_APPLICATION:
this.$router.push(RouteNames.INCORPORATION_DEFINE_COMPANY).catch(() => {})
return // *** TODO: should this be "break"?
return
case FilingTypes.REGISTRATION:
this.$router.push(RouteNames.REGISTRATION_DEFINE_BUSINESS).catch(() => {})
return // *** TODO: should this be "break"?
return
case FilingTypes.RESTORATION:
this.$router.push(RouteNames.RESTORATION_BUSINESS_NAME).catch(() => {})
return // *** TODO: should this be "break"?
return
default:
this.invalidRouteDialog = true
throw new Error(`fetchData(): invalid filing type = ${this.getFilingType}`) // go to catch()
Expand Down
3 changes: 2 additions & 1 deletion src/components/Amalgamation/AmalgamatingBusinesses.vue
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,9 @@ export default class AmalgamatingBusinesses extends Mixins(CommonMixin) {
// Set the amalgamated businesses array in the store.
this.setAmalgamatingBusinesses(this.amalgamatingBusinesses)
// Close the "Add an Amalgamating Business" Panel.
this.addAmalgamatingBusinessCancel()
this.isAddingAmalgamatingBusiness = false
}
}
</script>
Expand Down
47 changes: 37 additions & 10 deletions src/components/Amalgamation/BusinessStatus.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,40 +33,58 @@ export default class BusinessStatus extends Vue {
get icon (): string {
switch (this.status) {
case AmalgamatingStatuses.OK: return 'mdi-check'
case AmalgamatingStatuses.OK:
return 'mdi-check'
case AmalgamatingStatuses.ERROR_AFFILIATION:
case AmalgamatingStatuses.ERROR_CCC_MISMATCH:
case AmalgamatingStatuses.ERROR_FOREIGN:
case AmalgamatingStatuses.ERROR_NIGS: return 'mdi-alert'
case AmalgamatingStatuses.ERROR_FOREIGN_UNLIMITED:
case AmalgamatingStatuses.ERROR_FUTURE_EFFECTIVE_FILING:
case AmalgamatingStatuses.ERROR_LIMITED_RESTORATION:
case AmalgamatingStatuses.ERROR_NIGS:
return 'mdi-alert'
default: return 'mdi-alert-circle-outline' // should never happen
default:
return 'mdi-alert-circle-outline' // should never happen
}
}
get color (): string {
switch (this.status) {
case AmalgamatingStatuses.OK: return 'success'
case AmalgamatingStatuses.OK:
return 'success'
case AmalgamatingStatuses.ERROR_AFFILIATION:
case AmalgamatingStatuses.ERROR_CCC_MISMATCH:
case AmalgamatingStatuses.ERROR_FOREIGN:
case AmalgamatingStatuses.ERROR_NIGS: return 'warning'
case AmalgamatingStatuses.ERROR_FOREIGN_UNLIMITED:
case AmalgamatingStatuses.ERROR_FUTURE_EFFECTIVE_FILING:
case AmalgamatingStatuses.ERROR_LIMITED_RESTORATION:
case AmalgamatingStatuses.ERROR_NIGS:
return 'warning'
default: return 'error' // should never happen
default:
return 'error' // should never happen
}
}
get text (): string {
switch (this.status) {
case AmalgamatingStatuses.OK: return 'Ready'
case AmalgamatingStatuses.OK:
return 'Ready'
case AmalgamatingStatuses.ERROR_AFFILIATION:
case AmalgamatingStatuses.ERROR_CCC_MISMATCH:
case AmalgamatingStatuses.ERROR_FOREIGN:
case AmalgamatingStatuses.ERROR_NIGS: return 'Attention Required'
case AmalgamatingStatuses.ERROR_FOREIGN_UNLIMITED:
case AmalgamatingStatuses.ERROR_FUTURE_EFFECTIVE_FILING:
case AmalgamatingStatuses.ERROR_LIMITED_RESTORATION:
case AmalgamatingStatuses.ERROR_NIGS:
return 'Attention Required'
default: return '(Unknown)' // should never happen
default:
return '(Unknown)' // should never happen
}
}
Expand All @@ -81,13 +99,22 @@ export default class BusinessStatus extends Vue {
return 'A BC Community Contribution Company must amalgamate to form a new BC Community ' +
'Contribution Company.'
case AmalgamatingStatuses.ERROR_FOREIGN:
return 'A foreign corporation cannot be amalgamated except by Registries staff.'
case AmalgamatingStatuses.ERROR_FOREIGN_UNLIMITED:
return 'A foreign corporation must not amalgamate with a limited company and continue as ' +
'an unlimited liability company.'
case AmalgamatingStatuses.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 AmalgamatingStatuses.ERROR_LIMITED_RESTORATION:
return 'This business is under limited restoration. It cannot be part of an amalgamation ' +
'unless it is fully restored.'
case AmalgamatingStatuses.ERROR_NIGS:
return 'This business is not in good standing. This filing cannot be submitted until all ' +
'businesses are in good standing.'
default: return null // should never happen
default:
return null // should never happen
}
}
}
Expand Down
126 changes: 100 additions & 26 deletions src/components/Amalgamation/BusinessTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,28 @@
<tbody>
<tr
v-for="(item, index) in businesses"
:key="item.identifier || item.corpNumber"
:key="key(item)"
>
<td class="business-name">
<strong>{{ item.name || item.legalName }}</strong><br>{{ item.email }}
<strong>{{ name(item) }}</strong><br>{{ email(item) }}
</td>

<td class="business-type">
{{ GetCorpFullDescription(item.legalType) || 'Foreign' }}
{{ type(item) }}
</td>

<td class="business-address">
<BaseAddress
v-if="item.address"
:address="item.address"
/>
<span v-else-if="item.foreignJurisdiction">{{ jurisdiction(item) }}</span>
<span v-else>Affiliate to view</span>
<template v-if="item.type === 'lear'">
<BaseAddress
v-if="item.address"
:address="item.address"
/>
<span v-else>Affiliate to view</span>
</template>

<template v-if="item.type === 'foreign'">
{{ jurisdiction(item) }}
</template>
</td>

<td class="business-role">
Expand Down Expand Up @@ -69,10 +74,10 @@ import { Getter, Action } from 'pinia-class'
import { getName } from 'country-list'
import { useStore } from '@/store/store'
import { AmalgamatingStatuses, AmlRoles } from '@/enums'
import { AmalgamatingBusinessIF, DefineCompanyIF } from '@/interfaces'
import { AmalgamatingBusinessIF } from '@/interfaces'
import { BaseAddress } from '@bcrs-shared-components/base-address'
import BusinessStatus from './BusinessStatus.vue'
import { GetCorpFullDescription } from '@bcrs-shared-components/corp-type-module'
import { CorpTypeCd, GetCorpFullDescription } from '@bcrs-shared-components/corp-type-module'
@Component({
components: {
Expand All @@ -85,29 +90,99 @@ export default class BusinessTable extends Vue {
readonly GetCorpFullDescription = GetCorpFullDescription
@Getter(useStore) getAmalgamatingBusinesses!: AmalgamatingBusinessIF[]
@Getter(useStore) getDefineCompanyStep!: DefineCompanyIF
@Getter(useStore) getNameTranslationsValid!: boolean
@Getter(useStore) getShowErrors!: boolean
@Getter(useStore) isBaseCompany!: boolean
@Getter(useStore) isRoleStaff!: boolean
@Getter(useStore) isTypeBcCcc!: boolean
@Getter(useStore) isTypeBcUlcCompany!: boolean
@Action(useStore) setAmalgamatingBusinesses!: (x: AmalgamatingBusinessIF[]) => void
@Action(useStore) setDefineCompanyStepValidity!: (x: boolean) => void
@Action(useStore) setIgnoreChanges!: (x: boolean) => void
get businesses (): any[] {
// *** TODO: use "map" to compute status from other info
// eg, if business.goodStanding != true then status = ERROR_NIGS
// *** I'M STILL WONDERING IF I WANT TO USE THESE
// readonly isLear = (item: AmalgamatingBusinessIF): boolean => (item?.type === 'lear')
// readonly isForeign = (item: AmalgamatingBusinessIF): boolean => (item?.type === 'foreign')
/** True if there a limited company in the table. */
get isAnyLimited (): boolean {
return this.businesses.some(business =>
(business.type === 'lear' && business.legalType === CorpTypeCd.BC_COMPANY)
)
}
/**
* This is the list of amalgamating businesses with computed statuses.
* In other words, these are the business rules.
*/
get businesses (): AmalgamatingBusinessIF[] {
return this.getAmalgamatingBusinesses.map(business => {
if (business.type === 'lear' && business.goodStanding === false) {
/* eslint-disable brace-style */
// disallow foreign altogether if not staff
// (could happen if staff added it and regular user resumes draft)
if (business.type === 'foreign' && !this.isRoleStaff) {
business.status = AmalgamatingStatuses.ERROR_FOREIGN
}
// disallow foreign into ULC if there is also a limited
else if (business.type === 'foreign' && this.isTypeBcUlcCompany && this.isAnyLimited) {
business.status = AmalgamatingStatuses.ERROR_FOREIGN
}
// assume business is not affiliated if we don't have address (non-staff only)
else if (business.type === 'lear' && !business.address && !this.isRoleStaff) {
business.status = AmalgamatingStatuses.ERROR_AFFILIATION
}
// identify CCC mismatch
else if (business.type === 'lear' && business.legalType === CorpTypeCd.BC_CCC && !this.isTypeBcCcc) {
business.status = AmalgamatingStatuses.ERROR_CCC_MISMATCH
}
// disallow NIGS if not staff
else if (business.type === 'lear' && !business.goodStanding && !this.isRoleStaff) {
business.status = AmalgamatingStatuses.ERROR_NIGS
}
// check if limited restoration
// *** TODO
// check for future effective filing
// *** TODO
// otherwise, status is OK
else {
business.status = AmalgamatingStatuses.OK
}
/* eslint-enable brace-style */
return business
})
}
jurisdiction (item: any): string {
const fj = item?.foreignJurisdiction
key (item: AmalgamatingBusinessIF): string {
if (item?.type === 'lear') return item.identifier
if (item?.type === 'foreign') return item.corpNumber
return null // should never happen
}
name (item: AmalgamatingBusinessIF): string {
if (item?.type === 'lear') return item.name
if (item?.type === 'foreign') return item.legalName
return '(Unknown)' // should never happen
}
email (item: AmalgamatingBusinessIF): string {
if (item?.type === 'lear') return item.email
return null // should never happen
}
type (item: AmalgamatingBusinessIF): string {
if (item?.type === 'lear') return GetCorpFullDescription(item.legalType)
if (item?.type === 'foreign') return 'Foreign'
return '(Unknown)' // should never happen
}
jurisdiction (item: AmalgamatingBusinessIF): string {
const fj = (item?.type === 'foreign') && item.foreignJurisdiction
if (fj?.country) {
const country = getName(fj.country)
const region = (fj.region === 'FEDERAL' ? 'Federal' : fj.region)
Expand All @@ -117,7 +192,7 @@ export default class BusinessTable extends Vue {
return '(Unknown)' // should never happen
}
role (item: any): string {
role (item: AmalgamatingBusinessIF): string {
if (item.role === AmlRoles.AMALGAMATING) return 'Amalgamating Business'
if (item.role === AmlRoles.HOLDING) return 'Holding Company'
return '(Unknown)' // should never happen
Expand All @@ -126,6 +201,7 @@ export default class BusinessTable extends Vue {
removeBusiness (index: number): void {
const temp = this.getAmalgamatingBusinesses
temp.splice(index, 1)
// set updated list to trigger reactivity
this.setAmalgamatingBusinesses(temp)
}
Expand Down Expand Up @@ -170,22 +246,20 @@ export default class BusinessTable extends Vue {
padding-right: 2rem;
}
& td.business-name {
min-width: 120px;
max-width: 200px;
// show ellipsis when email overflows
// (doesn't affect name because name breaks on spaces)
overflow-x: hidden;
text-overflow: ellipsis;
}
& td.business-type {
min-width: 120px;
max-width: 150px;
}
& td.business-address {
min-width: 200px;
}
& td.business-role {
max-width: 120px;
max-width: 130px;
}
& td.business-status {
max-width: 120px;
Expand Down
Loading

0 comments on commit 95e789a

Please sign in to comment.