Skip to content

Commit

Permalink
- app version = TBD
Browse files Browse the repository at this point in the history
- added misc comments
- deleted debugging code
- deleted unneeded interface
- added special case for aml to clear location when setting a new entity type
- added special case for aml to use "BC" options by default (ie, ignore location in entity type options)
- fixed getter infinite loop
- added special case for aml to not clear entity type when mutating location
  • Loading branch information
severinbeauvais committed Sep 15, 2023
1 parent 80b31eb commit 7d61b67
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 31 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.1.7",
"version": "5.1.8",
"private": true,
"appName": "Name Request UI",
"sbcName": "SBC Common Components",
Expand Down
1 change: 1 addition & 0 deletions src/components/dialogs/pick-entity-or-conversion.vue
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ export default class PickEntityOrConversionDialog extends CommonMixin {
this.showSocietiesInfo = true
return
}
// if not already there, save selected entry for later addition to menu list
let index = this.getEntityTypeOptions.findIndex((ent: any) => ent.value === entity.value)
if (index === -1) {
this.setEntityTypeAddToSelect(entity)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ export default class EntityType extends Mixins(SearchMixin) {
}
get entityTypeOptions () {
// console.log('*** EntityType, new entity type options =', this.getEntityTypeOptions)
return (this.isConversion ? this.getConversionTypeOptions : this.getEntityTypeOptions)
}
Expand Down
1 change: 0 additions & 1 deletion src/interfaces/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export * from './request-or-consent-interface'
export * from './designation'
export * from './env-config'
export * from './jurisdiction'
export * from './mapping'
export * from './models'
export * from './name-check-interfaces'
export * from './dialog-options'
Expand Down
6 changes: 0 additions & 6 deletions src/interfaces/mapping.ts

This file was deleted.

4 changes: 2 additions & 2 deletions src/list-data/request-action-mapping.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { EntityTypes, NrRequestActionCodes } from '@/enums'
import { RequestActionMappingI, MappingI } from '@/interfaces'
import { RequestActionMappingI } from '@/interfaces'

const EntityTypesBC = [
EntityTypes.FR,
Expand Down Expand Up @@ -59,7 +59,7 @@ export const BcMapping: RequestActionMappingI = {
]
}

export const XproMapping: MappingI = {
export const XproMapping: RequestActionMappingI = {
AML: [
EntityTypes.XCR,
EntityTypes.XCP
Expand Down
11 changes: 8 additions & 3 deletions src/mixins/search-mixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,20 @@ export class SearchMixin extends Mixins(CommonMixin) {
}

set entity_type_cd (type: EntityTypes) {
// console.log('*** set entity_type_cd =', type)
// special case for amalgamation -- in case of changing entity type after changing xpro location
if (this.isAmalgamation) {
this.setSearchJurisdiction(null)
this.setLocation(null)
this.setJurisdictionCd(null)
}

// special case for sub-menu
if (type === EntityTypes.INFO) {
// set empty values until user chooses a new one
// (don't use null in case it's already null as we want reactivity)
this.setEntityTypeCd('')
this.setSearchCompanyType('')
// special case for amalgamation -- in case of changing entity type after changing location
if (this.isAmalgamation) this.setLocation(null)

// show the "View all business types" modal
this.setPickEntityModalVisible(true)
return
Expand Down
2 changes: 1 addition & 1 deletion src/store/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ export async function searchBusiness ({ getters }, corpNum: string): Promise<Bus
if (data.directors === 'Not Available' && data.incorporated === 'Not Available') {
return Promise.reject(error) // business not found
}
// *** TODO: update this when new endpoint is available
// FUTURE: update this when new endpoint is available
return {
identifier: corpNum, // data['incorp #'],
legalName: 'Future Name From COLIN',
Expand Down
28 changes: 16 additions & 12 deletions src/store/getters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ export const getEntityBlurbs = (state: StateIF): Array<EntityI | ConversionTypes
/** The BC Entity Types. */
export const getEntityTypesBC = (state: StateIF): EntityI[] => {
try {
let generateEntities = (entities) => {
const generateEntities = (entities) => {
let output = []
for (let entity of entities) {
let obj = EntityTypesBcData.find(ent => ent.value === entity)
Expand Down Expand Up @@ -523,7 +523,7 @@ export const getEntityTypesBC = (state: StateIF): EntityI[] => {
}

// see 'src/list-data/request-action-mapping.ts'
let mapping: RequestActionMappingI = BcMapping
let mapping = BcMapping
let cds = Object.keys(mapping)
if (cds.includes(getRequestActionCd(state))) {
return generateEntities(mapping[getRequestActionCd(state)])
Expand All @@ -544,7 +544,7 @@ export const getEntityTypesXPRO = (state: StateIF): EntityI[] => {
}

try {
let generateEntities = (entities) => {
const generateEntities = (entities) => {
let output = []
for (let entity of entities) {
// use EntityTypesXproData instead of scoped _entityTypesXproData here so that RLC can be included
Expand Down Expand Up @@ -577,7 +577,7 @@ export const getEntityTypesXPRO = (state: StateIF): EntityI[] => {
}

// see 'src/list-data/request-action-mapping.ts'
let mapping: RequestActionMappingI = XproMapping
let mapping = XproMapping
let cds = Object.keys(mapping)

if (cds.includes(getRequestActionCd(state))) {
Expand Down Expand Up @@ -649,8 +649,6 @@ export const getEntityTypeOptions = (state: StateIF): Array<EntityI> => {
return x
}
})
// console.log('*** getEntityTypeOptions, location =', getLocation)
// console.log('*** getEntityTypeOptions, bcOptions =', bcOptions)

const xproOptions: SelectOptionsI[] = getEntityTypesXPRO(state).filter(x => {
if (
Expand Down Expand Up @@ -699,19 +697,25 @@ export const getEntityTypeOptions = (state: StateIF): Array<EntityI> => {
})

let options: SelectOptionsI[]
// special case for amalgamation - location may be CA or IN
if (isAmalgamation) options = [...bcOptions]
// special case for amalgamation - ignore location
if (isAmalgamation(state)) options = [...bcOptions]
else if (isLocationBC(state)) options = [...bcOptions]
else options = [...xproOptions]
let n = 4

if (getEntityTypeAddToSelect(state)) {
getEntityTypeAddToSelect(state).rank = 4
options = options.concat(getEntityTypeAddToSelect(state))
// add recently-used entry to list
const entityTypeAddToSelect = getEntityTypeAddToSelect(state)
if (entityTypeAddToSelect) {
// push a partial copy of the object to avoid an infinite getter loop
options.push({
text: entityTypeAddToSelect.text,
value: entityTypeAddToSelect.value,
rank: 4
})
n = 5
}

options = options.concat({ text: 'View all business types', value: 'INFO', rank: n })
options.push({ text: 'View all business types', value: 'INFO', rank: n })

return options.sort((a, b) => {
if (a.rank < b.rank) return -1
Expand Down
14 changes: 12 additions & 2 deletions src/store/mutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,17 @@ export const mutateIsPersonsName = (state: StateIF, isPersonsName: boolean) => {
}

export const mutateLocation = (state: StateIF, location: Location) => {
// don't reset location if it hasn't changed
if (location === state.stateModel.newRequestModel.location) {
return
}

// reset entity type on location changes (options depend on location)
// except amalgamation because entity type came before location
// except amalgamation since entity type was set before location
if (state.stateModel.newRequestModel.request_action_cd !== NrRequestActionCodes.AMALGAMATE) {
state.stateModel.newRequestModel.entity_type_cd = null
}

if (
state.stateModel.newRequestModel.location === Location.CA ||
state.stateModel.newRequestModel.location === Location.IN
Expand All @@ -153,7 +156,14 @@ export const mutateLocation = (state: StateIF, location: Location) => {
return
}
}
state.stateModel.newRequestModel.entityTypeAddToSelect = null

// reset recently-used entry on location changes
// except amalgamation since recently-used entry was set before location
if (state.stateModel.newRequestModel.request_action_cd !== NrRequestActionCodes.AMALGAMATE) {
state.stateModel.newRequestModel.entityTypeAddToSelect = null
}

// finally, set location
state.stateModel.newRequestModel.location = location
}

Expand Down

0 comments on commit 7d61b67

Please sign in to comment.