-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
18640 Incremental amalgamating businesses validations, etc (#590)
* - app version = 5.6.10 - updated some validity calculations - moved ting validations to a mixin - generalized status computation - updated regular amalgation validity * - updated to use temp copy of array (instead of local copy) * wip --------- Co-authored-by: Severin Beauvais <severin.beauvais@gov.bc.ca>
- Loading branch information
1 parent
fb98b02
commit 8a12a43
Showing
10 changed files
with
178 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
import { Component, Vue } from 'vue-property-decorator' | ||
import { Getter } from 'pinia-class' | ||
import { useStore } from '@/store/store' | ||
import { AmalgamatingStatuses } from '@/enums' | ||
import { AmalgamatingBusinessIF } from '@/interfaces' | ||
import { CorpTypeCd } from '@bcrs-shared-components/corp-type-module' | ||
|
||
/** | ||
* Mixin that provides amalgamation rules, etc. | ||
*/ | ||
@Component({}) | ||
export default class AmalgamationMixin extends Vue { | ||
@Getter(useStore) getAmalgamatingBusinesses!: AmalgamatingBusinessIF[] | ||
@Getter(useStore) isRoleStaff!: boolean | ||
@Getter(useStore) isTypeBcCcc!: boolean | ||
@Getter(useStore) isTypeBcUlcCompany!: boolean | ||
|
||
// *** TODO: finish this, maybe name them something recognizable... | ||
/** Iterable array of rule functions, sorted by importance. */ | ||
readonly rules = [ | ||
this.rule1, | ||
this.rule2, | ||
this.rule3, | ||
this.rule4, | ||
this.rule5, | ||
this.rule6 | ||
] | ||
|
||
// *** 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.getAmalgamatingBusinesses.some(business => | ||
(business.type === 'lear' && business.legalType === CorpTypeCd.BC_COMPANY) | ||
) | ||
} | ||
|
||
/** True if there an unlimited company in the table in Alberta, Nova Scotia or USA. */ | ||
get isAnyUnlimitedAbNsUsa (): boolean { | ||
return this.getAmalgamatingBusinesses.some(business => | ||
(business.type === 'lear' && business.legalType === CorpTypeCd.BC_COMPANY) | ||
) | ||
} | ||
|
||
// readonly amalgamationRules = [ | ||
// { | ||
// id: 0, | ||
// rule: (v: any) => !!v || 'Required', | ||
// status: AmalgamatingStatuses.ERROR_FOREIGN | ||
// } | ||
// ] | ||
|
||
// A BC Company cannot amalgamate with an existing Unlimited Liability Company from Alberta, | ||
// Nova Scotia, or the USA to form a BC Unlimited Liability Company. | ||
|
||
// disallow foreign into ULC if there is also a limited | ||
rule1 (business: AmalgamatingBusinessIF): AmalgamatingStatuses { | ||
if (business.type === 'foreign' && this.isTypeBcUlcCompany && this.isAnyLimited) { | ||
return AmalgamatingStatuses.ERROR_FOREIGN | ||
} | ||
return null | ||
} | ||
|
||
// disallow foreign altogether if not staff | ||
// (could happen if staff added it and regular user resumes draft) | ||
rule2 (business: AmalgamatingBusinessIF): AmalgamatingStatuses { | ||
if (business.type === 'foreign' && !this.isRoleStaff) { | ||
return AmalgamatingStatuses.ERROR_FOREIGN | ||
} | ||
return null | ||
} | ||
|
||
// disallow foreign into ULC if there is also a limited | ||
rule3 (business: AmalgamatingBusinessIF): AmalgamatingStatuses { | ||
if (business.type === 'foreign' && this.isTypeBcUlcCompany && this.isAnyLimited) { | ||
return AmalgamatingStatuses.ERROR_FOREIGN | ||
} | ||
return null | ||
} | ||
|
||
// assume business is not affiliated if we don't have address (non-staff only) | ||
rule4 (business: AmalgamatingBusinessIF): AmalgamatingStatuses { | ||
// *** TODO: revert staff check | ||
if (business.type === 'lear' && !business.address /* && !this.isRoleStaff */) { | ||
return AmalgamatingStatuses.ERROR_AFFILIATION | ||
} | ||
return null | ||
} | ||
|
||
// identify CCC mismatch | ||
rule5 (business: AmalgamatingBusinessIF): AmalgamatingStatuses { | ||
if (business.type === 'lear' && business.legalType === CorpTypeCd.BC_CCC && !this.isTypeBcCcc) { | ||
return AmalgamatingStatuses.ERROR_CCC_MISMATCH | ||
} | ||
return null | ||
} | ||
|
||
// disallow NIGS if not staff | ||
rule6 (business: AmalgamatingBusinessIF): AmalgamatingStatuses { | ||
// *** TODO: revert staff check | ||
if (business.type === 'lear' && !business.goodStanding /* && !this.isRoleStaff */) { | ||
return AmalgamatingStatuses.ERROR_NIGS | ||
} | ||
return null | ||
} | ||
|
||
// check if limited restoration | ||
// *** TODO | ||
// *** need to look at all business' filings | ||
|
||
// check for future effective filing | ||
// *** TODO | ||
// *** need to look at all business' filings | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.