Skip to content

Commit

Permalink
Incorporate now for named companies after NR is approved (bcgov#627)
Browse files Browse the repository at this point in the history
* Package update

* Implemented incorporate now for named companies after NR submission

* Update in response to Sev's PR comments
  • Loading branch information
JazzarKarim committed Aug 24, 2023
1 parent 4d0ce2c commit 2b3543f
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 39 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": "name-request",
"version": "5.0.6",
"version": "5.0.7",
"private": true,
"appName": "Name Request UI",
"sbcName": "SBC Common Components",
Expand Down
19 changes: 2 additions & 17 deletions src/components/common/bullets-colin-link.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,14 @@ import { Getter } from 'vuex-class'
import { CompanyType, EntityType } from '@/enums'
import NameInput from '@/components/new-request/name-input.vue'
import { Navigate } from '@/plugins'
import { NrAffiliationMixin } from '@/mixins'
import { CorpTypeCd } from '@bcrs-shared-components/corp-type-module'
import { CommonMixin, NrAffiliationMixin } from '@/mixins'
@Component({
components: {
NameInput
}
})
export default class BulletsColinLink extends Mixins(NrAffiliationMixin) {
export default class BulletsColinLink extends Mixins(CommonMixin, NrAffiliationMixin) {
/** The selected business type. */
@Prop({ default: '' }) readonly businessType!: EntityType
Expand All @@ -91,20 +90,6 @@ export default class BulletsColinLink extends Mixins(NrAffiliationMixin) {
// For template
readonly CompanyType = CompanyType
/**
* The alternate codes for entity types.
* Alternate codes are used in Entities UIs.
*/
entityTypeAlternateCode (entityType: EntityType): CorpTypeCd {
switch (entityType) {
case EntityType.BC: return CorpTypeCd.BENEFIT_COMPANY
case EntityType.CC: return CorpTypeCd.BC_CCC
case EntityType.CR: return CorpTypeCd.BC_COMPANY
case EntityType.UL: return CorpTypeCd.BC_ULC_COMPANY
default: return null
}
}
/** Navigate to the Entity Dashboard. */
goToEntityDashboard (businessId: string): void {
if (businessId) {
Expand Down
20 changes: 7 additions & 13 deletions src/components/existing-request/existing-request-display.vue
Original file line number Diff line number Diff line change
Expand Up @@ -194,23 +194,17 @@
:nrNum="nr && nr.nrNum"
:approvedName="approvedName && approvedName.name"
:emailAddress="nr && nr.applicants && nr.applicants.emailAddress"
:showIncorporateNowButton="showIncorporateButton"
:showRegisterButton="showRegisterButton"
:disabled="disableUnfurnished"
@registerYourBusiness="registerYourBusiness()"
@incorporateRegisterYourBusiness="incorporateRegisterYourBusiness()"
/>

<NrNotApprovedGrayBox
class="mt-5"
v-if="showNrNotApprovedGrayBox"
:nrNum="nr.nrNum"
/>

<!-- incorporate button -->
<div class="mt-5 text-center" v-if="showIncorporateButton">
<v-btn id="INCORPORATE-btn" @click="handleButtonClick(NrAction.INCORPORATE)">
Incorporate Using This Name Request
</v-btn>
</div>
</div>
</transition>
</template>
Expand Down Expand Up @@ -417,15 +411,15 @@ export default class ExistingRequestDisplay extends Mixins(
*/
get showIncorporateButton (): boolean {
return (
this.isBenefitCompany(this.nr) &&
this.actions.includes(NrAction.INCORPORATE)
this.isSupportedEntity(this.nr) &&
this.nr.request_action_cd === NrRequestActionCodes.NEW_BUSINESS &&
NrState.APPROVED === this.nr.state
)
}
/** True if the Register button should be shown. */
get showRegisterButton (): boolean {
return this.isFirm(this.nr) &&
this.nr.request_action_cd &&
this.nr.request_action_cd === NrRequestActionCodes.NEW_BUSINESS &&
(NrState.APPROVED === this.nr.state ||
this.isConsentUnRequired)
Expand Down Expand Up @@ -688,8 +682,8 @@ export default class ExistingRequestDisplay extends Mixins(
this.setConditionsModalVisible(true)
}
/** Called to register the business. */
async registerYourBusiness (): Promise<void> {
/** Called to incorporate/register the business. */
async incorporateRegisterYourBusiness (): Promise<void> {
// safety check
if (!this.isNrApprovedOrConditional) return
Expand Down
16 changes: 15 additions & 1 deletion src/components/existing-request/nr-approved-gray-box.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,23 @@
class="register-btn"
min-width="20rem"
:disabled="disabled"
@click="$emit('registerYourBusiness')"
@click="$emit('incorporateRegisterYourBusiness')"
>
<strong>Register Your Business</strong>
</v-btn>
</div>

<div v-else-if="showIncorporateNowButton" class="d-flex justify-center my-1 pb-1">
<v-btn
class="incorporate-now-btn"
min-width="20rem"
:disabled="disabled"
@click="$emit('incorporateRegisterYourBusiness')"
>
<strong>Incorporate Your Business</strong>
</v-btn>
</div>

<p v-else>
Your Name Request <strong>{{nrNum}}</strong> for <strong>{{approvedName}}</strong> has been
approved for use. An email has been sent to <strong>{{emailAddress}}</strong> with instructions
Expand Down Expand Up @@ -48,6 +59,9 @@ export default class NrApprovedGrayBox extends Vue {
@Prop({ default: false })
readonly showRegisterButton: boolean
@Prop({ default: false })
readonly showIncorporateNowButton: boolean
@Prop({ default: false })
readonly disabled: boolean
}
Expand Down
23 changes: 20 additions & 3 deletions src/mixins/common-mixin.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { Component, Vue } from 'vue-property-decorator'
import { EntityType, PriorityCode, NrRequestActionCodes } from '@/enums'
import { CorpTypeCd } from '@bcrs-shared-components/corp-type-module'
import { GetFeatureFlag } from '@/plugins'

@Component({})
export class CommonMixin extends Vue {
Expand Down Expand Up @@ -51,6 +53,20 @@ export class CommonMixin extends Vue {
}
}

/**
* The alternate codes for entity types.
* Alternate codes are used in Entities UIs.
*/
entityTypeAlternateCode (entityType: EntityType): CorpTypeCd {
switch (entityType) {
case EntityType.BC: return CorpTypeCd.BENEFIT_COMPANY
case EntityType.CC: return CorpTypeCd.BC_CCC
case EntityType.CR: return CorpTypeCd.BC_COMPANY
case EntityType.UL: return CorpTypeCd.BC_ULC_COMPANY
default: return null
}
}

/**
* Returns request action text for the the specified code.
* See namex -> api/namex/resources/name_requests/report_resource.py::_get_request_action_cd_description()
Expand Down Expand Up @@ -80,9 +96,10 @@ export class CommonMixin extends Vue {
return (nr?.priorityCd === PriorityCode.YES)
}

/** Returns true if the specified NR is for a Benefit Company. */
isBenefitCompany (nr: any): boolean {
return (nr?.entity_type_cd === EntityType.BC)
/** Returns true if the specified NR is for a supported Incorporation Entity Type (FF). */
isSupportedEntity (nr: any): boolean {
const supportedEntites = GetFeatureFlag('supported-incorporation-registration-entities')
return supportedEntites.includes(nr?.entity_type_cd)
}

/** Returns true if the specified NR is for a firm (SP/GP). */
Expand Down
8 changes: 6 additions & 2 deletions src/mixins/nr-affiliation-mixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,12 @@ export class NrAffiliationMixin extends Mixins(CommonMixin) {

/** Returns business request object. */
private getBusinessRequest (accountId: number, nr: NameRequestI): BusinessRequest {
const name = this.isBenefitCompany(nr) ? 'incorporationApplication' : 'registration'
const legalType = this.isBenefitCompany(nr) ? 'BEN' : nr.legalType
let name = 'registration'
let legalType = nr.legalType
if (this.isSupportedEntity(nr)) {
name = 'incorporationApplication'
legalType = this.entityTypeAlternateCode(nr.entity_type_cd)
}
const nrNumber = nr.nrNum

const businessRequest = {
Expand Down

0 comments on commit 2b3543f

Please sign in to comment.