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

17468 Refactored search.vue + implemented xpro aml flow #674

Merged
merged 2 commits into from
Sep 13, 2023
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": "name-request",
"version": "5.0.44",
"version": "5.1.0",
"private": true,
"appName": "Name Request UI",
"sbcName": "SBC Common Components",
Expand Down
10 changes: 5 additions & 5 deletions src/components/common/nested-select.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<v-select
class="request-action-select"
class="nested-select"
filled
hide-details="auto"
item-value="[group,value]"
Expand Down Expand Up @@ -69,7 +69,7 @@ export default class NestedSelect extends Vue {
@Prop({ default: null }) readonly value!: any
@Prop() readonly maxHeight!: string

// data
// variables
activeActionGroup = NaN

// computed
Expand All @@ -93,13 +93,13 @@ export default class NestedSelect extends Vue {
}

// methods
@Emit('change')
emitChangeEvent (item: any): void {}

toggleActionGroup (group: number): void {
// if current group is active, deactivate it, otherwise activate it
this.activeActionGroup = (this.activeActionGroup === group) ? NaN : group
}

@Emit('change')
emitChangeEvent (item: any): void {}
}
</script>

Expand Down
5 changes: 1 addition & 4 deletions src/components/dialogs/mras-search-info.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@
<p>{{ resultDesc }}</p>
<p>{{ resultAct }}</p>

<NameInput
id="name-input-component"
:is-mras-search="!isNameSearch"
/>
<NameInput :is-mras-search="!isNameSearch" />
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

id is already set in the component.

</v-card-text>

