-
Notifications
You must be signed in to change notification settings - Fork 45
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
severinbeauvais
merged 2 commits into
bcgov:feature-search-refactor
from
severinbeauvais:17468
Sep 13, 2023
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
170 changes: 170 additions & 0 deletions
170
src/components/new-request/search-components/business-lookup-fetch.vue
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,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
45
src/components/new-request/search-components/company-type.vue
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,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> |
52 changes: 52 additions & 0 deletions
52
src/components/new-request/search-components/corp-number-checkbox.vue
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,52 @@ | ||
<template> | ||
<div id="corp-number-checkbox"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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> |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.