<v-card-actions class="justify-center">
Expand Down
8 changes: 4 additions & 4 deletions src/components/dialogs/nr-not-required.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
<ol>
<li>
<b>You are already Federally Incorporated.</b><br>
You do not require a name request. Please go to <a :href="corpOnlineLink" target="_blank">
You do not require a name request. Please go to <a :href="colinLink" target="_blank">
Corporate Online</a> to extra-provincially register your business.
</li>
<li class="my-3">
<b>You want a numbered company. The business does not need a name.</b><br>
You do not require a name request. If you are incorporating a Benefit company go to
<a :href="businessRegistryLink" target="_blank">BC Business Registry</a>, otherwise go to
<a :href="corpOnlineLink" target="_blank">Corporate Online</a>. A number will be assigned
<a :href="colinLink" target="_blank">Corporate Online</a>. A number will be assigned
upon registering your business.
</li>
<li>
Expand Down Expand Up @@ -44,8 +44,8 @@ export default class NrNotRequiredDialog extends Vue {
@Getter getNrRequiredModalVisible!: boolean
@Action setNrRequiredModalVisible!: ActionBindingIF

private corpOnlineLink = 'https://www.corporateonline.gov.bc.ca/'
private businessRegistryLink = 'https://www.bcregistry.ca/business'
readonly colinLink = sessionStorage.getItem('CORPORATE_ONLINE_URL')
readonly businessRegistryLink = 'https://www.bcregistry.ca/business'

get showModal () {
return this.getNrRequiredModalVisible
Expand Down
5 changes: 1 addition & 4 deletions src/components/new-request/name-input.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<v-text-field
id="name-input-text-field"
id="name-input-component"
ref="nameInputRef"
:error-messages="message"
autocomplete="chrome-off"
Expand All @@ -22,7 +22,6 @@
<script lang="ts">
import { Component, Prop, Vue, Watch, Emit } from 'vue-property-decorator'
import { Getter, Action } from 'vuex-class'
import { Location, NrRequestActionCodes } from '@/enums'
import { ActionBindingIF } from '@/interfaces/store-interfaces'
import { sanitizeName } from '@/plugins'
import { MRAS_MAX_LENGTH } from '@/components/new-request/constants'
Expand All @@ -42,9 +41,7 @@ export default class NameInput extends Vue {
@Getter getCorpSearch!: string
@Getter getErrors!: string[]
@Getter getHasNoCorpNum!: boolean
@Getter getLocation!: Location
@Getter getName!: string
@Getter getRequestActionCd!: NrRequestActionCodes
@Getter isMrasJurisdiction!: boolean
@Getter isXproFlow!: boolean

Expand Down
170 changes: 170 additions & 0 deletions src/components/new-request/search-components/business-lookup-fetch.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
<template>
<v-col id="business-lookup-fetch" :cols="cols" :md="md">
<template v-if="!getSearchBusiness">
<BusinessLookup
v-if="isAuthenticated"
:searchStatus="lookupActiveOrHistorical"
@business="onBusiness($event)"
/>
<BusinessFetch
v-else
@business="onBusiness($event)"
/>
</template>
<v-form v-else ref="businessLookupTextFieldForm">
<v-text-field
append-icon="mdi-close"
readonly
filled
:label="label"
:value="getSearchBusiness.legalName"
:rules="rules"
:hint="hint"
@click:append="onBusiness(null)"
@keyup.delete="onBusiness(null)"
/>
</v-form>
</v-col>
</template>

<script lang="ts">
import { Component, Mixins, Prop, Vue, Watch } from 'vue-property-decorator'
import BusinessFetch from '@/components/new-request/business-fetch.vue'
import BusinessLookup from '@/components/new-request/business-lookup.vue'
import { BusinessSearchIF, FormType } from '@/interfaces'
import { CorpTypeCd, EntityStates, EntityTypes, Location, NrRequestTypeCodes } from '@/enums'
import { CommonMixin, SearchMixin } from '@/mixins'

@Component({
components: { BusinessFetch, BusinessLookup }
})
export default class BusinessLookupFetch extends Mixins(CommonMixin, SearchMixin) {
@Prop({ default: '12' }) readonly cols!: string
@Prop({ default: '6' }) readonly md!: string

// Refs
$refs!: {
businessLookupTextFieldForm: FormType
selectBusinessTypeRef: FormType
}

get rules (): any {
return [
() => {
if (this.isConversion) {
return this.isAlterable || 'This business cannot alter their business type'
} else if (this.isRestoration) {
return this.isRestorable || 'This business cannot be restored.'
}
return true
}]
}

get label (): string {
if (this.isAuthenticated) {
if (this.lookupActiveOrHistorical === EntityStates.HISTORICAL) {
return 'Find a historical business'
} else {
return 'Find an existing business'
}
} else {
if (this.lookupActiveOrHistorical === EntityStates.HISTORICAL) {
return 'Fetch a historical business'
} else {
return 'Fetch an existing business'
}
}
}

get hint (): string {
if (this.isAuthenticated) {
return 'Search by name, incorporation or registration number of existing business'
} else {
return 'Enter registration number of existing business'
}
}

/** Search businesses with business lookup depending on the Action selected. */
get lookupActiveOrHistorical (): String {
return this.isRestoration ? EntityStates.HISTORICAL : EntityStates.ACTIVE
}

/** Event handled for business lookup/fetch. */
async onBusiness (business: BusinessSearchIF): Promise<void> {
this.setSearchBusiness(business)
this.entity_type_cd = this.getSearchBusiness?.legalType || null
this.setCorpNum(business?.identifier || null)
this.setEntityTypeCd(this.getSearchBusiness?.legalType)
this.setName('')

// Waiting for DOM update to be able to access the Ref. Trigger form validation.
// Need to do that because the ref is in a conditional.
await Vue.nextTick()
if (this.getSearchBusiness) this.$refs.businessLookupTextFieldForm.validate()

if (this.isConversion) {
if (this.getSearchBusiness) {
// set the from business for alteration (conversion)
this.setOriginEntityTypeCd(this.getSearchBusiness.legalType)
// special case if the from business is BEN
// set conversionType & entity_type_cd because there's only one alteration type for it
if (this.isBenBusiness) {
this.setConversionType(NrRequestTypeCodes.CONVERT_CORP)
this.setEntityTypeCd(EntityTypes.BC)
}
} else {
// clear all related fields when clearing business search/fetch for alter
this.setConversionType(null)
this.setOriginEntityTypeCd(null)
this.setSearchCompanyType(null)
}
}

if (this.isRestoration) {
// Check if not XPRO and BC restorable
if (!this.isSelectedXproAndRestorable && this.isBcRestorable) {
this.setLocation(Location.BC)
const corpType = this.getSearchBusiness.legalType as unknown as CorpTypeCd
this.setEntityTypeCd(this.corpTypeToEntityType(corpType))
} else if (this.isSelectedXproAndRestorable) { // Check if XPRO and restorable
this.setLocation(Location.CA)
this.setEntityTypeCd(this.getSearchBusiness.legalType)
} else {
this.setEntityTypeCd(null)
}
}

if (this.isChangeName) {
if (this.isBcBenCccUlc) {
this.setLocation(Location.BC)
const corpType = this.getSearchBusiness?.legalType as unknown as CorpTypeCd
this.setEntityTypeCd(this.corpTypeToEntityType(corpType))
} else {
this.setEntityTypeCd(this.getSearchBusiness.legalType)
}

if (this.isChangeNameXpro) {
this.setLocation(Location.CA)
this.setEntityTypeCd(this.getSearchBusiness.legalType)
}
}
}

/** Resets fields when returned to the Tabs component */
@Watch('getDisplayedComponent')
watchDisplayedComponent (displayedComponent: string) {
if (displayedComponent === 'Tabs') {
this.onBusiness(null)
}
}
}
</script>

<style lang="scss" scoped>
@import '@/assets/styles/theme.scss';

// make the business lookup close button always blue
::v-deep #business-lookup button.mdi-close {
color: $app-blue;
}
</style>
45 changes: 45 additions & 0 deletions src/components/new-request/search-components/company-type.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<template>
<v-col id="company-type" :cols="cols" :md="md">
<header class="h6">Select a company type:</header>

<v-radio-group
class="mt-0 pt-6"
hide-details
mandatory
row
:value="getSearchCompanyType"
@change="setSearchCompanyType($event)"
>
<v-radio
id="named-company-radio"
label="Named Company"
:value="CompanyTypes.NAMED_COMPANY"
/>
<v-radio
id="numbered-company-radio"
label="Numbered Company"
:value="CompanyTypes.NUMBERED_COMPANY"
/>
</v-radio-group>
</v-col>
</template>

<script lang="ts">
import { Component, Mixins, Prop } from 'vue-property-decorator'
import { SearchMixin } from '@/mixins'

@Component({})
export default class CompanyType extends Mixins(SearchMixin) {
@Prop({ default: '12' }) readonly cols!: string
@Prop({ default: '6' }) readonly md!: string
}
</script>

<style lang="scss" scoped>
::v-deep {
// override radio group background color
.v-input--radio-group .v-input__control .v-input__slot {
background-color: white !important;
}
}
</style>
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<template>
<div id="corp-number-checkbox">
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Note: this component is NOT a v-col like the others.

<v-tooltip
top min-width="390"
content-class="top-tooltip"
transition="fade-transition"
:disabled="isMobile"
>
<template v-slot:activator="{ on }">
<v-checkbox
v-model="noCorpNum"
id="corp-num-checkbox"
class="copy-small mt-0 pt-0"
hide-details
v-slot:label
v-on="on"
>
<span v-on="on" class="copy-small">I don't have a corporate number</span>
</v-checkbox>
</template>

<p>
If you don't have or don't know the corporation number of the business, enter the full legal name
of the business in its home jurisdiction.
</p>

<p>
Note: If the home jurisdiction requires a name reservation, you may want to complete a name search
in the home jurisdiction first to ensure that the name is available and then return to BC.
</p>
</v-tooltip>
</div>
</template>

<script lang="ts">
import { Component, Mixins } from 'vue-property-decorator'
import NestedSelect from '@/components/common/nested-select.vue'
import { SearchMixin } from '@/mixins'

@Component({
components: { NestedSelect }
})
export default class CorpNumberCheckbox extends Mixins(SearchMixin) {
get noCorpNum (): boolean {
return this.getHasNoCorpNum
}

set noCorpNum (value: boolean) {
this.setNoCorpNum(value)
}
}
</script>
Loading
Loading